Skip to content

feat(usage): let the reset timers hide their no-data placeholders - #542

Merged
sirmalloc merged 2 commits into
sirmalloc:mainfrom
zachthedev:feat-reset-timer-hide
Sep 17, 2026
Merged

sirmalloc merged 2 commits into
sirmalloc:mainfrom
zachthedev:feat-reset-timer-hide

Conversation

@zachthedev

@zachthedev zachthedev commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Closes #541.

Block Reset Timer and Weekly Reset Timer rendered [Loading] and the
[No credentials] family with no way to turn either off, while the usage
percentage widgets answer the same condition with a hide state. Both now declare
USAGE_NO_DATA_HIDEABLE_STATE and gate the whole no-window branch on it, so one
state covers the loading placeholder and the error text together. It is opt-in,
so nothing changes for anyone who does not enable it.

aae5add is what widened this: it replaced a return null with a persistent
placeholder, leaving no way back to the self-hiding behavior.

Two keybinds move off h, which the shared hide checklist claims:

Widget Was Now
Weekly Reset Timer h hours only o (o)nly hours
both, via usage-display h 12/24 hour f 12/24 (f)ormat

The second one is forced rather than cosmetic, and it is the part worth a look.
HOUR_FORMAT_TOGGLE_KEYBIND is offered in date mode only, so an item-free
getCustomKeybinds() call never sees it. Without the move, h in date mode
would toggle 12/24 instead of opening the checklist, making the state this PR
adds unreachable in that mode on exactly the two widgets it adds it to. Only
these two widgets pass includeHourFormat, so nothing else is affected.

That gap was invisible to the reservation test in #430, which called
getCustomKeybinds() with no item and therefore only ever saw one branch. It now
probes the display-mode metadata the usage and timer widgets branch on. Putting
the toggle back on h fails it, which is how I found the collision.

o and f were free against everything those widgets can offer (p, v, s,
t, w, z, l) and against the editor's own binds (a, c, d, i, k,
m, r).

Tested: bun run lint clean; bun test 2072 pass, plus the one
global-command-resolution failure main already has on this host.

Block Reset Timer and Weekly Reset Timer rendered [Loading] and the usage
error placeholders with no way to turn either off, while the usage
percentage widgets answer the same condition with a hideable state. Both
now declare USAGE_NO_DATA_HIDEABLE_STATE and gate the whole no-window
branch on it. The state is opt-in, so the default display is unchanged.

aae5add is what widened this: it replaced a return null with a persistent
placeholder, leaving no way back to the self-hiding behavior.

Two keybinds move off 'h', which the shared hide checklist claims:

- Weekly Reset Timer's '(h)ours only' becomes '(o)nly hours'
- the shared '12/24 (h)our' toggle becomes '12/24 (f)ormat'

The second is forced rather than cosmetic. It is offered in date mode
only, so without the move the hide checklist would be unreachable there
on exactly the two widgets this change gives a hide state to. Only these
two widgets pass includeHourFormat, so nothing else is affected.

The reservation test only called getCustomKeybinds() with no item, which
sees one branch and cannot observe a mode-dependent bind. It now probes
the display-mode metadata the usage and timer widgets branch on.
@zachthedev
zachthedev force-pushed the feat-reset-timer-hide branch from f745027 to 8ded2fd Compare September 4, 2026 13:58
@zachthedev
zachthedev marked this pull request as ready for review September 4, 2026 13:58
@sirmalloc
sirmalloc merged commit f370720 into sirmalloc:main Sep 17, 2026
3 checks passed
@zachthedev
zachthedev deleted the feat-reset-timer-hide branch September 18, 2026 18:00
pcvelz added a commit to pcvelz/ccstatusline-usage that referenced this pull request Sep 25, 2026
Upstream: TUI kept off the render path (sirmalloc#575), flex mode default full (sirmalloc#590), usage cache fingerprinted by refresh token (sirmalloc#536), CLAUDE_CONFIG_DIR keychain credential first (sirmalloc#573), llms.txt (sirmalloc#527), faster terminal width probing (sirmalloc#501), git/jj symbol slots (sirmalloc#574), model-scoped 0% quota as real zero (sirmalloc#534), custom-command output cache + timeout (sirmalloc#539), usage-percent widgets on a shared module (sirmalloc#545), hideable reset-timer placeholders (sirmalloc#542), git command timeouts (sirmalloc#559, sirmalloc#585)

Hand edits outside conflicts:
- src/widgets/shared/usage-percent-widget.ts: compat fix - pass RenderContext to getUsageProgressBarWidth (fork narrow/medium bar widths) and add fork short labels WS:/WO: that the extracted Sonnet/Opus widgets used to render; point the fable-weekly kind at the fork field weeklyFableUsage / resolveWeeklyFableUsageWindow (upstream's fableUsage / resolveFableUsageWindow do not exist in the fork and crashed the render)
- .fork-keep-deleted: drop llms.txt (points agents at the upstream package and at docs the fork deletes)

Conflict resolutions that deviate from upstream on purpose:
- src/types/Settings.ts: keep fork default flexMode full-minus-40 (upstream sirmalloc#590 switched to full)
- src/utils/terminal.ts: keep fork tmux $TMUX_PANE width probe, ported to execFileSync; upstream's CCSTATUSLINE_WIDTH override in getTerminalWidth replaces the fork copy
- src/ccstatusline.ts: keep getTerminalWidth() without the per-session width cache options (fork invariant); add upstream customCommandCacheTtlSeconds
- src/widgets/WeeklyFableUsage.ts (+ test): keep fork widget (Fable:/F: labels, 0% for accounts without Fable, weeklyFableUsage field) instead of upstream's shared-module FableWeeklyUsage
- src/utils/__tests__/usage-fetch.test.ts: adopt upstream sirmalloc#534 real-zero semantics on the fork field weeklyFableUsage
- docs/test-retirements.md: ledger entries for four tests upstream renamed or replaced (sirmalloc#542, sirmalloc#534) and one duplicate upstream test dropped
- src/utils/__tests__/usage-fetch.test.ts: compat - upstream's model-scoped real-zero test expects the fork field weeklyFableUsage
- src/widgets/__tests__/WeeklyFableUsage.test.ts: compat - set the shared suite's new required expectedWholePercentTime
- src/tui/components/__tests__/ImportPreviewDialog.test.ts: fork deviation - default flexMode is full-minus-40, so the non-default side is full
- src/utils/__tests__/usage-fetch.test.ts: drop upstream's duplicate "missing fable window" test that used the upstream-only fableUsage field
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.

Reset timer [Loading] and usage-error placeholders cannot be hidden

2 participants