Skip to content

fix(ui): use real window for compact usage metrics - #277

Merged
Finesssee merged 1 commit into
nesszer:mainfrom
FerdinansD:fix/single-metric-usage-window
Aug 13, 2026
Merged

fix(ui): use real window for compact usage metrics#277
Finesssee merged 1 commit into
nesszer:mainfrom
FerdinansD:fix/single-metric-usage-window

Conversation

@FerdinansD

@FerdinansD FerdinansD commented Aug 12, 2026

Copy link
Copy Markdown

Summary

  • Select the real secondary usage window when the primary window is informational on automatic single-metric surfaces.
  • Use the same selected window for FloatBar rendering, tone, reset data, and sorting.
  • Apply the shared policy to the Providers sidebar and add focused regression coverage.

Related issue

Fixes #275

Affected areas

Check every area this PR changes or could affect:

  • Tray panel
  • Settings UI
  • Config file / settings persistence
  • CLI
  • Provider-specific behavior
  • Installer / release packaging
  • Startup / background behavior
  • Documentation
  • Other: FloatBar

Validation

Hosted PR check runs on Blacksmith Windows when CI_BUDGET_MODE is not off (see .github/workflows/pr-check.yml and CONTEXT.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 in src/lib/paceBudget.test.ts (today: expected 80, received 30). src/lib/paceBudget.ts and src/lib/paceBudget.test.ts are unchanged from upstream/main. PR-focused tests passed 25/25.
  • For full pre-release validation: not applicable; this is not a release change.
  • For installer/release changes: not applicable; no installer or release files changed.
  • Thermo-nuclear code quality review completed before submitting: bounded reliability review completed with no findings; the content-bound pre-commit, pre-push, and pre-PR gates allowed the exact six-file candidate.
  • Other: focused Vitest suite passed (3 files, 25 tests); frontend production build passed; git diff --check passed.
  • Windows-native debug build completed successfully and the affected UI behavior was verified with CUA Driver.

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.

  • Not applicable
  • CUA Driver visual proof attached
  • CUA Driver could not be used

CUA Driver was run against the Windows-native debug build.

Test scenario:

  • Codex primary 5h window is informational/inactive.
  • Codex secondary weekly window contains real usage.
  • Automatic single-metric surfaces should therefore select the real secondary window.

Providers sidebar

Verified that the Codex row in Settings → Providers displays the real weekly usage instead of the informational 5h placeholder.

providers-sidebar-weekly

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.

floatbar-weekly

Verified behavior:

  • Providers sidebar uses the real weekly usage.
  • FloatBar uses the real weekly usage.
  • The inactive No active 5h session window is not selected as the compact metric when a real secondary window is available.
  • Percentage, tone/color, reset information, and FloatBar sorting use the same selected window.

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.

@Finesssee

Copy link
Copy Markdown
Collaborator

Thanks for the PR, I will review it ASAP.

@Finesssee Finesssee left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bohacf bohacf mentioned this pull request Aug 13, 2026
17 tasks
@Finesssee
Finesssee merged commit 7878793 into nesszer:main Aug 13, 2026
3 of 4 checks passed
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.

[Bug]: FloatBar shows informational 5h placeholder instead of weekly usage

2 participants