fix(ui): use real window for compact usage metrics - #277
Conversation
|
Thanks for the PR, I will review it ASAP. |
Finesssee
left a comment
There was a problem hiding this comment.
Approving.
The shared automatic single-metric selector is correctly layered: selectSingleMetricUsageWindow in apps/desktop-tauri/src/lib/usageWindows.ts encodes the surface-agnostic rule (an informational primary yields to a real secondary), and every consumer routes through it — FloatBar pill percentage and remaining, tone thresholds, the reset line, and provider sorting all read the selected window, and the provider sidebar metric in ProvidersTab uses the same helper instead of its own snap.primary shortcut.
The focused tests (usageWindows.test.ts covering all four primary/secondary combinations, plus the FloatBar and ProvidersTab integration cases) and tsc pass. No structural or file-size concerns (FloatBar.tsx 498 lines, ProvidersTab.tsx 271 lines, the selector itself 14 lines).
Scope note: issue #275 is specifically the FloatBar rendering the informational 5h placeholder instead of weekly usage, and tray surfaces are deliberately excluded — so no ProviderGrid or tray changes are requested here.
Summary
Related issue
Fixes #275
Affected areas
Check every area this PR changes or could affect:
Validation
Hosted PR check runs on Blacksmith Windows when
CI_BUDGET_MODEis notoff(see.github/workflows/pr-check.ymlandCONTEXT.md). Still run the local slice and list commands/results below. If a check is not relevant, say why.powershell.exe -ExecutionPolicy Bypass -NoProfile -File scripts\local-check.ps1— ran on Windows; frontend tests stopped with 1 failure insrc/lib/paceBudget.test.ts(today: expected 80, received 30).src/lib/paceBudget.tsandsrc/lib/paceBudget.test.tsare unchanged fromupstream/main. PR-focused tests passed 25/25.git diff --checkpassed.UI / tray proof
For UI, tray, settings, or visual behavior changes, use CUA Driver for visual proof. If CUA Driver cannot be used, explain why and attach equivalent manual proof.
CUA Driver was run against the Windows-native debug build.
Test scenario:
Providers sidebar
Verified that the Codex row in Settings → Providers displays the real weekly usage instead of the informational 5h placeholder.
FloatBar
Verified that FloatBar selects the same real weekly usage window instead of displaying the inactive 5h informational placeholder.
The displayed percentage, tone/color, and reset data are derived from the same selected usage window.
Verified behavior:
No active 5h sessionwindow is not selected as the compact metric when a real secondary window is available.Notes for reviewers
The selector is intentionally scoped to automatic single-metric surfaces.
Explicit metric preferences, tray resolution, provider detail views, and backend behavior are unchanged.
Please focus on preserving that boundary and on the shared primary/secondary identity selection.