Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Updates mobile usage text to describe tokens written to cache, with singular/plural wording and matching translations. Token accounting, billing, and product defaults remain unchanged. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dismissing prior approval to re-evaluate 872d54f
EvidencePixel 9 emulator, Android API 36, 1080×2424, English, light theme on both sides. Separate fresh backend databases; identical synthetic Claude transcript scanned by the real usage service. Android is not supported by the scenario runner, so this comparison was driven through agent-device. On each commit, start an isolated backend with dev seeding disabled, CLAUDE_CONFIG_DIR pointing to the same synthetic transcript and CODEX_HOME empty. Install the matching Android dev client, serve that checkout through Metro, and pair with a fresh credential. Open Usage, allow Claude and Codex usage access, select Tokens, then select 24h, 7d, and 30d and scroll to Totals → Uncached input. Capture each static result after two screenshots at least 500 ms apart are identical. Base shows “1 cache writes”, “2 cache writes”, and “1.10K cache writes”; head shows “1 token written to cache”, “2 tokens written to cache”, and “1.10K tokens written to cache”. Uncached input remains 2, 4, and 6 respectively. All six captures were opened and visually inspected.
Transcript seed script · Capture driver Not shown:
|






Problem
The mobile Usage → Totals "Uncached input" tile describes cache-creation input tokens as write operations. With Claude Code history it reads
1.10K cache writesfor 1,097 tokens written to the cache. The string also has no plural selector, so a single token reads1 cache writes.Deterministic repro on
origin/main(57c1ddc8b2248aff0b5b0d1d398f10223d3ceff5):usage.cache_creation_input_tokens: 1097. This is the fixture inapps/server/src/usage/UsageService.test.ts.cacheCreationTokensinapps/server/src/provider/Drivers/claudeUsage.ts.mergeUsagesums it intoMergedUsage.cacheCreationTokens.TotalsSectioninapps/mobile/src/features/usage/UsageRouteScreen.tsxrenders it asgt("{tokens} cache writes", …).To check it without the app, render
TotalsSectionwith{ ...mergeUsage([], USAGE_CONTRACT_VERSION), cacheCreationTokens: 1097 }. Use 1 or 2 for the plural cases.1.10K cache writes; synthetic edge cases give1 cache writesand2 cache writes1.10K tokens written to cache,1 token written to cache,2 tokens written to cacheChange
The detail line now uses an ICU plural keyed by the raw token count. It still shows the compact formatted count (
{n, plural, one {{tokens} token written to cache} other {{tokens} tokens written to cache}}). I swapped the old key for the new one in place in all 11 mobile catalogs. Theen.jsonvalue matches whatvp run i18n:generateproduces for this key, and the 10 translations are hand-written, as in #46211. Russian, Polish, Japanese, Korean and Chinese use count-neutral phrasing. Web has no equivalent tile, and nothing else uses this string.Scope
Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.
Verification
apps/mobile/src/features/usage/UsageRouteScreen.test.tsxrenders the realTotalsSectionthrough mobile's gt-react-native test build. That build uses its default English locale, so the test checks the English source message, not theen.jsoncatalog. It covers 1,097 tokens (the Claude fixture) and synthetic counts of 1 and 2.Received: "…<p>Uncached input</p><p>0</p><p>1.10K cache writes</p>…".Tests 3 passed (3).vp run i18n:check: catalogs match the source in apps/web, apps/mobile and apps/desktop.en.jsonline by hand, but it matches the generator's output: runningvp run i18n:generateon this head leaves the4ab74446797722c5entry untouched, and its value matches the committed line byte for byte. I didn't commit the full generator output because it rewrites 239/239 unrelateden.jsonlines, and it does the same on unmodifiedorigin/main(57c1ddc8b22). That drift exists on main already, so committing it would be an unrelated change.vp run check:changedpassed ond652cf517bc(format, lint, knip, typecheck, tests, react compiler). The output is in the transcript.Not shown:
usage.cache_creation_input_tokens: 1097, give it a timestamp inside the selected Usage window, wait for the scan, and assert the text under Uncached input. The render test does not run the scanner or RPC.Authored by Claude Opus 5.5 (Model Hub); reviewed by GPT-6.2 Sol (Codex).
Not shown