feat: Today's Pulse — same-elapsed usage comparison in the dashboard rail - #45
Merged
Conversation
Replaces the redundant StatsPanel rolling-tiles + top-models (which duplicated the Hero period tabs and Provider Breakdown) with a lean "Today's Pulse" card that answers one question nothing else showed: heavier or lighter than usual, right now? - Tokens / Cost / $-per-MTok, each vs an apples-to-apples same-elapsed baseline (partial "today" compared only up to the current clock hour). - Day view: 2 deltas (vs yesterday + vs 7-day trailing average); 7d/30d: 1 delta (vs previous window); Total: hidden. - Semantic colour: usage up = amber attention, $/MTok up = red (pricier), $/MTok down = green (cheaper). - Server: aggregateHourlyByDay now sums total_cost_usd per bucket (mirrors aggregateByDay) so cost/$MTok can be same-elapsed. - Fetch is minimal: hourly only for the partial/boundary days, daily aggregates for completed days (~2-8 requests, no 60-request cliff). - StatsPanel decluttered to the identity block; pulse math is pure and unit-tested (pulse-stats.test).
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.
Summary
aggregateHourlyByDaynow sumstotal_cost_usdper bucket (mirrorsaggregateByDay) so cost & $/MTok can be computed same-elapsed. Reuses the existingcomputeRowCost.pulse-stats.ts); StatsPanel decluttered to the identity block.Test plan
pulse-statsunit tests (17) — truncation, ratio-of-sums $/MTok, div-by-zero guards, period-aware deltasci:localgreen — root 775 tests, copy, ui-hardcode, guardrails 4/4scripts/release.sh→ Playwright verify on :17680