Repository navigation
feat(studio): Anonymizer job detail page [ASTD-330] - #962
Conversation
Replaces the "coming soon" placeholder so list rows and the post-create redirect land somewhere real. Summary panel with status, strategy, source, ownership and timestamps; results list with per-artifact download; logs; and the existing job actions menu for cancel/delete, which returns to the list once a job is deleted. Job and log queries poll while the job is live and stop once it reaches a terminal status. Results are only fetched after that, since none exist before it. Job results are file artifacts rather than structured records, so rendering Original vs Replaced inline needs artifact parsing — left to ASTD-332, which has the record shape from the preview stream. Signed-off-by: mschwab <mschwab@nvidia.com>
Fileset sources are long enough to overlap the neighbouring column in the two-up grid. Signed-off-by: mschwab <mschwab@nvidia.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe anonymizer job detail route now fetches and polls job data, displays metadata, results, artifact previews, failed records, and logs, and supports result downloads with utility and Blob-preservation tests. ChangesAnonymizer job detail
Sequence Diagram(s)sequenceDiagram
participant User
participant AnonymizerJobDetailRoute
participant JobAPI
participant ResultsAPI
participant ArtifactFiles
participant LogsAPI
User->>AnonymizerJobDetailRoute: Open job details
AnonymizerJobDetailRoute->>JobAPI: Fetch and poll job
JobAPI-->>AnonymizerJobDetailRoute: Return job status and metadata
AnonymizerJobDetailRoute->>ResultsAPI: Fetch results after terminal status
ResultsAPI-->>AnonymizerJobDetailRoute: Return artifact URL and result data
AnonymizerJobDetailRoute->>ArtifactFiles: Fetch preview and failed-record files
ArtifactFiles-->>AnonymizerJobDetailRoute: Return artifact content
AnonymizerJobDetailRoute->>LogsAPI: Fetch job logs
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/JobSummaryPanel.tsx (1)
13-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMake component props readonly.
web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/JobSummaryPanel.tsx#L13-L15: markjobasreadonly.web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPanel.tsx#L10-L16: mark properties readonly and usereadonly PlatformJobResultResponse[]forresults.As per coding guidelines, “Use
readonlyfor immutable properties in TypeScript interfaces and types.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/JobSummaryPanel.tsx` around lines 13 - 15, Update the JobSummaryPanelProps interface in web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/JobSummaryPanel.tsx:13-15 to mark job readonly. Update the ResultsPanel props in web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPanel.tsx:10-16 to mark all properties readonly and type results as readonly PlatformJobResultResponse[].Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/packages/studio/src/routes/AnonymizerJobDetailRoute/index.tsx`:
- Around line 45-56: Update the query destructuring in the
AnonymizerJobDetailRoute component to capture errors from
useAnonymizerListRunJobResults and useAnonymizerGetRunJobLogs, then render an
error state or message for each failed query before the existing empty-state
fallbacks. Preserve the current loading, successful data, and empty-result
behavior when no error occurs.
---
Nitpick comments:
In
`@web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/JobSummaryPanel.tsx`:
- Around line 13-15: Update the JobSummaryPanelProps interface in
web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/JobSummaryPanel.tsx:13-15
to mark job readonly. Update the ResultsPanel props in
web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPanel.tsx:10-16
to mark all properties readonly and type results as readonly
PlatformJobResultResponse[].
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 9a98eed7-8fa9-4720-9620-278f101a1a47
📒 Files selected for processing (5)
web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/JobSummaryPanel.tsxweb/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPanel.tsxweb/packages/studio/src/routes/AnonymizerJobDetailRoute/index.tsxweb/packages/studio/src/routes/AnonymizerJobDetailRoute/util.test.tsweb/packages/studio/src/routes/AnonymizerJobDetailRoute/util.ts
|
ResultsPanel had its own object-URL dance; triggerDownload already does it, and better — it appends the anchor to the DOM, which Firefox needs, and revokes the URL in a finally so a throwing click can't leak it. Reusing it surfaced a bug in the helper: it wrapped its input in a fresh Blob, which drops the type, and the browser picks the file extension from that. A tar arrived as artifacts.txt. Pass a Blob straight through. Signed-off-by: mschwab <mschwab@nvidia.com>
A failed results fetch rendered "This job produced no results", which claims something false about the job; failed logs rendered an empty viewer. Both queries now surface an error banner instead. Also marks the panel props readonly, per the TypeScript guidelines. Signed-off-by: mschwab <mschwab@nvidia.com>
Adds a table preview of the anonymized output and a panel for records the pipeline dropped, both read straight from the job's result fileset. No tar handling or new dependency needed: results are stored as a fileset, so dataset.parquet, metadata.json and failed_records.json are individually addressable, and useDatasetFileContent already parses parquet with a size cap. The preview reads the first 20 rows. metadata.json names the source column; the anonymized counterpart is that name plus _rewritten or _replaced depending on strategy. Matching the suffix exactly matters — replace runs also emit <column>_with_spans, which a prefix match would pick instead. Failed records were only visible as a log line before, and the dropped rows are silently missing from the results. Signed-off-by: mschwab <mschwab@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/FailedRecordsPanel.tsx`:
- Around line 40-46: Update the useMemo failed-record parsing flow to validate
each array element before treating it as a FailedRecord. Add or reuse a runtime
type guard that confirms entries are non-null objects with the required
record_id field, then filter invalid rows before returning records; preserve the
empty-array fallback for invalid JSON or non-array input.
In
`@web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPreviewPanel.tsx`:
- Around line 33-37: Update renderCell so the JSON.stringify(value) result is
coalesced to '—' when serialization returns undefined, preserving the string
return contract and existing handling for nullish and primitive values.
In `@web/packages/studio/src/routes/AnonymizerJobDetailRoute/util.ts`:
- Around line 32-43: Update parseJsonLines to retain only non-null JSON objects
before returning parsed rows, excluding primitives and null values while
preserving valid object entries. Ensure ResultsPreviewPanel receives rows safe
for Object.keys(rows[0]) without adding a separate unsafe filtering path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 930d3d27-48a8-4c38-aeb7-9f657a9cce58
📒 Files selected for processing (5)
web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/FailedRecordsPanel.tsxweb/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPreviewPanel.tsxweb/packages/studio/src/routes/AnonymizerJobDetailRoute/index.tsxweb/packages/studio/src/routes/AnonymizerJobDetailRoute/util.test.tsweb/packages/studio/src/routes/AnonymizerJobDetailRoute/util.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- web/packages/studio/src/routes/AnonymizerJobDetailRoute/index.tsx
… [ASTD-330] Review feedback on the anonymizer job detail page. Replace the local parseJsonLines helper with parseDataFile(…, 'jsonl'), which already normalizes non-object JSON into a row shape. It throws per line where the old helper swallowed, so the call is wrapped — no route error boundary is wired and a malformed line would otherwise throw during render. Swap the hand-rolled TableRoot for StudioDataView, following AgentEvalTaskResultsPanel: long cells become TableExpandableCell with a modal instead of being clamped at six lines. Split the panel along the way — useResultPreview owns the fetches and parsing, ResultsPreviewTable owns the DataView wiring, ExpandedCellModal owns the modal, and the panel is left with its layout. The metadata parse moves to metadataTextColumn in util.ts, with a test. Read failed_records.json with fullContent so the 512 KB preview cap cannot truncate it. It is a pretty-printed JSON array, so a truncated body fails JSON.parse into an empty catch and the panel renders nothing — visually identical to a job with no failures. Also key rows by index when record_id is absent. Signed-off-by: mschwab <mschwab@nvidia.com>
…able [ASTD-330] The expanded-cell state lived in ResultsPreviewTable, so opening the modal re-rendered all 140 cells of a full preview page to show something that is not part of the table. Move the state and the modal up into ResultsPreviewPanel and memoize the table. Its props are all stable references — rows and columns come from useResultPreview's memos, onExpand is the useState setter — so the memo holds rather than being defeated by a fresh identity each render. Also use explicit ternaries for the two conditionally rendered banners. Signed-off-by: mschwab <mschwab@nvidia.com>
Signed-off-by: mschwab <mschwab@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@web/packages/studio/src/routes/AnonymizerJobDetailRoute/useResultPreview.ts`:
- Around line 4-13: Restore external-before-internal import grouping across the
affected AnonymizerJobDetailRoute modules. In
web/packages/studio/src/routes/AnonymizerJobDetailRoute/useResultPreview.ts
lines 4-13, move the React import before `@studio` imports; in
web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPreviewTable.tsx
lines 4-13, ResultsPreviewPanel.tsx lines 4-9, and ExpandedCellModal.tsx lines
4-6, place React and `@nvidia` imports before `@nemo` and `@studio` imports; in
web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/FailedRecordsPanel.tsx
lines 4-17, move React before `@studio` imports. Preserve all imported symbols and
group relative imports after external and internal aliases.
In `@web/packages/studio/src/routes/AnonymizerJobDetailRoute/util.ts`:
- Around line 32-35: Update metadataTextColumn to runtime-check that the parsed
original_text_column value is a string before returning it; return undefined for
non-string values while preserving the existing parse-error behavior. Add a test
covering metadata where original_text_column is a non-string value.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 5f56784b-bb87-483a-ba97-c3cbe5612764
📒 Files selected for processing (9)
web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ExpandedCellModal.tsxweb/packages/studio/src/routes/AnonymizerJobDetailRoute/components/FailedRecordsPanel.tsxweb/packages/studio/src/routes/AnonymizerJobDetailRoute/components/JobSummaryPanel.tsxweb/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPanel.tsxweb/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPreviewPanel.tsxweb/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPreviewTable.tsxweb/packages/studio/src/routes/AnonymizerJobDetailRoute/useResultPreview.tsweb/packages/studio/src/routes/AnonymizerJobDetailRoute/util.test.tsweb/packages/studio/src/routes/AnonymizerJobDetailRoute/util.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPanel.tsx
- web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/JobSummaryPanel.tsx
metadata.json is external input, so the unchecked cast let a non-string value out of a function typed string | undefined. Guard it at runtime and cover the non-string and non-object cases. Signed-off-by: mschwab <mschwab@nvidia.com>
Closes ASTD-330.
Replaces the "Job details coming soon." placeholder at
/anonymizer/:anonymizerJobName, so list rows and the post-create redirect finally land somewhere real.What's here
error_detailsStudioDataViewof the first 20 output records, with long cells expandable into a modal, so you can eyeball what the job produced without downloading a tarballLogViewerwith download, same component Safe Synthesizer usesAnonymizerJobActionsMenu(cancel/delete); deleting returns to the listNotable
The stored job shape is not the one you submit.
RunJobRequest.specis anAnonymizerRequest, butRunJob.specis anAnonymizerStepConfigthat wraps it — so the strategy and source live atjob.spec.request.config/.data.source, notjob.spec.config. Easy to get wrong from the ticket alone;jobStrategy/jobSourceisolate it and are unit-tested, including the missing-spec case.Results are a fileset, not an opaque tarball.
PlatformJobResultResponse.artifact_urllooks likedefault/job-fileset-deer#results/attempt-1/artifacts, and every file under that path is individually addressable through the existing datasets API. That's what makes Preview and Failed Records possible with no new dependency and no new endpoint —dataset.parquetis read with a[0, 20]row range, andmetadata.json/failed_records.jsonare read whole.failed_records.jsonhas to bypass the preview cap. It is a pretty-printed JSON array, so the 512 KB size-capped preview would truncate it mid-array;JSON.parsethen throws into acatch, the record list comes back empty, and the panel hides itself — indistinguishable from a job with no failures. It is read withfullContentinstead, which raises the ceiling to 8 MB. JSONL survives that truncation, which is why nothing else here needed the same treatment.Column ordering is strategy-aware. Rewrite writes
<column>_rewritten, the replace strategies write<column>_replaced.orderResultColumnspins the source column and its output side by side and leaves everything else alone. It matches the suffix exactly rather than by prefix, so abiography_with_spanscolumn is not mistaken for the output ofbiography— there's a test pinning that.Parsing and the table are existing components, not new ones. Per review, JSONL parsing goes through
parseDataFile(…, 'jsonl')rather than a local helper, and the table isStudioDataViewrather than a hand-rolledTableRoot, modelled onAgentEvalTaskResultsPanel.parseDataFilethrows per line where the local helper swallowed, so the call is wrapped — no route error boundary is wired and a malformed line would otherwise throw during render. The panel is split accordingly:useResultPreviewowns the fetches and parsing,ResultsPreviewTableowns the DataView,ExpandedCellModalowns the modal. The table is memoized so opening the modal doesn't re-render all 140 cells of a full page.The builder's live preview is still ASTD-332. That panel streams unsaved records from
/previewwhile you edit a config; this one reads a finished job's artifacts. Different data path, different component.Testing
Unit tests on the spec-reading and artifact-parsing helpers, typecheck, eslint, prettier clean.
Verified against real jobs on a live platform, not mocks — the workspace has jobs in every terminal state, and the two failure states were produced by intercepting the API and forcing a 500:
ytterbic-aquamarine-deerbiography/biography_rewritten/utility_score, 3 failed records, 30 log linesobvious-apricot-crowbiography/biography_replaced/biography_with_spans— confirms the suffix match picks the right output columnminor-black-larklively-maroon-leopon…deer+ forced 500 on/results…deer+ forced 500 on/logsNo console errors in any of the six runs. Download was exercised end-to-end through the UI: clicking Download fetched
artifacts.tar, 457 KB. The expandable cells were exercised too — 140 expand affordances on a full page (20 rows × 7 columns), clicking one opens a modal headed with the column name and the full untruncated value, and Close dismisses it.Two bugs the real data caught, both fixed here:
default/anonymizer-sample#NVIDIA_synthetic_biographies.csvoverlapped the neighbouring column in the two-up grid, so Source now gets its own full-width row.triggerDownloadre-wrapped an existingBlob, dropping its MIME type — the browser then named the tarballartifacts.txt. Fixed in the shared helper, with a test.Screenshots
Summary by CodeRabbit
Summary by CodeRabbit
BlobMIME types.Blobtype preservation during downloads.