Skip to content

Make Claude reset credits, Extra usage and plan dates selectable - #894

Merged
Finesssee merged 4 commits into
mainfrom
feat/claude-optional-rows
Oct 15, 2026
Merged

Finesssee merged 4 commits into
mainfrom
feat/claude-optional-rows

Conversation

@Finesssee

Copy link
Copy Markdown
Collaborator

Summary

Ports upstream steipete#4484 (selectable Claude card sections) and steipete#4324 (Claude plan renewal and expiry dates).

  • Plan dates: the Claude web path fetches subscription_details (two-second budget, non-fatal). It only runs when the cookie source is on and the signed-in account is a member of the organization. The card shows "Renews: …", or "Plan expires: …" when there is no renewal date, under the quota rows. Calendar-only dates are formatted in UTC so they stay on the right day.
  • Selectable sections: "Visible usage items" now offers section:subscription, section:claude-reset-credits and section:claude-extra-usage for Claude (same IDs as upstream). A hidden section the provider stops reporting stays restorable as "(unavailable)". Admin API spend is never treated as Extra usage, so hiding Extra usage never hides it.
  • When Cost summary display is Hidden, the Extra usage checkbox explains why the block is not shown.
  • Tray card, compact Overview and Settings preview all apply the choices. Locale strings were added for all ten locales.

Differences from upstream:

  • Upgrades keep all three sections visible. Upstream hides reset credits when its global "optional credits" switch was off, but Windows has no such switch and always showed them.
  • Upstream's post-request account re-check and its OAuth profile path are not ported. Only Claude shows plan dates.

Commands run

  • cargo fmt --all -- --check: clean
  • cargo test --manifest-path rust/Cargo.toml: 4661 passed, 1 ignored
  • cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml: 731 passed
  • cargo clippy -D warnings on both manifests: clean
  • pnpm test: 135 files, 1269 tests passed; pnpm run build: ok

UI proof

CUA proof is pending. The workstation is in active use, so I did not launch the desktop app. Rendering is covered by MenuCard, usageItemVisibility and UsageItemVisibilitySection tests.

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: nesszer/Win-CodexBar/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 348a3c69-2d78-41ee-a6a5-9f4497484ed0
📥 Commits

Reviewing files that changed from the base of the PR and between 468d33f and 465dae3.

📒 Files selected for processing: 35
  • CHANGELOG.md
  • apps/desktop-tauri/src-tauri/src/commands/bridge.rs
  • apps/desktop-tauri/src-tauri/src/commands/provider_detail.rs
  • apps/desktop-tauri/src-tauri/src/commands/tests.rs
  • apps/desktop-tauri/src-tauri/src/commands/usage_items.rs
  • apps/desktop-tauri/src/components/MenuCard.test.tsx
  • apps/desktop-tauri/src/components/MenuCard.tsx
  • apps/desktop-tauri/src/components/card/describeCard.ts
  • apps/desktop-tauri/src/i18n/keys.ts
  • apps/desktop-tauri/src/lib/usageItemVisibility.test.ts
  • apps/desktop-tauri/src/lib/usageItemVisibility.ts
  • apps/desktop-tauri/src/surfaces/settings/providers/ProviderDetailPane.tsx
  • apps/desktop-tauri/src/surfaces/settings/providers/sections/UsageItemVisibilitySection.test.tsx
  • apps/desktop-tauri/src/surfaces/settings/providers/sections/UsageItemVisibilitySection.tsx
  • apps/desktop-tauri/src/surfaces/settings/providers/sections/UsageSection.tsx
  • apps/desktop-tauri/src/surfaces/tray-card.css
  • apps/desktop-tauri/src/types/bridge.ts
  • rust/src/core/usage_snapshot.rs
  • rust/src/locale.rs
  • rust/src/locale/en-US.ftl
  • rust/src/locale/es-MX.ftl
  • rust/src/locale/ja-JP.ftl
  • rust/src/locale/ko-KR.ftl
  • rust/src/locale/pt-BR.ftl
  • rust/src/locale/ru-RU.ftl
  • rust/src/locale/tr-TR.ftl
  • rust/src/locale/uk-UA.ftl
  • rust/src/locale/zh-CN.ftl
  • rust/src/locale/zh-TW.ftl
  • rust/src/providers/claude/mod.rs
  • rust/src/providers/claude/subscription_details.rs
  • rust/src/providers/claude/subscription_details_wire_tests.rs
  • rust/src/providers/claude/web_api.rs
  • rust/src/settings.rs
  • rust/src/settings/tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

📝 Walkthrough

The change adds Claude Web subscription renewal and expiry metadata, and makes plan dates, reset credits, and Extra usage independently configurable in usage views. The desktop app carries date precision through its bridge, persists section visibility choices, and renders localized plan-date notes.

Changes: Claude usage details

