Skip to content

Show selected-provider spend in Overview - #3027

Merged
steipete merged 3 commits into
mainfrom
fix/3023-overview-spend
Aug 18, 2026
Merged

Show selected-provider spend in Overview#3027
steipete merged 3 commits into
mainfrom
fix/3023-overview-spend

Conversation

@steipete

Copy link
Copy Markdown
Owner

Supersedes #3023 without closing it. This preserves @Chipagosfinest's original commit and credits the contribution in the changelog.

Summary

  • merge the selected-provider Overview spend row onto the newly landed spend-reporting stack
  • keep Overview inputs scoped to each selected provider's current configuration snapshot
  • honor the existing Inline / Submenu only / Both / Off cost-summary preference boundary
  • reuse the stack's partial-cost, history-coverage, pricing-coverage, and provenance affordances
  • keep wholly unpriced spend unavailable instead of reconstructing an apparently authoritative total
  • refresh the exact ProviderArchitectureGatekeeper anchors shifted by the Overview insertion

Review verdict

The design fits the new stack cleanly. A priced subset renders with a leading approximation marker and explicit subscription coverage; wholly unpriced data renders as unavailable. Distinct currencies stay separate, and the row does not borrow identity, plan, or spend data across providers.

UI proof

Before: Overview had no selected-provider aggregate spend row.

After:

Overview spend summary

Verification

  • swiftformat Sources Tests using the repository-pinned SwiftFormat 0.61.1
  • swiftlint --strict using the repository-pinned SwiftLint 0.65.0
  • make check
  • swift test --filter 'OverviewSpend|SpendDashboard|ProviderArchitectureGatekeeper' (203 tests passed; one opt-in screenshot test skipped in this invocation)
  • CODEXBAR_SPEND_PROOF_DIR=.github/pr-proof swift test --filter SpendDashboardScreenshotRenderTests
  • make test (892 selections in 75 groups; zero failures or retries)
  • source-blind behavior contract: complete, partial, missing-provider, wholly unpriced, mixed-currency, and display-style cases passed
  • autoreview: clean, no accepted/actionable findings; the generated PNG was visually inspected because the review helper intentionally refuses binary diffs

@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0828161bd1

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +139 to +143
return SpendDashboardModel.build(
inputs: inputs,
requestedDays: self.settings.costUsageHistoryDays,
now: now,
preferredCurrencyCode: self.settings.preferredCurrencyCode)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use the pinned calendar for Overview spend

When the system time zone has changed since cost tracking pinned costUsageBucketTimeZoneIdentifier, this call falls back to Calendar.current, unlike SpendDashboardController.rebuildModel, which passes the configured bucket calendar. Around either zone's midnight, the Overview can therefore interpret stored YYYY-MM-DD buckets in a different zone from the scanner and include or exclude a boundary day, making its spend and coverage disagree with Usage & Spend; pass settings.costUsageBucketCalendar into this build.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed August 17, 2026, 10:12 PM ET / August 18, 2026, 02:12 UTC.

ClawSweeper review

What this changes

The branch adds a selected-provider Usage & Spend card above Overview provider rows, using current provider snapshots and existing inline-cost display preferences.

Merge readiness

⚠️ Needs maintainer review before merge - 2 items remain

Keep open. Current main has the spend dashboard but no Overview spend card; this PR supplies that missing integration, but it can disagree with the dashboard when the pinned cost-bucket time zone differs from the system time zone.

Priority: P2
Reviewed head: 0828161bd164b27b1acaa5ba02960a833f593394

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Direct UI proof and substantial focused coverage are strong, but the confirmed time-zone mismatch is a merge-blocking correctness defect.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): The PR includes an inspected after-change screenshot that directly shows the new spend card and its partial-coverage rendering.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The PR includes an inspected after-change screenshot that directly shows the new spend card and its partial-coverage rendering.
Evidence reviewed 7 items Current main lacks the requested Overview integration: Current main builds Overview provider rows directly and has no spend-summary insertion, so the central user-visible capability remains necessary.
Overview calculation uses the wrong calendar default: The new Overview helper omits the calendar argument, so SpendDashboardModel.build defaults to Calendar.current rather than the persisted cost-bucket calendar.
Dashboard establishes the intended calendar contract: The existing Usage & Spend dashboard rebuild explicitly passes its configured bucket calendar into the same model builder.
Findings 1 actionable finding [P2] Use the pinned bucket calendar for Overview spend
Security None None.

How this fits together

CodexBar converts provider usage snapshots into a shared spend-dashboard model and then renders menu cards. This change sends Overview’s selected providers through that model and presents the resulting spend, coverage, and provenance summary in the Overview menu.

