fix(menubar): keep every enabled provider's ring, refetch stale quota windows - #56
Merged
Merged
Conversation
… windows An enabled provider disappeared from the menubar whenever its quota percentages were missing: the menubar ranking filtered on `fiveHourPercent != nil`. Enabling a provider is an explicit request to see it, so ranking now keeps every visible provider — score is the worse of the 5h/7d windows, no-data providers sort last and render an empty track. `mostConstrained(in:count:)` becomes `menuBarOrder(in:count:)`; the unused `store.mostConstrained` property is removed. The missing data was itself a bug. `quota.py` caches Claude's limits for an hour, but its 5-hour window can reset inside that hour: the cache still counted as fresh, `_scrub_expired` then dropped the expired window, and Claude reported no 5-hour usage for up to a full TTL after every reset. A cached snapshot is now treated as a miss once any of its own `*_resets_at` has passed, so the next poll refetches. Bump to 0.9.3 (build 35).
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.
What
QuotaStore.mostConstrained(in:count:)→menuBarOrder(in:count:): score ismax(5h, 7d), no-data providers sort last and render an empty track. Enabling a provider is an explicit request to see it.quota.py: a cached limits snapshot is now invalid once any of its own*_resets_athas passed. Claude's TTL is 3600s but its 5-hour window resets inside that hour — the stale-but-'fresh' cache was scrubbed by_scrub_expired, so Claude reported no 5-hour usage for up to an hour after every reset.Symptom
Two providers enabled (
claude,codex), only the Codex ring drawn.Verification
swift test: 157 passed, 0 failures. QuotaStoreTests rewritten for the no-drop contract (no-data kept and ordered last, input order preserved among no-data, max-of-both-windows, bounds).python3 Resources/quota.py --jsonnow returnsfive_hour_used_percent: 2.0alongsideseven_day_used_percent: 8.0for claude; cache file refreshed.kaji stateshows claudefiveHourPercent: 2, weekPercent: 8; menubar screenshot shows both rings.