Repository navigation
C0-R · Register ReadSetSnapshot Artifact Identity - #35
Merged
Merged
Conversation
jamespud
marked this pull request as ready for review
October 22, 2026 23:43
This was referenced Oct 23, 2026
Closed
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.
A. 基线
origin/main/ docs(contracts): draft C1 input artifact contracts #34 merge:2e0ab56183244d5dc98426501b62f9f7acbe77bf.git ls-remotematched; open PR count was 0.643667c35288878791a8bf71dac2aedca0468a79.B. 修改
C0-R registers
read_set_snapshotwith prefixrsetso consumers can calculate its independent content identity. The production change is exactly two additions (constant and prefix map); existing C0 encoding, domain separator construction, SHA-256, original types/prefixes, and all legacy algorithms stay unchanged.Files (8):
backend/domain/canonical/canonical.go: constant/prefix.backend/domain/canonical/read_set_snapshot_test.go: typed identity, equivalence, domain separation, mutation, unknown-type/adoption rejection and all registered IDs.backend/domain/canonical/canonical_test.go: golden artifact-ID assertions.backend/domain/canonical/testdata/golden_vectors.json: append 15 identity vectors; retain all original 18 positive / 15 negative vectors unchanged.backend/domain/canonical/testdata/verify_golden.py: independent prefix/ID verification, preserving encoding/digest rules.scripts/check-input-artifact-contract.go: identity succeeds; minimal probe and 5 relabelled supported examples remain rejected by the unchanged C1 schema. Preserve 5 positive, 46 negative and 14 D-04 checks.docs/canonical-encoding-contract.md: whitelist and identity-only compatibility boundary.docs/input-artifact-contract.md: current D-01 implementation status; separate C0 minimal identity and C1-C full-body acceptance.Independent minimal identity probe (deliberately incomplete, not a usable ReadSet):
{ "schema_version": "1.0", "context_revocation_epoch": 0, "artifact_type": "read_set_snapshot" }Expected canonical UTF-8 bytes:
{"artifact_type":"read_set_snapshot","context_revocation_epoch":0,"schema_version":"1.0"}Digest:
5fad4b2ab6f44260174c65a2f5478b6e8402059e18ef33ce709ed866b2fb5824.ID:
rset_5fad4b2ab6f44260174c65a2f5478b6e8402059e18ef33ce709ed866b2fb5824.Expected bytes were explicit literals; Python
hashlib.sha256(b"magi:canonical:v1:read_set_snapshot\n" + canonical_bytes)generated expectations independently of Go. Both implementations reproduce them. Additional identical-body vectors freeze all 14 registered types, including the 13 pre-C0-R identities.C. RED→GREEN
Before production registration (using the literal type to obtain a behavioral failure rather than an undefined-constant compile error):
The 13 old identity regressions and 18 old positive golden vectors already passed in RED. Unknown-type and non-canonical adoption rejection were existing invariants that stayed green. After appending the constant/map entry, tests use
TypeReadSetSnapshot; the same focused suite and checker pass.Additional negative controls (temporary fixtures, no repository schema/vector corruption): changing the expected rset ID makes the Python CI verifier fail; adding a schema branch accepting ReadSet makes the C1-A checker fail with
D-01 identity-only ReadSet probe accepted as a C1 input artifact. The unchanged fixtures pass.D. 验证
All commands below passed from
backend/using the writable cache:Also passed:
gofmt -l scripts/check-input-artifact-contract.go,git diff --check, unchanged-vector/schema audit, and explicit-count=1 -vruns of both named legacy freezes. Local full race does not activate MySQL-gated tests; real MySQL validation is supplied by the two dedicated CI jobs.Named compatibility tests:
TestCanonicalGoldenVectors,TestGoldenVectorsReproduceInPython,TestRegisteredArtifactIDsAreByteFrozen(14 types),TestLegacyManifestDigestsAreByteFrozen(legacy-manifest/v1,legacy-approval-intent/v1) andTestLegacyA2ARequestHashIsByteFrozen.All 6/6 CI jobs in
.github/workflows/ci.ymlpassed on the exact Head above. CI run 39872320461. Backend step results separately confirm race tests, vet, Python cross-language vectors and the C1-A checker succeeded; both real MySQL jobs passed.E. Findings
Read-only reviewer found no actionable defects; independently reran the Python gate, canonical package tests, C1-A checker and whitespace check. No old test constant, schema, historical digest or legacy data changed.
Local baseline initially could not write the default Go cache; all actual test evidence uses writable
GOCACHE=/tmp/magi-c0r-go-cache. That setup failure is not the behavioral RED.F. 放行
Draft for review only. C0 identity registration is implemented; formal ReadSet issuance/publication/voting remains unavailable. Registration does not let old consumers accept the new type. Producers must remain disabled until complete consumer validation and explicit capability negotiation pass.
Not implemented or claimed: ReadSetJournal, full ReadSet schema/semantic validator, full-body Golden/closure, database tables, FSM/Agent Loop/RAG/context/recovery changes, SealedBallot/BallotSet changes, AuthorityProof, runtime revocation/concurrency/production switch verification, C1-B or decision-artifact v2 work. No Issue closure, CAS-9 Done, Ready conversion or merge. Full body semantics/Golden are C1-C, and authority integration remains blocked by its stated contracts and C2.