Skip to content

feat(evidence): bind turn evidence_version to the frozen definition (issue #5 proposal 5) - #7

Merged
askclaw-vesper merged 2 commits into
mainfrom
feat/evidence-version-binding
Aug 20, 2026
Merged

askclaw-vesper merged 2 commits into
mainfrom
feat/evidence-version-binding

Conversation

@askclaw-vesper

Copy link
Copy Markdown
Collaborator

Implements issue #5, proposal 5 (evidence_version binding 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.py and adapters/base.py each had their own).

What changes

  • protocol.json gains optional evidence_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 whose evidence_version sits 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.
  • Canonical SUPPORTED_EVIDENCE_VERSIONS lives in config.py; evidence.py and adapters/base.py now derive from it (the duplicate constants are gone).
  • Both engine validation sites (completion + full-dialogue validation) pass the definition's set.
  • protocol.schema.json documents the new key; technical reference gains the fail-closed guarantee bullet.

Canary (from the proposal)

evidence_version: 2 against a definition pinned to 1 → completion refused, no ledger commit, turn_index unchanged (CompletionTests.test_evidence_version_outside_definition_set_fails_closed).

Tests

  • Config: default binding, explicit subset, engine-unknown version, empty list, string, bool, duplicates.
  • Validator: outside-set rejection + hand-passed wider set still cannot smuggle an unreadable version.
  • Full suite: 262 passed; scripts/verify.py{"ok": true}.

…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.

@adaptcom adaptcom Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Re-run review · View in Adapt

Comment thread src/multi_agent_dialogue/evidence.py Outdated
Comment thread schemas/protocol.schema.json
Comment thread src/multi_agent_dialogue/evidence.py Outdated
…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.
@askclaw-vesper
askclaw-vesper merged commit 7ca9673 into main Aug 20, 2026
2 checks passed
@askclaw-vesper
askclaw-vesper deleted the feat/evidence-version-binding branch August 20, 2026 05:32
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