test: pin signatures, output shape & model fields in API contract#4
Merged
Conversation
Strengthens tests/test_api_contract.py from name-only pinning to also pin: - Full signatures of all public functions + the DiceEngine constructor (param names, order, defaults, return type). - The evaluate_character output key set (verified stable across class types and input completeness, so exact-match is safe). - The field set of every exported pydantic model, plus NodeType members. Each pin also asserts the pinned set equals the live public set, so a new public function/model can't ship without a contract entry. Catches signature drift, output-shape changes, and field rename/removal that the name-level contract missed. Test-only; no source or version change. 1575 passed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Strengthens the API contract test from name-only pinning to also pin signatures, the primary output shape, and model fields — so the bulk of accidental breaking changes turn CI red instead of shipping silently. Test-only; no source or version change.
What's now enforced (additions to
tests/test_api_contract.py)#1 — Full signature pins (
TestPublicSignatures)DiceEngineconstructor.#2 — Output-shape pin (
TestOutputShape)evaluate_character.#3 — Model-field pins (
TestModelFields)NodeTypeenum members.Each pin has a clear
was: … now: …failure message and a header comment documenting the deliberate update path (edit expected value → bump version → note in CHANGELOG).Tests
1575 passed (was 1568; +7 new), ruff clean.
🤖 Generated with Claude Code