feat(dashboard/workflows): surface run params, errors, and one-click re-run (#6292)#6324
Conversation
…re-run (#6292) The backend already returns `input`/`error` on the runs list, run-level and step-level `error` on the run detail, and a `POST /api/workflows/runs/{run_id}/rerun` endpoint (shipped via #6293 / #6302 / #6298), but the dashboard never surfaced any of it. Run-history rows now show the parameters the run was launched with and, for failed runs, the failure reason inline — no need to open the detail panel. The step accordion shows each step's own error and switches its header icon to the error hue when that step failed. Each run row gets a "Re-run with same parameters" control wired to the existing rerun endpoint, which faithfully repeats the stored input rather than re-submitting caller-typed params. Sync the TypeScript types that had drifted from the backend (`WorkflowRunItem` gains `input`/`error`; `WorkflowStepResult` gains `error`), add the `rerunWorkflowRun` client call plus a `useRerunWorkflowRun` mutation hook that invalidates the workflow's run list, and add `workflows.rerun*` i18n keys to en/zh/uk.
houko
left a comment
There was a problem hiding this comment.
Logic and data-layer wiring look correct — useRerunWorkflowRun correctly threads workflowId through to onSuccess invalidation, locale parity across en/uk/zh is maintained, and the test mock setup matches the new hook. Three files have multi-line comment blocks that violate CLAUDE.md's one-line-max rule — see inline notes.
Generated by Claude Code
There was a problem hiding this comment.
CLAUDE.md: "Don't write multi-paragraph docstrings or multi-line comment blocks — one short line max."
The JSDoc on rerunWorkflowRun spans six lines across two paragraphs. Collapse to one line:
/** Re-run a stored workflow run with its original parameters; returns `{ run_id }` of the freshly-queued run. */Generated by Claude Code
There was a problem hiding this comment.
CLAUDE.md: "Don't write multi-paragraph docstrings or multi-line comment blocks — one short line max."
The JSDoc on useRerunWorkflowRun spans six lines. Collapse to one line:
/** Re-run a previous run with its stored parameters; invalidates `workflowKeys.runs(workflowId)` on success (#6292). */Generated by Claude Code
There was a problem hiding this comment.
CLAUDE.md: "Don't write multi-paragraph docstrings or multi-line comment blocks — one short line max."
Four multi-line comment blocks in this file:
-
JSDoc on
formatRunParamsPreview(four lines). Collapse to:/** Formatinputas a compactk: v, …preview; non-object JSON and raw strings are shown verbatim. */ -
{/* Parameters the run was launched with … */}(three lines). Collapse to:{/* Params preview — shows WHAT was passed without opening the detail panel (#6292). */} -
{/* Failure reason, surfaced inline … */}(two lines). Collapse to:{/* Failure reason surfaced inline so the list shows WHY a run failed (#6292). */} -
{/* Re-run with the same parameters … */}(three lines). Collapse to:{/* Re-run sibling: never nested inside the row button so it is a valid standalone control (#6292). */}
Generated by Claude Code
Summary
Fixes #6292. Completes the dashboard half of the workflow-runs visibility work. The backend already exposes everything the issue asked for —
inputanderroron the runs list, run-level and step-levelerroron the run detail, and a dedicatedPOST /api/workflows/runs/{run_id}/rerunendpoint (landed via #6293 / #6302 / #6298) — but the dashboard never surfaced it. This PR is frontend-only; no backend changes were needed.Changes
Dashboard (
crates/librefang-api/dashboard/):formatRunParamsPreviewrenders a JSON object askey: value, …, anything else verbatim, truncated with the full value on hover).errorand flips the step header icon from the success hue to the error hue when that step failed.Plumbing (per
dashboard/AGENTS.mddata-layer rules):api.ts:WorkflowRunItemgainsinput?/error?,WorkflowStepResultgainserror?(types had drifted from what the backend already returns); newrerunWorkflowRun(runId)call.lib/http/client.ts: re-exportrerunWorkflowRun.lib/mutations/workflows.ts: newuseRerunWorkflowRun()hook; invalidatesworkflowKeys.runs(workflowId)+ the workflow lists inonSuccess(colocated invalidation).locales/{en,zh,uk}.json:workflows.rerun/rerun_started/rerun_failedadded to all three (locale-parity kept).Verification
All run in
crates/librefang-api/dashboard/:pnpm typecheck— cleanpnpm lint— 0 errors (warnings are pre-existing baseline)pnpm test --run— 839 passed (85 files), including the vitestlocale-paritygatepnpm build— succeedsAdded a
WorkflowsPage.test.tsxcase asserting the run row surfaces params (sector: fintech) + the failure reason inline, and that the re-run control calls the mutation with{ runId, workflowId }. The page test'svi.mock("../lib/mutations/workflows")was extended to expose the newuseRerunWorkflowRunsymbol (the page imports it, so the mock must too).No backend / OpenAPI changes, so no regeneration needed.