Skip to content

fix(pricing): key the fast lane per model in a slash-combined row - #32

Merged
krayong merged 1 commit into
mainfrom
fix/pricing-refresh-fast-mult
Aug 7, 2026
Merged

fix(pricing): key the fast lane per model in a slash-combined row#32
krayong merged 1 commit into
mainfrom
fix/pricing-refresh-fast-mult

Conversation

@krayong

@krayong krayong commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Fixes the bug behind #31, which is pure regression: its whole diff was the deletion of fast_mult, with no rate change at all.

The bug

The published fast-mode table now bills one shared lane for several models by naming them in a single cell:

["Claude Opus 5 / Claude Opus 4.8", "$10 / MTok", "$50 / MTok"]

buildFastInput keyed the map on the raw cell text, so the lookups for "Claude Opus 5" and "Claude Opus 4.8" never matched. fast_mult was therefore never derived, and mergeRows replaced each row wholesale and dropped the field.

Downstream, fast_mult defaults to 1 (pricing.ts:56) and gates the speed multiplier (pricing.ts:188), so fast-mode messages on Opus 5 and 4.8 priced at ×1 instead of ×2 — reporting half their true cost.

Changes

  • buildFastInput splits the cell and keys each model name separately.
  • mergeRows carries an established fast_mult forward when a model has dropped off the fast table. Opus 4.7 has, and transcripts recorded while that lane was offered still need ×6 to price correctly. A model still listed is re-derived normally, and deleting the field by hand still sticks.
  • The refresh workflow now writes a minor changeset next to pricing.json. That file ships inside the published ccsidekick package, so CI's changeset gate failed on every automated pricing PR. A fixed filename keeps re-runs idempotent, since the branch is recreated from main each run.

Why the tests were green while production drifted

The fixture pinned the old single-name table shape, so it tested the parser against a page that no longer exists. It now mirrors the live slash-combined row.

Verification

  • refresh-pricing.test.ts: 8 pass. Both new tests were confirmed failing first (Expected: 2, Received: undefined).
  • bun run test: 1076 pass, 0 fail. The existing ×6 assertion for Opus 4.7 still passes, because the carry-forward leaves pricing.json byte-identical.
  • refresh-pricing.ts --check against the live page: in sync, with pricing.json unchanged — confirming chore(pricing): sync pricing.json with published rates #31's diff was entirely spurious.
  • The changeset gate was simulated in a scratch worktree by committing a pricing.json edit plus the generated changeset: changeset status --since=origin/main exits 0.
  • typecheck, lint, format:check clean.

Follow-up

#31 should be closed rather than merged.

🦇 Generated by Penny-One at Batcave

The published fast-mode table now bills one shared lane for several models by
naming them in a single cell ("Claude Opus 5 / Claude Opus 4.8"). buildFastInput
keyed the map on the raw cell text, so no per-model lookup ever matched and
fast_mult was dropped from every row on regeneration. Fast messages then priced
at x1 instead of x2, halving reported cost on Opus 5 and 4.8.

Split the cell and key each name separately. mergeRows now also carries an
established fast_mult forward when the model has dropped off the fast table
(Opus 4.7 has), so transcripts recorded while that lane was offered keep pricing
correctly instead of reverting to x1. Deleting the field by hand still sticks.

The refresh workflow now writes a minor changeset alongside pricing.json:
the file ships inside the published ccsidekick package, so CI's changeset gate
failed every automated pricing PR. A fixed filename keeps re-runs idempotent.

Co-Authored-By: Penny-One (Batcave) <noreply@anthropic.com>
@github-actions github-actions Bot added core The engine (packages/core) ci/cd Repo scripts and GitHub workflows labels Aug 7, 2026
@krayong
krayong merged commit 25e3449 into main Aug 7, 2026
7 checks passed
@krayong
krayong deleted the fix/pricing-refresh-fast-mult branch August 7, 2026 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd Repo scripts and GitHub workflows core The engine (packages/core)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant