Skip to content

Port upstream 0.64.0: Usage & Spend provider grouping, consolidated chart selector, clear selected day - #705

Draft
Finesssee wants to merge 1 commit into
port/upstream-0.64.0from
port/micro-0.64.0-usage-spend-provider-grouping
Draft

Finesssee wants to merge 1 commit into
port/upstream-0.64.0from
port/micro-0.64.0-usage-spend-provider-grouping

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Found by the 0.60.4-0.69.0 port gap audit (gap G9, audit-0.64.0).

Summary

Settings -> Usage & Spend now groups model history by provider, folds the daily and hourly charts behind one compact selector, and adds a control that clears the selected day.

  • The flat "Models" list is replaced by collapsible provider groups. Each group header shows the provider name and its spend/tokens (with ~ when some models are unpriced). Each group shows six models, with Show all / Show less, and a "Partial model breakdown" note when local history is incomplete.
  • The standalone hourly heatmap is now one panel with a Day / Hour selector. The Day view is a new daily spend bar chart built from the existing contract.daily points. The Hour view is the existing heatmap. With only one view available the selector is hidden.
  • Clicking a day bar selects it. The chip with the date has a clear (x) button and clicking the selected bar again also clears it. Changing the 7d/30d/all-time range clears the selection.

Upstream reference

  • Release note (v0.64.0, Improved): "Usage & Spend: group sources and models by provider, consolidate detail and daily/hourly chart selectors, and add a clear selected-day control while preserving incomplete-history warnings, local-history labels, calendar boundaries, privacy, and exports (feat(spend): group usage details by provider steipete/CodexBar#3353)."
  • Commit 212c8d63a (feat(spend): group usage details by provider steipete/CodexBar#3353). Tag-pinned v0.64.0 files read: Sources/CodexBar/SpendDashboardProviderBreakdown.swift (spendDashboardProviderBreakdowns ordering, spendProviderModelDisplayLimit = 6, per-provider model rows, partial model warning), SpendDashboardSummary.swift (selected-day chip and clear button), PreferencesSpendDashboardPane.swift (SpendDashboardTrendSection daily/hourly picker), SpendDashboardModel.swift (incompleteModelProviders).

Ported / Deferred

Ported: provider grouping and ordering rule, six-model collapse, partial-model-history label, single Day/Hour selector, selected-day chip and clear control.

Deferred, because the Windows data model does not carry it and inventing fields is out of bounds:

  • Per-provider model rows for providers other than the contract provider. The shell builds one model-level contract (contract.providerId, Codex, merged with OpenCodex imports), so only that provider gets a group. Other providers stay in the existing provider table. The grouping helper takes the contract, so more groups appear when the backend supplies them.
  • Upstream's "Sources / Accounts" children per provider group: there is no per-native-source cost row on Windows.
  • Selected day only scopes the Spend card (from contract.daily). Models, projects and hourly activity stay on the full range because the contract has no per-day breakdown of them. The panel says so when a day is selected.
  • Upstream's Sessions/Projects/Providers detail picker, daily ledger, and incompleteModelProviders per-provider set (Windows uses historyCoverageEstablished for the single contract).

Unchanged: incomplete-history labels, calendar/reporting day, privacy redaction, share card and JSON export, provider table.

Validation

  • pnpm --dir apps/desktop-tauri exec vitest run (full): 69 files, 413 tests passed, including 11 new tests (usageSpendBreakdown.test.ts, UsageSpendBreakdownPanels.test.tsx).
  • pnpm --dir apps/desktop-tauri run lint: no findings in the touched files (pre-existing warnings elsewhere).
  • pnpm --dir apps/desktop-tauri run build: passed.
  • cargo +1.98.0 fmt --all: clean.
  • cargo +1.98.0 test -p codexbar locale: 16 passed (new locale keys are in the enum, en-US.ftl, and keys.ts).
  • cargo +1.98.0 clippy --workspace --all-targets -- -D warnings: passed (workspace, both crates)

Affected areas

  • Settings UI (Usage & Spend tab)
  • Locale catalog (6 new en-US keys; other locales fall back)
  • Rust provider/backend logic (none)

UI proof

Pending: coordinator will capture CUA proof on a fresh build (CODEXBAR_PROOF_MODE=settings:usageSpend with a seeded spend file).

@coderabbitai

coderabbitai Bot commented Sep 30, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant