Repository navigation
Show TypeSafe spend and balance as a pay-as-you-go card - #1033
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Provider snapshot behavior rust/src/core/usage_snapshot.rs, rust/src/providers/soniox/*, rust/src/providers/typesafe.rs, apps/desktop-tauri/src-tauri/src/tray_presentation_tests.rs, apps/desktop-tauri/src-tauri/src/usage_metric/tests.rs |
CostSnapshot adds a default-false presentation flag. Soniox and TypeSafe set the flag on their cost snapshots. Tests cover the flag and related snapshot values. |
Bridge flag transport apps/desktop-tauri/src-tauri/src/commands/bridge.rs, apps/desktop-tauri/src/types/bridge/usage.ts |
The Rust bridge copies the flag from provider cost data and omits it from serialization when false. The TypeScript bridge type adds an optional payAsYouGo property. |
Pay-as-you-go card rendering apps/desktop-tauri/src/lib/cardCost.ts, apps/desktop-tauri/src/lib/cardCost.test.ts, apps/desktop-tauri/src/i18n/keyGroups/core.ts, rust/src/locale.rs, rust/src/locale/*.ftl |
The frontend renders the localized period and spend, with an optional balance and no percentage bar. Locale keys and translations are added. Tests cover display styles and the missing-balance case. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant Soniox
participant TypeSafe
participant CostSnapshot
participant ProviderUsageSnapshot
participant CostSnapshotBridge
participant cardCostSection
Soniox->>CostSnapshot: marks cost snapshot pay_as_you_go
TypeSafe->>CostSnapshot: marks cost snapshot pay_as_you_go
CostSnapshot->>ProviderUsageSnapshot: supplies provider cost data
ProviderUsageSnapshot->>CostSnapshotBridge: copies pay_as_you_go
CostSnapshotBridge->>cardCostSection: provides payAsYouGo for card rendering
Possibly related PRs
- nesszer/Win-CodexBar#1030: Adds the bridge contract and frontend card branch used by this change.
- nesszer/Win-CodexBar#1002: Adds the Soniox provider whose cost snapshot is marked pay-as-you-go.
Suggested reviewers: pasharm
Merge Risk: 
Minimal · up to 6c0bd
-
The pay-as-you-go display change is ready to merge after normal checks.
Pre-merge checks: 
7 · 
1
-
Failed checks: 1 warning Passed checks: 7 passed-
Full details: Provider Data Stays Siloed
-
Explanation
PASS. The diff adds only a provider-owned
pay_as_you_gopresentation flag, maps each provider's ownCostSnapshotinto its bridge snapshot, and renders that snapshot in the sameMenuCardprovider context. TypeSafe and Soniox set the flag only in their provider modules. No changed addition transfers identity, plan, account label, or email, and no new shared-code branch matches a specificProviderId.
Full details: Secrets Handled Safely
-
Explanation
The reviewed diff adds only a pay-as-you-go presentation flag, UI rendering, localization, and test fixtures. Added provider code carries spend and balance values, not tokens, cookies, API keys, OAuth credentials, or authorization headers. No added tracing/println/console/error logging, credential persistence, plain-text credential output, or credential-file/keyring deletion appears in the diff. The new Rust flag is explicitly skipped during core snapshot serialization, and the bridge serializes only the boolean flag.
Full details: No Unapproved Dependencies
-
Explanation
The authoritative PR diff changes only Rust source/locales and desktop TypeScript source/tests. It does not change any Cargo.toml or package.json, add an npm or yarn lockfile, or change a pinned pnpm packageManager version. No dependency approval is required.
-
Full details: Ui Changes Include Windows Proof
-
Explanation
The PR changes visible UI behavior in
apps/desktop-tauri/src/lib/cardCost.ts: pay-as-you-go cards now show a title, spend, and balance and remain visible in hidden style. The PR description states, “No new desktop proof for this PR,” and only refers to earlier desktop proof against a fake Soniox API. It includes no screenshot or proof note from a fresh Windows build.Resolution
Add screenshots or a proof note from a fresh Windows build to the PR description. The proof must show the changed pay-as-you-go card, including its title, spend, balance, and no usage bar.
-
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.
Comment @coderabbitai help to get the list of available commands.
|
@coderabbitai review |
✅ Action performed
|
Summary
TypeSafe's card dropped the prepaid balance. Its cost was
always_visiblewith no limit, which renders the "API spend" branch, and that branch has no balance line. Upstream shows TypeSafe with the.payAsYouGoSpendcard style, the same as Soniox.CostSnapshotnow sets.pay_as_you_go(). The card shows "Pay-as-you-go", the cycle spend (for example "September: $4.50") and "Balance: $10.00", with no bar, under every cost summary style.replacedDetailRows). The plan and credit rows are unchanged.billing_is_a_pay_as_you_go_card_with_spend_and_balance.Depends on #1030
This branch contains #1030 (
fix/soniox-balance), which addsCostSnapshot.pay_as_you_goand the frontend pay-as-you-go card. Until #1030 merges, the diff here includes its changes. Merge #1030 first; this PR then reduces to the singlerust/src/providers/typesafe.rscommit.Checks
cargo fmt --all -- --check: clean.cargo build --manifest-path rust/Cargo.toml --examples: ok.cargo test --manifest-path rust/Cargo.toml --lib: 5483 passed, 0 failed, 2 ignored.cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml: 832 passed, 0 failed.cargo clippy --all-targets -- -D warningson both manifests: clean.UI proof
No new desktop proof for this PR. The frontend pay-as-you-go card is unchanged from #1030, which has a desktop proof against a fake Soniox API. This PR only sets the same flag on TypeSafe's cost, and the new Rust test covers that. A TypeSafe desktop proof would need a fake of its cookie-authenticated Next.js server-action flow.
Summary by CodeRabbit