Skip to content

fix(pricing): stop asserting which models upstream has not shipped yet - #1523

Merged
ryoppippi merged 1 commit into
mainfrom
fix/pricing-test-opus-5
Jul 28, 2026
Merged

fix(pricing): stop asserting which models upstream has not shipped yet#1523
ryoppippi merged 1 commit into
mainfrom
fix/pricing-test-opus-5

Conversation

@ryoppippi

@ryoppippi ryoppippi commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

Every hourly update-pricing run has been failing its Rust test leg, so the refreshed pricing snapshot cannot reach main. The workflow is not at fault — the validation added in #1509 is doing its job and refusing to push a tree whose tests fail:

test pricing::tests::fuzzy_match_allows_date_like_suffixes_for_known_numeric_model_versions ... FAILED

The test loads the embedded catalogue and then asserted that claude-opus-4-9 and claude-opus-5 resolve to nothing. Both litellm and models.dev now ship claude-opus-5, so the assertion fails the moment either input is refreshed.

What Changed

Drops the two absence assertions. What remains is the case the test is named after: a date-like suffix on a version the catalogue really has (claude-opus-4-8-20270898).

Which versions must not fuzzy match is already covered by fuzzy_match_requires_model_key_boundaries and fuzzy_match_does_not_fall_back_across_numeric_model_versions — both build their own PricingMap, including the exact claude-opus-4-9 and claude-opus-5 cases, so they cannot rot when upstream adds a version.

Testing

Reproduced and verified against the data that breaks it: nix flake update litellm models-dev plus just gen-models-dev-pricing, after which the snapshot does contain claude-opus-5. Then:

cargo test -p ccusage-core --lib pricing::tests::fuzzy_match   → 4 passed
nix build .#ccusage-tests                                      → exit 0

The lock and snapshots were reverted afterwards; update-pricing will land those itself once this is on main.


View with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is enabled.


Summary by cubic

Fixes the failing pricing test by removing brittle absence checks for claude-opus-4-9 and claude-opus-5. This unblocks hourly update-pricing snapshots when upstream ships new versions.

  • Bug Fixes
    • Removed the two absence assertions in fuzzy_match_allows_date_like_suffixes_for_known_numeric_model_versions; kept the date-suffix check for a known version.
    • Negative cases remain covered by fuzzy_match_requires_model_key_boundaries and fuzzy_match_does_not_fall_back_across_numeric_model_versions.

Written for commit 37d4ebe. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Tests
    • Expanded pricing validation coverage for date-like suffixes on known numeric model versions.
    • Confirmed that a valid model variant resolves to an existing pricing entry.

`fuzzy_match_allows_date_like_suffixes_for_known_numeric_model_versions`
loads the embedded catalogue and then asserted that `claude-opus-4-9` and
`claude-opus-5` resolve to nothing. Both litellm and models.dev now ship
`claude-opus-5`, so the assertion fails the moment either input is refreshed:
every hourly update-pricing run has failed its Rust test leg since, and the
snapshot could no longer land on main.

The remaining assertion is the one the test is named after - a date-like
suffix on a version the catalogue really has. Which versions must not fuzzy
match is already covered by fuzzy_match_requires_model_key_boundaries and
fuzzy_match_does_not_fall_back_across_numeric_model_versions, which build
their own maps and therefore cannot rot when upstream adds a version.

Verified by updating both inputs, regenerating the snapshots and running the
suite against data that does contain claude-opus-5.
Copilot AI review requested due to automatic review settings July 28, 2026 12:08
@pullfrog

pullfrog Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor
  • Read the diff and PR summary file
  • Triage: understand the change and its context
  • Decide if specialists are needed
  • Aggregate findings and draft review
  • Submit review

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | View workflow run | via Pullfrog | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: dda1c3fc-a6d2-42fa-99d1-c68ea334fdec

📥 Commits

Reviewing files that changed from the base of the PR and between b1f8b85 and 37d4ebe.

📒 Files selected for processing (1)
  • rust/crates/ccusage-core/src/pricing.rs
💤 Files with no reviewable changes (1)
  • rust/crates/ccusage-core/src/pricing.rs

📝 Walkthrough

Walkthrough

The fuzzy-matching pricing test now verifies that claude-opus-4-8-20270898 resolves to an existing pricing entry and removes prior non-match assertions for similar model keys.

Changes

Pricing fuzzy matching

Layer / File(s) Summary
Date-like model suffix coverage
rust/crates/ccusage-core/src/pricing.rs
The fuzzy-matching test now checks successful resolution of claude-opus-4-8-20270898 and removes non-match checks for claude-opus-4-9 and claude-opus-5.

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

Possibly related PRs

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: relaxing pricing tests to avoid asserting on models not yet shipped upstream.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pricing-test-opus-5

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
ccusage-guide 37d4ebe Commit Preview URL

Branch Preview URL
Jul 28 2026, 12:08 PM

@ryoppippi
ryoppippi merged commit 7d897f3 into main Jul 28, 2026
17 checks passed
@ryoppippi
ryoppippi deleted the fix/pricing-test-opus-5 branch July 28, 2026 12:09
@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 37d4ebe06273
Base SHA: b1f8b85688de

