Show model-scoped weekly rows before Daily Routines - #2461
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Codex review: found issues before merge. Reviewed July 28, 2026, 12:42 AM ET / 04:42 UTC. ClawSweeper reviewWhat this changesThe PR reorders Claude Web and OAuth extra usage rows so model-scoped weekly limits appear before Daily Routines, with three focused parser regression tests. Merge readinessKeep this PR open for maintainer review. The patch is a narrow, proof-backed presentation-policy change, but it is paired with the still-open product request at #2460, which explicitly leaves maintainers to choose fixed priority versus configurable Claude-row controls. Priority: P3 Review scores
Verification
How this fits togetherCodexBar collects Claude usage from Web/session and OAuth responses, maps optional quota windows into card metrics, then renders those metrics in the menu-bar usage card. This PR changes the relative order of two optional metric categories while preserving their values and identities. flowchart LR
A[Claude Web or OAuth response] --> B[Usage window parser]
B --> C[Scoped weekly limits]
B --> D[Daily Routines window]
C --> E[Ordered extra usage rows]
D --> E
E --> F[Claude usage card]
F --> G[Menu-bar metrics]
Decision needed
Why: The implementation is mechanically narrow, but it selects one of two user-facing product directions explicitly preserved by the paired issue; tests cannot determine the intended permanent UI policy. Before merge
Findings
Agent review detailsSecurityNone. Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Choose and document a single Claude-card policy: adopt scoped-weekly-first consistently across sources if fixed priority is desired, or design one bounded optional-row preference that covers ordering and visibility without competing controls. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this PR changes a presentation policy rather than repairing a defined failing contract. Its redacted before/after live CLI output is sufficient evidence that the proposed ordering takes effect on a real Claude account. Is this the best way to solve the issue? Unclear. Fixed scoped-weekly-first ordering is the narrowest implementation and aligns the Web and OAuth sources, but the paired open request explicitly asks maintainers to choose between that policy and configurable optional-row controls. Full review comments:
Overall correctness: patch is correct AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against dd029db4cb17. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
I have a PR #2450 that handles the "always empty" routines bit. |
Thanks — #2450 looks good and I don't think the two overlap. #2450 hides the row when the routines payload is They also touch different seams (visibility vs. parser row order), so they should compose cleanly either way. If #2450 lands first I'm happy to rebase and confirm the ordering assertions still hold. |
|
Final maintainer verification completed on head
Merged as |
Summary
Implements the fixed-reorder option recommended in the review of #2460: on the Claude card, model-scoped weekly rows (e.g.
Fable only) now render before theDaily Routinesrow. No new settings are introduced.Rationale: accounts that never use Routines/Cowork see
Daily Routinessit permanently at 0% while the model-scoped weekly row — the one tracking the budget they actually spend day to day — gets pushed to the bottom of the card.Changes
Two ordering-only edits, plus regression coverage for both:
ClaudeWebExtraRateWindowParser.swift— appendscopedWeeklyLimitWindows(from:)before thedefinitionsloop that producesDaily Routines.ClaudeUsageFetcher.swift— OAuth path returnsoauthScopedWeeklyLimitWindows(from:) + routineWindowsinstead of the reverse, so both sources agree on row order.ClaudeWebUsageExtraWindowTests.swift— neworders scoped weekly windows before daily routines: feeds a payload containing bothseven_day_coworkand aweekly_scopedlimit, assertsextraRateWindows.map(\.title) == ["Fable only", "Daily Routines"].ClaudeWebUsageExtraWindowTests.swift— newkeeps multiple scoped weekly windows in payload order before routines: twoweekly_scopedlimits plus routines, asserts["Opus only", "Fable only", "Daily Routines"], pinning that scoped rows keep their payload order relative to each other.ClaudeOAuthTests.swift— neworders O auth scoped weekly windows before daily routines: same assertion through_mapOAuthUsageForTesting.The CLI/status-probe path is untouched: its order comes from the order the windows appear in the
claudeCLI output.Real behavior proof
Built
CodexBarCLIfrom this branch and compared its JSON output against the shipped 0.45.2 helper on the same account, same minute. Output redacted toid+title(percentages, reset timestamps and account identifiers stripped):extract_rows.pyjust walks the JSON forextraRateWindowsand printsid/titleper row.Disclosure per AGENTS.md: this was a live provider probe against a real Claude Max account, run at the explicit request of the account owner (who also filed #2460) on their own machine. No screenshot is attached — the menu card on that account shows spend figures that should not go into a public PR; the redacted CLI output above is the equivalent evidence for row order.
Why this direction matches existing expectations
ClaudeCLIScopedWeeklyUsageTestsalready constructsweb: [webFable, routines]and assertsmerged.map(\.id) == ["claude-weekly-scoped-fable", "claude-routines"]— scoped weekly first. The parsers were producing the opposite order; this change makes them agree with that expectation.Test impact review
Every order-sensitive assertion I could find:
MenuCardModelTests.swift:987—#expect(model.metrics.map(\.title) == ["Session", "Weekly", "Sonnet", "Daily Routines"]). Unaffected:Sonnetcomes from thetertiaryslot, and that fixture'sextraRateWindowscontains onlyDaily Routines.ClaudeCLIScopedWeeklyUsageTests.swift:285—#expect(merged.last?.title == "Daily Routines"). Still holds once scoped rows come first.ClaudeWebUsageExtraWindowTests.swift,ClaudeOAuthTests.swift(existing cases) — usefirst(where: { $0.id == ... }), order-independent.extraRateWindows.first?assertions inClaudeCLIScopedWeeklyUsageTestsuse fixtures whose only window is a scoped weekly one (map(\.title) == ["Fable only"]), so they are unaffected.Known gaps in this PR's coverage
Disclosing these rather than leaving them to be found in review:
extraRateWindowsorder out of each parser). Nothing pins "the third row rendered on the Claude card is the scoped weekly one" —MenuCardModelTestscovers the card model but its Claude fixture carries onlyDaily RoutinesinextraRateWindows. I verified the rendered result out of band by reading the app's widget snapshot after a refresh, which is not automated. Happy to add a card-model case with both row kinds if you want that pinned too.claude's own/usageoutput does not print a Daily Routines line at all (the CLI source yielded onlyFable only), so no ordering conflict is observable there. But the status-probe path still takes whatever orderclaudeprints, so if some account prints both, the CLI source could disagree with the Web/OAuth order this PR establishes. If you want all three sources strongly consistent, I can sort inClaudeStatusProbetoo — I left it out to keep the diff to the two sites the issue is about.Commands run
Not run, and why
make test/swift test— this machine has only the Command Line Tools, so the test targets fail to build withno such module 'Testing'. The two new tests have therefore not been executed locally; they are written against the same fixture shapes as the neighbouring cases in each file, but please let CI be the first real run.swiftformat/swiftlint— not installed here, and AGENTS.md says not to add tooling without confirmation. Longest added line is 89 chars and indentation matches the surrounding code.Happy to push fixups if CI or the linters flag anything.
Refs #2460. Related: #2353 (hide Daily Routines) remains a separate product decision; this PR deliberately does not add a visibility/order preference.