Repository navigation
Spec 003 companion — verification policy surface - #9
Merged
Merged
Conversation
Expose the core's Spec 003 verification policy idiomatically:
Database.verify / verify_file accept trusted={actor: pubkey_hex}
(identity mode; None = bare self-consistency, {} trusts nobody) and
expected_head={head_hash, min_events, checkpoint_root} (the
truncation pin). verify_file returns the full eight-field
Verification dataclass instead of the reduced tuple and reports
malformed files as verdicts instead of raising. Verification gains
unsigned_events and untrusted_actors, reported in every mode.
Docs: verification.md rewritten around the policy (bare vs trusted,
presence reporting, head pinning stated plainly incl. that a
truncated prefix passes bare verification, the write-time ValueError
on non-finite / out-of-range values); api.md updated to the new
shapes; format.md gains the pinned canonical encoding from core
Spec 003 section 5 and the corrected snapshot-id construction.
Tests: tests/test_verification_policy.py mirrors the core's
acceptance from Python (transplanted checkpoint root fails even
re-signed; sig-stripped fails trusted mode and is reported bare;
unmapped actor named in untrusted_actors; truncation fails under
expected_head; F-VP-8 rejection battery leaves the file
byte-identical; verify_file never raises on malformed files). The
new tests fail against the pre-fix 0.1.0 extension and pass against
the Spec 003 core (cc45299). Existing verify_file tuple uses updated
to the full result shape. CHANGELOG [Unreleased] entry added.
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.
Companion to AXIOVEX/axiomere Spec 003 (verification policy), claim AXM-003-15, item (1): the axiomere-python half. The core work is merged on AXIOVEX/axiomere main (
cc45299). This PR exposes it idiomatically from Python; it does not merge itself — coordinator verifies and merges.The surface
Database.verify(*, trusted=None, expected_head=None)andaxiomere.verify_file(path, *, trusted=None, expected_head=None).trustedis a plain dict{actor: public_key_hex}:None= bare mode (signatures checked against the keys embedded in the events — self-consistency); a dict = trusted mode (identity: every actor named in the map, every event signed with the mapped key, no fallback to embedded keys);{}trusts nobody and is deliberately distinct fromNone.expected_headis a plain dict with any ofhead_hash,min_events,checkpoint_root(checkpoint root compared against the root verification recomputes).Verificationgains the two new result fields — now the full eight the bindings return:ok,events,break_seq,reason,signatures_checked,signatures_failed,unsigned_events(tuple of seqs),untrusted_actors(tuple of actor names).verify_filereturns the fullVerificationinstead of the old reduced(ok, count, reason)tuple, and a malformed/unreadable file is a verdict (ok=False+ named reason), never an exception — FR-VP-11 at this surface.Database.openkeeps raising, per C3.ValueErrorand append nothing.Docs (plain language)
docs/verification.mdrewritten around the policy: the eight result fields, what is checked (incl. canonical bytes and checkpoint recomputation), signature presence and whatunsigned_events/untrusted_actorsmean, bare vs trusted, head pinning — with the plain statement that a truncated prefix passes bare verification and the pin is the detection, and the write-timeValueError.docs/api.mdupdated to the new shapes;docs/format.mdgains the pinned canonical encoding from core Spec 003 §5 and the corrected snapshot-id construction (SHA-256(canonical({"content":…, "parent":…}))).mkdocs build --strictclean.CHANGELOG.md:[Unreleased]entry (Added / Changed / Fixed). No version bump — releases are the coordinator's.Tests
Extension built from axiomere main
cc45299via the repo's own flow (maturin, venv). Full suite: 17 passed.New
tests/test_verification_policy.py(10 tests) mirrors the core's acceptance from Python, rebuilding the red team's constructions with a pure-Python Ed25519 re-signing harness (its soundness is proven by a control that re-signs an untouched event and still verifies):signer-key-mismatch; unmapped actor →untrusted-actorwith the actor inuntrusted_actors(F-VP-5 shape), via bothverify_fileand the ledger object; empty map trusts nobody;checkpoint-root-mismatch— bare and trusted, identity genuine, root recomputed;unsigned-event; full strip is a visible bare-mode state (signatures_checked=0, all seqs inunsigned_events) and fails trusted mode;expected_headasshortfall/head-mismatch/root-mismatch;2**70,-(2**70)raise and leave the file byte-identical;2**64-1,2**63,-2**63round-trip as exact ints; a finite float round-trips bit-exact;verify_fileon garbage / empty / broken / missing files returns failed verdicts, never raises.Teeth check: the same 10 tests run against the pre-fix 0.1.0 extension (PyPI build) — 10 failed, as they must. Existing tuple-shape uses in
test_axiomere.pyandtest_float_roundtrip.pywere updated to the full result shape.Scope: no changes to AXIOVEX/axiomere or Tekmerion. The Tekmerion companion (recomputed-root comparison at study boundaries) is a separate item under AXM-003-15 and is not claimed by this PR.