Repository navigation
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
|
Reviewed by Codex gpt-6-luna (xhigh); verified and validated by Claude Thermo-nuclear review of this PR:
|
|
Follow-up: fixed the two P2 findings (unclamped shares, unique row ids) with a new regression test. Left the 1e400 parse finding because it needs a Cargo feature change (spec: no new dependency). Commands run: cargo +1.98.0 fmt --all; clippy --workspace --all-targets -D warnings; cargo test -p codexbar grok (74 passed). |
…own (stacked on nesszer#652) (stacked on nesszer#652)
…reakdown on the grok.com billing fallback (stacked on nesszer#656; keeps the nesszer#656 repeated-name test next to the nesszer#692 gRPC breakdown tests)
Stacked on #652 (
port/micro-0.67.0-grok-credits-proxy); base is that branch, so the diff shows only the breakdown.Summary
Grok bearer logins now show the per-product breakdown that the credits proxy carries in
config.productUsage(for exampleGrok Chat 4%,Grok Build 2%) as plain detail rows next to the single weekly bar. Shares are slices of the same credit pool as the total, so they never become a bar or a rate window and never change the total, period, or plan.Behavior:
config.productUsage: [{product, usagePercent}]. The list is kept only when the primary percent came from the wirecreditUsagePercentof the same payload and the shares sum to that raw (unclamped) percent within 1.0 point (120with one120share is kept; the bar still clamps to 100).null, or an empty list drops the whole breakdown, so a partial list cannot pass the sum check. Total, period, and plan are untouched.4%,<1%below one point), no bar or secondary value. Labels:GrokBuild"Grok Build",GrokChat"Grok Chat",GrokImagine"Grok Imagine",GrokAppBuilder"Grok App Builder"; unknown names verbatim (trimmed). Row ids aregrok.product.<name>.Upstream reference
bbeb03cd9, feat(grok): show product usage breakdown under the weekly bar steipete/CodexBar#3975).Providers/Grok/GrokCreditsProxyFetcher.swift(composingProducts,LossyProductUsageArray,LossyProductUsage),GrokStatusProbe.swift(GrokProductUsageDetails.sections,toUsageSnapshot),docs/grok.md"Usage breakdown by product",Tests/CodexBarTests/GrokCreditsProxyFetcherTests.swift(live multi-product payloads, malformed-entry, composition, raw overage, on-demand, and gRPC-borrow cases).Ported / Deferred
Ported: parsing, composition rule, all-or-nothing malformed handling, labels, ordering, and rows.
Deferred / different:
ProviderDisplayDetailrows have no section concept, and adding one would touch the UI in every provider surface. Rows use idsgrok.product.<name>so a later grouping change can key on them. Titles are the product labels.usagePercent: 1e400) makesserde_jsonreject the whole payload, so it falls back to the gRPC path instead of only dropping the breakdown. Not a real server shape; handling it would need a second lenient parse pass.MenuCardDetails.tsxrenders thedisplayDetailsblock twice (two adjacent identical<section>blocks), so these rows will repeat in the tray card until that is fixed separately.Validation
Pinned toolchain
+1.98.0, E-cores, build slot-6.cargo +1.98.0 fmt --allcleancargo +1.98.0 clippy --workspace --all-targets -- -D warningspasscargo +1.98.0 test -p codexbar grok -- --test-threads=473 passed, 0 failed (13 new inproduct_usage_tests.rs)cargo +1.98.0 test -p codexbar-desktop-tauri grok -- --test-threads=48 passed, 0 failedFiles:
product_usage.rs(new, 113 lines),product_usage_tests.rs(new, 338),credits_proxy.rs(250 to 265),mod.rs(839 to 851). No file over 1000 lines. No new dependencies.Affected areas
UI proof
Not applicable for code changes; the rows reuse the existing display-detail renderer. Pending: coordinator may capture a CUA smoke on a fresh build with
CODEXBAR_SEED_USAGE_JSONif desired.