-
Notifications
You must be signed in to change notification settings - Fork 433
[temp] Frontend feat/new testsets integration #3323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…InfiniteVirtualTable component - Add optional created_by_id field to testset interface for tracking testset creators - Replace custom Table implementation with InfiniteVirtualTableFeatureShell - Migrate to useTableManager and useTableActions hooks for state management - Replace manual column definitions with createStandardColumns utility - Add TestsetsHeaderFilters component for search and filtering - Consolidate action handlers
…elete/export buttons - Replace deleteButton ReactNode with TableDeleteConfig object - Replace renderExportButton callback with TableExportConfig object - Remove settingsDropdownDelete in favor of unified deleteAction config - Move button rendering responsibility to InfiniteVirtualTableFeatureShell - Remove direct Button, Tooltip, and Trash icon imports from useTableManager - Update shellProps to pass deleteAction and exportAction instea
…etching and custom rendering - Add ExpandableRowConfig and ExpandIconRenderProps types for expandable row configuration - Create useExpandableRows hook to manage expand state, async child fetching, and caching - Add expandable prop to InfiniteVirtualTableInner and InfiniteVirtualTableFeatureShell - Support custom expand icons with loading states (default to circle icons) - Add accordion mode to collapse other rows when one exp
…ant and revision query endpoints - Add testset_refs, testset_variant_refs, and testset_revision_refs parameters to query endpoints - Pass reference filters through to underlying artifact service queries - Add include_archived and windowing parameters to testset revision query endpoint - Make testset_revision_query parameter optional with default None value - Forward all filtering and pagination parameters to artifact service layer
…s support - Add expandable rows to testsets table showing variants and revisions as nested children - Implement async fetching of variants and revisions on row expansion with loading states - Add custom expand icons (plus/minus circles) integrated into Name column instead of separate column - Display variants with GitBranch icon and revisions with version tags (similar to app variant revisions) - Add indentation levels for visual
…wer synchronization - Create testcase.ts module for managing testcase_id query parameter state - Add testcaseIdAtom to track testcase ID from URL - Implement syncTestcaseStateFromUrl to sync URL param with atom state - Add route validation to only allow testcase param on /testsets routes - Create clearTestcaseQueryParam and clearTestcaseParamAtom for cleanup - Export testcase atoms and actions from state/url/index.ts and state
…es page to InfiniteVirtualTable with editable drawer - Add windowing field to TestcasesResponse model for pagination support - Implement compute_next_windowing in testcases router for cursor-based pagination - Update BlobsDAO to use id attribute (UUID7) instead of created_at for windowing - Create TestcasesTable component with InfiniteVirtualTable integration - Add testcase edit drawer with deep linking support via testcase_id URL
…t testset modals - Replace Typography.Paragraph with TableDescription component for page description - Uncomment DeleteTestsetModal and CreateTestsetModal components to restore modal functionality
…description - Replace Typography.Paragraph with TableDescription component for consistent styling - Import TableDescription from InfiniteVirtualTable components
- Add tailwind class to remove left padding from ant-dropdown-trigger elements - Ensures consistent spacing within the editor wrapper
…lay and validation - Extend SimpleChatMessage interface to support tool_calls, tool_call_id, name, function_call, and provider-specific fields - Make content optional (nullable) to support assistant messages with tool_calls but no content - Add ToolCall interface for structured function calling - Implement extractDisplayTextFromMessage to show formatted tool calls for assistant messages - Add ToolMessageHeader component to display
…ge objects in TestcaseEditDrawerContent - Update isChatMessage validation to accept tool_calls array and function_call as valid content - Make content nullable in parseMessageObject to support assistant messages with tool_calls but no content - Preserve tool calling fields (name, tool_call_id, tool_calls, function_call) when parsing messages - Preserve provider-specific fields (provider_specific_fields, annotations, refusal) when parsing messages - Make
… from testsets - Delete fetchTestsetVariants module and TestsetExpandedContent component - Create fetchTestsetRevisions module to fetch revisions directly by testset_id - Remove testset_variant_id field from TestsetRevision interface - Update testsets page to expand testsets directly to revisions (2-level hierarchy) - Remove variant transformation logic and simplify expand handler - Update revision row transformation to use testset name
…detection and collapsed display - Extend SyntaxHighlightPlugin to detect base64 strings in code tokens and create Base64Nodes for them - Update token matching logic to handle base64 nodes alongside highlight nodes - Add base64 type comparison in token match check to prevent unnecessary re-renders - Import base64 utilities ($createBase64Node, $isBase64Node, isBase64String, parseBase64String) - Update getDiffRange utility to support
…unified-table-layout-testsets-and-testcases
- Implement `useSmartResizableColumns` hook to intelligently distribute table column widths based on container size and column constraints - Add support for flexible columns that share remaining space proportionally while respecting maxWidth constraints - Reduce default minimum column width from 80px to 48px for better space utilization - Add `maxWidth` property to actions column definition for better width control - Fix selection column width handling
…t-testsets-and-testcases
…_ids - Replace testset_ids array with testset_refs object array in fetchTestsetMetadata and fetchTestset API calls - Add p-6 padding to TestcasesTable container for consistent layout spacing
…ub.com/Agenta-AI/agenta into frontend-feat/new-testsets-integration
| const response = await axios.post( | ||
| `${getAgentaApiUrl()}/preview/testsets/revisions/${revisionId}/archive?project_id=${projectId}`, | ||
| ) |
Check failure
Code scanning / CodeQL
Server-side request forgery Critical test
URL
user-provided value
Copilot Autofix
AI 1 day ago
Copilot could not generate an autofix suggestion
Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.
| const response = await axios.post( | ||
| `${getAgentaApiUrl()}/preview/testsets/revisions/${revisionId}/download`, | ||
| {}, | ||
| { | ||
| params: {project_id: projectId, file_type: fileType, _t: Date.now()}, | ||
| responseType: "blob", | ||
| }, | ||
| ) |
Check failure
Code scanning / CodeQL
Server-side request forgery Critical test
URL
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 1 day ago
General approach: Avoid using raw, unchecked user input inside the URL of outgoing requests. When input must be part of the path, constrain it to an expected format (for example, allow only hex/UUID-like patterns) and fall back or reject if it is invalid, so that crafted values cannot alter the path unexpectedly.
Best fix here: add a small, local validator for revisionId in the API layer, and have downloadRevision refuse to send a request when revisionId does not match the expected format. This keeps the existing functionality (valid IDs still work) while ensuring that arbitrary path strings from the URL are not directly concatenated into the request path.
Concretely in web/oss/src/services/testsets/api/index.ts:
- Define a helper
isValidRevisionIdneardownloadRevisionthat enforces a strict pattern, such as a UUID-like or hex string. Since we cannot see the real ID format, a conservative example is to allow only word characters, hyphens, and underscores with a reasonable length, e.g./^[A-Za-z0-9_-]{1,128}$/. - In
downloadRevision, before constructing the axios URL, checkrevisionIdusing this helper. If invalid, throw an error (or optionally log and return early) instead of callingaxios.post. This prevents malformed or path‑traversal–like values from ever reaching the URL interpolation while preserving behavior for valid IDs. - No changes are required in the React components (
TestcasesTableNewanduseTestcaseActions) beyond what’s already there; they will receive a rejected promise if they somehow pass an invalid ID.
No new imports are required; the validation can be implemented with a simple regex.
-
Copy modified lines R508-R514 -
Copy modified lines R520-R523
| @@ -505,11 +505,22 @@ | ||
| * @param fileType - The file type to download (csv or json) | ||
| * @param filename - Optional filename for the downloaded file | ||
| */ | ||
|
|
||
| // Restrict revision IDs used in request paths to a safe, expected pattern | ||
| function isValidRevisionId(revisionId: string): boolean { | ||
| // Allow only alphanumeric characters, underscore and hyphen, with a reasonable length | ||
| return /^[A-Za-z0-9_-]{1,128}$/.test(revisionId) | ||
| } | ||
|
|
||
| export async function downloadRevision( | ||
| revisionId: string, | ||
| fileType: ExportFileType = "csv", | ||
| filename?: string, | ||
| ) { | ||
| if (!isValidRevisionId(revisionId)) { | ||
| throw new Error("Invalid revisionId") | ||
| } | ||
|
|
||
| const {projectId} = getProjectValues() | ||
|
|
||
| const response = await axios.post( |
…unified fields/JSON view with centralized entity controller API - Replace custom view mode toggle, editor state, and drill-in logic with EntityDualViewEditor component - Remove TraceDataDrillIn component usage in favor of EntityDualViewEditor's built-in EntityDrillInView - Remove manual editor change handling, dirty state tracking, and revert logic now handled by EntityDualViewEditor - Pass traceSpan entity controller to EntityDualViewEditor for centr
…mprove dirty state tracking across testcase navigation - Add onPathChange callback prop to DrillInContent, EntityDrillInView, and EntityDualViewEditor components for drill-in path persistence - Lift drill-in path state to TestcaseEditDrawer to persist navigation across testcase changes - Track everDirtyIds Set to enable save button if any testcase was edited during drawer session, even after reverting changes - Use Map for session
…TableRow type instead of legacy testset type - Replace testset type with TestsetTableRow in CreateTestsetFromScratch and modal index component props - Update editTestsetValues property access from _id to id to match TestsetTableRow schema - Update imports to use TestsetTableRow from testset entity module instead of legacy Types
…ub.com/Agenta-AI/agenta into frontend-feat/new-testsets-integration
…nd improve trace data entity synchronization
- Add stable mapping IDs using createMappingId() to prevent React key changes that cause cursor loss during typing
- Add useRef-based trace data load tracking to trigger entity sync when trace data finishes loading
- Update getValueAtPath to parse stringified JSON values before path navigation (handles outputs: '{"Response": "value"}')
- Add debug logging to mapping extraction in update
…r accurate testset navigation - Add testsetRevisionReference memo to find testset_revision reference from trace references - Pass revisionId prop to TestsetTag component using testset_revision reference ID - Remove label prop from TestsetTag (slug no longer passed explicitly) - Add comment explaining evaluation reference structure (testset ID vs revision ID)
…ared when no revisions exist or auto-select is disabled - Move initial revision clear inside "create new" condition to avoid premature clearing - Add explicit revision clear when no revisions found after loading - Add explicit revision clear when autoSelectLatest is disabled - Add comments explaining revision selection logic for each branch (create new, auto-select, no revisions)
…messages in testset table - Comment out conditional check that hides empty or auto-generated commit messages - Allow all commit messages to be displayed regardless of content or generation method - Retain rendering logic for commit messages with ellipsis and tooltip
… empty or auto-generated commit messages - Remove commented conditional check that would hide empty or auto-generated commit messages with dash placeholder - Clean up dead code to improve readability and maintainability
…for consistent layout - Change modal body flex from "0 0 auto" to "1 1 auto" to allow flexible sizing - Add explicit height of 620px to modal body styles - Simplify body className by removing h-[620px] and !flex-0 (now handled in styles prop) - Retain overflow-hidden and !flex classes for proper content containment
…tyLocked prop independent of fixed positioning - Add columnVisibilityLocked prop to TextColumnDef interface for explicit column visibility control - Update createTextColumn to use explicit columnVisibilityLocked value or derive from fixed prop (defaults to true if fixed is set) - Remove fixed="left" from testsets table name column and use explicit columnVisibilityLocked instead - Add explicit columnVisibilityLocked to name and actions
…dd tooltip for disabled delete button - Add version > 0 filter to cascader state revision loading (both cached and fresh data paths) - Filter out v0 revisions in buildRevisionMenuItems before sorting and mapping - Add version filter to fetchRevisionsList responses in TestsetsTable (handles both numeric and string "0") - Add deleteDisabledReason tooltip to header actions delete menu item explaining why delete is disabled - Update
…erm persistence - Replace useAtom with separate useAtomValue and useSetAtom for search term management - Use setDebouncedSearchTermAtom setter to trigger debounced filtering instead of direct atom updates - Change testcasesSearchTermAtom from atomWithStorage to regular atom to clear search on page refresh - Update import to include setDebouncedSearchTermAtom from tableStore - Add comment explaining debounced setter usage and non
…DrillInContent - Add ag.data path prefix when navigating from mapping focus paths to trace span entities - Check if initialPath was "ag.data" to determine if ag.data prefix should be prepended to targetPath - Add parsedInitialPath to focusPath effect dependencies - Add comments explaining trace span entity data structure and ag.data wrapping behavior
…dling in entity drill-in
- Remove unused onPropertyClick, dataPath, and rootTitle props from renderFieldContent
- Simplify JSON editor onPropertyClick to only handle internal navigation without external coordination
- Fix getValueAtPath to return entire root data when path is empty (used by JSON view)
- Change DrillInContent gap from gap-4 to gap-2 and remove py-2 from breadcrumb container
- Add showViewToggle={false} to DataPreviewEditor to
…ith EditorMarkdownToggleExposer integration - Add showMarkdownToggle, isMarkdownView, and onToggleMarkdownView props to DrillInFieldHeaderProps - Add markdown toggle button to DrillInFieldHeader with TextAa/MarkdownLogoIcon icons based on view state - Add MarkdownViewState helper component to read markdownViewAtom state for a field - Add markdownToggleFnsRef and registerMarkdownToggle to track toggle functions per field - Add E
…awer
- Remove conditional rendering of commit message input to show it for both new and existing testsets
- Add commitMessage parameter to createNewTestset function and pass it to API payload
- Update success message to include commit message when provided ("Testset created with message: ..." vs "Testset created successfully")
- Pass commitMessage || undefined to createNewTestset call in useSaveTestset hook
- Add message field to API
No description provided.