feat: day-progress gauge on Today's Pulse (multiple of a normal day) - #48
Merged
Conversation
Adds a full-day-basis readout under Tokens & Cost — "today so far as a multiple of a normal full day" (e.g. 1.8x) — alongside the existing same-elapsed deltas. It answers a different question (progress, not intensity): the deltas say "heavier/lighter than usual right now" and stay steady all day; the gauge says "how much of a normal day have I burned" and climbs through the day, read as a fuel gauge. - computePulse: new optional `trailingFull` (full-day 7d average) → per-metric `progress` ratio for tokens/cost; null for $/MTok (a rate), non-day periods, or a zero baseline (guarded, no Inf). - reduceDaySlices: also returns `trailingFull` = mean of the 7 trailing days summed to end-of-day. Reuses the already-fetched 7-day hourly data — no extra request. (use-pulse spreads it straight through.) - PulseCard: a 0–2x gauge with a "normal day" tick at 1x, so a fill past the midpoint means today already outran a whole typical day. $/MTok keeps deltas only. Pure logic + reducers covered by unit tests; verified live (client-only, no server change).
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
Adds a full-day-basis readout under Tokens & Cost — "today so far as a multiple of a normal full day" (e.g. 1.8×) — beside the existing same-elapsed deltas. Chosen after reviewing 4 candidate formulas against real data across the day (mockup):
Changes
computePulse: optionaltrailingFull(full-day 7-day average) → per-metricprogressratio for tokens/cost; null for$/MTok(a rate), non-day periods, or a zero baseline (guarded — no Inf).reduceDaySlices: also returnstrailingFull= mean of the 7 trailing days summed to end-of-day. Reuses the already-fetched 7-day hourly data — no extra request.use-pulsespreads it straight through (no hook change).PulseCard: a 0–2× gauge with a "normal day" tick at 1×; a fill past the midpoint = today already outran a whole typical day. $/MTok keeps deltas only.Test plan
pulse-stats+pulse-planunit tests (31, +4): progress ratio,$/MTok= null, no-baseline = null, zero-baseline guard, andtrailingFullcaptures post-cutoff hours (differs from same-elapsed)ci:localgreen — root 775, copy, ui-hardcode, guardrails 4/4