Repository navigation
validate-carve-manifest: the revision check is ancestor-plus-digests, satisfiable on a merge ref and on main after the manifest lands (split-opendox § 3.1, part 1b) - #864
Conversation
…te is satisfiable on a merge ref and on main after the manifest lands As landed (#839, 6ef5d02), check 2 required the revision under test to RESOLVE TO `carve_commit`. That is unsatisfiable in every run this validator ever gets: a pull request's CI checks out a synthetic merge ref, which is a commit no manifest can name, and after the manifest lands `main`'s tip is the manifest's own squash. The § 8.2 seat (`test_the_real_repository_answers_at_the_ruled_path`) asserts `OK` the moment `docs/opendox-carve-manifest.yaml` exists — so the manifest's own pull request could never have gone green, and the required suite would have redded for every lane from the moment it landed. The § 6 ceremony's intent is not identity: it is that a file which moves between the manifest and the carve REFUSES, by name. This buys exactly that and nothing else. 2 REVISION `carve_commit` must name a commit the repository carries AND be an ancestor of the tested revision (`HEAD` or `--at <sha>`), via `git merge-base --is-ancestor`. Identity is the trivial ancestor case and still passes. 3 DIGEST two passes. Pass 1 is today's check at `carve_commit` — the manifest must be true about its own referent. Pass 2 compares the tested revision's blob and mode against the referent's: CHANGED SINCE THE CARVE / DELETED SINCE THE CARVE. Pass 2 is memo § 6 step 3 as running code. Two passes and not one loop, so a referent lie is reported even when another row also moved on main. 4 SURFACE the completeness walk runs at the tested revision too: a file that APPEARED under the surface since the carve is `carve-file-undeclared`, and a row (a `not_moved` row, the one check 3 never reads) whose path was deleted since the carve is `carve-path-absent`. `carve-surface-vacuous` stays keyed on the referent. `REFUSAL_CODES` is unchanged, eleven codes; exit codes stay 0 and 2. The `OK` line and `--json` now name both revisions (`verified_at`) when they differ. `tree_at` carries git's blob OID beside the mode, so pass 2 compares two revisions without a second `cat-file` per row. Tests: 87 pass (was 77). The thirteen that pin the new semantics were proven against `git show origin/main:scripts/validate-carve-manifest.py` — 13 failed / 74 passed there, 87 passed / 0 failed here. Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
There was a problem hiding this comment.
Hi @brettheap! 👋
Your private repo does not have access to Sourcery.
Please upgrade to continue using Sourcery ✨
There was a problem hiding this comment.
🟡 Changes recommended
check_revision() currently verifies carve_commit^{commit} but still uses the original carve_commit string for later operations, which can allow non-commit object IDs (e.g. tag objects) and lead to confusing/incorrect behavior relative to the documented “commit id” contract.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Updates the carve manifest validator to make the “revision” check satisfiable in real CI contexts (PR merge refs and main after the manifest lands) by switching from commit-identity to commit-ancestry, while also extending digest/surface validation to compare both the manifest’s referent commit and the tested revision.
Changes:
- Change check 2 from “tested revision resolves to
carve_commit” to “carve_commitis carried and is an ancestor of the tested revision”. - Add a second pass in check 3 (and a second walk in check 4) to detect surface/file drift since the carve at the tested revision, with updated messaging and JSON including
verified_at. - Expand
tests/carve_manifestto pin the new ancestry + two-revision semantics and new--jsonbehavior.
File summaries
| File | Description |
|---|---|
| scripts/validate-carve-manifest.py | Implements ancestry-based revision validation; adds two-revision digest/surface comparisons and reports verified_at in human/JSON output. |
| tests/carve_manifest/test_carve_manifest.py | Adds/updates fixtures and tests to cover descendant revisions, non-ancestor refusal, drift since carve, and JSON verified_at. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Copilot review 3972445078: `check_revision` verified that
`<carve_commit>^{commit}` RESOLVES and then went on using the raw
`carve_commit`. An annotated tag's object id is also 40 lowercase hex, so
it passes check 1's grammar, `^{commit}` resolves it, and `merge-base`,
`ls-tree` and `cat-file` all peel it silently — the whole manifest would
have verified against a referent the § 6 ceremony forbids ("the tag is a
LABEL, never the referent"; `carve_tag:` is where a label belongs).
The landed identity check refused this as a side effect, since a tag
object id can never equal a `rev-parse HEAD^{commit}`. Ancestry has to
refuse it on purpose: the peeled sha is compared to `carve_commit` and a
difference is `carve-revision-mismatch`, naming the commit id to record
instead. No new refusal code.
Test: `test_an_annotated_tags_object_id_used_as_the_referent_refuses`
builds a real annotated tag and feeds its object id as `carve_commit`;
it fails against `origin/main`'s validator and passes here. 88 pass.
Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
blob_at() read failures are currently surfaced as carve-path-absent / carve-digest-mismatch in check 3, but should refuse as carve-unreadable for accurate diagnostics and correct refusal categorization.
Review details
Suppressed comments (2)
Previously missed (1) — in code that hasn't changed since the last review.
scripts/validate-carve-manifest.py:922
blob_at()returns None whengit cat-filefails; at this point we already provedls-treelists this path as a blob, so treating that ascarve-path-absentis misleading. This is an environment/read failure and should surface ascarve-unreadable(an existing refusal code) so callers can distinguish “path missing” from “could not read blob object”.
This issue also appears on line 967 of the same file.
content = blob_at(repo, commit, path)
if content is None: # pragma: no cover - ls-tree already said blob
raise CarveRefusal(
"carve-path-absent",
f"{path} could not be read as a blob at {commit[:12]}")
scripts/validate-carve-manifest.py:971
- In digest pass 2, when the blob OID differs you call
blob_at()and then treat a read failure as a digest mismatch with<unreadable>. If the object is missing (e.g., partial clone / promisor remote) orcat-filefails, this should becarve-unreadable, notcarve-digest-mismatch, so the failure reason and remediation are accurate.
content = blob_at(repo, verified_at, path)
# `tested` came from `ls-tree`, which already said blob, so the
# `<unreadable>` arm is unreachable outside a racing checkout.
moved_to = (hashlib.sha256(content).hexdigest()
if content is not None
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
Lane: openxfactory-4-opendox-extraction I did not author this. I built my own throwaway git repos from scratch (a six-file surface in two directories, one
The before/after proof, reproduced independentlyI copied the head's test file onto 14 failed, 74 passed against The attack tableEvery row is my own fixture.
The three design choices — judged
DefectsNone BLOCKING. None SHOULD-FIX.
Shared checkout
|
…Xfactory/codexFactory Tasks 7.2-7.3 of the ratified change adopt-codexfactory-repository-identity. ONE candidate commit over ONE integration point, per docs/contract-versioning-policy.md § Bundle Realization Order step 2. THE CUT IS OWED, NOT ELECTIVE. Eight members of the declared contract-v3.4 inventory changed bytes when the org move landed, and § "What a red verify-commit at HEAD means" calls a mismatch on a non-editorial member "a defect ... the remedy is a release cut, never a hand-edit". Measured at 00d368a: verify-commit reported exactly ten HGR-RELEASE-DIGEST-MISMATCH findings - these eight plus contracts/manifest.yaml and contracts/README.md, the two editorial movers that section allows between cuts. INTEGRATION POINT 95e67ab (#806, 2026-09-09T20:44:00Z), the LAST of the four gated realization slices. The candidate was first derived at 00d368a (#805, 20:00:16Z) and RE-DERIVED here when main moved, per step 1's "fetch and rebase onto the final integration point, then immediately recheck bundle/tag availability". The branch was unpublished, so the integration is a rebase; the resulting tree is what a merge would have produced. Re-measured across the move: neither #806 nor #864 touches a release-inventory member (exact-path check against the inventory's 283 entries), so the re-derivation moved no digest the first derivation had not already moved. NUMBER FRESH-COUNTED AT THE CANDIDATE, not assumed. manifest.yaml declared contract-v3.4; contracts/releases/ held inventories through contract-v3.4.digests.yaml; git ls-remote --tags origin publishes annotated tags through contract-v3.4 (807a4f4) and refs/tags/contract-v3.5 is ABSENT; there is no Unreleased block. So no earlier bundle owes a tag, contract-v3.5 is not a reuse, and it is the next available additive minor. Task 7.2 reserved no number and says so in terms. CHANGE CLASS: ADDITIVE (minor), MEASURED. git diff --name-status contract-v3.4 HEAD -- contracts/ reports 4 additions and 27 modifications, every path attributed in the changelog entry. No required field added, no shape removed, no contract_schema_version moved, no vocabulary semantics changed: every edit to a published member replaces one owner segment inside a value that was already a free-form repository string. The ONE break in the release is a command line, not a record shape - the --domain-repo key becomes codeXfactory/codexFactory=<checkout>, and the changelog entry carries the migration note. INVENTORY. 283 entries, membership UNCHANGED, no git_mode change, TWELVE digests re-baselined: the eight above; the three editorial members (manifest.yaml, README.md, CHANGELOG.md); and tests/intent-compliance/test_release_boundary.py, which is a release member and carries the by-hand boundary statement every cut past the intent-compliance floor owes. FEATURE_SUCCESSOR_9 = "contract-v3.5" is added to the enum and to both match arms, and the docstring records the measurement: git diff --name-status contract-v3.4 HEAD over contracts/intent-compliance/, scripts/intent_compliance/, tests/intent-compliance/ and scripts/validate-intent-compliance.py reports ZERO paths, so this cut moves no intent-compliance member. Built LAST by the tool, never hand-edited; contract-v3.4.digests.yaml is byte-unchanged and remains valid provenance. 7.4 IS AN OPERATOR ACT AND IS NOT PERFORMED HERE. verify-promotion and the annotated tag are release surfaces that the ceremony runbook assigns to the operator. The exact four-command sequence is written into the changelog entry § "The annotated tag is published at the LANDED commit, not from this branch". No tag is created by this commit. BOOKKEEPING IN THE SAME COMMIT, DELIBERATELY. tasks.md ticks 7.2 and 7.3 and annotates 7.4 as the operator half. It rides the cut rather than following it because release-tag-gate grades the DECLARING DISTANCE: the family emits no finding only when the earliest first-parent commit declaring the bundle is the TIP, and a bookkeeping commit stacked on top of the declaration puts it at distance one and refuses the gate. Measured on this branch before the squash: "1 first-parent landing(s) after the commit that declared it", REFUSED gate-findings. One commit is also what 7.3 asks for. 7.1 and 6.5 are NOT ticked here; they belong to the lane's own later pass. Lane: provenance-autonomous-merge Co-Authored-By: Claude Fable 5.1 <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…865) split-opendox-two-layer-product § 3.1, part 2 — the openDox carve manifest at carve_commit b075fd9 (tag `opendox-carve-0`, a label beside the commit), on Brett Heap's word "merge 1b when green, then the manifest" (2026-09-09). - `docs/opendox-carve-manifest.yaml` (RULED OQ-E path; the first machine-validated YAML under `docs/` here): 454 rows, one per file in the declared surface, none undeclared — 172 `moved_verbatim`, 146 `moved_with_declared_edit` (edit classes `import rewrites` / `path constants` / `adapter calls`, RULING OQ-1 verbatim; every edit's line numbers statement-anchored at the carve commit, 782 lines checked), 136 `not_moved` (`stays_openxfactory_adapter` 103, `replicated_at_destination` 18 incl. the Q4 corpus-adapter interface, `stays_openxfactory_governance` 14, `deleted_at_carve` 1). Destinations: openDox-code 123, openXdox-code 92, openDox-spec 56, openXdox-spec 47; the assembly root carries release identity only (§ 3.8). - Rows follow the RULINGS: OQ-A..G as recommended, B-2 (i′), B-4 (a); mixed openDox+openXdox tests → openXdox (OQ-G), with the recorded refinement that a test importing the adapter column stays in openxFactory, applied transitively through test helpers. Ten memo-vs-tree disagreements plus the memo's omission of the Q4 interface are listed in the PR body; the tree at the carve commit wins. - Validated by `scripts/validate-carve-manifest.py` (#839 + #864): `OK` at the carve commit, at this head via `--at`, and at this head plainly ("verified at"); 318 digests recomputed. Independent verification FAIL → one fix round (two test rows re-filed as adapter-column; the stays rule applied transitively; statement-anchored citations) → re-verification PASS. One Copilot round taken. Refs #656 (stays OPEN). Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]>
Lane: openxfactory-4-opendox-extraction
Refs #656 (split-opendox § 3.1, part 1b — the validator only; the manifest is not authored here)
The defect
scripts/validate-carve-manifest.pylanded at #839 (6ef5d02d) with check 2 written as identity: the revision under test (HEAD, or--at <sha>) had to RESOLVE TOcarve_commit. That is unsatisfiable in both runs this validator ever actually gets:mainafter the manifest lands.main's tip is then the manifest's own squash — nevercarve_commit, and it moves again on the next merge.And
test_the_real_repository_answers_at_the_ruled_path(the § 8.2 seat) asserts exit 0 withOKfrom the momentdocs/opendox-carve-manifest.yamlexists. So the manifest's own PR could never have gone green, and the requiredpytest-suitewould have redded for every lane the moment it landed. Found by the orchestrator before the manifest was authored, so nothing has to be unwound.Memo § 6 step 3's INTENT is not identity — it is "a file changed on main between manifest and move surfaces as
carve-digest-mismatchon the next PR". Identity bought that by refusing every revision as well.The new semantics
carve_commitcarve_commitmust name a commit the repository carries AND be an ancestor of the tested revision (git merge-base --is-ancestor). Identity is the trivial ancestor case and still passes.--atkeeps meaning "the revision under test".carve_commitcarve-digest-mismatchworded CHANGED SINCE THE CARVE / MODE DRIFT SINCE THE CARVE, andcarve-path-absentworded DELETED SINCE THE CARVE. Pass 2 is memo § 6 step 3 as running code.edits[].linesbounds stay on the referent blob.ls-tree -ratcarve_commitcarve-surface-vacuousstays keyed on the referent), plus the same completeness question at the tested revision: a file that has APPEARED under the surface since the carve iscarve-file-undeclared("re-cut the manifest"), and a row whose path was deleted since the carve iscarve-path-absent— which is what catches anot_movedrow, the one class check 3 never reads.Two passes in check 3 rather than both comparisons in one row loop, because the order between the two kinds of finding is itself a finding: a manifest that lies about its own referent is a document defect its author fixes with one recomputed digest; a file that moved on
mainafterwards is a tree fact whose remedy is the § 6 re-cut. A single loop would report whichever row sorted first — choosing the reader's remedy by filename.tree_at()now carries git's blob OID beside the mode (TreeEntry), so pass 2 compares one path at two revisions with no secondcat-fileper row; the bytes are read only for the row whose OIDs differ, so the refusal still prints the sha256 at the tested revision.Output. The
OKline and--jsonname both revisions when they differ (… @<carve12> (opendox-carve-0), verified at <rev12> — …; JSON gainsverified_atbesidecarve_commit). Byte-identical to today's line when the two coincide.Docstring. Checks 2/3/4 rewritten; the "LAST thing on that tree" prose corrected; two new sections — why ancestry and not identity, and that the manifest lives at
docs/opendox-carve-manifest.yaml, outside everymoved_paths:prefix, so its own landing can never trip check 4.Refusal codes
Unchanged — the same eleven, in the same order. No code added, removed or renamed;
test_the_refusal_vocabulary_is_the_ratified_listand theastclosure scan both hold as they are. Exit codes stay 0 / 2, with no exit 1. What changed is which code answers which tree, and the prose that names the file.What still refuses, per memo § 6 step 3
mainafter the carve →carve-digest-mismatch(CHANGED SINCE THE CARVE), naming the path and both sha256scarve-digest-mismatch(MODE DRIFT SINCE THE CARVE)carve-path-absent(DELETED SINCE THE CARVE), moved rows in check 3 andnot_movedrows in check 4carve-file-undeclared(RULING OQ-1's "a file in no row")carve_committhe repository cannot resolve (a re-cut typo, or a checkout too shallow to reach it) →carve-revision-mismatch, saying socarve-revision-mismatch(NOT AN ANCESTOR)What no longer refuses: a revision that merely descends from the carve commit with the surface untouched — the merge ref, and
mainafter the manifest lands.Tests
python3 -m pytest -q tests/carve_manifest→ 87 passed (was 77).Thirteen tests pin the new semantics and were each proven against the landed validator by swapping in
git show origin/main:scripts/validate-carve-manifest.pyand re-running this same file:origin/main's validator: 13 failed, 74 passedThe thirteen:
test_at_a_descendant_with_no_surface_change_verifies,test_at_a_revision_the_carve_commit_does_not_reach_refuses,test_a_head_that_has_moved_past_the_carve_commit_verifies,test_a_carve_commit_the_repository_does_not_carry_refuses,test_a_surface_file_changed_since_the_carve_refuses,test_a_moved_row_whose_file_is_deleted_since_the_carve_refuses,test_a_mode_flip_since_the_carve_refuses,test_a_lie_about_the_referent_outranks_a_change_since_the_carve,test_a_file_added_under_the_surface_since_the_carve_refuses,test_a_not_moved_row_whose_file_is_deleted_since_the_carve_refuses,test_a_file_added_outside_the_surface_since_the_carve_does_not_refuse,test_json_reports_the_summary,test_json_names_the_verified_revision_when_it_differs.Three tests that pinned the identity semantics are rewritten rather than deleted:
test_head_that_is_not_the_carve_commit_refuses→test_a_head_that_has_moved_past_the_carve_commit_verifies;test_an_at_that_resolves_elsewhere_still_refuses→ the surface-ADD and NOT-AN-ANCESTOR cases;test_the_revision_check_runs_before_the_digestskeeps its ordering claim on an unresolvablecarve_commit. Every other test is untouched and green, including the § 8.2 seat (NO MANIFESTtoday, since the manifest is still unwritten).Neighbour suites:
tests/carve_manifest tests/manifest_digests tests/openreposhape_pin tests/openxwallet_pin tests/pin_registrations→ 197 passed, 6 failed; the six aretests/openxwallet_pin/test_verify_pin.pyand are pre-existing in a worktree — they need theopenXwalletsubmodule, which CI initialises (git submodule update --init openXwallet) and a bare worktree does not. Verified by stashing this change and re-running: the same six fail on unmodifiedorigin/main.CI reaches the carve commit:
pytest-suite.ymlchecks out withfetch-depth: 0, somerge-base --is-ancestorhas the history it needs.NOT DONE
docs/opendox-carve-manifest.yaml) is not authored here and is not created by this PR — that is the § 6 ceremony, gated on the three pre-carve splits..github/**,openspec/**andcontracts/**are untouched.REFUSAL_CODES, to the manifest grammar, or to the ruled path.Asking for Brett Heap's separate word to land this.
🤖 Generated with Claude Code