Skip to content

feat: day-progress gauge on Today's Pulse (multiple of a normal day) - #48

Merged
pitimon merged 1 commit into
mainfrom
feat/pulse-day-progress
Jul 5, 2026
Merged

feat: day-progress gauge on Today's Pulse (multiple of a normal day)#48
pitimon merged 1 commit into
mainfrom
feat/pulse-day-progress

Conversation

@pitimon

@pitimon pitimon commented Jul 5, 2026

Copy link
Copy Markdown
Owner

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):

  • The deltas answer "heavier/lighter than usual, right now?" — steady all day (same-elapsed).
  • The gauge answers "how much of a normal day have I burned?" — a fuel gauge that climbs through the day. It complements, not replaces.
  • Rejected alternatives: naive full-day delta (flips sign in the morning), pace-projection (noisy early).

Changes

  • computePulse: optional trailingFull (full-day 7-day 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 (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-plan unit tests (31, +4): progress ratio, $/MTok = null, no-baseline = null, zero-baseline guard, and trailingFull captures post-cutoff hours (differs from same-elapsed)
  • Full dashboard vitest: 286 pass
  • ci:local green — root 775, copy, ui-hardcode, guardrails 4/4
  • Live (local serve, real data, 6 AM): gauge renders under Tokens (0.1×) & Cost (0.2×), fill width matches ratio on the 0–2× scale, $/MTok has no gauge
  • Post-merge: fold into 0.39.33 release

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).
@pitimon
pitimon merged commit 5c4835c into main Jul 5, 2026
1 check passed
@pitimon
pitimon deleted the feat/pulse-day-progress branch July 5, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant