Skip to content

feat(menubar): switch the Capacity Dock gauge between usage windows - #1288

Closed
ozymandiashh wants to merge 1 commit into
getagentseal:mainfrom
ozymandiashh:feat/1243-dock-period-toggle
Closed

ozymandiashh wants to merge 1 commit into
getagentseal:mainfrom
ozymandiashh:feat/1243-dock-period-toggle

Conversation

@ozymandiashh

Copy link
Copy Markdown
Collaborator

Summary

  • The resting Capacity Dock gauge always reported the weekly (else monthly)
    billing window. Clicking the provider that already rests in the rail now
    switches that gauge to the provider's short rolling window — Claude's 5-hour
    limit, Codex's 5-hour or daily window, any Hourly / Daily / session row an
    adapter reports — and clicking again switches back. Closes Feature Request: Allow switching Claude usage periods in the collapsed Capacity Dock #1243.
  • The choice is stored per provider under CodeBurnCapacityDockGlanceWindows
    alongside the other dock preferences, so Claude can sit on its 5-hour window
    while Codex stays weekly, and it survives relaunch. It is deliberately not a
    Claude-only switch: the dock's collapsed row is provider-agnostic.
  • A new pure CapacityDockGlanceWindow policy decides which window is drawn.
    billing reuses QuotaSummary.headlineWindow so the app keeps one definition
    of the weekly glance; burst matches short-horizon labels only after
    excluding weekly/monthly ones, so a per-model row like Weekly · Opus is
    never mistaken for a 5-hour window. A provider reporting one window keeps the
    existing click-to-pin behaviour, and a stored horizon the provider stops
    reporting falls back to the window it does report instead of blanking the
    gauge to --.
  • The rail's geometry is untouched, the click can only pin and never collapses
    (so hover expansion, the drag suppression window and Escape / outside-click
    dismissal all behave as before), and keyboard and VoiceOver users get the same
    switch as a named action on the provider cell, whose accessibility value now
    names the window feeding the ring.

Testing

  • I have tested this locally against real data (not just unit tests)
  • npm test passes
  • npm run build succeeds

mac/ change only; no TypeScript touched.

  • cd mac && swift build — passes.
  • cd mac && swift test --filter CapacityDock — could not run on this machine:
    every test file, including ones this branch does not touch, fails with
    error: no such module 'Testing' on a CLT-only toolchain. Relying on CI for
    the suite.
  • New coverage in mac/Tests/CodeBurnMenubarTests/CapacityDockGlanceWindowTests.swift:
    the per-provider preference round-trip (including defaults and rejection of
    foreign stored values) and the toggle policy — which window is shown for a
    given stored preference and set of published windows, that Weekly · Opus is
    not a short window, and the fallbacks when only one window exists or the
    stored horizon disappears.

The resting rail shows one number per provider, and that number was always
the weekly (else monthly) billing window. A user watching Claude's 5-hour
limit had to expand the dock and read the glance card every time, which
defeats the point of an always-visible usage monitor.

Clicking the provider that already rests in the rail now switches its gauge
to the provider's short rolling window and back. The preference is stored per
provider rather than as a Claude-only switch: the dock's collapsed row is
provider-agnostic, and Codex publishes a 5-hour and a weekly window too, so
the question is "which horizon for this provider", stored under
CodeBurnCapacityDockGlanceWindows alongside the other dock preferences.

The two horizons are named rather than labelled, so the policy works for any
adapter: billing reuses QuotaSummary.headlineWindow, the app's single
definition of the weekly/monthly glance, and burst matches the short rolling
rows the adapters emit (5-hour, Hourly, Daily, session) while excluding
anything weekly or monthly, so Claude's per-model "Weekly · Opus" row can
never be read as a short window. CapacityDockGlanceWindow keeps that policy
pure and testable, including the fallbacks: a provider with one window shows
it whichever horizon is stored, and a stored horizon the provider stops
reporting resolves to the one it does report instead of blanking the gauge.

The click cannot fight the hover expansion: this branch only ever pins, never
collapses, and it is reached only when the provider actually has two windows,
so a single-window provider keeps the existing click-to-pin toggle. Escape
and an outside click still unpin. Keyboard and VoiceOver users get the same
switch as a named accessibility action on the provider cell, and the cell's
accessibility value now names the window feeding the ring. The rail's
geometry is untouched.

Closes getagentseal#1243
@iamtoruk

Copy link
Copy Markdown
Member

Landed as #1309 (b0e53cf) with your commit and authorship intact, rebased onto current main after #1308; changelog conflict only. Verified before merging: single call-site blast radius on the resting gauge, every adapter's real label shape checked, click writes a preference only with no fetch, persistence normalized, mutation-verified tests, 473/473. Thank you.

@iamtoruk iamtoruk closed this Sep 12, 2026
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.

Feature Request: Allow switching Claude usage periods in the collapsed Capacity Dock

2 participants