Materialize a frozen bundle, and prove two copies are one repository - #446
Merged
Conversation
CDEB-02. Every CDEB comparison rests on one invariant: the ON and OFF arms of a task/repeat pair see byte-identical repository state, and the only difference between them is the frozen agent settings. This module owns that invariant -- creating the §6.1 bundle with its six-field identity, materializing it offline into a detached checkout, and computing the §6.2 identity both arms are compared by. The gate returns the mismatched field names, so a violation says what diverged rather than only that something did. Deliberately new code rather than a reuse. `bench/workspace.ts` with `seedRecords: false` strips the trailer block out of seeded commits -- exactly the OFF-arm construction §6.3 prohibits -- and the PRD names it as the one helper the materializer must not touch. Nothing here imports it, and the mutation test builds that forbidden shape independently to prove the gate catches it: a trailer-stripped history fails with `commit_message_digest` named, which identifies the kind of divergence and not merely its existence. The digest boundary follows the v1.2 rule: identity covers commits, trees, refs and the notes mirror, and excludes `.git/` internals -- the working-tree digest reads `git ls-files -s`, which never sees the product's lazily created index or lifecycle log, so an ON arm that has been queried does not "differ" from an OFF arm that has not. One git behaviour shaped the materialization order: git refuses to fetch into the branch a clone checked out, so the copy detaches onto the snapshot first and only then restores the bundle's refs to their local names. The contract is a detached checkout anyway. Limit: `git bundle create --all` includes refs/notes only by configuration, so the notes ref is passed explicitly -- a bundle that silently dropped the mirror would materialize an OFF arm by accident Ruled-out: reusing bench/workspace.ts for materialization | its record-stripping mode is the §6.3 prohibited control, and a helper that can build the forbidden shape should not be in the path that exists to prevent it Ruled-out: comparing arms by bundle digest alone | both arms come from one bundle, so the bundle digest cannot catch a materialization that diverged after import; the §6.2 identity is computed from each working copy Warn: a materialization whose digests mismatch the freeze throws rather than warns -- it is a different repository, and running an arm in it compares two experiments while calling them one Blast: local Undo: easy Certainty: firm Verified: two materializations of one bundle report zero mismatches; the notes record and the trailer record are both readable in the copy; a tampered bundle and a missing bundle each refuse with the named reason; and the trailer-stripped history fails the gate with commit_message_digest among the mismatches Provenance: authored Record-Id: r-cdebmat02
CommitLore — record lintTrailers: clean — 1 commit in Active constraints for the paths this PR touchesLimits (1)
Ruled out (2)
Warnings (1)
Trailer violations fail this check. Active constraints are informational — they are what the repository already decided, not a verdict on this PR. |
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.
Closes #445. CDEB-02 — the second infrastructure ticket of the protocol (
bench/cdeb/PRD.mdv1.2). CDEB-01 landed in #444.What this owns
Every CDEB comparison rests on one invariant: the ON and OFF arms of a task/repeat pair see byte-identical repository state, and the only difference is the frozen agent settings.
bench/cdeb/freeze/repository-bundle.tsowns that end to end — the §6.1 bundle with its six-field identity, offline materialization into a detached checkout, and the §6.2 identity both arms are compared by.sameHistoryMismatchesreturns the mismatched field names, so a violation says what diverged rather than only that something did.Deliberately new code, and why the PRD says so
bench/workspace.tswithseedRecords: falsestrips the trailer block out of seeded commits — exactly the OFF-arm construction §6.3 prohibits. The PRD names it as the one helper the materializer must not touch. Nothing here imports it, and the mutation test builds that forbidden shape independently to prove the gate catches it: a trailer-stripped history fails withcommit_message_digestamong the mismatches, which identifies the kind of divergence rather than merely its existence.Digest boundary (v1.2 §6.2)
Identity covers commits, trees, refs and the notes mirror; it excludes
.git/internals. The working-tree digest readsgit ls-files -s, which never sees the product's lazily created index or MCP lifecycle log — so an ON arm that has been queried does not "differ" from an OFF arm that has not.One git behaviour shaped the order
Git refuses to fetch into the branch a clone checked out, so the copy detaches onto the snapshot first and only then restores the bundle's refs to their local names. The contract is a detached checkout anyway.
Also:
git bundle create --allincludesrefs/notes/*only by configuration, so the notes ref is passed explicitly. A bundle that silently dropped the mirror would materialize an OFF arm by accident.Tests — 5
commit_message_digestnamedVerification
Full suite: 96 files, 2201 passed, 1 skipped.
bench/tsconfig.jsontypecheck clean.test/dogfood.test.tsre-run after committing: 9 passed.