[AAASM-5159] ♻️ (costs): Restore Avg / agent today KPI and surface cost date - #1780
Conversation
…ro-guard Compute the mock's fourth "Avg / agent today" KPI (design/v1/hi-fi/costs.jsx:299-305). A genuine zero-agent roster folds to `not-evaluated` rather than NaN or a fabricated $0.00; any other absence in agentsTracked propagates unchanged. Refs AAASM-5159 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Wire the restored fourth spec KPI into the Cost & Budget strip, captioned with the summary's cost date. ADR-0017 item 14 ratifies Utilisation and Blocked-by-budget as additive to the spec KPIs, not replacements for one of its four cards, so the missing avg-per-agent card was a regression. Refs AAASM-5159 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…gation Refs AAASM-5159 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e states Refs AAASM-5159 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drives both themes for the known-roster and zero-agent cases and captures the review screenshots under dashboard/verify/5159/. Refs AAASM-5159 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…t, both themes) Refs AAASM-5159 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Chisanan232
left a comment
There was a problem hiding this comment.
✅ LGTM — reviewed and approved by Claude Code
(COMMENT review because GitHub blocks self-approval; this is the sign-off of record.)
Requirement correctness — AAASM-5159
Restores the "Avg / agent today" KPI per design/v1/hi-fi/costs.jsx:299-305, cites ADR-0017 item 14 (Utilisation/Blocked are additive, not a replacement — so the missing 4th card was a real regression). avgPerAgent = daily.spend / agentsTracked folds a genuine measured zero to not-evaluated (not NaN/$0.00), and propagates every other absence state (unconfigured/unavailable/in-flight) through the Certain<> boundary — matching the module's truthfulness discipline exactly. The card renders usd(avgPerAgent) with costs.date as the sub-caption via mapCertain, so the date propagates its own absence. Tests cover the divide, the zero-agent not-evaluated case, the unconfigured/unavailable propagation, plus a page-level render assertion.
CI — all checks green (CI Success pass).
Security — pure client-side arithmetic on already-fetched cost data; no new backend surface.
Merging as org admin with a merge commit.
🤖 Reviewed with Claude Code



Description
Restores the fourth spec KPI on the Cost & Budget page — "Avg / agent today" (
daily_spend / agentsTracked, captioned withcosts.date) — fromdesign/v1/hi-fi/costs.jsx:299-305. The shipped strip had Utilisation and Blocked-by-budget but was missing this card, and never surfacedCostSummary.dateat all.The computation lives in
deriveCostKpisas a pure function with a divide-by-zero guard: a genuine zero-agent roster folds tonot-evaluated(rendered as the canonical em-dash), neverNaNor a fabricated$0.00— the same false-negative the rest of the module exists to prevent. Any other absence inagentsTracked(outage, in-flight, no breakdown configured) propagates unchanged. The date sub-caption resolves independently, so it still renders even when the ratio is undefined.ADR basis: ADR-0017 item 14 ratifies Utilisation and Blocked-by-budget as additive to the four spec KPIs — not replacements for one of them. The missing avg-per-agent card was therefore a genuine parity regression, and restoring it is purely additive, consistent with that recorded decision.
Type of Change
Breaking Changes
Related Issues
Testing
costKpis.test.ts(divide, zero-guard, absence propagation) andCostsPage.test.tsx(render, em-dash, failure states)dashboard/tests/e2e/review-aaasm-5159.spec.tsdrives both themes for the known-roster and zero-agent casesDesign verification: screenshots in
dashboard/verify/5159/(known + zero-agent, both themes) confirm all four spec KPI cards render, the avg-per-agent card shows$105.00with2026-05-13as its sub-caption, and the zero-agent case renders an em-dash (notNaN/$0.00) while the date sub-caption still resolves.Local checks (Node v22, pnpm):
tsc --noEmitclean,eslint .clean,vitest run— 3066 passed.Security: pure client-side arithmetic on already-fetched
/costsdata — no new network surface, no new inputs, no new trust boundary.Checklist
Closes AAASM-5159
🤖 Generated with Claude Code