Skip to content

UI money pages: Cost & Budget + Compliance depth, tokens/budget/benchmark signals#219

Merged
richard-devbot merged 8 commits into
mainfrom
feat/ui-money-92-215
Jul 6, 2026
Merged

UI money pages: Cost & Budget + Compliance depth, tokens/budget/benchmark signals#219
richard-devbot merged 8 commits into
mainfrom
feat/ui-money-92-215

Conversation

@richard-devbot

Copy link
Copy Markdown
Owner

Closes #92
Part of #215 (tokens + per-stage cost, run_budget_usd consumption, parallel benchmark slices)

What ships

Run Analytics (ui/pages/run-analytics.js)

Cost & Budget (ui/pages/cost-budget.js) — stub replaced

  • Actual tracked spend + token totals with per-run provenance counts (persisted vs event-recomputed)
  • Budget Consumption — Loop Cost Brake: run_budget_usd cap vs actual with ok / near / over progress bars. This is a governance surface and the panel copy says so: "run_budget_usd is enforced in code, not by prompt text: the goal loop checks actual spend against this cap before every iteration and stops the run when it is reached." No cap configured → empty state explaining how to arm the brake via .rstack/budget.json
  • Cost-per-run table with data-source pills and honest dashes; spend-by-stage bars across the scope; Business Flex planned budgets kept as planned-vs-actual reference
  • No fabricated numbers anywhere: absent telemetry renders an explanatory empty state, never $0.00

Compliance (ui/pages/compliance.js) — scorecard per #92

  • Overall score, gap-severity chips (critical/high/medium/low), release gate, per-framework rows (pass / partial / gap counts + status) from the stage-13 compliance_report.json
  • Severity-first controls list with gap descriptions and remediation actions; tolerates both report shapes in the wild (agent contract framework_scores/compliance_requirements and the compact controls/overall_score form); truncated/unparseable artifacts are said so
  • Probes the cached /api/run-report endpoint directly because index-served (cold) runs arrive with an empty stageReports list
  • Honest empty state: explains the optional stage and why brownfield adoption deliberately skips it

State layer (state/client-state.js, sole-owned; additive)

  • tokenTotals, metricsSource (persisted | events | none, mirroring resolveRunTotals incl. the metrics_write_failed drift downgrade), loopBudgetUsd per run + snapshot loopBudgets — read from the exact .rstack/budget.json that evaluateLoopBudget enforces, so the UI never shows a cap the loop wouldn't stop on

Server alignment (one focused fix in server.js, [wave:money]-tagged)

Verification (fixture run 2026-07-06T12-00-00-000Z-ui-fixture-july-signals)

Hub run from the worktree (node bin/rstack-business.js --port 3923), verified in a real browser via preview + DOM inspection:

  • Run Analytics KPIs: $4.8700 cost with PERSISTED METRICS pill, 1.73M tokens, 1.42M in / 312k out
  • Cost & Tokens by Stage: 06-architecture $1.12 · 451k tok, 07-code $2.65 · 888k tok, 08-testing $1.10 · 393k tok
  • Parallel Benchmark: MODELLED — MOCK WORKLOAD, 60% FASTER — CLEARS THE 40% GATE, Sequential 2s vs Parallel 900ms, stage-group chips, measurement note verbatim
  • Cost & Budget: $4.87 actual tracked spend, 1.73M tokens, 1/3 runs reporting cost, and with a local .rstack/budget.json cap of $10: $4.87 of $10.00 — 49% of cap used — $5.13 headroom (green bar); runs without telemetry show + NO TELEMETRY, never $0.00
  • Compliance: empty state verified first (fixture has no stage-13 artifact), then with a locally seeded compliance_report.json: 40% overall, 1 critical / 1 high / 1 medium gap chips, release gate blocked — 1 CRITICAL gap (HIPAA-02)…, HIPAA 1 pass · 1 partial · 1 gap of 3 controls, severity-first controls with Gap/Fix lines
  • Zero browser console warnings/errors

Gates

