Skip to content

fix(clients): display CLI values verbatim, align period windows, true Lifetime tab#759

Merged
iamtoruk merged 1 commit into
mainfrom
fix/client-math-parity
Jul 20, 2026
Merged

fix(clients): display CLI values verbatim, align period windows, true Lifetime tab#759
iamtoruk merged 1 commit into
mainfrom
fix/client-math-parity

Conversation

@iamtoruk

Copy link
Copy Markdown
Member

Client half of the cross-surface accuracy work: the desktop app, web dash, and macOS menubar must display CLI-computed values verbatim. Full audit of every client-side computation, then fixes for the drifted sites.

The user-facing correctness fix

The desktop app tab labeled "All time" actually renders the CLI's all period, which is a 6-month window. A user reading "All time" was seeing a 6-month total. The tab now reads "Last 6 months", and true all-time is the new "Life" tab (the lifetime period from #753, which no client had exposed).

Parity fixes

  • lifetime wired end-to-end: renderer period.ts window (1970-01-01, matching cli-date), Period types, TopBar tab, dash period list, mac Period enum + panel control (kept out of menubar metric cases). Swift cliArg mapping tested.
  • Parity test table: renderer periodWindowStart asserted equal to cli-date getDateRange for all six periods, so the mirrors can never silently diverge again.
  • Verified-clean sites (no change needed): app currency applied exactly once at the display leaf on raw-USD sums; Plans consumes projectedMonthEnd/percentUsed verbatim; dash forwards period keys (CLI computes windows); mac QuotaPace is legitimate client math (payload carries only percent/resetsAt).

Flagged, not fixed (documented in the audit)

  1. App "Models this period" table re-aggregates history.daily for token columns current.topModels doesn't carry (~0.1-0.2% cost undercount from per-day top-N truncation; 365-day cap vs lifetime hero). Proper fix is adding tokens to current.topModels in menubar-json — follow-up after the sibling CLI-totals PR lands, to avoid overlap.
  2. App vs menubar spend-projection formulas differ (median-based vs linear); neither is CLI-emitted, so converging is a product decision, not a drift fix.
  3. Dash prints $ with no FX conversion — pre-existing endpoint limitation, not client drift.

Tests: app 411 passed (14 period tests incl. the 6-row parity table), Swift 83 passed (2 new), app+dash typecheck/build clean.

@iamtoruk
iamtoruk merged commit 92843bc into main Jul 20, 2026
3 checks passed
@iamtoruk
iamtoruk deleted the fix/client-math-parity branch July 20, 2026 14:14
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