This compares the Rust PR release binary against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 347.2ms 2.90 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 321.0ms 3.14 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 117.7ms 8.55 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 99.7ms 10.10 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 30.6ms 5.8ms 5.28x 55.00 MiB 12.44 MiB 0.23x 0.05 MiB/s 0.27 MiB/s
claude session --offline --json 0.00 MiB 29.6ms 4.9ms 6.05x 55.00 MiB 12.44 MiB 0.23x 0.05 MiB/s 0.32 MiB/s
codex daily --offline --json 0.00 MiB 25.4ms 2.4ms 10.77x 55.00 MiB 10.44 MiB 0.19x 0.03 MiB/s 0.36 MiB/s
codex session --offline --json 0.00 MiB 23.8ms 2.4ms 9.97x 55.00 MiB 10.44 MiB 0.19x 0.04 MiB/s 0.36 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published native ccusage binary from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 373.1ms 317.8ms 1.17x 970.58 MiB 952.58 MiB 0.98x 2.70 GiB/s 3.17 GiB/s
codex --offline --json 1.01 GiB 116.1ms 102.1ms 1.14x 394.64 MiB 422.64 MiB 1.07x 8.67 GiB/s 9.86 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 18.78 KiB 18.78 KiB -0.00 KiB 1.00x
installed native package binary 4156.78 KiB 4156.78 KiB +0.00 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

@github-actions

Copy link
Copy Markdown
Contributor

ccusage performance comparison

PR SHA: 37d4ebe06273
Base SHA: b1f8b85688de

This compares the PR package against the configured base package on the same CI runner.

Package runtime diagnostics

Compares the PR package wrapper, the installed native optional dependency binary, and the workspace release binary on the same large fixture. This identifies whether slow package results come from JavaScript wrapper overhead, the published native binary build, or the Rust core itself.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
All rows run --offline --json, measured by hyperfine with 0 warmups and 1 runs. This isolates wrapper overhead from the installed native optional dependency and the workspace release binary built on the runner.

Command Runtime Input Median Throughput Samples
claude --offline --json Package wrapper 1.01 GiB 350.0ms 2.88 GiB/s 1
claude --offline --json Installed native binary 1.01 GiB 314.3ms 3.20 GiB/s 1
codex --offline --json Package wrapper 1.01 GiB 116.7ms 8.63 GiB/s 1
codex --offline --json Installed native binary 1.01 GiB 103.1ms 9.76 GiB/s 1

Committed fixture performance

Committed small fixtures for stable PR-to-PR feedback and explicit Claude/Codex command coverage.

Fixtures: Claude apps/ccusage/test/fixtures/claude (0.00 MiB, 2 files), Codex apps/ccusage/test/fixtures/codex (0.00 MiB, 1 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 2 warmups and 7 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude daily --offline --json 0.00 MiB 22.8ms 26.2ms 0.87x 55.25 MiB 55.00 MiB 1.00x 0.07 MiB/s 0.06 MiB/s
claude session --offline --json 0.00 MiB 25.1ms 27.4ms 0.92x 55.00 MiB 55.25 MiB 1.00x 0.06 MiB/s 0.06 MiB/s
codex daily --offline --json 0.00 MiB 25.8ms 25.4ms 1.02x 55.00 MiB 55.00 MiB 1.00x 0.03 MiB/s 0.03 MiB/s
codex session --offline --json 0.00 MiB 25.5ms 22.9ms 1.12x 55.00 MiB 55.00 MiB 1.00x 0.03 MiB/s 0.04 MiB/s

Large real-world-shaped fixture performance

Generated fixtures shaped from aggregate local log statistics: thousands of JSONL files, many small sessions, and a long tail of larger sessions. No real prompts, paths, or outputs are stored in the fixtures.

Fixtures: Claude /home/runner/_work/_temp/ccusage-large-fixture (1.01 GiB, 2597 files), Codex /home/runner/_work/_temp/ccusage-large-codex-fixture (1.01 GiB, 2597 files)
Base runs the published ccusage package from pkg.pr.new, installed before measurement; PR runs the published ccusage package from pkg.pr.new, installed before measurement. Both run --offline --json, measured by hyperfine with 0 warmups and 1 runs.
Peak RSS is measured separately with /usr/bin/time using 1 runs. Lower RSS ratios are better.

Command Input Base median PR median PR vs base Base peak RSS PR peak RSS PR/base RSS Base throughput PR throughput
claude --offline --json 1.01 GiB 376.9ms 366.6ms 1.03x 962.58 MiB 962.59 MiB 1.00x 2.67 GiB/s 2.75 GiB/s
codex --offline --json 1.01 GiB 121.2ms 141.5ms 0.86x 408.65 MiB 412.64 MiB 1.01x 8.30 GiB/s 7.11 GiB/s

Artifact size

Artifact Base PR Delta Ratio
packed ccusage-*.tgz 18.78 KiB 18.78 KiB -0.00 KiB 1.00x
installed native package binary 4156.78 KiB 4156.78 KiB +0.00 KiB 1.00x

Lower medians and smaller artifacts are better. CI runner noise still applies; use same-run ratios as directional PR feedback, not release guarantees.

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.

2 participants