fix(claude): surface desktop usage diagnostics - #614
Merged
IvGolovach merged 1 commit intoJun 4, 2026
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Validation * Validation tier: Tier 3 — shared pricing resolver plus CLI report diagnostics. * git diff --check origin/main...HEAD: PASS * git diff --cached --check: PASS * cargo fmt --all -- --check: PASS * cargo test -p tokscale-cli claude_desktop_diagnostic: PASS, 3 tests * cargo test -p tokscale-cli models: PASS, 44 tests * cargo test -p tokscale-cli clients: PASS, 24 tests * cargo test -p tokscale-core opus_4: PASS, 12 tests * cargo test -p tokscale-core claude: PASS, 70 tests * cargo test -p tokscale-core pricing::lookup::tests: PASS, 137 tests * /opt/homebrew/Cellar/rust/1.94.0/bin/cargo-clippy clippy -p tokscale-cli --all-targets -- -D warnings: PASS * /opt/homebrew/Cellar/rust/1.94.0/bin/cargo-clippy clippy -p tokscale-core --all-targets -- -D warnings: PASS * Ledger: not applicable — not required for selected validation tier/change family. * Version: not applicable — no release manifests changed; repository release workflow owns version bumps. * Not run: full workspace cargo test — not required for selected validation tier; targeted CLI/core tests cover the changed surfaces. Rollback * git revert HEAD
IvGolovach
force-pushed
the
codex/claude-usage-diagnostics
branch
from
May 31, 2026 22:15
6f0480e to
917d26b
Compare
IvGolovach
pushed a commit
to IvGolovach/tokscale
that referenced
this pull request
Jun 4, 2026
Validation * Validation tier: Tier 2R - post-merge rebase correction for pricing lookup conflict with junhoyeo#614. * git diff --check origin/main...HEAD: PASS. * git diff --cached --check: PASS. * cargo fmt --all -- --check: PASS. * cargo test -p tokscale-core pricing::lookup::tests: PASS, 143 passed. * cargo clippy -p tokscale-core --all-targets -- -D warnings: PASS. * Ledger: not applicable - not required for selected validation tier/change family. * Version: not applicable - release workflow owns package version bumps. * Not run: full workspace cargo test - not required for selected validation tier; targeted lookup tests cover resolver behavior and mandatory remote CI will run on the final PR SHA. Rollback * git revert HEAD
IvGolovach
added a commit
that referenced
this pull request
Jun 4, 2026
fix(pricing): skip unusable exact price entries Validation * Validation tier: Tier 2R - post-merge rebase correction for pricing lookup conflict with #614. * git diff --check origin/main...HEAD: PASS. * git diff --cached --check: PASS. * cargo fmt --all -- --check: PASS. * cargo test -p tokscale-core pricing::lookup::tests: PASS, 143 passed. * cargo clippy -p tokscale-core --all-targets -- -D warnings: PASS. * Remote CI: Test & Coverage: PASS. * Remote CI: Build Native (Test Only): PASS, all targets. * Ledger: not applicable - not required for selected validation tier/change family. * Version: not applicable - release workflow owns package version bumps. * Not run: full workspace cargo test - not required for selected validation tier; targeted lookup tests cover resolver behavior and remote CI passed on the final PR SHA. Rollback * Revert this squash merge commit. Co-authored-by: Junho Yeo <i@junho.io>
This was referenced Jun 8, 2026
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
Closes #558 by making Claude Desktop detection explicit without fabricating token totals from undocumented local app storage.
This PR adds Claude diagnostics to
tokscale clientsand to explicit emptytokscale models --client claude --jsonreports when Claude Desktop app data is present but only Claude Code JSONL usage roots are scannable. It also documents the boundary between Claude Code local usage, Claude Desktop consumer chat data,tokscale usagequota bars, and Anthropic Admin Usage/Cost APIs.Why
Claude Code usage is countable when local JSONL assistant messages include structured
message.usagemetadata. Claude Desktop consumer chat storage and Claude data exports do not expose a documented stable per-message token ledger, so importing Desktop app data as usage would risk silently fabricated totals. The better behavior is to tell users what Tokscale found, what it scanned, and why Desktop chat usage is not counted as a local transcript source.Docs checked: Claude Code costs, Claude data export, Usage and Cost Admin API, and Claude pricing.
Diff scope
claude_desktop_not_scanneddiagnostics intokscale clientsJSON/text output and in explicit empty Claude model reports.stats-cache.jsonout of session imports and report it as informational because it is aggregate data without stable per-message/session attribution.claude-opus-4pricing while preserving valid same-minor fuzzy/date fallback behavior.Branch integrity
Base branch:
main.Validated base SHA:
fcab5fbda431dfe6efd76660e6bb44c45d2d32e1.Ahead/behind against fetched
origin/main:0 behind / 1 ahead.Merge-base SHA:
fcab5fbda431dfe6efd76660e6bb44c45d2d32e1.Fast-forward safety:
origin/mainis an ancestor of this branch, and the PR diff was computed against the fetched base.Commit integrity
Introduced commit:
6f0480ed9d898a30d2575ef904dcadabb3af7563 fix(claude): surface desktop usage diagnostics.The PR contains one logical change. The final diff contains only Claude diagnostics, Claude README notes, Claude parser regression coverage, and pricing resolver coverage needed for the same Claude usage-reporting issue.
Diff hygiene
Changed files:
git diff --check origin/main...HEAD: PASS, no output.Validation mode and proof
Validation mode: Mode 3 — shared runtime pricing resolver plus CLI report diagnostics.
Local validation:
Full workspace test suite: not run locally because targeted CLI/core tests cover the changed surfaces and required remote CI will validate the final PR SHA.
Ledger and version proof
Ledger: not applicable — not required for this change family.
Version: not applicable — no release manifests changed; repository release workflow owns version bumps.
Migration notes
Not applicable — no database migration changed.
CI context confirmation
Pending — required GitHub Actions checks will run after the PR is opened.
CI context names unchanged.
Runtime safety
No database writes, auth changes, network sync behavior, queues, migrations, or submission semantics changed.
No invariant regression introduced.
Documentation integrity
README now documents that
claudeis Claude Code token accounting, not consumer Claude Desktop chat accounting, and explains wheretokscale usageand Anthropic Admin Usage/Cost APIs fit.Rollback plan
Rollback: revert this PR.
DB downgrade: not applicable.
Data repair: not applicable.
Operational caveats: none known.
Known residual risks
This PR does not claim to count Claude Desktop consumer chat tokens. It intentionally avoids doing so until Anthropic exposes a stable, documented per-message token ledger or official personal usage export/API for that surface.