test: guard consumer-side verdict maps stay total over the enum#91
Merged
Conversation
The resolver's verdict growth is guarded (test_resolver_branch_count) and the enum is frozen (test_verdict_models), but the consumer tables that turn a Verdict into a CI signal had no totality guard. A new verdict class could be wired into the enum + resolver while a downstream map silently went out of sync: - render._EXIT_CODES is indexed directly, so a missing verdict KeyErrors at run time when that verdict reaches the CLI — the "one exit code your CI can gate on" contract becomes a crash. - diff._QUALITY_RANK is read with .get(), so a missing verdict silently falls off the ladder and is reported as OTHER_CHANGE, suppressing a regression. Add tests/meta/test_verdict_consumer_coverage.py: _EXIT_CODES must cover every Verdict and map only to documented verdict-derived codes (0/1/2/4); _QUALITY_RANK must partition the enum into ranked verdicts plus exactly the two deliberately off-ladder ones (INVALID_EVAL, INSUFFICIENT). No runtime behavior changes.
ericckzhou
added a commit
that referenced
this pull request
Jun 7, 2026
…num (#91) (#92) The resolver's verdict growth is guarded (test_resolver_branch_count) and the enum is frozen (test_verdict_models), but the consumer tables that turn a Verdict into a CI signal had no totality guard. A new verdict class could be wired into the enum + resolver while a downstream map silently went out of sync: - render._EXIT_CODES is indexed directly, so a missing verdict KeyErrors at run time when that verdict reaches the CLI — the "one exit code your CI can gate on" contract becomes a crash. - diff._QUALITY_RANK is read with .get(), so a missing verdict silently falls off the ladder and is reported as OTHER_CHANGE, suppressing a regression. Add tests/meta/test_verdict_consumer_coverage.py: _EXIT_CODES must cover every Verdict and map only to documented verdict-derived codes (0/1/2/4); _QUALITY_RANK must partition the enum into ranked verdicts plus exactly the two deliberately off-ladder ones (INVALID_EVAL, INSUFFICIENT). No runtime behavior changes.
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:
tests/meta/test_verdict_consumer_coverage.py, an anti-entropy guard that asserts the two consumer-side tables which turn aVerdictinto a CI signal stay total over the enum.render._EXIT_CODESmust cover everyVerdict—exit_code_forindexes it directly (_EXIT_CODES[verdict]), so a verdict missing from the map is aKeyErrorcrash the moment that verdict reaches the CLI. The contract is "one exit code your CI can gate on"; a crash is not an exit code.0/1/2/4); codes3/5/6belong to non-verdict surfaces (errors, diff) and a verdict must never resolve to one.diff._QUALITY_RANKmust partition the enum into ranked verdicts plus exactly the two deliberately off-ladder ones (INVALID_EVAL,INSUFFICIENT)._classify_transitionreads the rank with.get(), so a new verdict missing from the map silently becomesOTHER_CHANGEand suppresses a regression signal — this forces a conscious rank-vs-off-ladder decision instead.Validation:
uv run pytest tests/meta tests/unit -q→ 720 passed.uv run ruff check/ruff format --checkclean on the new file.Notes:
test_resolver_branch_count.py) and the frozen-enum guard (test_verdict_models.py): the enum could grow and the resolver emit a new class while a downstream consumer map went silently out of sync, surfacing only in a user's CI.