Skip to content

test(pr-cost): close the last two gaps from the superseded branch - #38

Merged
cheshirecode merged 1 commit into
mainfrom
test/pr-cost-close-coverage
Sep 12, 2026
Merged

test(pr-cost): close the last two gaps from the superseded branch#38
cheshirecode merged 1 commit into
mainfrom
test/pr-cost-close-coverage

Conversation

@cheshirecode

Copy link
Copy Markdown
Owner

Why

Auditing whether fix/pr-cost-cache-visibility was safe to delete left two of its assertions unrepresented on main. This carries both, so nothing in that branch is unique any more and it can be deleted without losing coverage.

The two gaps

1. Only claude-opus-4-6 was asserted against the 3× overcharge.

claude-opus-4-7 and claude-opus-4-8 are separate table rows. A test covering one row leaves the other two free to be deleted back into the overcharging claude-opus-4 prefix — the exact defect #35 fixed. The test now covers all three via subTest.

2. The corrected-repost test asserted the row COUNT, not the figures.

self.assertEqual(len(rows), 2)   # two rows holding the SAME wrong number passes this

That is the whole point of --allow-duplicate: the second row is a correction. It now asserts [517.46, 602.99], and pins in the same place that the unflagged second call still reports "duplicate", so the idempotent default is covered too.

Both proved by mutation

Against scratchpad copies of the skill tree, so no tracked source was written:

Mutation Result
Delete the 4-7 and 4-8 rate rows fails test_opus_4_6_and_later_are_not_priced_as_opus_4_0
Write the correction as a copy of the row already in the ledger fails test_allow_duplicate_publishes_a_corrected_figure

The second mutation is the interesting one: it still lands two ledger rows, so the old length check would have passed it while the correction was silently lost. That is what the value assertion buys.

Verification

tests/run.sh                                       -> 157 pass, 0 fail, exit 0
python3 -m unittest discover skills/pr-cost/tests  -> 81 tests OK
ruff check (both changed files)                    -> clean

Tests only — no behaviour change.

Auditing whether fix/pr-cost-cache-visibility was safe to delete left two
of its assertions unrepresented on main. Both are now carried, so nothing
in that branch is unique any more.

1. Only claude-opus-4-6 was asserted against the 3x overcharge, but 4-7
   and 4-8 are separate table rows. A test covering one row leaves the
   other two free to be deleted back into the overcharging
   "claude-opus-4" prefix. The test now covers all three.

2. The corrected-repost test asserted the ledger row COUNT. Two rows
   holding the same wrong number satisfy a length check while losing the
   correction entirely, which is the whole point of the flag. It now
   asserts the figures -- [517.46, 602.99] -- and also pins that the
   unflagged second call still reports "duplicate", so the idempotent
   default is covered in the same place.

Both proved by mutation against scratchpad copies of the skill tree, so
no tracked source was written:

- deleting the 4-7 and 4-8 rows fails
  test_opus_4_6_and_later_are_not_priced_as_opus_4_0
- writing the correction as a copy of the row already in the ledger --
  which still lands two rows -- fails
  test_allow_duplicate_publishes_a_corrected_figure

Verified: 81 pr-cost tests OK; ruff clean.
@cheshirecode
cheshirecode merged commit d871ca2 into main Sep 12, 2026
5 checks passed
@cheshirecode
cheshirecode deleted the test/pr-cost-close-coverage branch September 12, 2026 03:46
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.

1 participant