Repository navigation
feat: show five-hour windows only when reported (#9) - #10
Merged
Merged
Conversation
Apply one rule to both providers: the five-hour window appears only when the current usage data has a value for it. Accounts without one lose the `--` in the menu bar label and the "5-hour Unavailable" popover row, the compact label falls through to the weekly value, and a provider with no values shows a single `--`. No plan lookup and no new credential reads. Also stop the rollout fallback from returning a five-hour value whose window has reset since the event was written. The scan only compares reset times with the event's own timestamp, so without this a stale snapshot would revive the window while the CLI cannot report limits. The check runs after the scan and leaves the parsers and scan unchanged. Claude-Session: https://claude.ai/code/session_01EFLAijReeyVZHXSemDq6rZ
Contributor
Author
Review ledger
No findings to resolve. HEAD and the working tree were unchanged after the review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The five-hour window now appears only when the current usage data has a value for it, for both Claude and Codex. Accounts without the window no longer see
--in the label or a "5-hour Unavailable" row, and the compact label shows the weekly value. If the provider reports the window again, it comes back on the next refresh. No plan lookup, no setting.✳ 45·70✳ 70✳ 45✳ 70✳ --and no 5-hour rowOne change the issue did not anticipate
The issue lists rollout-scan changes as out of scope because "expired ones are rejected", but that was only partly true. The scan compares a window's reset time with when the event was written, not with the current time. A rollout snapshot written before a reset was therefore returned as current after that reset, in the
okstate, whenever the Codex CLI could not report limits. A failing test reproduced this before the fix.To meet the acceptance criterion "A Codex five-hour window whose reset time has passed is not shown",
CodexProvidernow drops such a window after the scan, using an injected clock. The parsers and the scan loop are unchanged. If a rollout held only that window, the refresh counts as failed, so earlier values are kept as usual.Eight existing Codex tests read July fixtures against the real clock, so they now pin
nowto before their fixture resets. No assertion changed.Left as they are:
Related issue
Closes #9
Verification
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer make test: 104 tests passDEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer make buildgit diff --checkgit grep -n "showsFiveHourUsage" -- InferenceMeter: no outputScreenshots
These are not
screencaptureimages, and the menu bar was not checked in place. macOS blocks this environment:screencapturefails withcould not create image from display, andSystem Eventsfails with-1719(no assistive access). The images come from a temporary, uncommitted probe that hosted the realMenuBarLabelandDetailPopoverin an offscreen window. Still worth checking by hand: the label in the real menu bar and the popover opening from it.Window not reported: live data from an account without the window. Both real providers returned
state=ok,fiveHour=nil.Window reported: existing fixtures. The values are from
claude-usage-response.jsonandcodex-rollout-rate-limits.jsonl. Reset times were moved forward for the render so the countdowns read normally.Security and privacy
https://claude.ai/code/session_01EFLAijReeyVZHXSemDq6rZ