fabro/apps/fabro-web/app/lib
fabro-sh-0530[bot] 786a6f67e1
Read billing and stages from RunProjection with live runtimes (#213)
### Summary
Billing and stage lists now use the event-sourced `RunProjection` as
their source of truth, so running and retrying stages appear immediately
and runtimes keep advancing in the UI. This removes the checkpoint
completed-node bypass that hid in-flight work and froze totals until the
next server response.

### Plan Summary
- Store stage `started_at`, terminal `duration_ms`, server-internal
`usage`, and lifecycle `state` on `StageProjection`.
- Populate those fields from stage lifecycle events, including retry
transitions and per-attempt reset on new starts.
- Render `/runs/{id}/stages` and `/runs/{id}/billing` from
`RunProjection.iter_stages()`.
- Expose the new API/client fields and tick in-flight billing runtimes
on the web UI.

```mermaid
flowchart TB
  Events["Stage lifecycle events"] --> Projection["RunProjection StageProjection"]
  Projection --> StagesAPI["GET /runs/{id}/stages"]
  Projection --> BillingAPI["GET /runs/{id}/billing"]
  StagesAPI --> StageUI["Stage sidebar/stages view"]
  BillingAPI --> BillingUI["Billing tab live totals"]
```

### Key decisions
Retry and revisit handling stays one row per node id: latest visit data
wins, while first-seen event sequence keeps ordering stable with
finalize output. `state` is stored rather than derived so `Retrying` is
representable, and old serialized projections still work through the
`effective_state()` fallback. Billing `usage` remains server-internal
and is skipped on the wire; public schemas only expose the fields needed
by `/stages`, `/billing`, and the frontend live timer.

Added focused reducer, server retry/revisit, API round-trip, billing UI,
and event invalidation coverage.

⚒️ Generated with [Fabro](https://fabro.sh)

---------

Co-authored-by: Fabro <noreply@fabro.sh>
Co-authored-by: Bryan Helmkamp <bryan@brynary.com>
2026-05-05 09:32:33 -04:00
..
api-client.test.ts refactor(web): move server state to SWR 2026-04-25 07:16:41 -04:00
api-client.ts Render stage activity from scoped events endpoint (#212) 2026-05-05 09:16:52 -04:00
board-events.test.tsx fix(web): recover cross-tab SSE coordination after fallback 2026-05-04 15:52:18 -04:00
board-events.ts fix(web): recover cross-tab SSE coordination after fallback 2026-05-04 15:52:18 -04:00
cross-tab-sse.test.ts fix(web): recover cross-tab SSE coordination after fallback 2026-05-04 15:52:18 -04:00
cross-tab-sse.ts fix(web): recover cross-tab SSE coordination after fallback 2026-05-04 15:52:18 -04:00
demo-mode.test.tsx feat: wire web UI to real server with demo mode toggle 2026-04-08 04:46:08 -04:00
demo-mode.tsx feat: wire web UI to real server with demo mode toggle 2026-04-08 04:46:08 -04:00
format.ts refactor(web): simplify run logs view 2026-04-26 17:47:10 -04:00
graph-theme.ts refactor(web): drop light mode, go dark-only 2026-04-20 09:27:08 -04:00
mutations.ts feat(web): add interview dock for answering blocked runs from the UI 2026-05-02 15:39:01 -04:00
queries.ts Render stage activity from scoped events endpoint (#212) 2026-05-05 09:16:52 -04:00
query-keys.test.ts Read billing and stages from RunProjection with live runtimes (#213) 2026-05-05 09:32:33 -04:00
query-keys.ts Render stage activity from scoped events endpoint (#212) 2026-05-05 09:16:52 -04:00
run-actions.test.ts feat(web): add interview dock for answering blocked runs from the UI 2026-05-02 15:39:01 -04:00
run-actions.ts feat(web): add interview dock for answering blocked runs from the UI 2026-05-02 15:39:01 -04:00
run-events.test.tsx Read billing and stages from RunProjection with live runtimes (#213) 2026-05-05 09:32:33 -04:00
run-events.ts Read billing and stages from RunProjection with live runtimes (#213) 2026-05-05 09:32:33 -04:00
run-settings-snapshot.ts refactor(web): narrow event property reads via shared helpers 2026-04-30 22:45:38 -04:00
sse.ts refactor(web): simplify SWR event plumbing 2026-04-25 07:37:17 -04:00
stage-sidebar.test.ts Encode stage visits in run stage URLs (#206) 2026-05-05 08:27:11 -04:00
stage-sidebar.ts Read billing and stages from RunProjection with live runtimes (#213) 2026-05-05 09:32:33 -04:00
time.ts Read billing and stages from RunProjection with live runtimes (#213) 2026-05-05 09:32:33 -04:00
unknown.ts refactor(web): narrow event property reads via shared helpers 2026-04-30 22:45:38 -04:00
workflow-api.ts refactor(web): regenerate client for precise stage states 2026-04-30 06:33:12 -04:00