flowchart LR
A[Provider snapshots] --> B[Overview selected providers]
B --> C[Inline cost preference]
C --> D[Spend dashboard model]
D --> E[Coverage and provenance summary]
E --> F[Overview menu card]
Loading

Before merge

  • Use the pinned bucket calendar for Overview spend (P2) - Pass settings.costUsageBucketCalendar here. The dashboard passes its configured bucket calendar into the same builder, while this omitted argument defaults to Calendar.current; after a time-zone change, stored daily buckets can be included differently around midnight and make Overview disagree with Usage & Spend.
  • Resolve merge risk (P1) - Users whose persisted cost-bucket time zone differs from the system zone can see Overview include or exclude a boundary day differently from Usage & Spend, producing conflicting spend and coverage values.

Findings

  • [P2] Use the pinned bucket calendar for Overview spend — Sources/CodexBar/StatusItemController+OverviewSpend.swift:139-143
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Implementation and regression coverage production +171, tests +228, changelog +1 The focused UI integration is accompanied by more regression/render coverage than production code, but needs one calendar-consistency case.

Root-cause cluster

Relationship: canonical
Canonical: #3027
Summary: This PR carries the Overview spend work onto the newly landed spend-reporting stack; the earlier contribution remains preserved as history.

Members:

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

Merge-risk options

Maintainer options:

  1. Align Overview with the pinned bucket calendar (recommended)
    Pass the configured bucket calendar into the Overview model build and cover a time-zone boundary case before merge.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Pass `settings.costUsageBucketCalendar` into the Overview spend model build and add a pinned-time-zone boundary-day regression test.

Technical review

Best possible solution:

Pass SettingsStore.costUsageBucketCalendar to the Overview model build and add a boundary-day regression test with a different system and bucket time zone.

Do we have a high-confidence way to reproduce the issue?

Yes, source-reproducible: configure a persisted bucket zone different from the system zone and open Overview near either midnight; it uses Calendar.current while Usage & Spend uses the pinned bucket calendar.

Is this the best way to solve the issue?

No. The feature integration is appropriate, but it must use the same configured calendar as the existing dashboard rather than the model’s system-calendar default.

Full review comments:

  • [P2] Use the pinned bucket calendar for Overview spend — Sources/CodexBar/StatusItemController+OverviewSpend.swift:139-143
    Pass settings.costUsageBucketCalendar here. The dashboard passes its configured bucket calendar into the same builder, while this omitted argument defaults to Calendar.current; after a time-zone change, stored daily buckets can be included differently around midnight and make Overview disagree with Usage & Spend.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add merge-risk: 🚨 other: A time-zone configuration can make the newly added Overview totals disagree with the established Usage & Spend dashboard.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (screenshot): The PR includes an inspected after-change screenshot that directly shows the new spend card and its partial-coverage rendering.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on author.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P2: The PR adds a bounded spend presentation feature but currently has a concrete cross-view accuracy defect.
  • merge-risk: 🚨 other: A time-zone configuration can make the newly added Overview totals disagree with the established Usage & Spend dashboard.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (screenshot): The PR includes an inspected after-change screenshot that directly shows the new spend card and its partial-coverage rendering.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR includes an inspected after-change screenshot that directly shows the new spend card and its partial-coverage rendering.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR includes an inspected after-change screenshot that directly shows the new spend card and its partial-coverage rendering.

Evidence

Acceptance criteria:

  • [P1] swift test --filter 'OverviewSpend|SpendDashboard|StatusMenu'.
  • [P1] make check.

What I checked:

Likely related people:

  • Yuxin Qiao: Introduced the current-main spend-dashboard work and the pinned day-time-zone behavior that this integration must preserve. (role: spend-dashboard and bucket-time-zone feature contributor; confidence: high; commits: 39b17af0b75a, bbb5cd73af04; files: Sources/CodexBar/SpendDashboardController.swift, Sources/CodexBar/SettingsStore+Defaults.swift)
  • Peter Steinberger: Merged the spend-reporting series on main and authored the current Overview integration branch. (role: recent spend-stack integrator and Overview owner; confidence: high; commits: 4dd5e4258f5c, 0828161bd164; files: Sources/CodexBar/StatusItemController+Menu.swift, Sources/CodexBar/StatusItemController+OverviewSpend.swift)

Rank-up moves

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

  • Pass the pinned bucket calendar to the Overview model builder.
  • Add a differing-time-zone boundary-day regression test proving Overview matches Usage & Spend.

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.

@steipete
steipete merged commit 8c113bb into main Aug 18, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal priority bug or improvement with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient Contributor real behavior proof is sufficient. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants