Lock the one-verdict contract: one canonical verdict enum + projection guards#145
Merged
Merged
Conversation
…n guards The verify cycle (M1-M3) already computes one release verdict in build_release_decision() and projects it onto the report summaries and the agent-facing merge_verdict, but the discipline was enforced only by convention and docstrings. This makes it structural. - Define ReleaseDecisionStatus once in schemas/common.py and reuse it for AgentSummary.verdict, ReviewerSummary.verdict, VerifierVerdict, and ReleaseConsequence.decision (previously four hand-respelled Literals of the same vocabulary). Generated JSON schemas are byte-identical (generate_schemas.py --check clean) - no wire change, no schema bump. - Type _DECISION_TO_VERDICT as dict[ReleaseDecisionStatus, MergeVerdict] and add a totality test, so a new release status without a mapping fails CI instead of silently falling back to human_review_required. - Add a VerifierArtifact model_validator: when a head release_decision is present, merge_verdict and the decision copy MUST be exact projections of it - an inconsistent artifact is impossible to construct. - Centralize the no-decision verdict rule in merge_verdict_for(); delete the divergent inline _merge_verdict in the orchestrator (summaries defaulted to "passed", verify defaulted to "mergeable"/"unknown" - now one rule). - Add tests/test_verdict_contract.py pinning canonical-enum reuse across all verdict surfaces, projection totality + the exact table, the fail-safe (unknown status never auto-passes), and the validator. Full suite: 2302 passed, 4 skipped. Behavior unchanged. 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.
What
Locks the "one decision engine" discipline structurally. The verify cycle (M1–M3, #139–#143) already computes a single release verdict in
build_release_decision()and projects it onto the report summaries and the agent-facingmerge_verdict— but nothing enforced that the projections couldn't drift. This converts the documented discipline into types + tests, with zero behavior or wire-format change.Why
verifier.json'smerge_verdictandrelease_decision.decisionare two vocabularies bridged by a hand-maintained mapping, and the verdict enum was hand-respelled in four places. A drift between them means two parts of the system disagree about whether a PR can merge — the exact failure this product exists to prevent.Changes
ReleaseDecisionStatusnow lives once inschemas/common.py;AgentSummary.verdict,ReviewerSummary.verdict,VerifierVerdict, andReleaseConsequence.decisionreuse it (were four inlineLiteralrespellings). Generated schemas are byte-identical —generate_schemas.py --checkis clean, noreport_schema_versionbump._DECISION_TO_VERDICTis typeddict[ReleaseDecisionStatus, MergeVerdict]; a totality test fails CI if a release status lacks an explicit mapping (no silenthuman_review_requiredfallback for a known status).VerifierArtifactmodel_validatormakes it impossible to construct an artifact whosemerge_verdict/decisiondisagree withrelease_decision.decision.merge_verdict_for()centralizes the skipped/failed fallback; the divergent inline_merge_verdictin the orchestrator is removed (summaries defaulted topassed, verify defaulted tomergeable/unknown— now one rule).tests/test_verdict_contract.py.Verification
python scripts/generate_schemas.py --check: clean (nodocs/schema changes)ruff check: clean🤖 Generated with Claude Code