Skip to content

Show model-scoped weekly rows before Daily Routines - #2461

Merged
steipete merged 4 commits into
steipete:mainfrom
Eimerrrrr:claude-scoped-weekly-before-routines
Jul 28, 2026
Merged

Show model-scoped weekly rows before Daily Routines#2461
steipete merged 4 commits into
steipete:mainfrom
Eimerrrrr:claude-scoped-weekly-before-routines

Conversation

@Eimerrrrr

@Eimerrrrr Eimerrrrr commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

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 the Daily Routines row. No new settings are introduced.

Rationale: accounts that never use Routines/Cowork see Daily Routines sit 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 — append scopedWeeklyLimitWindows(from:) before the definitions loop that produces Daily Routines.
  • ClaudeUsageFetcher.swift — OAuth path returns oauthScopedWeeklyLimitWindows(from:) + routineWindows instead of the reverse, so both sources agree on row order.
  • ClaudeWebUsageExtraWindowTests.swift — new orders scoped weekly windows before daily routines: feeds a payload containing both seven_day_cowork and a weekly_scoped limit, asserts extraRateWindows.map(\.title) == ["Fable only", "Daily Routines"].
  • ClaudeWebUsageExtraWindowTests.swift — new keeps multiple scoped weekly windows in payload order before routines: two weekly_scoped limits plus routines, asserts ["Opus only", "Fable only", "Daily Routines"], pinning that scoped rows keep their payload order relative to each other.
  • ClaudeOAuthTests.swift — new orders 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 claude CLI output.

Real behavior proof

Built CodexBarCLI from this branch and compared its JSON output against the shipped 0.45.2 helper on the same account, same minute. Output redacted to id + title (percentages, reset timestamps and account identifiers stripped):

$ CodexBarCLI usage --provider claude --json | extract_rows.py   # shipped 0.45.2
  [0] id='claude-routines'                        title='Daily Routines'
  [1] id='claude-weekly-scoped-fable'             title='Fable only'

$ .build/debug/CodexBarCLI usage --provider claude --json | extract_rows.py   # this branch
  [0] id='claude-weekly-scoped-fable'             title='Fable only'
  [1] id='claude-routines'                        title='Daily Routines'

extract_rows.py just walks the JSON for extraRateWindows and prints id/title per 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

ClaudeCLIScopedWeeklyUsageTests already constructs web: [webFable, routines] and asserts merged.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: Sonnet comes from the tertiary slot, and that fixture's extraRateWindows contains only Daily Routines.
  • ClaudeCLIScopedWeeklyUsageTests.swift:285#expect(merged.last?.title == "Daily Routines"). Still holds once scoped rows come first.
  • ClaudeWebUsageExtraWindowTests.swift, ClaudeOAuthTests.swift (existing cases) — use first(where: { $0.id == ... }), order-independent.
  • Remaining extraRateWindows.first? assertions in ClaudeCLIScopedWeeklyUsageTests use 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:

  1. No UI-level assertion. The new tests pin the data layer (extraRateWindows order out of each parser). Nothing pins "the third row rendered on the Claude card is the scoped weekly one" — MenuCardModelTests covers the card model but its Claude fixture carries only Daily Routines in extraRateWindows. 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.
  2. CLI source is not brought in line. On the account I could test, claude's own /usage output does not print a Daily Routines line at all (the CLI source yielded only Fable only), so no ordering conflict is observable there. But the status-probe path still takes whatever order claude prints, 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 in ClaudeStatusProbe too — I left it out to keep the diff to the two sites the issue is about.

Commands run

swift build --target CodexBarCore     # exit 0
swift build --product CodexBarCLI     # exit 0

Not run, and why

  • make test / swift test — this machine has only the Command Line Tools, so the test targets fail to build with no 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.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. labels Jul 26, 2026
@clawsweeper

clawsweeper Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codex review: found issues before merge. Reviewed July 28, 2026, 12:42 AM ET / 04:42 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 6 items remain

Keep 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
Reviewed head: f0e245a7b45ea9faa88f1024f1e186be347c08b6
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow, real-world-proven change with focused source coverage; only the permanent UI-policy choice and minor repository-style cleanup remain.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR supplies redacted before/after live CLI output from the same Claude account that directly demonstrates the intended row-order change; no additional contributor proof is needed.
Patch quality 🐚 platinum hermit (4/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR supplies redacted before/after live CLI output from the same Claude account that directly demonstrates the intended row-order change; no additional contributor proof is needed.
Evidence reviewed 6 items Web parser ordering change: The proposed Web/session parser appends model-scoped weekly limits before iterating the definitions that emit Daily Routines, establishing the requested fixed order for that source.
OAuth parser ordering change: The proposed OAuth mapper returns scoped weekly windows before routine windows, matching the Web/session source rather than adding a separate setting or data-model change.
Focused regression coverage: The branch adds two Web parser cases, including multiple scoped rows retaining payload order, and one OAuth case asserting scoped rows precede Daily Routines.
Findings 2 actionable findings [P3] Remove the new OAuth inline comment
[P3] Remove the new Web-parser inline comment
Security None None.

How this fits together

CodexBar 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]
Loading

Decision needed

