feat(overview): chart spans and cost together in one block - #96
Closed
Fl0p wants to merge 1 commit into
Closed
Conversation
The Overview stacked a History block and a Costs block, two requests and two cards for two series that answer the same question at a glance. They are now one block, Activity & Cost: spans as a filled area against a left axis, cost as a line against a right axis, fed by a single /history call. /history buckets already carried cost_usd beside spans, from the same row of the same spans ∪ daily_usage union, so the two series are bucketed, windowed and user-filtered identically by construction rather than by a client-side join of two endpoints that has to keep three things in sync. Both series now start and stop together on every range, including Day, where cost is charted hourly for the first time — /costs is daily-only, so the old pair showed 24 hourly points above a single daily one. Two y-scales on one plot can invent a correlation the data does not hold. The series wear different marks and the legend names the axis each reads against in words, so the plot stays readable; ADR-0015 records what that mitigation buys and what it does not. The blue/amber pair is the existing chart-1/chart-4 tokens, validated for CVD separation rather than eyeballed. StatSection takes an optional links array so the block can reach both full pages; the single viewAllHref stays the default everywhere else. Co-Authored-By: Daedalus <daedalus@agents.flopbut.local> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 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. Comment |
Fl0p
pushed a commit
that referenced
this pull request
Aug 21, 2026
The Overview's History and Costs blocks are now one block, Activity & Cost, plotting both series on one field: spans as a filled area against a left axis, cost as a line against a right axis, in the existing CVD-validated colour tokens. One /history call feeds both series — its buckets already carry cost_usd beside spans, so the two series are bucketed, windowed and user-filtered identically by construction, and the page drops its /costs request. On the Day range cost is charted hourly for the first time. StatSection takes an optional links array so the block header can point at both full pages. ADR-0015 records the two-scale trade-off and the stacked alternative kept in reserve. Squash of PR #96, implemented by Daedalus, reviewed and approved by Prospero. Co-Authored-By: Prospero <prospero@agents.flopbut.local> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
Squash-merged to main locally as ea5d06c (per the agent-identity merge rule; author/committer Prospero). Reviewed and approved: diff matches the handoff block, CI green on head f706178, board's one-field ask satisfied. The stacked-plot alternative (ADR-0015 option 3c) remains behind the open board confirmation on FLO-595. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merges the Overview's History and Costs blocks into one Activity & Cost block, both series on one field in different colours.
What changed
/historycall instead of two requests.bucketsalready carriedcost_usdbesidespans, from the same row of the samespans ∪ daily_usageunion — so the two series are bucketed, windowed and user-filtered identically by construction, rather than by a client-side join of/historywith/coststhat has to keep bucket width, window and user filter in sync at the call site.--color-chart-1, blue); cost as a line against a right axis (--color-chart-4, amber), tick-formatted in dollars.Day, where cost is charted hourly for the first time —/costsis daily-only, so the old pair showed 24 hourly points above a single daily one.History →Costs →);StatSectiontakes an optionallinksarray, and the singleviewAllHrefstays the default for every other block.The two-scale decision
Spans and cost are counts and dollars, three orders of magnitude apart — on one scale the cost line is flat on the axis floor. Two y-scales on one plot is a shape that can invent a correlation the data does not hold, so it is taken deliberately and paid for:
Spans (left axis),Cost (right axis, USD)— identity is never colour-alone;That makes the plot readable; it does not make the scale alignment meaningful.
docs/decisions/0015-overview-activity-and-cost-one-block.mdrecords the alternatives (index-to-common-base; two stacked plots sharing an x-axis) and says which one to reach for if the board wants the stronger form — it is a contained change behind the same block.The colour pair was validated, not eyeballed: CVD separation ΔE 32.3 protan / 29.3 tritan in light and 29.9 / 24.6 in dark, against a target of ≥ 8.
Verified
npm run build(tsc + vite) green.npm run buildindocs/green — no dead links from the new ADR.scripts/seed-demo.py(454 sessions / 22 583 spans over 90 days), both colour schemes:2026-08-11 · Spans: 341 · Cost: $8.85— one crosshair, both series, each in its own unit, identical text in light and dark;page.on('request')recorded/api/v1/history?granularity=day&range=monththen…granularity=hour&range=dayon switching toDay, and no/api/v1/costscall at all — confirming the page dropped the second request;Dayrange charts both series hourly.scripts/shoot-screenshots.mjs(synthetic data only — no real user names or spend).Docs
docs/decisions/0015-…(new) + index row.[Unreleased] → Changed; two neighbouring unreleased entries that named the now-merged blocks corrected so the section describes the state that ships.docs/operations/screenshots.md:playwright-coremust be symlinked, not reached viaNODE_PATH— the shoot script is an ES module and ESM resolution ignoresNODE_PATH. The existing instruction does not work.🤖 Generated with Claude Code