Registry Mirror
Skip to content

Conversation

@saphid

@saphid saphid commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

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 writes for 1,097 tokens written to the cache. The string also has no plural selector, so a single token reads 1 cache writes.

Deterministic repro on origin/main (57c1ddc8b2248aff0b5b0d1d398f10223d3ceff5):

  1. Use a Claude Code transcript assistant record with usage.cache_creation_input_tokens: 1097. This is the fixture in apps/server/src/usage/UsageService.test.ts.
  2. The server parses that field into cacheCreationTokens in apps/server/src/provider/Drivers/claudeUsage.ts.
  3. mergeUsage sums it into MergedUsage.cacheCreationTokens.
  4. TotalsSection in apps/mobile/src/features/usage/UsageRouteScreen.tsx renders it as gt("{tokens} cache writes", …).

To check it without the app, render TotalsSection with { ...mergeUsage([], USAGE_CONTRACT_VERSION), cacheCreationTokens: 1097 }. Use 1 or 2 for the plural cases.

  • Observed: 1.10K cache writes; synthetic edge cases give 1 cache writes and 2 cache writes
  • Expected: 1.10K tokens written to cache, 1 token written to cache, 2 tokens written to cache

Change

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. The en.json value matches what vp run i18n:generate produces 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

  • New apps/mobile/src/features/usage/UsageRouteScreen.test.tsx renders the real TotalsSection through mobile's gt-react-native test build. That build uses its default English locale, so the test checks the English source message, not the en.json catalog. It covers 1,097 tokens (the Claude fixture) and synthetic counts of 1 and 2.
    • Base: all three fail, for example Received: "…<p>Uncached input</p><p>0</p><p>1.10K cache writes</p>…".
    • Head: Tests 3 passed (3).
  • vp run i18n:check: catalogs match the source in apps/web, apps/mobile and apps/desktop.
  • I wrote the en.json line by hand, but it matches the generator's output: running vp run i18n:generate on this head leaves the 4ab74446797722c5 entry untouched, and its value matches the committed line byte for byte. I didn't commit the full generator output because it rewrites 239/239 unrelated en.json lines, and it does the same on unmodified origin/main (57c1ddc8b22). That drift exists on main already, so committing it would be an unrelated change.
  • vp run check:changed passed on d652cf517bc (format, lint, knip, typecheck, tests, react compiler). The output is in the transcript.
  • Before/after transcript: https://gist.github.com/saphid/295d1d8af8d0494f7dea9f138ecdf9c7

Not shown:

  • No native iOS/Android captures of the tile, and no scenario run against a seeded server. For that, the scenario would seed a Claude transcript with 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.
  • Localized (non-English) rendering was not checked on a device.
  • The non-English wording was written by hand and no native speaker has reviewed it.

Authored by Claude Opus 5.5 (Model Hub); reviewed by GPT-6.2 Sol (Codex).

Not shown

  • apps/mobile/src/features/usage/UsageRouteScreen.tsx:702 — No native before/after capture of the Totals tile; capture it on iOS or Android to verify the longer detail fits.
  • apps/mobile/src/features/usage/UsageRouteScreen.test.tsx:37 — The component test bypasses the scanner and RPC; for scenario proof, seed an isolated Claude JSONL assistant record with message.usage.cache_creation_input_tokens set to 1097 and a timestamp inside a fixed Usage window, then assert the rendered Uncached input detail after the summary loads.
  • apps/mobile/src/features/usage/UsageRouteScreen.tsx:702 — Non-English catalogs were checked for source consistency but not rendered on a device or reviewed by native speakers; verify localized wording and wrapping on a narrow screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Dec 1, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Dec 1, 2026
@macroscopeapp

macroscopeapp Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 872d54f

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.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The uncached-input detail now describes cache creation values as tokens written to cache. English, German, Spanish, French, Japanese, Korean, Polish, Brazilian Portuguese, Russian, Swedish, and Chinese translations have updated wording.

Changes: Cache Token Usage Label

Layer / File(s) Summary
Render and localize cache token counts
apps/mobile/src/features/usage/UsageRouteScreen.tsx, apps/mobile/src/i18n/translations/*.json
The uncached-input detail and translations describe cache creation values as tokens written to cache. Several translations use singular or plural wording based on the count.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge, only21mil

Merge Risk: Minimal · up to 872d5

This updates the Usage totals label to describe cache creation as tokens written to cache, with plural-aware wording in several languages. No merge-blocking risk is evident.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(mobile): show the correct unit for a single cache-write token" matches the main change. The PR replaces the "cache writes" label in the mobile Usage Totals "Uncached input" detail with …
Description check Passed The description covers the template sections: Problem (with a deterministic repro and expected versus observed output), Change (ICU plural keyed by the raw count, catalog updates), Scope (small obviou…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "fix(mobile): show the correct unit for a single cache-write token" matches the main change. The PR replaces the "cache writes" label in the mobile Usage Totals "Uncached input" detail with an ICU plural that says "token(s) written to cache". The title names the mobile scope, the fix type, and the singular-unit case, which the diff targets through the plural selector. It does not mention the wider wording change across all 11 catalogs, but that is expected for a title.

Full details: Description check

Explanation

The description covers the template sections: Problem (with a deterministic repro and expected versus observed output), Change (ICU plural keyed by the raw count, catalog updates), Scope (small obvious bug, no issue needed), and Verification (render test results for 1,097, 1, and 2 tokens, i18n checks, and a transcript link). It also lists what was not shown. The template asks for a conventional commit title in plain language, which the title satisfies. The description does not explain the commit message's removal of a copy-text render test, which the objectives mention. That gap is minor and does not change the overall assessment.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a101c95 and 872d54f.

Files selected for processing: 1

  • apps/mobile/src/features/usage/UsageRouteScreen.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Dec 1, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@macroscopeapp
macroscopeapp Bot dismissed their stale review December 1, 2026 13:27

Dismissing prior approval to re-evaluate 872d54f

@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Pixel 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.

Window Before After
24h — 1 cache-creation token 3763606d20
Before: 24h — 1 cache-creation token
872d54f479
After: 24h — 1 cache-creation token
7d — 2 cache-creation tokens 3763606d20
Before: 7d — 2 cache-creation tokens
872d54f479
After: 7d — 2 cache-creation tokens
30d — 1,097 cache-creation tokens 3763606d20
Before: 30d — 1,097 cache-creation tokens
872d54f479
After: 30d — 1,097 cache-creation tokens

Transcript seed script · Capture driver

Not shown:

  • Other translated catalogs were not rendered; device verification covered English only.
  • iOS was not run; the reported reproduction and captures use Android.

@juliusmarminge juliusmarminge added takeover:ready Takeover done; auto-lands when gates pass and removed takeover:in-progress A takeover lead is working on this PR labels Dec 1, 2026
@juliusmarminge
juliusmarminge merged commit 89ba000 into pingdotgg:main Dec 1, 2026
57 checks passed
@juliusmarminge juliusmarminge removed the takeover:ready Takeover done; auto-lands when gates pass label Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants