Skip to content

feat(studio): Anonymizer job detail page [ASTD-330] - #962

Merged
marcusds merged 9 commits into
mainfrom
astd-330-anonymizer-job-detail/mschwab
Jul 29, 2026
Merged

marcusds merged 9 commits into
mainfrom
astd-330-anonymizer-job-detail/mschwab

Conversation

@marcusds

@marcusds marcusds commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Job Details — status badge, strategy, source, created-by, created/updated, plus an error banner when the job carries error_details
  • Results — lists artifacts with per-file download; distinguishes "produced no results" from "results appear once the job finishes"
  • Preview — a StudioDataView of the first 20 output records, with long cells expandable into a modal, so you can eyeball what the job produced without downloading a tarball
  • Failed Records — records dropped mid-pipeline, with the step and reason; hidden entirely when there are none
  • Logs — LogViewer with download, same component Safe Synthesizer uses
  • Actions — reuses the existing AnonymizerJobActionsMenu (cancel/delete); deleting returns to the list
  • Polling — job and logs poll every 5s while the job is live and stop at terminal status; results are only fetched once terminal, since none exist before

Notable

The stored job shape is not the one you submit. RunJobRequest.spec is an AnonymizerRequest, but RunJob.spec is an AnonymizerStepConfig that wraps it — so the strategy and source live at job.spec.request.config / .data.source, not job.spec.config. Easy to get wrong from the ticket alone; jobStrategy / jobSource isolate it and are unit-tested, including the missing-spec case.

Results are a fileset, not an opaque tarball. PlatformJobResultResponse.artifact_url looks like default/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.parquet is read with a [0, 20] row range, and metadata.json / failed_records.json are read whole.

failed_records.json has 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.parse then throws into a catch, the record list comes back empty, and the panel hides itself — indistinguishable from a job with no failures. It is read with fullContent instead, 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. orderResultColumns pins the source column and its output side by side and leaves everything else alone. It matches the suffix exactly rather than by prefix, so a biography_with_spans column is not mistaken for the output of biography — 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 is StudioDataView rather than a hand-rolled TableRoot, modelled on AgentEvalTaskResultsPanel. parseDataFile throws 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: useResultPreview owns the fetches and parsing, ResultsPreviewTable owns the DataView, ExpandedCellModal owns 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 /preview while 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:

Job State Result
ytterbic-aquamarine-deer completed (rewrite) Completed badge, artifacts + Download, preview columns biography / biography_rewritten / utility_score, 3 failed records, 30 log lines
obvious-apricot-crow completed (hash) preview columns biography / biography_replaced / biography_with_spans — confirms the suffix match picks the right output column
minor-black-lark error Error badge, "Job exited with code 1", "This job produced no results.", traceback in logs, no preview
lively-maroon-leopon cancelled Cancelled badge, no results, no preview, logs render
…deer + forced 500 on /results — results error banner, page otherwise intact
…deer + forced 500 on /logs — logs error banner, preview and results still render

No 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:

  • Fileset sources are long enough that default/anonymizer-sample#NVIDIA_synthetic_biographies.csv overlapped the neighbouring column in the two-up grid, so Source now gets its own full-width row.
  • triggerDownload re-wrapped an existing Blob, dropping its MIME type — the browser then named the tarball artifacts.txt. Fixed in the shared helper, with a test.

Screenshots

01-completed-rewrite 02-completed-replace 03-error 04-cancelled 05-results-unavailable 06-logs-unavailable

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Added a functional Anonymizer Job Details page with a job summary, results display, results preview, and logs.
    • Added a failed records panel and an expanded-cell preview modal for result values.
    • Added inline error messaging for job, results, and logs loading states, including a clearer results-load failure banner.
  • Bug Fixes
    • Improved file downloads by preserving existing Blob MIME types.
  • Tests
    • Added unit tests covering anonymizer utility parsing/ordering and Blob type preservation during downloads.

marcusds added 2 commits July 28, 2026 15:35
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>
@marcusds
marcusds requested review from a team as code owners July 28, 2026 22:50
@github-actions github-actions Bot added the feat label Jul 28, 2026
@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The 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.

Changes

Anonymizer job detail

Layer / File(s) Summary
Job metadata utilities
web/packages/studio/src/routes/AnonymizerJobDetailRoute/util.ts, web/packages/studio/src/routes/AnonymizerJobDetailRoute/util.test.ts
Adds job metadata extraction, artifact parsing, metadata parsing, result-column ordering, polling, preview limits, and tests for these behaviors.
Summary and results panels
web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/JobSummaryPanel.tsx, web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPanel.tsx, web/packages/common/src/utils/file.ts, web/packages/common/src/utils/file.test.ts
Adds job metadata and error rendering, result loading/error states, downloads, and Blob type preservation.
Artifact preview and failed records
web/packages/studio/src/routes/AnonymizerJobDetailRoute/useResultPreview.ts, web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPreviewPanel.tsx, web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPreviewTable.tsx, web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ExpandedCellModal.tsx, web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/FailedRecordsPanel.tsx
Fetches artifact metadata, preview rows, and failed records, then renders tables, expandable cells, and loading, error, and empty states.
Route data flow and rendering
web/packages/studio/src/routes/AnonymizerJobDetailRoute/index.tsx
Fetches job, result, and log data; polls until terminal status; and renders the connected panels and logs viewer.

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
Loading

Possibly related PRs

Suggested reviewers: steramae-nvidia, htolentino-nvidia, nv-odrulea

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding the anonymizer job detail page.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch astd-330-anonymizer-job-detail/mschwab

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/JobSummaryPanel.tsx (1)

13-15: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Make component props readonly.

  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/JobSummaryPanel.tsx#L13-L15: mark job as readonly.
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPanel.tsx#L10-L16: mark properties readonly and use readonly PlatformJobResultResponse[] for results.

As per coding guidelines, “Use readonly for 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

📥 Commits

Reviewing files that changed from the base of the PR and between 05cd69f and 5e60f55.

📒 Files selected for processing (5)
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/JobSummaryPanel.tsx
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPanel.tsx
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/index.tsx
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/util.test.ts
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/util.ts

@github-actions

github-actions Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 28099/35888 78.3% 62.7%
Integration Tests 16324/34606 47.2% 19.6%

marcusds added 3 commits July 28, 2026 16:13
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>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0d59ebd and 81bb5bd.

📒 Files selected for processing (5)
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/FailedRecordsPanel.tsx
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPreviewPanel.tsx
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/index.tsx
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/util.test.ts
  • web/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

marcusds added 3 commits July 29, 2026 11:03
… [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>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 81bb5bd and ef6b5f9.

📒 Files selected for processing (9)
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ExpandedCellModal.tsx
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/FailedRecordsPanel.tsx
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/JobSummaryPanel.tsx
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPanel.tsx
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPreviewPanel.tsx
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/components/ResultsPreviewTable.tsx
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/useResultPreview.ts
  • web/packages/studio/src/routes/AnonymizerJobDetailRoute/util.test.ts
  • web/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>
@marcusds
marcusds enabled auto-merge July 29, 2026 19:25
@marcusds
marcusds added this pull request to the merge queue Jul 29, 2026
Merged via the queue into main with commit 324d64e Jul 29, 2026
56 checks passed
@marcusds
marcusds deleted the astd-330-anonymizer-job-detail/mschwab branch July 29, 2026 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants