[AAASM-3509] ✨ (dashboard): Build the Cost & Budget page (replace ComingSoon)#1183
Conversation
Pure derivation of total spend / top consumer / budget utilisation / blocked-by-budget from the /api/v1/costs summary, daily/monthly aware. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
KPI strip, section scaffolding, and state styles using only --paper/--ink/ --line/--ok/--warn/--danger tokens so the page inverts under data-theme="dark". Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Compose KPI strip, per-team TeamBudgetBar bars with a daily/monthly period toggle, and the reused analytics CostBreakdownPanel per design/v1/hi-fi/costs.jsx. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the ComingSoon stub at /costs with the real Cost & Budget page. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Assert KPI figures, red (danger) team bar at >=95% burn, period toggle, empty/error states, and the reused per-agent breakdown panel render. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
🔎 Review (Claude Code)CI: ✅ green — Scope vs AAASM-3509: ✅ Matches. Replaces the
Documented caveat — per-team bars are spend vs org limit: The OSS Front-end visual verification (Playwright, bundled Chromium, 1440×1024, network-mocked, ws aborted):
Daily→Monthly period toggle verified live: total spend updates $842.37 → $18230.55 (recorded video attached to the ticket). Minor (non-blocking) observation: in the full-page headless capture the Recharts bar series in the breakdown panel did not paint, although the legend totals computed correctly from the data — a known Evidence: Verdict: ✅ Ready — light + dark both PASS, scope matches the ticket, org-limit caveat is documented and acceptable, 0 console errors. CI green except the ignorable codecov acceptance check. (UI review by Claude Code.) |
…page Captured via Playwright on a local preview (mocked gateway) during UI review — referenced inline from the PR description. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Resolve App.tsx conflict: keep both the AuditLogPage import (this branch) and the OverviewPage import (master, #1182), and drop the now-unused ComingSoon import — all three /overview, /costs, /audit routes now render real pages after #1182/#1183 merged. type-check/lint/build clean, dashboard suite 1303 passed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Description
Builds the real Cost & Budget page in the OSS dashboard, replacing the
<ComingSoon name="Cost & Budget" />stub at/costs. Implemented perdesign/v1/hi-fi/costs.jsx, composed entirely from existing OSS blocks:GET /api/v1/costs(useCostSummaryQuery) via the new purederiveCostKpishelper. Daily/monthly aware.TeamBudgetBaroverjoinTeamRows(overview, costs), with a Daily/Monthly period toggle (reusedSegmentedControl). Green/amber/red is the sharedbucketForBudgetthreshold (ok <80% · warn 80–95% · danger ≥95%).CostBreakdownPanel(own filter + query), as on/analytics.Reused, not reimplemented:
CostBreakdownPanel,useCostSummaryQuery/joinTeamRows(features/teams/api),TeamBudgetBar,budgetThreshold/bucketForBudget,SegmentedControl.Note on data: the OSS
/api/v1/costssummary only carries an org-level budget limit (TeamCostEntryhas spend but no per-team limit), so per-team utilisation is each team's spend against the org limit — its share of the org budget — rather than a per-team configured limit. The design's budget-tree / sparkline / 7-day-history tabs depend onwindow.*mocks with no OSS data source and are out of scope for this page.Light / dark: every colour is a theme token (
--paper*,--ink*,--line*,--ok/--warn/--danger), which auto-invert under:root[data-theme="dark"]. No hex/white/blackliterals (verified by grep) — the bug class fixed in AAASM-3506/3507. The reusedTeamBudgetBarandCostBreakdownPanelare already token-driven.Type of Change
Breaking Changes
Related Issues
Testing
dashboard/src/pages/CostsPage.test.tsx(vitest + RTL): KPI strip figures, red (danger) team bar at ≥95% burn, ok bar otherwise, period toggle switching to monthly figures, empty + error states, and the reused breakdown panel.Local results (in
dashboard/):pnpm type-check— cleanpnpm lint— clean (--max-warnings 0)pnpm test— 144 files, 1271 tests passing (6 new)pnpm build— succeedsScreenshots — light + dark (Playwright, local preview)
Light theme:
Dark theme:
Checklist
🤖 Generated with Claude Code