Port upstream 0.58.0: re-land stranded Usage & Spend daily ledger (#492) with the 0.67.0 30-row cap - #715
Draft
Finesssee wants to merge 4 commits into
Draft
Port upstream 0.58.0: re-land stranded Usage & Spend daily ledger (#492) with the 0.67.0 30-row cap#715Finesssee wants to merge 4 commits into
Finesssee wants to merge 4 commits into
Conversation
(cherry picked from commit f43cb6e)
Adapted to main: main already keeps the canonical spend formatters in lib/usageSpendSharing.ts (formatUsd, formatSpendMetric), so the daily ledger reuses them and the token-cell helper is added there as formatSpendTokens instead of a second lib/usageSpendFormatters.ts module. UsageSpendTab keeps main's layout unchanged. (cherry picked from commit 89edce6)
The re-landed daily ledger added six keys to en-US only. Add them to the other seven locale files so every .ftl stays aligned with locale.rs and keys.ts.
Port upstream 0.67.0 steipete#3998 (ce1b808) now that the daily ledger exists: the ledger opens with the newest 30 days and a Show all (N) / Show less control expands it to the complete history. Translates the upstream SpendDashboardDailyLedgerTests expansion test.
|
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: true
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re-lands the upstream v0.58.0 Usage & Spend port #492. It was merged on 2026-09-13 only into the stacked base
port/upstream-0.58.0and never reachedmain;git cherryagainstmain@7695471bstill reported both commits as missing.SpendContract.dailycost and token fields, newest day first. A missing cost or token count shows "Unknown", and an explicit zero stays$0.00/0 tokens.chartData.tokensHistory.Show all (N)/Show lesscontrol.0.67.0.mdrow 18 marked this SKIP because Windows had no ledger. This PR adds the ledger, so the row is ported here.The original commits are cherry-picked with
-x. The second commit adapts them tomain, which already keeps the canonical spend formatters inlib/usageSpendSharing.ts. The ledger reusesformatUsd, and the token-cell helper is added there asformatSpendTokensinstead of a second formatter module.Upstream reference
36cf4e3aeaee18ebe9cd2655efb8b9e09cfb0a2c(Add hover details to inline cost charts steipete/CodexBar#3413, inline cost chart hover details) and5e5a9003efb26b9291e48b31a0088e7b666b65c0(Add focused daily spend ledger steipete/CodexBar#2635, daily spend ledger), v0.58.0.ce1b80863e4b78607d7323dc18087cc199a71c38(perf(spend): bound initial ledger layout on long ranges steipete/CodexBar#4001, v0.67.0 release note Fix Usage & Spend scroll lag on long ranges steipete/CodexBar#3998).spendDailyLedgerVisibleSummariesandSpendDailyLedger.collapsedRowCount = 30are inSources/CodexBar/PreferencesSpendDashboardPane.swift, unchanged atv0.70.0(tag-pinned GET).SpendDashboardDailyLedgerTestsledger expansion preserves every day in newest first order(arguments 0, 7, 30, 31, 365) →dailyLedgerVisibleRowsinUsageSpendDailyLedger.test.tsx.Ported / Deferred
SpendContract.dailypoint has no per-day provider mix or request count, and wire shapes are not invented.Locale: six new keys (
UsageSpendDailyLedger,UsageSpendDailyLedgerHelper,UsageSpendNoDailyData,UsageSpendColDate,UsageSpendColCost,UsageSpendColTokens) are inrust/src/locale.rs,keys.tsand all eight.ftlfiles. The toggle reuses the existingUsageSpendShowAll/UsageSpendShowLess.Validation
Run in the worker worktree on Rust 1.98.0 and Node 24:
pnpm install --frozen-lockfilepnpm run check-localepnpm testpnpm run lintmainpnpm run buildcargo +1.98.0 fmt --all --checkcargo +1.98.0 clippy --workspace --all-targets -- -D warningscargo +1.98.0 test -p codexbarcargo +1.98.0 test -p codexbar-desktop-tauri -- --skip bootstrap_payload_exposes_every_provider_variantThe skipped desktop test is the non-hermetic #684 test, which reads the real
%APPDATA%\CodexBar\settings.jsononmain. #711 fixes it separately.Affected areas
apps/desktop-tauri/src/components/UsageSpendDailyLedger.tsx(new) and its testapps/desktop-tauri/src/components/MenuCardDetails.tsx(chart hover titles) andMenuCard.test.tsxapps/desktop-tauri/src/lib/usageSpendSharing.ts(formatSpendTokens) and its testapps/desktop-tauri/src/surfaces/settings/tabs/UsageSpendTab.tsx(mounts the ledger)apps/desktop-tauri/src/styles.css,apps/desktop-tauri/src/i18n/keys.ts,rust/src/locale.rs,rust/src/locale/*.ftlUI proof
Pending: a browser-use proof over WebView2 CDP of Settings > Usage & Spend (ledger, 30-row cap, Show all) and the tray card chart titles, built from this head with isolated data. It will be posted as a "UI proof (browser-use)" comment.