Skip to content

fix(parser): apply short model id fix, drop priceFamily stopgap - #13

Merged
axisrow merged 3 commits into
mainfrom
ao/claude-devtools-4/parser-short-model-ids
Sep 21, 2026
Merged

axisrow merged 3 commits into
mainfrom
ao/claude-devtools-4/parser-short-model-ids

Conversation

@axisrow

@axisrow axisrow commented Sep 20, 2026

Copy link
Copy Markdown
Owner

Summary

Cherry-picks the parser fix (9d7bea7, branch fix/parse-short-model-ids) into main and removes the priceFamily() stopgap from src/cli/analyzeSession.ts — roundCostUsd now calls parseModelString directly, since short model ids (claude-sonnet-5) parse natively. The regex fallback was dead code.

Closes #5. Part of #2 (fork takeover).

Diff

  • src/shared/utils/modelParser.ts — accept claude-{family}-{major} (minor/date stay optional)
  • test/shared/utils/modelParser.test.ts — 2 new parser cases
  • src/cli/analyzeSession.ts — priceFamily() deleted, direct parseModelString call
  • test/main/cli/analyzeSession.test.ts — stopgap test removed (covered by parser tests + e2e pricing test)

Net: −22 / +19.

Tests

  • pnpm typecheck — green
  • pnpm test — 56 files, 756 tests passed
  • pnpm analyze:session on the August short-id session (dd8f991f…, cycle-review): models: claude-sonnet-5, est. cost: $2.49 — identical to the stopgap build (verified both), per-round math sums to sonnet rates exactly

Follow-up

Upstream PR matt1398#235 to be closed with "fix carried in fork" comment; branch fix/parse-short-model-ids kept for history.

🤖 Generated with Claude Code

axisrow and others added 2 commits September 21, 2026 02:07
claude-{family}-{major} (e.g. "claude-sonnet-5", as written into
session logs by some routers/proxies) was rejected by the new-format
branch, which required a 4th part. parseModelString returned null, so
consumers silently lost model info (model badges, pricing lookups).

The length guard was redundant: 2-part input is already rejected
earlier, and minor version and date remain optional as in other
formats.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Short model ids (claude-sonnet-5) now parse natively after the parser
fix, so the local regex fallback is dead code. roundCostUsd resolves
the price family via parseModelString directly; the priceFamily export
and its test go away — short-id parsing is covered by modelParser tests,
short-id pricing by the existing roundCostUsd e2e test.

Closes #5

Co-Authored-By: Claude Code <noreply@anthropic.com>

@axisrow axisrow left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. Reviewed the diff against origin/main (4 files, +19/-22). The parts.length<4 relaxation is confined to the new-format branch (old format untouched); every parseModelString caller (roundCostUsd, modelExtractor, SubagentItem) null-checks the result, so short ids flipping from null to parsed is exactly the intended fix with no downstream breakage. priceFamily removal is safe: the regex fallback only matched claude-prefixed strings the parser already handles (dead code confirmed), and the removed test assertions are covered by the new parser cases - the non-claude null case pre-exists as gpt-4. Doc comment updated. One non-blocking nit inline. Tests/builds not run from the reviewer checkout.

Comment thread src/shared/utils/modelParser.ts
With the length guard gone, claude-sonnet-20250929 parsed with
majorVersion=20250929. An 8-digit parts[2] is a misplaced date, not a
version — reject it.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@axisrow
axisrow merged commit 328aacb into main Sep 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Apply parser fix locally, drop priceFamily stopgap (carried in fork)

1 participant