Port upstream 0.67.0: History window setting and period-aware spend surfaces (stacked on #648) - #665
Conversation
…nd surfaces Persist cost_reporting_period, add the Settings History window picker, and thread the selected period through usage spend, tray, menu card, float bar and share PNG. thirtyDay stays a fixed 30-day column and PowerToys stays 30 days.
|
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 |
|
Port gap follow-up Added: Bedrock now fetches Cost Explorer DAILY spend (current UTC month plus 13 months, via Still left out:
|
|
Thermo-nuclear review Reviewed the diff against the "cost-period-desktop" spec (settings control, Usage & Spend, tray/menu, float bar, share PNG, PowerToys kept at 30 days, workspaces rolling). Behavior matches the spec and no file crosses 1k lines because of this PR (
Noted, not changing: the extra Cost Explorer DAILY request per Bedrock refresh matches upstream (each paginated Cost Explorer request is billed by AWS; deriving the monthly figure from the daily pages would halve it but changes the failure semantics, so it needs a decision); |
|
Thermo-nuclear review follow-up (fixes at 29b34cc) Reviewed by Codex gpt-6-luna (xhigh); verified and validated by Claude. Fixed (all 7 findings):
Left as-is: the extra Cost Explorer DAILY request per Bedrock refresh (needs a decision), repeated Commands run: |
CUA proofBuild commit: Proof-only patch (never committed, restored after the build): root Commands:
Screenshots (local, not committed): |
|
Lane validation 2026-10-01 (worktree W:/wcb-wt/lane-b, local rustc 1.96, CARGO_TARGET_DIR=W:\cargo-target\lane-b, E-core gate):
No code changes needed at head 29b34cc; branch is up to date with origin. Awaiting merge order (stacked on #648). |
…d-aware spend surfaces (stacked on #648)
|
Adversarial validation passed at a453cfd Scope: History window setting and period-aware spend surfaces (#665, upstream 0.67.0), validated as merged into release/v0.70.0 (merge a453cfd = merge of 29b34cc into 4988b27... per the audit the desktop row cites merge a453cfd on the 648 branch). Attacks (highest-risk semantics, from the merged tree):
No defects found. READY for the un-draft rule. |
Summary
Stacked on #648 (
CostReportingPeriodcore and range-aware cost scanners). This PR wires the period into the desktop app:cost_reporting_periodand a Settings > Usage & spend "History window" control: Month to date, All, 1 / 7 / 30 / 90 / 365 days, plus a custom day count in 1..=365. The old fixed 7d / 30d / All buttons are gone.rolling:30; a legacyhistory_daysof 0 means All.get_usage_spend_summaryandget_spend_contracttake an optionalperiod(omitted means the saved setting). The period identity (month-to-date includes the month, so the key changes across a month boundary) is part of every cache key.UsageSpendRow.seven_day/thirty_daystay as fixed compatibility columns; newperiod_cost/period_tokens(andreporting_periodon the summary, contract and local-usage summary) carry the selected window.Upstream reference
CodexBar 0.67.0, part C "reporting periods" (PR 3 of the 0.67.0 plan). Upstream is read-only reference; nothing was written upstream.
Ported / Deferred
Ported: everything listed in Summary, plus 16 en-US locale keys (Rust
locale_keys!,en-US.ftl,keys.ts; other languages fall back to en-US).Behaviour notes:
thirty_day_cost/thirty_day_tokensstay the trailing 30 days regardless of the setting (documented inpowertoys.rs).ProviderLocalUsageSummary.thirty_day_*is also fixed at 30 days.Bedrock: the provider now also fetches Cost Explorer DAILY spend over the exposed range (current month plus 13 months, best-effort) into
CostSnapshot.daily, so month to date and All are answered from it. The fixed 30-day column only sums the last 30 days of daily points.Deferred: translations of the new keys (English fallback); removal of now-unused legacy locale keys such as
UsageSpendAllTimeHistory.Validation
Rust toolchain 1.98.0, run through the E-core wrappers,
CARGO_BUILD_JOBS=5,--test-threads=4.cargo +1.98.0 fmt --all: cleancargo +1.98.0 clippy --workspace --all-targets -- -D warnings: cleancargo +1.98.0 test -p codexbar -- --test-threads=4: 2190 passed, 0 failed, 1 ignored (plus 1 passed in the second test target)cargo +1.98.0 test -p codexbar-desktop-tauri -- --test-threads=4: 466 passed, 1 failed. The failure iscommands::tests::bootstrap_payload_exposes_every_provider_variant(catalog 79 vs 78 active providers). It reads the machine's real settings viaget_bootstrap_state, which depends on the local config, and is in code this PR does not touch (this PR only adds one field tobridge.rs). It fails the same way run alone. Not verified against a clean base on this machine.thirty_dayfixed, and settings validation (rolling:0rejected,month-to-dateapplied).pnpm --dir apps/desktop-tauri exec vitest run: 69 files, 422 tests passedpnpm --dir apps/desktop-tauri run lint: 0 errors, 14 warnings (all in code this PR does not add, unchanged)pnpm --dir apps/desktop-tauri exec tsc --noEmit: cleanpnpm --dir apps/desktop-tauri run build(includescheck-locale-drift): builtTrayPanel.period.test.tsxbecauseTrayPanel.test.tsxwas at 999 lines.Affected areas
rust/src/cost_reporting_period.rs,rust/src/spend_contract*,rust/src/locale*; Tauri commandssettings,bridge,usage_spend,chart,spend_contract,powertoys; frontendcostPeriod,CostPeriodControl,UsageSpendTab,MenuCardDetails,TrayPanel,FloatBar,usageSpendSharing,bridge.ts,tauri.ts,keys.ts.UI proof
Pending: coordinator will capture CUA proof on a fresh build.