npm test (681 pass, incl. new 26-test tests/dashboard-money-pages.test.js and the #216 bundle-compile test), npm run lint, npm run validate (196 agents), node scripts/security-audit.mjs, git diff --check — all green.

🤖 Generated with Claude Code

richardsongunde and others added 7 commits July 6, 2026 20:35
…caps in the client projection

[wave:money] additive fields for #92/#215: per-run tokenTotals
(input/output/total from persisted metrics), metricsSource
(persisted | events | none — mirrors resolveRunTotals incl. the
metrics_write_failed drift downgrade), and loopBudgetUsd resolved from the
project's .rstack/budget.json — the same file evaluateLoopBudget enforces,
so the dashboard never shows a cap the loop wouldn't actually stop on.
Snapshot-level loopBudgets lists the armed caps per source root.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The REST path sent raw buildFullState output while the WebSocket path sent
toClientState(state) — so REST-served clients (first paint + WS-down
fallback) missed every projection-only field (evidenceRecent, stageCost /
stageTokens, and the new tokenTotals / metricsSource / loopBudgets) and
hauled full event/evidence streams over the wire. Both transports now send
the same projection; the ETag hashes the projection so 304s stay reachable.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…, stage money fills

Append-only block: budget consumption track/fill with ok/near/over states,
SEQ-vs-PAR benchmark bar colors, amber per-stage money fill, bench badge row.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…arallel benchmark panel

#215 slices: cumulative tokens (1.73M-style compact, in/out breakdown) as a
headline KPI next to cost with a provenance pill (persisted metrics vs
event recompute); a Cost & Tokens by Stage panel from the #135 stage maps;
and artifacts/parallel-benchmark.json rendered as SEQ-vs-PAR bars with the
improvement % against the 40% evidence gate and an honest mock-vs-real
badge — a modelled measurement never looks like a live one. Benchmark
fetches are cached (misses re-checked after 60s); absent telemetry renders
an explanatory empty state, never a fabricated $0.00. Panels attach
client-side so the shared page shell stays untouched by the parallel wave.

Part of #215

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… consumption vs the loop cap

Replaces the stub (#92 + #215 budget slice): actual tracked spend + token
totals with per-run provenance counts, a Budget Consumption governance
panel (run_budget_usd cap vs actual with ok/near/over progress bars — the
copy states the goal loop enforces this cap in code before every
iteration), cost-per-run table with data-source pills and honest dashes,
spend-by-stage bars across the scope, and the Business Flex planned
budgets kept as the planned-vs-actual reference. No telemetry = an
explanatory empty state, never $0.00 pretending to be real.

Closes #92 (Cost & Budget half)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…_report.json

#92 compliance half: overall score, gap severity chips, release gate, and
per-framework rows (pass/partial/gap counts, status) from the stage-13
artifact, plus a severity-first controls list with gap descriptions and
remediation actions. Normalizes both report shapes in the wild (the agent
contract's framework_scores/compliance_requirements and the compact
controls/overall_score form); truncated or unparseable artifacts are said
so, not pretended parsed. Probes the cached run-report endpoint directly
because index-served runs arrive with an empty stageReports list. Honest
empty state explains the optional stage and why adoption skips it.

Closes #92 (Compliance half)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…provenance, budget caps

26 tests: client-state provenance (persisted / drift-downgraded / none) and
budget-cap wiring against real tmp-dir budget.json files; Run Analytics
KPI/stage-money/benchmark builders on the July fixture numbers ($4.87,
1.73M tokens, 3 stages, mock badge, 60% vs 40% gate); Cost & Budget
summary/governance/table builders incl. the no-$0.00 rule and over/near/
under cap states; compliance model normalization for both report shapes,
severity-first controls, the index-served probe path, and the honest empty
states — all via the sandboxed-bundle + fake-DOM pattern.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@richard-devbot, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 43 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d6c5bf4e-87ff-4dd3-8142-9365935287de

📥 Commits

Reviewing files that changed from the base of the PR and between dc45b1a and 5b2c0ac.

📒 Files selected for processing (7)
  • src/observability/dashboard/server.js
  • src/observability/dashboard/state/client-state.js
  • src/observability/dashboard/ui/pages/compliance.js
  • src/observability/dashboard/ui/pages/cost-budget.js
  • src/observability/dashboard/ui/pages/run-analytics.js
  • src/observability/dashboard/ui/styles.js
  • tests/dashboard-money-pages.test.js
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/ui-money-92-215

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

# Conflicts:
#	src/observability/dashboard/ui/styles.js
@richard-devbot richard-devbot merged commit fc310c9 into main Jul 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI: Compliance scorecard + Cost & Budget pages

2 participants