Question Recommendation
Should CodexBar adopt model-scoped weekly rows before Daily Routines as the permanent default, or should optional Claude-row ordering and visibility be designed as a configurable policy instead? Adopt fixed scoped-first order: Merge the narrow reorder and treat model-scoped weekly budgets as higher-priority Claude-card metrics than Daily Routines.

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

  • Remove the new OAuth inline comment (P3) - The repository policy says not to add inline comments without an explicit request. This comment repeats behavior that the return expression and focused regression test already make clear, so remove it rather than adding code-level rationale.
  • Remove the new Web-parser inline comment (P3) - The added multi-line rationale is an inline comment not requested by the task, contrary to repository policy. Keep the ordering intent in the PR discussion and test names instead of embedding it in the parser.
  • Resolve merge risk (P1) - Merging establishes a permanent fixed display order for real Daily Routines rows without resolving whether users should instead receive configurable ordering or visibility; the paired issue remains the place for that product choice.
  • Resolve merge risk (P1) - The branch changes only Web/session and OAuth ordering. The CLI/status-probe path intentionally preserves the upstream Claude CLI row order, so sources can still differ if the CLI emits both row kinds.
  • Complete next step (P2) - A maintainer must choose the permanent Claude optional-row policy before this otherwise narrow patch should merge; likely related people: steipete (low-confidence recent upstream integrator).

Findings

  • [P3] Remove the new OAuth inline comment — Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:1161-1162
  • [P3] Remove the new Web-parser inline comment — Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebExtraRateWindowParser.swift:24-26
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Patch surface 4 files affected; 79 added, 2 removed The change is confined to two Claude mapping paths and their focused parser tests.
Ordering coverage 3 added regression tests Both Web/session and OAuth paths are checked, including multi-model payload order.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #2460
Summary: This PR is a candidate implementation of the fixed-reorder alternative in the canonical paired Claude-card ordering request; related null-row visibility work is adjacent rather than the same root cause.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    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.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best 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:

  • [P3] Remove the new OAuth inline comment — Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift:1161-1162
    The repository policy says not to add inline comments without an explicit request. This comment repeats behavior that the return expression and focused regression test already make clear, so remove it rather than adding code-level rationale.
    Confidence: 0.96
  • [P3] Remove the new Web-parser inline comment — Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebExtraRateWindowParser.swift:24-26
    The added multi-line rationale is an inline comment not requested by the task, contrary to repository policy. Keep the ordering intent in the PR discussion and test names instead of embedding it in the parser.
    Confidence: 0.96

Overall correctness: patch is correct
Overall confidence: 0.78

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against dd029db4cb17.

Labels

Label justifications:

  • P3: This is a low-blast-radius Claude-card presentation-policy improvement rather than a broken usage-fetching or account-access workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR supplies redacted before/after live CLI output from the same Claude account that directly demonstrates the intended row-order change; no additional contributor proof is needed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR supplies redacted before/after live CLI output from the same Claude account that directly demonstrates the intended row-order change; no additional contributor proof is needed.

Evidence

What I checked:

Likely related people:

  • steipete: The supplied PR commit history identifies steipete as author of the latest merge of current main into this branch, making them the clearest available routing candidate for the current Claude-card integration decision; deeper local provenance inspection was unavailable in the review environment. (role: recent upstream integrator; confidence: low; commits: f0e245a7b45e; files: Sources/CodexBarCore/Providers/Claude/ClaudeUsageFetcher.swift, Sources/CodexBarCore/Providers/Claude/ClaudeWeb/ClaudeWebExtraRateWindowParser.swift)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Get a maintainer decision on fixed ordering versus configurable optional Claude-row controls.
  • Remove the two new inline comments to comply with repository policy.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-07-26T18:06:36.180Z sha d106ea1 :: needs real behavior proof before merge. :: [P2] Add regression coverage for the new source ordering
  • reviewed 2026-07-26T18:19:08.459Z sha 97ce3b8 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-26T18:37:40.267Z sha e07827f :: needs maintainer review before merge. :: none

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 26, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@urda

urda commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

I have a PR #2450 that handles the "always empty" routines bit.

@Eimerrrrr

Copy link
Copy Markdown
Contributor Author

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 null. On my account the payload is present, it just sits at 0% because I never use Routines/Cowork — so the row still renders and the Fable only row still ends up below it. #2450 wouldn't change that case; this PR would.

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.

@steipete
steipete merged commit 0611e8e into steipete:main Jul 28, 2026
9 checks passed
@steipete

Copy link
Copy Markdown
Owner

Final maintainer verification completed on head f0e245a7b45ea9faa88f1024f1e186be347c08b6.

  • Re-read the complete exact-head diff and the adjacent Web/OAuth parser and rendering paths; no blocking defect or scope drift found. The PR changes only the two row-order sites plus focused regression tests.
  • Independent autoreview completed cleanly with no actionable findings.
  • Exact-head hosted CI was fully green, including both macOS test shards, Linux builds, lint, aggregate gate, and security checks: https://github.com/steipete/CodexBar/actions/runs/30329343394
  • The contributor's redacted same-account before/after CLI proof directly demonstrated the visible row-order change. A focused local test bundle also compiled, but this machine's Xcode-beta runner could not load its Sparkle runtime; hosted macOS CI provides the authoritative test execution.
  • Verified the clean three-way composition with merged Hide Daily Routines bar when the routines payload is null #2450: populated Daily Routines rows follow model-scoped weekly rows, while null routines payloads are omitted entirely.

Merged as 0611e8e634c8c5ebceab23b55827af0d9d4ed8c7. Thank you, @Eimerrrrr, for the focused implementation, regression coverage, and careful redacted behavior proof.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants