Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks 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 |
|
Thermo-nuclear review Reviewed by Codex gpt-6-luna (xhigh); verified and validated by Claude Codex reported two findings. After verification, neither was applied:
No code changes were made to this PR. No commit or push. |
CUA proof (Windows desktop, real WebView2 build)Build commit: Proof-only patches (uncommitted, reverted in the worktree; exact text in
Commands:
Screenshots (local, not committed),
|
|
Reviewed by Claude (triage of the CUA note on 47f55c7; Codex not used per operator request to use fewer agents). No code change: none of the three items is a defect of this PR.
Commands run: read-only inspection of |
Port re-review: Vercel AI Gateway credit balance (#678, GAP row 2 of 0.66.0)Re-checked the branch at the current head What I verified at the current head:
Result: no new findings. The port matches upstream semantics with documented deviations ("Team credits" as info text/cost title instead of a grouped section; no dashboard icon-table entry). Files under the cap; no new dependency. |
Summary
Adds the Vercel AI Gateway provider (
vercel, display name "Vercel AI Gateway"). With an API key it reads the team's credit balance and lifetime spend fromGET https://ai-gateway.vercel.sh/v1/creditsand shows them as informational rows. No quota, percentage, or billing period is invented; the primary window is informational.AI_GATEWAY_API_KEY(env, keyring targetcodexbar-vercel, or the Preferences API-key field). Off by default.{"balance":"95.50","total_used":"4.50"}: both fields must be strings matching^-?\d+(?:\.\d+)?$and finite;total_used < 0is a parse failure. Numericbalance, missing fields,{},null, non-JSON,NaN,1e999,0x10, empty and whitespace-only values fail with a fixed message that does not echo response data.$95.50,-$1.25,$0.00) and "Lifetime spend" ($4.50), login methodAPI, and a typedCostSnapshot(used = lifetime spend, period "Team credits", notalways_visibleso it never feeds the 30-day spend views) carrying the balance.CostSnapshot::with_balanceclamps to >= 0, so a negative balance is not typed (it would read as a fabricated$0.00); it survives only through the signed display row. A zero balance is a typed 0.ProviderId::Vercel(cli namevercel; aliasesvercel-ai-gateway,ai-gateway), factory arm, token-accounts (unsupported), API-key catalog, frontend icon (upstream triangle,currentColor), tray dashboard-link set, provider source label, test catalog, README row.0xFFFFFF), which is invisible on light surfaces; uses neutral#737373.Upstream reference
5cfe3f1f(feat(providers): add Atlas Cloud and Vercel balance plugins steipete/CodexBar#3917).v0.66.0) sources:Sources/CodexBarCore/Resources/Plugins/vercel.js(fetchUsage,money),Sources/CodexBarCore/Providers/Vercel/VercelProviderDescriptor.swift,Tests/CodexBarTests/APIBalancePluginTests.swift(fixture and invalid-value list),Sources/CodexBar/Resources/ProviderIcon-vercel.svg.docs/vercel.mdin the tag; the test fixture is the only wire evidence, so onlybalanceandtotal_usedare read.Ported / Deferred
Ported: everything in the spec above.
Deferred / adjusted:
ProviderDisplayDetailrows have no section concept here, so "Team credits" is the informational primary text and the cost card title instead of a grouped section.cli/serve/dashboard/icons.rs): not extended; the dashboard falls back to its neutral dot, as for other recently added providers.Validation
All on Rust 1.98.0, E-core wrappers, slot-4 target dir.
cargo +1.98.0 fmt --all: cleancargo +1.98.0 clippy --workspace --all-targets -- -D warnings: passcargo +1.98.0 test -p codexbar vercel -- --test-threads=4: 17 passedcargo +1.98.0 test -p codexbar -- --test-threads=4(full, shared core/settings touched): 2177 passed, 0 failed, 1 ignoredpnpm --dir apps/desktop-tauri exec vitest run src/components/providers src/surfaces/settings src/surfaces/TrayPanel.test.tsx: 26 files, 161 tests passedpnpm --dir apps/desktop-tauri run build: pass;run lint: only pre-existing warnings in untouched filesTests cover the upstream fixture,
0.00/-1.250000, the invalid list (""," ",NaN,1e999,0x10,private-response), overflow digits, wrong shapes (numeric balance, missing fields,{},null, arrays), negativetotal_used, unknown fields, signed USD formatting, 401/403/429/503/400 mapping without the body, redirects not followed, trimmed bearer header over a local one-shot server, and the clamp behavior.Known limit: the wire shape comes from upstream test fixtures only; no live Vercel account was used.
Affected areas
UI proof
Pending: coordinator will capture CUA proof on a fresh build (tray card, settings API-key field).