feat(evidence): bind turn evidence_version to the frozen definition (issue #5 proposal 5) - #7
Merged
Merged
Conversation
…issue #5 proposal 5) The definition now declares the closed set of evidence-record versions it accepts (evidence_versions, defaulting to the engine-supported set); validation rejects a turn whose evidence_version sits outside that set even when every other field is perfect, and definition load refuses versions the engine cannot interpret. Canonical support list lives in config.py; the duplicate adapter/evidence constants now derive from it. Canary: evidence_version 2 against a definition pinned to 1 fails closed with no ledger commit (engine-level test), plus config- and validator-level accept/reject matrices.
There was a problem hiding this comment.
Confidence Score: 4/5
Summary
Binds turn evidence_version to a fail-closed definition-declared set, deduplicating the engine constant. Logic is sound and all 262 tests pass locally; only minor type-strictness and schema gaps remain.
Important Files Changed
| File | Overview |
|---|---|
| src/multi_agent_dialogue/config.py | Canonical SUPPORTED_EVIDENCE_VERSIONS plus fail-closed evidence_versions parsing |
| src/multi_agent_dialogue/evidence.py | validate_evidence gains accepted_versions; membership check allows bool/float coercion |
| src/multi_agent_dialogue/adapters/base.py | Duplicate EVIDENCE_VERSION constant removed, derived from evidence.py |
| src/multi_agent_dialogue/engine.py | Both validation sites pass the definition's accepted set |
| schemas/protocol.schema.json | Documents evidence_versions; lacks uniqueItems despite parser rejecting duplicates |
| docs/technical-reference.md | Adds fail-closed guarantee bullet |
| tests/test_config.py | Parse-time coverage for subset, unknown, empty, type, duplicate cases |
| tests/test_evidence.py | Outside-set rejection, defense-in-depth, and completion canary covered |
…x() for current version Review follow-up: 1.0/true compare equal to 1 under membership tests, so reject non-int/bool evidence_version outright (matching the definition parser strictness); schema gains uniqueItems so schema-valid definitions cannot fail engine load on duplicates; EVIDENCE_VERSION derives via max() so tuple order cannot matter.
This was referenced Aug 20, 2026
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.
Implements issue #5, proposal 5 (
evidence_versionbinding per turn).Problem
Turn evidence carries
evidence_version: 1, but nothing bound it to the frozen definition: the validator compared only against a hard-coded engine constant (defined twice —evidence.pyandadapters/base.pyeach had their own).What changes
protocol.jsongains optionalevidence_versions: the closed set of evidence-record versions the dialogue accepts (default: the engine-supported set). Parsed fail-closed: non-list, empty, non-integer, boolean, duplicate entries all rejected; versions the engine cannot interpret are rejected at load even when listed.validate_evidence(..., accepted_versions=...): a turn whoseevidence_versionsits outside the definition's set is rejected even when every other field is perfect; a defense-in-depth branch still rejects versions the engine cannot read even if a caller hand-passes a wider set.SUPPORTED_EVIDENCE_VERSIONSlives inconfig.py;evidence.pyandadapters/base.pynow derive from it (the duplicate constants are gone).protocol.schema.jsondocuments the new key; technical reference gains the fail-closed guarantee bullet.Canary (from the proposal)
evidence_version: 2against a definition pinned to 1 → completion refused, no ledger commit,turn_indexunchanged (CompletionTests.test_evidence_version_outside_definition_set_fails_closed).Tests
scripts/verify.py→{"ok": true}.