feat(valuation): one-click Run Valuation button on every no-valuation surface
Merged
SW
3mo ago+337+337+012345678901234567890123456789-26-26-01234567890123456789
Implements the shared-button row of #1973. Merge order: docs#305 → api#844 → this (the re-run surface relies on api#844's idempotent claims; the button itself works against today's API).
What this does
useRunValuationresolves the runnable roster artist (selected artist with a linked Spotify profile, else the first that has one) and POSTs/api/valuationunder the signed-in account; invalidatescatalogs/catalog-measurements/runson success so every surface settles without a refresh.RunValuationButton: one click, no wizard hop. Disabled while the run is in flight — a double click cannot start two runs (server-side idempotency via api#844 backstops it). Failure renders the API's error string verbatim (runValuationnow throwsbody.errorinstead of a generic HTTP message) — per the live incident where"No releases found for this Spotify artist"was the diagnostic for a wrong-duplicate profile link. No runnable artist → the/setup/artistsroute (nothing to run against).- Surfaces:
/catalogsempty state (personal scope only — a run always lands on the calling account), the measuring panel's "Been waiting a while?" escape (the stranded-state fix from #1973's original scope), the zero-stream panel (safe re-run), and the home greeting viaHomeValuationCta— a signed-in account with a runnable artist and no catalog gets the button in place instead of a bounce to the marketing funnel it already finished.
Verification (local)
- TDD red→green:
getArtistSpotifyId(extraction incl. normalized/query-string links, non-artist links, no socials) andrunValuation(verbatim API error, non-JSON fallback, parsed result). Full chat suite 98 files / 424 tests green;tsc --noEmit0 errors; eslint clean.
Preview verification (one-click run from each surface, double-click prevention, verbatim 404 error render) to follow as a PR comment with screenshots.
Part of #1973.
🤖 Generated with Claude Code
Summary by cubic
Adds a one-click Run Valuation button across no-valuation surfaces so users start a valuation in place. Previously these linked to the funnel; now one click runs for the selected or first Spotify‑linked artist, respects the selected organization, prevents double submits, and surfaces API errors verbatim. Part of #1973.
- Surfaces: Catalogs empty state in both personal and organization scopes, Measuring panel (“Been waiting a while?”), Zero‑stream panel (safe re‑run via API idempotency), and the home greeting via
HomeValuationCta(button only when signed in, has a runnable artist, and no catalog; otherwise links to the funnel). - Org ownership: Selected organization is sent to POST
/api/valuationso resulting catalogs belong to the org, not the personal account. - UX/a11y:
RunValuationButtondisables during flight witharia-busy, hides while the roster resolves to avoid setup-route flashes, and routes to/setup/artistswhen no runnable artist exists; error strings render verbatim. - API client and cache:
runValuationnow returns the parsed result and throws the API’serrorstring; update any callers expectingvoid. On success, invalidatecatalogs,catalog-measurements, andruns. - Rollout/QA: Ship after idempotent claims are live. Verify org-owned runs, button shows on both empty-catalog views, double-click prevention, error rendering, and no route flash while the roster loads.
Summary by CodeRabbit
- New Features
- Added options to run or rerun valuations from catalog and onboarding screens.
- Added valuation actions to the home experience when an account is ready.
- Added progress feedback, error messages, and guidance when setup is required.
- Valuations now support organization-specific context and refresh related results automatically.
- Bug Fixes
- Improved handling of valuation failures with clearer messages.
- Reused existing linked artist information to run valuations consistently.