feat(valuation): in-flight run status on home, artists and catalogs
Merged
SW
3mo ago+246+246+012345678901234567890123456789-2-2-0123456789
Implements the status-hook row of #1973. Merge order: docs#305 → api#844 → this (the hook consumes GET /api/runs; until api#844 is live the chip simply never renders — the query errors quietly and nothing mounts).
What this does
useValuationRunStatus— one shared read ofGET /api/runs?kind=valuation&limit=1(the run resource from the #1973 contract) behind every status surface. Polls at 5s only while a run is queued/measuring (getRunPollInterval), stops on any terminal phase or when the account has never run one — idle sessions make zero background requests. When a run transitions measuring → claimed it invalidates the catalog reads, so every surface settles into the result without a manual refresh. The hook keys offrun.stateonly, never storage details.ValuationRunStatusChip— a status pill ("Valuation in progress · measuring N releases") that renders nothing when no run is in flight, so it mounts unconditionally.- Mounted where the customer stands: the home greeting area (
components/VercelChat/chat.tsx), the Artists roster page header, and the Catalogs page header. The artist profile page chip ships in the artist-page PR, which composes this hook. - File-disjoint from #1981 (the run-button PR) by construction — the two merge in either order.
Verification (local)
- TDD red→green:
getRuns(url/auth/error) andgetRunPollInterval(all five cadence cases). Full chat suite 99 files / 426 tests green;tsc --noEmit0 errors; eslint clean.
Preview verification (chip appears during a live run on all three surfaces and settles on completion, screenshots) to follow as a PR comment.
Part of #1973.
🤖 Generated with Claude Code
Summary by cubic
Shows in‑flight valuation run status on Home, Artists, and Catalogs. Previously no status; now a pill appears while a run is queued or measuring, polling stops on terminal states, and pages auto‑refresh into results when the run is claimed.
useValuationRunStatus: shared read of GET/api/runs?kind=valuation&limit=1via@tanstack/react-query; polls every 5s only whilequeued/measuring; no refetch on window focus/reconnect while idle; keys offrun.stateonly.- Completion: invalidates
["catalogs"]and["catalog-measurements"]when a run reachesclaimedafter any observed in‑flight phase; no invalidation if first seen alreadyclaimed. ValuationRunStatusChip: spinner + “Valuation in progress · measuring N releases”; merges caller classes withcn(); renders nothing when no run or on query error.- Mounted in Chat greeting, Artists header, and Catalogs header.
getRuns: throws on non‑ok responses and on 2xx envelopes withstatus: "error"so polling does not silently stop. Tests cover request/auth/error handling and poll cadence. Part of #1973.
Rollout
- Merge order:
recoupable/docs#305→recoupable/api#844→ this. Until the API is live, the chip does not render (the query errors but no UI change).