Layer / File(s) Summary
Fetch and parse subscription dates
rust/src/core/usage_snapshot.rs, rust/src/providers/claude/*
The Claude Web API fetches subscription details for the selected organization when cookie sourcing is enabled. Parsing accepts supported statuses and date formats, applies scheduled-ending and renewal precedence, and records date-only values.
Expose and persist visibility sections
apps/desktop-tauri/src-tauri/src/commands/bridge.rs, apps/desktop-tauri/src-tauri/src/commands/provider_detail.rs, apps/desktop-tauri/src-tauri/src/commands/usage_items.rs, apps/desktop-tauri/src-tauri/src/commands/tests.rs, apps/desktop-tauri/src/types/bridge.ts, rust/src/settings.rs, rust/src/settings/tests.rs
Bridge data carries subscription metadata and date precision. Claude section descriptors cover plan dates, reset credits, and Extra usage; settings retain section IDs, including previously saved IDs that are no longer available. Extra usage descriptors indicate when cost-summary display is required.
Project and render Claude sections
apps/desktop-tauri/src/lib/usageItemVisibility.ts, apps/desktop-tauri/src/lib/usageItemVisibility.test.ts, apps/desktop-tauri/src/components/MenuCard.tsx, apps/desktop-tauri/src/components/MenuCard.test.tsx, apps/desktop-tauri/src/components/card/describeCard.ts, apps/desktop-tauri/src/surfaces/settings/providers/*, apps/desktop-tauri/src/surfaces/tray-card.css, apps/desktop-tauri/src/i18n/keys.ts, rust/src/locale.rs, rust/src/locale/*.ftl, CHANGELOG.md
The desktop app filters Claude sections by saved visibility IDs and formats renewal dates before expiry dates. Usage views render plan-date notes, and the visibility settings show a helper message for cost-gated rows when cost-summary display is hidden. Localization and the changelog include the new labels and behavior. Tests cover section filtering, rendering, and saved visibility choices.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ClaudeWebApi
  participant SubscriptionDetailsEndpoint
  participant SubscriptionDetailsParser
  participant DesktopBridge
  participant UsageView
  ClaudeWebApi->>SubscriptionDetailsEndpoint: Request details for selected organization
  SubscriptionDetailsEndpoint-->>ClaudeWebApi: Return HTTP response
  ClaudeWebApi->>SubscriptionDetailsParser: Parse successful response body
  SubscriptionDetailsParser-->>ClaudeWebApi: Return subscription metadata
  ClaudeWebApi->>DesktopBridge: Attach subscription metadata to usage snapshot
  DesktopBridge->>UsageView: Provide subscription dates and date-only flags
  UsageView->>UsageView: Format and render renewal or expiry note
Loading

Suggested reviewers: pasharm

Merge Risk: ⚪ Minimal · up to 465da

No actionable issue remains that should prevent merging after normal checks.

Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

Failed Failed checks: 1 error · 1 warning

Check name Status Explanation Resolution
Provider Data Stays Siloed Error The change adds provider-specific branching in shared TypeScript code. In apps/desktop-tauri/src/lib/usageItemVisibility.ts, projectClaudeSections matches providerId !== "claude" and `claudePlan… Move Claude-specific section projection and plan-date formatting into a Claude-specific module or provider-owned data transformation. Make shared UI consume provider-neutral projected data. Remove providerId comparisons to "claude" from…
Ui Changes Include Windows Proof Warning The PR changes visible Windows UI. The diff changes MenuCard.tsx, UsageSection.tsx, UsageItemVisibilitySection.tsx, ProviderDetailPane.tsx, and tray-card styling. The description includes no s… Add screenshots or a clear proof note from a fresh Windows build to the PR description. The proof should cover the changed card, tray, compact Overview, and settings visibility controls.
Passed Passed checks: 6 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title is a short imperative summary that clearly describes the main change: making Claude reset credits, Extra usage, and plan dates selectable.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Secrets Handled Safely Passed No changed production path logs or displays cookies, session keys, API credentials, authorization headers, or subscription response bodies. The new subscription request reads the response into a parse…
No Unapproved Dependencies Passed The pull request changes no Cargo.toml or package.json files and adds or changes no npm, Yarn, or pnpm lockfile. It also does not change the pinned pnpm packageManager version. The dependency conditio…
Full details: Provider Data Stays Siloed

Explanation

The change adds provider-specific branching in shared TypeScript code. In apps/desktop-tauri/src/lib/usageItemVisibility.ts, projectClaudeSections matches providerId !== "claude" and claudePlanDateNote matches providerId !== "claude"; both functions are outside the permitted Rust provider paths. Shared MenuCard.tsx and UsageSection.tsx call these helpers for provider data. This matches the explicit cross-provider branching failure condition.

Resolution

Move Claude-specific section projection and plan-date formatting into a Claude-specific module or provider-owned data transformation. Make shared UI consume provider-neutral projected data. Remove providerId comparisons to "claude" from apps/desktop-tauri/src/lib/usageItemVisibility.ts and other shared code.

Full details: Ui Changes Include Windows Proof

Explanation

The PR changes visible Windows UI. The diff changes MenuCard.tsx, UsageSection.tsx, UsageItemVisibilitySection.tsx, ProviderDetailPane.tsx, and tray-card styling. The description includes no screenshots and states that CUA proof is pending because the desktop app was not launched. The listed test and build commands do not provide a proof note from a fresh Windows build.

  • Fix all pre-merge checks with AI
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@coderabbitai coderabbitai 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.

Pre-merge checks failed. Please resolve the failing checks before merging.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

On the "Provider Data Stays Siloed" pre-merge check: the section IDs and plan-date note are Claude-only by design, matching upstream steipete#4484/steipete#4324. The frontend already gates Claude-specific card behavior the same way (lib/claudeAccountActions.ts, lib/accountMenuRow.ts, ProviderDetailPane.tsx). Claude's plan dates and credits are only ever read from Claude's own snapshot, and other providers' cards are untouched, so no provider's data appears in another's UI.

On the UI-proof warning: CUA proof is pending because the workstation is in active use. It is tracked with the remaining UI-proof items. Rendering is covered by the MenuCard, usageItemVisibility and UsageItemVisibilitySection tests.

@Finesssee
Finesssee merged commit 4d7bdd3 into main Oct 15, 2026
3 checks passed
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