Repository navigation
Add validate-carve-manifest.py: six ordered checks over the § 3.1 carve manifest, with its pytest driver (split-opendox § 3.1, part 1) - #839
Conversation
… 3.1, part 1) FLOOR PART 1 of the RULED four-part floor (design.md § D6, RULING OQ-1) is a mapping manifest with per-file digests and a closed edit-class list, and a manifest nothing checks is a claim rather than a floor. This lands the checker BEFORE its subject: `docs/opendox-carve-manifest.yaml` is authored at the carve commit as the last thing on that tree (scout memo § 6), so given no manifest the validator prints `NO MANIFEST <path> (nothing to validate)` and exits 0 — the one branch here that is not fail-closed, deliberately, because a red suite on every pull request until the carve would train the lane to ignore the checker. Six ordered checks, first failure wins, exit 0 clean / 2 on any refusal (validate-openreposhape-pin.py's convention, and there is no exit 1 for its reason): shape (`carve-shape-invalid`); revision, refusing unless HEAD or `--at <sha>` resolves to `carve_commit` (`carve-revision-mismatch`); digest, recomputing the sha256 of the raw git blob at the carve commit and comparing the recorded git_mode (`carve-digest-mismatch` / `carve-path-absent`); surface completeness over every `moved_paths:` prefix, which is RULING OQ-1's "a file in no row is an UNDECLARED MOVEMENT" as running code (`carve-file-undeclared` / `carve-file-duplicated`); the closed vocabularies (`carve-vocabulary-unknown`); and disposition consistency plus the bytewise row order (`carve-disposition-inconsistent` / `carve-path-order-violation`). The rulings are encoded rather than described. `edit_classes:` is asserted EQUAL to the ruling's own three, in order, so a manifest declaring its own fourth class cannot validate against itself. The three dispositions are a code constant that nothing in the file can widen (RULED OQ-C), while the `not_moved` reason vocabulary is declared in the file AND required to be a subset of the known five, so `replicated_at_destination` is expressible and a typo is not. The manifest path is the ruled one verbatim (RULED OQ-E), with the docs/ convention break recorded rather than corrected. `carve_tag` is a label: a tag name in `carve_commit` refuses. No schema ships under contracts/ — the shape checks live in code, because a new artifact there fires release-tag-gate and the digest inventory for a document with exactly one instance. No workflow is added: pytest.ini declares no testpaths and the required job runs `pytest tests/`, so tests/carve_manifest/ is collected on every pull request; nothing here skips, so the exact EXPECT_SKIPPED pin does not move. The driver builds a throwaway git repository per case and GENERATES the manifest from that tree, so the clean case is clean by construction and every refusal is one deliberate mutation away from it; each of the nine refusal codes is reached by at least one test, and two tests pin the check ORDER. 51 tests pass; the manifest-digests, openspec-cli-pin and openreposhape-pin suites are unchanged (177); proposal-support verify is ok; doc-health reports 92 findings on this branch and 92 identical findings without these files. Refs #656 Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_0139swz8Tq3FjNveDRR2SNPv
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
There is at least one concrete correctness issue in the validator (potential uncaught UnicodeEncodeError in the path-order check) that can crash the script and violate the stated exit-code contract.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a new carve-manifest validator and a comprehensive pytest suite to enforce the “§ 3.1 carve manifest” floor for the upcoming openDox/openXdox extraction, including ordered refusal semantics, stable refusal codes, and a seat-holding “no manifest yet” pass.
Changes:
- Introduces
scripts/validate-carve-manifest.py, implementing six ordered validation checks with refusal-code reporting (human and--json). - Adds
tests/carve_manifest/test_carve_manifest.py, generating a scratch git repo/manifest and pinning every refusal code + ordering constraints via subprocess-driven tests.
File summaries
| File | Description |
|---|---|
| scripts/validate-carve-manifest.py | New CLI validator implementing the ordered carve-manifest checks and refusal semantics. |
| tests/carve_manifest/test_carve_manifest.py | New pytest suite that builds hermetic scratch repos/manifests and asserts each refusal code and check ordering. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…annot hold, and say what renders the refusal Two factual findings, both accepted. (1) The bytewise sort key encoded STRICTLY while `tree_at()` decodes git's paths with `surrogateescape` two functions away. A path is bytes, and the strict encode would raise `UnicodeEncodeError` out of the comparison and end the run with a traceback and exit 1 — the exit code this file's docstring says does not exist. The key now encodes with `surrogateescape` too. Following the same reasoning to the input side found a hole that IS reachable today: `read_manifest` caught `OSError` and `yaml.YAMLError`, and a manifest file that is not valid UTF-8 raises `UnicodeDecodeError`, which is a `ValueError` and was caught by neither — so the one input class Copilot's finding is about was crashing rather than refusing. `ValueError` is now caught and the file reports `carve-unreadable`, exit 2. Both are pinned: `test_a_manifest_that_is_not_utf8_refuses_rather_than_crashing` and `test_the_path_order_key_survives_a_path_utf8_cannot_hold`. (2) `CarveRefusal`'s docstring was inherited from `validate-openreposhape-pin.py`, where the message IS `str(exc)`. Here it is `render(manifest)`, because the message names the manifest that failed and the exception does not carry it — every check can be raised from a nested helper that has no idea which file it is reading. The docstring now says that, and says why it is a method rather than `__str__`, so the next refactor does not reach for `str(exc)` semantics that are not there. 53 tests pass (was 51). Refs #656 Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_0139swz8Tq3FjNveDRR2SNPv
There was a problem hiding this comment.
🔵 Needs a closer look
The test fixture helper Scratch.blobs() documents that it parses the tree “the way the validator reads it” but currently uses different git ls-tree flags/decoding, making the docstring inaccurate and allowing fixture parsing semantics to drift from the validator.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
tests/carve_manifest/test_carve_manifest.py:160
Scratch.blobs()claims it reads the carve surface “the way the validator reads it”, but it callsgit ls-treewithout-zand relies ontext=Truedecoding/splitting by lines. The validator usesls-tree -zandsurrogateescapedecoding to correctly handle unusual/non-UTF-8 paths; keeping this mismatch can let the test fixture generator drift from the validator’s parsing semantics (and makes the docstring incorrect).
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox) VERDICT: PASS WITH NOTES at head Items
CI at head: all 9 required checks pass, including Check-by-check (item 2)
Nothing the memo names is missing. Attacks (own fixtures: 4 throwaway repos, 7 blobs / 4 dirs / 2 commits / one
|
| attack | exit | code | right? |
|---|---|---|---|
a correct manifest (--at, and HEAD==carve_commit with no --at, and --json) |
0 | — | ✅ |
b carve_commit UPPERCASE hex / 39 chars / tag name / branch name |
2 | carve-shape-invalid ×4 |
✅ |
c HEAD ≠ carve_commit, no --at |
2 | carve-revision-mismatch |
✅ |
c --at <carve_commit> |
0 | — | ✅ |
c --at <other commit> / --at <unresolvable> |
2 | carve-revision-mismatch ×2 |
✅ |
d git_mode 100755→100644 on a real 0755 blob; 100644→100755 |
2 | carve-digest-mismatch (MODE DRIFT) ×2 |
✅ mode is compared, both directions |
| e row for a path added in commit 2, carve_commit = commit 1 (two constructions) | 2 | carve-path-absent ×2 |
✅ |
| f a surface file in no row | 2 | carve-file-undeclared |
✅ |
| f one path in two rows | 2 | carve-file-duplicated |
✅ |
f row whose source_path is outside every moved_paths: prefix |
2 | carve-shape-invalid |
✅ it refuses (see N-code remark) |
f pkg_old/z.py beside prefix pkg |
0 | — | ✅ not swallowed |
g moved_verbatim + edits; moved_with_declared_edit with edits: []; with no edits key; not_moved + edits |
2 | carve-disposition-inconsistent ×4 |
✅ |
g edits[].lines: [] / lines: ["1"] |
2 | carve-shape-invalid ×2 |
✅ |
| h a 4th edit class / the three reordered / only two | 2 | carve-shape-invalid ×3 |
✅ |
h class: import-rewrites (hyphen) |
2 | carve-vocabulary-unknown |
✅ |
i destination: opendox_kode |
2 | carve-vocabulary-unknown |
✅ |
i reason: replicated_at_destinaton (typo, and declared) |
2 | carve-shape-invalid |
✅ |
i a 6th not_moved_reasons: entry |
2 | carve-shape-invalid |
✅ |
| i a KNOWN reason the file does not declare | 2 | carve-vocabulary-unknown |
✅ (declared-AND-known both bite) |
| i a 4th disposition | 2 | carve-vocabulary-unknown |
✅ |
i not_moved row carrying sha256 |
2 | carve-shape-invalid |
✅ |
i not_moved row carrying destination + destination_path |
0 | — | ❌ S2 |
j pkg/b.py before pkg/a.py |
2 | carve-path-order-violation |
✅ |
| j non-ASCII paths (U+FF01 vs U+E000) misordered | 2 | carve-path-order-violation |
✅ |
j the byte-vs-codepoint divergence: real filenames pkg/\xff.py and pkg/\xee\x80\x80.py (surrogateescape → U+DCFF, U+E000, whose CODEPOINT order is the REVERSE of their BYTE order), expressed in the YAML via \udcff escapes |
2 | carve-path-order-violation |
✅ the const's distinguishing claim is enforced — a codepoint sort would have accepted this file. Byte-ordered variant → exit 0. No shipped test covers this — see S7. |
| k top-level YAML list / empty file / a bare scalar | 2 | carve-shape-invalid ×3 |
✅ |
| k non-UTF-8 bytes / unclosed YAML | 2 | carve-unreadable ×2, no traceback |
✅ exit 2 (code classification → S5) |
l schema_version: 2 / wrong kind / digest_source: working_tree / path_order: flipped / unquoted git_mode / empty moved_paths / empty destinations / unknown ROW key / destinations entry missing leg / carve_tag with a space / blank carve_tag / whitespace-only evidence |
2 | carve-shape-invalid ×12 |
✅ |
l schema_version: true / schema_version: 1.0 |
0 | — | ❌ S3 (True == 1, 1.0 == 1) |
| m default path absent | 0 | NO MANIFEST … (nothing to validate) |
✅ intended |
m --manifest <path that does not exist>, plain and --json |
0 | no-manifest |
❌ S1 |
n --json on a refusal |
2 | valid JSON, result/code/detail/manifest |
✅ exit code unchanged |
n --json on a pass |
0 | valid JSON, 9 keys | ✅ |
env --repo <missing dir> / --repo <plain dir> |
2 | carve-unreadable ×2 |
✅ |
extra not_moved row for a path absent at carve_commit |
2 | carve-path-absent |
✅ |
extra symlink row (git_mode: '120000') |
0 | — | ✅ |
| extra digest recorded from the WRONG revision | 2 | carve-digest-mismatch |
✅ |
extra working-tree modification with HEAD == carve_commit |
0 | — | ✅ the tree, not the checkout |
extra duplicate YAML key rows: (PyYAML last-wins) |
2 | carve-digest-mismatch |
|
extra edits[].lines: [999999] on a 3-line file |
0 | — | ❌ N1 |
extra two rows sharing one destination+destination_path |
0 | — | ❌ N2 |
extra destination_path: ../../etc/passwd |
0 | — | ❌ N3 |
extra a moved_paths: prefix matching no blob at all |
0 | — | ❌ S4 |
| extra surface shrunk to one named file | 0 | — | moved_paths is the surface) |
| extra unknown TOP-LEVEL key | 0 | — | header:) — N4 |
extra trailing-slash prefixes (pkg/, lib/) |
0 | — | ✅ |
Defects
No BLOCKING defect. Every guarantee the four-part floor's part 1 exists to give — a file in no row refuses, a drifted digest refuses, a flipped mode refuses, an edit in no class refuses, a moved tree refuses — held under all 81 attacks.
S1 — SHOULD-FIX. An explicitly named missing --manifest exits 0. main()'s seat-holding pass keys off manifest_path.is_file() and never asks whether the caller named the path. The pass is right for the default and wrong for a named one: the memo's own "one-shot step in the carve PR" (§ 1.3), or any later job that typos --manifest docs/carve-manifest.yaml, goes green forever — the single not-fail-closed branch in the file becomes the branch a typo selects. Repro: python3 scripts/validate-carve-manifest.py --manifest /tmp/nope.yaml --repo <any repo> → NO MANIFEST, exit 0. Fix: if args.manifest is None and not manifest_path.is_file(): …return 0, and refuse a named absent file as carve-unreadable.
S2 — SHOULD-FIX. A not_moved row may carry destination and destination_path. _check_row_shape() forbids sha256/git_mode on a not_moved row, on the stated reason that "a digest … is the claim that these bytes arrive somewhere, and nothing arrives" — which condemns a destination just as squarely. The memo's § 1.2 not_moved row is source_path + disposition + reason + evidence and nothing else, and the body calls the row grammar closed. Today such a row passes and its destination is even validated against destinations:, so it reads at the destination as "this file goes there" while its disposition says it does not. Repro: clean manifest, add destination: opendox_code + destination_path: lib/d.py to the not_moved row → exit 0. Fix: add both keys to that row's forbidden set.
S3 — SHOULD-FIX. schema_version is type-blind. doc.get("schema_version") != SCHEMA_VERSION accepts true and 1.0 (Python True == 1, 1.0 == 1). Harmless to the carve, but the first assertion of a fail-closed chain should not admit a bool. Fix: if not isinstance(v, int) or isinstance(v, bool) or v != SCHEMA_VERSION — the same guard _check_edits_shape already applies to line numbers, correctly.
S4 — SHOULD-FIX. A moved_paths: entry that matches nothing at the carve commit passes silently, and no test covers it. The completeness check is only as good as the prefix list, and a mistyped prefix (scripts/ideation_dashbord) contributes an empty surface while looking like coverage in review. The tree is already in hand (tree_at() runs before check_surface), so refusing a vacuous prefix is free. (Fairness: a typo'd prefix whose rows are still present does refuse, as carve-shape-invalid per row; the silent case is the typo and its rows dropped together — which is exactly the hand-editing error a ~430-row manifest invites.) Repro: append nowhere/at/all to moved_paths: on a clean manifest → exit 0.
S5 — SHOULD-FIX. carve-unreadable's stated rationale does not cover the case it is most often raised for. The tuple comment says the excluded code "describes an environment in which no finding can be reached at all". Four of its five raise sites are environments; the fifth is read_manifest's yaml.YAMLError / UnicodeDecodeError branch, and an unparseable manifest is not an environment — it is a document defect a reviewer acts on. The result is that two adjacent document defects get codes from two different vocabularies: an EMPTY manifest (parses to None) is carve-shape-invalid, a manifest with one unclosed bracket is carve-unreadable, a code the body's own nine-code table says does not exist. Both exit 2, so nothing is unsafe — but a caller branching on the code, which the comment says is the reason the vocabulary is closed, meets an undocumented value. Fix: route the manifest-parse failures to carve-shape-invalid, or admit carve-unreadable to the tuple and state the environment/document split there.
S6 — SHOULD-FIX (and it is an OPEN review finding at this head, not mine). Copilot's second review (2026-09-09T12:23:07Z, after 122ec3fe) raises a third finding with no thread to resolve, so it is easy to miss: Scratch.blobs() claims it reads the tree "the way the validator reads it" but calls git ls-tree without -z, decodes with text=True and splits on lines, and filters with a bare path.startswith(SURFACE) where the validator uses -z, surrogateescape and segment-aware in_surface(). The finding is correct. Impact today is nil — the fixture's paths are ASCII and SURFACE carries a trailing slash, so the two agree — but the docstring is false, and a fixture path with a space or a quote would be git-quoted and silently mis-parsed. My repo-4 fixture shows the divergence is not hypothetical: -z + surrogateescape is exactly what it takes to see those two filenames at all.
S7 — SHOULD-FIX. The Copilot round's second test does not test what it names. test_the_path_order_key_survives_a_path_utf8_cannot_hold calls MODULE.check_disposition_consistency() in process (the only test that bypasses the subprocess the suite otherwise uses), asserts nothing, and its two paths — scripts/pkg/alpha.py and scripts/pkg/\udcffzeta.py — are in the same order bytewise and by code point. So it pins "the encode does not raise", not the ordering semantics. Combined with test_rows_out_of_bytewise_order_refuse using reversed() over ASCII paths, no test in the suite distinguishes bytewise_utf8 from a code-point sort. The other Copilot fix is genuinely pinned (test_a_manifest_that_is_not_utf8_refuses_rather_than_crashing writes real non-UTF-8 bytes, runs the subprocess, asserts exit 2 + carve-unreadable + no traceback — I reproduced it independently). Fix: replace the doc with a divergent pair; the construction is in this report's row j and the validator already passes it.
NOTES (no action asked, recorded so the next reader does not re-derive them)
- N1
edits[].linesare never bounded against the blob, whichcheck_digestshas already read:lines: [999999]on a 3-line file passes. The memo carries line numbers because they make the claim "falsifiable at the destination" — a line past EOF at the carve commit is falsifiable here, for nothing. - N2 Nothing checks
destination+destination_pathuniqueness, so two source files may claim one destination path; the surface check guarantees completeness on the source side only. - N3
destination_pathis wholly unvalidated:../../etc/passwdpasses. - N4 The top-level grammar is OPEN (only rows and edits are closed) — which is what permits the
header:prose the body describes, and also means a stray or mistyped top-level key is silently ignored. The precedent the consts are borrowed from (release-digest-inventory.schema.yaml) isadditionalProperties: false. - N5 Digest field shape: this manifest is
sha256: <raw 64 hex>; the release-digest inventory whose three consts it cites by file:line isdigest: sha256:<hex>. The validator faithfully implements the memo's § 1.2 example, so the divergence originates upstream of this PR — butSHA256_REwould reject the precedent's prefixed form, so the two documents' digest fields are not interchangeable and a reader of one does not already know how to write the other. - N6
destinations.<key>.legis a free non-empty string; the memo's example usescode | spec | assembly.leg: kodepasses. - N7
--helpdoes not name the six checks (they live in the module docstring), andformatter_class=RawDescriptionHelpFormatteris inert with a one-paragraph description and no epilog.validate-openreposhape-pin.pydoes exactly the same, so this matches the precedent rather than deviating from it. - N8
REFUSAL_CODESis referenced nowhere in the script — the closure is asserted only by the test's literal, and nothing stops a future check raising a code outside the tuple.carve-unreadablealready does (deliberately). Oneassert code in REFUSAL_CODES + ("carve-unreadable",)inCarveRefusal.__init__would make the closure real rather than documentary. - N9 PyYAML accepts duplicate keys silently (last wins); a manifest with two
rows:keys is read as the last. Contained today — the surface/digest checks refuse it for a downstream reason. - N10 The shipped fixture has no
100755blob, so the tree side of the mode comparison is only ever exercised against100644. I tested both directions against a real0755file and both refuse. - N11 The body's file table says 802/783 lines; the files at this head are 810/787 (the Copilot round). Body prose otherwise matches what I measured, including 53 / 177 / 92-and-92 /
proposal support verification ok(all re-run and confirmed). - N12
test_the_real_repository_answers_at_the_ruled_pathpassescwd=REPO_ROOT, but--repodefaults toPath(__file__).resolve().parents[1], so the cwd is decorative. - N13 The memo's optional "one-shot step in the carve PR the way
openreposhape-pin-gate.yml:93does" is not present. The memo itself says the pytest seat alone satisfies § 8.2, so this is owed at the carve, not here. - N14 Two stale worktrees from a previous, dead verifier (
wt-verify-839,wt-verify-839-base, under another session's scratchpad) are still registered in the shared checkout. Not mine; left untouched. I worked inwt839/wt839-baseunder my own scratchpad and removed them.
Shared checkout
/home/brett/projects/xFactory/openxFactory — start: rev-parse --short HEAD = 6612d323, diff --cached --name-only | wc -l = 0. End: 6612d323, 0. Unchanged; only fetch / worktree prune / worktree add --detach / worktree remove --force (mine) were run against it. Fixtures were four throwaway git init repos under my scratchpad, never inside a worktree. No merge, approve, push, auto-merge, ruleset, workflow-dispatch or thread act; this is my one and only comment.
…ses, strict row and top-level grammar, integer schema_version, dead or leaky surface prefixes refuse, YAML errors are shape defects, a real bytewise-order test The independent verification of `122ec3fe` was PASS WITH NOTES over 81 adversarial runs: no attack got a wrong digest, a wrong mode, a missing file, a duplicated row, an unknown vocabulary word or a misordered file past the validator. The nine wrong outcomes were all permissiveness at the edges of the row grammar. All seven should-fixes are taken, with three of the recorded notes, and each one is pinned by a test that FAILS against `122ec3fe` and passes here (14 of the new cases fail against the old script; the two fixture-side ones fail against the old `Scratch.blobs()`). S1 — a `--manifest` the caller NAMED and that does not exist exited 0. The seat-holding pass now keys off `args.manifest is None`, so it covers the DEFAULT path only; a named absent path refuses `carve-unreadable`, exit 2, and `--json` says `refused` rather than `no-manifest`. The one branch in this file that is not fail-closed must not be the branch a typo selects. S2 — the row grammar is now stated PER DISPOSITION in one place (`ROW_KEYS_BY_DISPOSITION`), so a `not_moved` row carrying `destination` or `destination_path` refuses as its `sha256`/`git_mode` already did: the memo's § 1.2 `not_moved` row is `source_path + disposition + reason + evidence`, and such a row used to pass with its destination validated against `destinations:` on the way — arriving as "this file goes there" over a disposition saying it does not. `edits` stays legal on every disposition BY DESIGN, because whether an edit list agrees with the disposition is check 6's question and `carve-disposition-inconsistent` is the more precise finding. The TOP level is closed too (`TOP_LEVEL_KEYS`, `header:` optional), so a mistyped `moved_path:` refuses instead of being ignored in silence. S3 — `schema_version` must be the INTEGER 1: `true` and `1.0` are both equal to 1 in Python and used to verify a whole manifest. S4 — a `moved_paths:` prefix matching NO file at the carve commit refuses, with its own code `carve-surface-vacuous`. A new code rather than `carve-shape-invalid` because the document is well formed: the finding is a claim about the TREE, which is why check 1 cannot make it, and the remedy is to re-derive the prefix rather than to fix a grammar. (A row whose `source_path` is outside every prefix already refused; the shipped test for it stands.) S5 — an unparseable manifest is a DOCUMENT defect: `carve-shape-invalid` with the parser's own line and column. `carve-unreadable` now means the environment and the encoding only — and it is IN `REFUSAL_CODES`, because a closed vocabulary whose purpose is that callers branch on the code may not have a value outside itself. `test_every_code_the_validator_can_emit_is_in_the_vocabulary` scans this file's own raise sites, so the tuple cannot drift in either direction — the closure is asserted rather than documentary. S6 — Copilot's second review (12:23:07Z, no thread) was right: `Scratch.blobs()` claimed to read the tree "the way the validator reads it" and used neither `-z` nor `surrogateescape` nor a segment-aware prefix test. Without `-z` git QUOTES a path it cannot print, so the helper silently DROPPED exactly the filenames S7 needs. Fixed rather than re-documented, and duplicated rather than importing `in_surface`, so the fixture cannot agree with a broken `in_surface`. S7 — `test_the_path_order_key_survives_a_path_utf8_cannot_hold` asserted nothing, ran in process, and used two paths that agree under both orders. Replaced by a subprocess test over two REAL files whose bytewise order is the REVERSE of their code-point order (`\xff` decodes to U+DCFF = 56575; `\xee\x80\x80` is U+E000 = 57344): the bytewise order passes, the code-point order — which a `sorted()` implementation would have accepted — refuses `carve-path-order-violation`. The test asserts the fixture is actually divergent, so it cannot go vacuous again. Notes taken: `edits[].lines` are bounded by the line count of the blob the digest check has already read (a line past EOF is not the falsifiable claim the numbers are recorded for); two moved rows arriving at one `(destination, destination_path)` refuse `carve-file-duplicated`, since completeness was guaranteed on the source side only; and the module docstring records in one sentence that this manifest's `sha256: "<hex>"` diverges from the precedent's `digest: sha256:<hex>` because the memo's § 1.2 example does. Not taken: N3 (`destination_path` unvalidated), N6 (`leg` free-form), N7, N9 (PyYAML duplicate keys), N10, N12 — none is a hole in the floor and each needs a shape decision that is the memo's to make. 73 tests pass in tests/carve_manifest (was 53); manifest-digests, openspec-cli-pin and openreposhape-pin unchanged at 177; the documented invocation at the repository root still prints the NO MANIFEST line and exits 0. Refs #656 Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox) Verifier round 1 applied — Every item is pinned by a test that FAILS against
|
There was a problem hiding this comment.
🟡 Changes recommended
There are a couple of concrete input/contract gaps in the validator (notably --manifest path resolution vs --repo, and “closed map” enforcement for destinations.*) that should be fixed before relying on it as a gate.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
…eg} map; a relative --manifest resolves against --repo Two factual findings, both accepted. (1) `destinations.<key>` entries silently accepted extra keys despite the module docstring's "closed maps" claim. An entry is now closed to exactly `repository` (must match `owner/name`) and `leg` (one of the RULED `openRepoShape` legs — `code`, `spec`, `assembly`, declared as `LEGS`); an unknown or missing field refuses `carve-shape-invalid` naming the destination key and the offending field. Pinned by `test_a_destination_entry_with_an_unknown_key_refuses`. (2) A relative `--manifest` resolved against the caller's CWD rather than `--repo`, so `--repo <other-tree> --manifest docs/....yaml` pointed at the wrong file unless CWD happened to be the repo, despite the help text's "default: <repo>/...". A relative `--manifest` now resolves against `--repo` (an absolute one is untouched), and the result is always `.resolve()`d so every message — `NO MANIFEST`, `OK`, a refusal's render, `--json` — prints the absolute path actually read. Pinned by `test_a_relative_manifest_resolves_against_repo_not_cwd`. Both regression tests proven to fail against the pre-fix script (`git show HEAD:scripts/validate-carve-manifest.py`) and pass against the fix. 75 tests pass in tests/carve_manifest (was 73); tests/manifest_digests, tests/openspec_cli_pin and tests/openreposhape_pin unchanged at 177 passing. `python3 scripts/validate-carve-manifest.py` at the repo root still prints `NO MANIFEST ... (nothing to validate)`, exit 0. Refs #656 Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Lane: openxfactory-4-opendox-extraction Copilot round 3 taken: |
There was a problem hiding this comment.
🔵 Needs a closer look
A refusal message can still become unprintable for non-UTF-8 git paths (surrogateescape) and potentially violate the “no exit 1” contract unless the rendered output is sanitized.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
scripts/validate-carve-manifest.py:280
tree_at()decodesgit ls-tree -zpaths usingsurrogateescape, so any refusal detail that interpolates a path from the tree can contain surrogate code points (e.g., filenames with raw bytes like0xff). Printing such a refusal viarender()can raiseUnicodeEncodeErroron UTF-8 stdio with strict error handling, breaking the documented “no exit 1” contract. Consider sanitizing the rendered human message so it is always printable (e.g., escaping non-encodable code points).
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
|
Lane: openxfactory-4-opendox-extraction (formerly openxfactory-opendox) VERDICT: PASS WITH NOTES at head All eleven items the two fix rounds claim to close are closed, each proved by its own attack — and every one of them fails against the pre-fix behaviour the first verifier reported. One NEW defect (SHOULD-FIX) that the round-1 fix left reachable, one declared not-taken item re-measured, and one OPEN Copilot finding on this head which I judge NOT to be a defect, with the mechanism named. Items
Check-by-check, and the invented codes judged (item 2)I read the sources rather than the author's summary of them. Memo § 1.3 declares "Five ordered checks" plus "a sixth check belongs here and § 3.1's text does not have it", and exit
The author's two "not taken" calls, judged.
Attacks (134 runs; one per item the fix rounds claim, plus the brief's full list, plus my own)
DefectsNo BLOCKING defect. Every guarantee floor part 1 exists to give held under all 134 attacks: a file in no row refuses, a drifted digest refuses, a flipped mode refuses (both directions, on a real executable and on a symlink), an edit in no class refuses, a moved tree refuses, a dead surface prefix refuses, a misordered file refuses bytewise-and-not-by-code-point, and no right manifest was refused. S8 — SHOULD-FIX (NEW; a hole left inside the round-1 N2 fix). The destination-arrival uniqueness check is keyed on the manifest's own O1 — an OPEN Copilot finding on THIS head, which I judge NOT to be a defect. Copilot's fifth review ( NOTES (no action asked)
CI at this head — RED, estate-freeze class, not this PR'sSeven of the eight non-
Shared checkout
|
…pository, leg, destination_path), not the alias
The check_surface() duplicate-arrival check (`carve-file-duplicated`) keyed on
the manifest's own `destination` ALIAS — `(destination, destination_path)` —
rather than the real arrival. `destinations:` may legally carry two keys
sharing one `{repository, leg}` body, so two rows naming the two different
keys with one shared `destination_path` passed silently: keyed on the alias
they look like two different destinations, but they are one real file, and
one of them overwrites the other with the manifest not saying which — exactly
the outcome `carve-file-duplicated` exists to refuse.
Now keyed on `(destinations[key].repository, destinations[key].leg,
destination_path)`. A `destination` naming no key of `destinations:` falls
back to keying on the alias itself, in a shape (a 1-tuple) that can never
collide with a resolved 3-tuple: that case is check 5's
`carve-vocabulary-unknown` and check 4 must not crash ahead of it.
Decided, and recorded in the module docstring: two `destinations:` keys
sharing one body do NOT themselves refuse at check 1 (`carve-shape-invalid`).
Whether two rows actually collide at a real destination is check 4's
question, not check 1's — the document alone cannot answer it — and refusing
the alias regardless of row usage would make check 4's own fix permanently
unreachable by any subprocess run of this file (check 1 always runs first),
which is how every behavioural test in this suite is required to run.
Regression test added: two destination aliases with an identical
{repository, leg} body, two rows sharing a destination_path across them.
Proved against the pre-fix validator (`git show
HEAD:scripts/validate-carve-manifest.py` at d97371d): the fixture exits 0
there and exit 2 `carve-file-duplicated` under the fix.
One docstring sentence added at CarveRefusal.render(), the refusal-rendering
site Copilot's fifth review (5155397957, 14:03:37Z) named: a refusal detail
can interpolate a surrogateescape-decoded tree path, and this is safe printed
to stderr because CPython pins stderr's error handler to `backslashreplace`
regardless of PYTHONIOENCODING — reproving the re-verifier's 14-run finding
that this is unreachable rather than a defect. No code change for that item;
the review carries no comment thread, so this PR's comment is the record.
tests/carve_manifest: 76 passed (was 75). tests/manifest_digests,
tests/openspec_cli_pin, tests/openreposhape_pin: 177 passed, unchanged.
Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Lane: openxfactory-4-opendox-extraction Fix round 3 taken —
Diff: 2 files changed, 88 insertions(+), 5 deletions(-). All 4 review threads resolved; 0 unresolved. No merge, approve, auto-merge, ruleset, workflow or 🤖 Generated with Claude Code |
There was a problem hiding this comment.
🟢 Approval recommended
The new validator’s behavior is extensively pinned by subprocess-based tests (including vocabulary closure and edge cases) and the PR is additive-only with no modifications to existing code paths.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
There was a problem hiding this comment.
🟡 Changes recommended
The validator can crash (TypeError) when destinations: contains non-string keys because check_shape() doesn’t validate destination keys before later sorted(destinations) formatting.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
…sure test reads CarveRefusal calls by AST, not by quote style PRRT_kwDOTAvnrs6guuUN: a non-string `destinations:` key (PyYAML parses an unquoted `1:` as the int 1) passed check_shape() in silence and reached check_vocabularies' `sorted(destinations)` the moment a row's destination failed to match it, raising a raw TypeError and exiting 1 -- not one of the two exit codes this file's docstring promises. check_shape() now requires every destinations: key to be a non-empty string matching a label pattern (`^[a-z][a-z0-9_]*$`), refusing carve-shape-invalid and naming the offending key's repr, checked before descending into the entry's own shape (same first-failure-wins discipline as every other check here). Regression test proves the pre-fix crash against a25a323 (this round's base commit) and the post-fix refusal. PRRT_kwDOTAvnrs6guuUv: the refusal-code closure test's regex matched only a double-quoted CarveRefusal("...") first argument, so a single-quoted raise site would silently miss its own code -- the exact blind spot the test exists to close. Replaced the regex with an ast walk over Call nodes named CarveRefusal whose first argument is a string constant, which reads either quote style alike and fails loudly on a call whose first argument is not a literal, rather than skipping it. Kept the test's bidirectional contract (every raised code is ratified, every ratified code is raised). Swept the validator for every other sorted()/comparison/membership site a manifest-supplied value reaches: each is already isinstance(str)-gated in check_shape before use (source_path via _require_str, edits[].lines via an explicit int check, destination/reason/edit class all validated before their vocabulary checks run), except check_vocabularies' own sorted(destinations) -- which this same fix closes at its source, since check_shape always runs first. No other independent fix was needed. Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Lane: openxfactory-4-opendox-extraction Copilot round 4 taken,
🤖 Generated with Claude Code |
There was a problem hiding this comment.
🔵 Needs a closer look
The new tests hard-code /dev/null (a host-absolute path) instead of using os.devnull, conflicting with the repo’s “no host-absolute paths in committed files” rule and reducing portability.
Review details
Suppressed comments (1)
Previously missed (1) — in code that hasn't changed since the last review.
tests/carve_manifest/test_carve_manifest.py:127
- This hard-codes a host-absolute path ("/dev/null"), which conflicts with the repo constitution’s “no host-absolute paths in committed files” rule and also makes the test non-portable on non-POSIX platforms. Prefer
os.devnull(already imported) to express the null device without embedding an absolute path literal.
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Lite
… satisfiable on a merge ref and on main after the manifest lands (split-opendox § 3.1, part 1b) (#864) split-opendox-two-layer-product § 3.1, part 1b — the carve-manifest validator's revision semantics, on Brett Heap's word "merge 1b when green, then the manifest" (2026-09-09). Validator + driver only; no other file. Why: as landed by #839 (a faithful reading of the memo's § 1.3 text), check 2 refused unless HEAD resolved to `carve_commit` — unsatisfiable on a pull request's synthetic merge ref and on main after the manifest's own squash; the driver's real-repo test would have turned the suite red for every lane the moment the manifest landed. The memo's intent (§ 6 step 3) is realized instead: - Check 2: `carve_commit` must be a commit the repository carries and an ANCESTOR of the tested revision (`HEAD` or `--at`); identity is the trivial case; an annotated tag's object id peels and refuses. - Check 3: two passes — the referent's blob/mode must match the recorded digest (a manifest lying about its referent), then the tested revision's blob/mode must equal the referent's (`carve-digest-mismatch` "changed since the carve", "mode drift"; `carve-path-absent` "deleted since the carve"). - Check 4: the surface walk runs at the referent (vacuity) and at the tested revision (a file added under `moved_paths:` since the carve → `carve-file-undeclared`). - `OK … verified at <12>` when the revisions differ; `--json` gains `verified_at`; eleven refusal codes unchanged; exit 0/2 only; `docs/` lies outside every surface prefix, so the manifest's own landing never trips the walk. - 88 tests (14 proven discriminating against the pre-amendment validator); one Copilot round taken; independent verification on the PR. Refs #656 (stays OPEN). Lane: openxfactory-4-opendox-extraction Co-Authored-By: Claude Fable 5.1 <[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 (formerly openxfactory-opendox)
Refs #656 —
split-opendox-two-layer-product§ 3.1 part 1, the validator only. Basemainat56e69a11.FLOOR PART 1 of the RULED four-part floor (design.md § D6, RULING OQ-1) is a mapping manifest, and a manifest nothing checks is a claim rather than a floor. This PR lands the checker before its subject:
docs/opendox-carve-manifest.yamlis authored at the carve commit as the last thing on that tree (scout memo § 6 ceremony), so the validator has to exist first and has to stay green until then.NEW FILES ONLY — two of them. No existing file is touched.
scripts/validate-carve-manifest.pytests/carve_manifest/test_carve_manifest.pyThe six ordered checks, and what each refuses with
First failure wins; exit
0clean /2on any refusal,validate-openreposhape-pin.py's convention (there is deliberately no exit 1 — "a digest drifted" and "the bytes could not be read" are the same answer to "may this carve proceed"). Prose isFAIL <manifest path>: <code> — <detail>plus one fixed remediation trailer.carve-shape-invalid.schema_versionthe integer1(trueand1.0are equal to 1 in Python and refuse),kind: opendox-carve-manifest, the three consts (digest_algorithm: sha256,digest_source: raw_git_blob,path_order: bytewise_utf8), a 40-lowercase-hexcarve_commit, a labelcarve_tag, anowner/namesource_repository, a non-empty closeddestinations:map of{repository, leg},edit_classes:asserted equal to the ruling's list,not_moved_reasons:a subset of the known five, a non-emptymoved_paths:, a closed top-level key set (TOP_LEVEL_KEYS;header:is the one optional key, so a mistypedmoved_path:refuses rather than being ignored), and a row grammar stated per disposition in one place (ROW_KEYS_BY_DISPOSITION):moved_*rows requiregit_mode(quoted) +sha256+destination+destination_pathand may not carryreason/evidence;not_movedrows requirereason+evidenceand may not carrysha256/git_mode/destination/destination_path.editsis grammatically legal on every disposition by design — whether it agrees with the disposition is check 6's question. A row whosesource_pathlies under nomoved_paths:prefix refuses here too.carve-revision-mismatch. Refuses unless the repository'sHEAD, or--at <sha>, resolves tocarve_commit. This is the ceremony's intended pressure: a file that changes onmainbetween the manifest and the move reds the next pull request instead of surprising the destination.carve-digest-mismatch/carve-path-absent. Onegit ls-tree -r -z --full-tree <carve_commit>supplies every mode and the whole path set; then per moved rowgit cat-file blob <carve_commit>:<path>is re-hashed and the recordedgit_modecompared (a mode flip is the one change a blob digest cannot see, which is why the mode is carried). The blob is in hand here, soedits[].linesare also bounded by its line count — a line past EOF at the carve commit is not the falsifiable claim the numbers are recorded for (carve-shape-invalid).carve-surface-vacuous/carve-file-undeclared/carve-file-duplicated. Every declared prefix must match at least one file at the carve commit (a mistyped prefix otherwise contributes an empty surface while looking like coverage in review); every blob under amoved_paths:prefix appears in exactly one row; and no two moved rows may arrive at one(destination, destination_path), since completeness is otherwise guaranteed on the source side only. This isvalidate-openreposhape-pin.py:515-530re-aimed, and it is RULING OQ-1's "a file in no row … is an UNDECLARED MOVEMENT and the carve REFUSES" as running code. Prefix matching is segment-aware, soscripts/pkgdoes not swallowscripts/pkg_old/. A row for a path the surface does not carry reportscarve-path-absent, not "undeclared".carve-vocabulary-unknown.disposition∈ the three;destination∈ the keys ofdestinations:;edits[].class∈edit_classes:;reason∈not_moved_reasons:.carve-disposition-inconsistent, thencarve-path-order-violation.moved_with_declared_editwith empty/absentedits:ismoved_verbatimmislabelled;moved_verbatimornot_movedwithedits:is a contradiction. Then the rows' file order must equal their bytewise-UTF-8 sort — a ~430-row manifest is reviewed by diff, and a diff of an unsorted file hides a moved row inside a reordering.Three refusal codes the memo did not name, and why each is separate rather than folded into
carve-shape-invalid.carve-vocabulary-unknown(memo § 1.3 check 5 names the check but no code),carve-path-order-violation(§ 1.3 tacks the ordering onto check 6, which is the disposition code) andcarve-surface-vacuous(round 1). Each is separate because a reader acts differently on it: "you used a word that is not in the closed list", "re-sort the file", "this prefix names nothing — re-derive it from the tree"; and none is a malformed document. The eleven-code tuple isREFUSAL_CODES, asserted as a literal in the tests so a rename or reorder reds, and now also asserted complete —test_every_code_the_validator_can_emit_is_in_the_vocabularyscans the script's ownCarveRefusal(...)sites, so no code can be raised but unlisted (ascarve-unreadablewas) or listed but never raised.One deviation from the memo's numbering, stated so it is a decision and not a slip. The
edits[]entry grammar ({class, lines: [int…], note?}, at least one line) is enforced in check 1 rather than in check 6: it is a property of the document alone, and check 5 must readedits[].classbefore check 6 runs, so a vocabulary check that first had to defend itself against a malformed entry would be two checks wearing one name. Check 6 keeps what is its own — whether the entries agree with the disposition.How the rulings are encoded
EDIT_CLASSES = ("import rewrites", "path constants", "adapter calls"), andedit_classes:in the file is asserted equal to it, in order — declared and constant. Reading the list only from the file would let a manifest that declared its own fourth class validate against itself; the packet's "vocabulary parameterization" is not carried, so it refuses.test_a_declared_fourth_edit_class_refuses/test_a_reordered_edit_class_list_refuses.not_movedreason vocabulary carries the nuance: the file declares its own list (so the manifest says which reasons it uses) and the validator requires that list to be a subset ofKNOWN_NOT_MOVED_REASONS=stays_openxfactory_adapter,stays_openxfactory_governance,deleted_at_carve,superseded_by_split,replicated_at_destination. Declared and known, so neither a typo nor a silently widened vocabulary passes.replicated_at_destinationis what makes OQ-A'sscripts/output_boundary.pyrow expressible. A file created at a destination has no row, which the surface check enforces by construction: the manifest declares what LEAVES.MANIFEST_RELPATH = "docs/opendox-carve-manifest.yaml", the ruled path verbatim, with the convention break recorded in the module docstring rather than corrected; the manifest carries aheader:for the same note (permitted, unvalidated prose). Pinned bytest_the_manifest_path_is_the_ruled_one.carve_commitis the referent andcarve_tagis a label: a tag name incarve_commitrefuses ascarve-shape-invalid(test_a_tag_used_as_the_referent_refuses), and the remediation trailer says re-cut and recompute, never carry digests forward.No
contracts/schema, and no workflowThe shape checks live in code and no schema file ships under
contracts/— a new artifact there firesrelease-tag-gateand the digest inventory for a document with exactly one instance, andvalidate-openreposhape-pin.pyis the precedent for a pin-like claim carrying its own grammar. There is no new workflow either: the pytest driver is the seat, which is what § 8.2 needs.The fixture strategy
Each case builds a fresh git repository under
tmp_path—git init, four files on two commits, one of them (docs/outside.md) deliberately outsidemoved_paths:so the completeness check cannot pass by walking the whole tree — and then generates the manifest from that tree (clean_manifest()): realgit ls-treemodes, realsha256of real blobs, all three dispositions present. Every refusal is one deliberate mutation of that document. A hand-written fixture manifest would rot against the validator and a test that had to be edited whenever a digest changed would stop being evidence.The script is run as a subprocess — the documented invocation,
tests/manifest_digests/test_manifest_digest_sweep.py:26-45's reason — and also loaded by path once, for the constant assertions. The git environment is pinned, not inherited (GIT_CONFIG_GLOBAL=/dev/null,GIT_CONFIG_NOSYSTEM=1, a repository-local identity), the treatmenttests/openxwallet_pin/test_verify_pin.py:32-40documents: a CI runner has no ambient identity and a developer's global config can carrycore.hooksPathorcommit.gpgsign.Refusal-code coverage — every code is reachable, and reached
carve-shape-invalidtest_a_wrong_kind_refuses,test_a_flipped_const_refuses,test_an_abbreviated_carve_commit_refuses,test_an_uppercase_carve_commit_refuses,test_a_tag_used_as_the_referent_refuses,test_a_moved_row_without_a_destination_path_refuses,test_an_unquoted_git_mode_refuses,test_a_not_moved_row_carrying_a_digest_refuses,test_a_not_moved_row_without_evidence_refuses,test_a_moved_row_carrying_a_reason_refuses,test_a_declared_fourth_edit_class_refuses,test_a_reordered_edit_class_list_refuses,test_a_not_moved_reason_the_validator_does_not_know_refuses,test_a_row_outside_the_declared_surface_refuses,test_an_edit_with_no_line_numbers_refuses,test_an_edit_with_an_unknown_key_refuses,test_a_row_with_an_unknown_key_refuses,test_a_schema_version_that_is_not_the_integer_one_refuses(5 cases),test_an_unknown_top_level_key_refuses,test_a_not_moved_row_carrying_a_destination_refuses(3 cases),test_an_edit_line_past_the_end_of_the_blob_refuses,test_an_unparseable_manifest_is_a_document_defect(22 functions / 28 cases)carve-revision-mismatchtest_head_that_is_not_the_carve_commit_refuses,test_the_revision_check_runs_before_the_digests,test_an_at_that_resolves_elsewhere_still_refuses,test_an_unresolvable_at_refuses(4)carve-digest-mismatchtest_a_drifted_digest_refuses,test_a_digest_taken_at_the_wrong_revision_refuses,test_a_mode_flip_refuses,test_the_digest_check_runs_before_the_surface_check,test_json_reports_the_refusal_code(5)carve-path-absenttest_a_moved_row_for_a_path_the_commit_does_not_carry_refuses,test_a_not_moved_row_for_an_absent_path_refuses(2)carve-file-undeclaredtest_a_file_in_no_row_refuses(1)carve-file-duplicatedtest_a_file_in_two_rows_refuses,test_two_rows_arriving_at_one_destination_path_refuse,test_two_destination_aliases_sharing_a_body_still_refuse_a_duplicate_arrival(3)carve-surface-vacuoustest_a_moved_paths_prefix_that_matches_nothing_refuses(1)carve-vocabulary-unknowntest_a_fourth_disposition_refuses,test_an_undeclared_destination_key_refuses,test_an_edit_class_outside_the_closed_list_refuses,test_a_reason_the_manifest_does_not_declare_refuses(4)carve-disposition-inconsistenttest_a_declared_edit_with_no_edits_refuses,test_a_declared_edit_with_no_edits_key_at_all_refuses,test_verbatim_with_edits_refuses,test_not_moved_with_edits_refuses(4)carve-path-order-violationtest_rows_out_of_bytewise_order_refuse,test_the_row_order_is_bytewise_and_not_by_code_point(2)carve-unreadabletest_a_manifest_that_is_not_utf8_refuses_rather_than_crashing,test_a_named_manifest_that_does_not_exist_refuses,test_a_named_manifest_that_does_not_exist_refuses_in_json(3)Plus the clean pass,
--aton an earlier carve commit, the negative-space cases (a file outside the surface needs no row; a sibling directory is not swallowed by the prefix;header:is still accepted; an edit on the blob's last line still passes), two ordering pins (revision before digest, digest before surface), three--jsoncases, the fixture's own reading of the tree (test_the_fixture_reads_the_tree_the_way_the_validator_does), and six constant assertions including the vocabulary-completeness scan and the docstring's record of the digest-field divergence.The ABSENT-manifest behaviour, and why
Given no manifest at the default path the validator prints
NO MANIFEST <path> (nothing to validate)and exits 0. It is the one branch here that is not fail-closed and it is deliberate: this file lands before its subject, and a red suite on every pull request between now and the carve would train the lane to ignore the checker — the same failure modevalidate-manifest-digests.pyexists to close, one level up. Everything after the manifest appears is fail-closed. The pass keys off--manifestbeing unset, not off the file's absence: a--manifestthe caller NAMED and that is not there refusescarve-unreadable, exit 2 (round 1, S1) — otherwise the one branch here that is not fail-closed is the branch a typo selects, and a job verifying nothing reports green forever.test_the_real_repository_answers_at_the_ruled_pathruns the documented invocation from the repository root with no arguments and asserts exit 0 either way: today it asserts theNO MANIFESTline; the moment the § 6 ceremony lands the manifest at the carve commit, the same test asserts theOKline. It is a branch and never apytest.skip— a skip is a green bar indistinguishable from a pass, andpytest-suite.yml'sEXPECT_SKIPPED: "21"is an exact pin a conditional skip here would red.Where the suite collects it
Nothing needs registering.
pytest.inideclares notestpaths(it is the rootdir anchor, deliberately option-free) and the required job runspython3 -m pytest tests/ -q -m "not postgres", sotests/carve_manifest/is collected on every pull request. Noconftest.pyis added — the FR-043 hermeticity guard reaches the directory throughtests/conftest.py, which is whatpytest.ini's own header requires. No.github/**edit is needed or made:MIN_SELECTED/MIN_PASSEDare floors that 76 new passing tests only raise, andEXPECT_SKIPPEDis unmoved because nothing here skips.Evidence
python3 -m pytest -q tests/carve_manifest→ 77 passed (51 at the first push, 53 after the Copilot round, +20 in verifier round 1 = 73, +2 in Copilot round 3 = 75, +1 in verifier round 2 = 76, +1 in Copilot round 4 = 77).python3 -m pytest -q tests/manifest_digests tests/openspec_cli_pin tests/openreposhape_pin→ 177 passed, unchanged from base.python3 scripts/proposal-support.py . verify→proposal support verification ok.python3 scripts/doc-health.py --single-repo .→ 92 findings, byte-identical to the 92 the same tree reports without these two files (measured by holding them out and diffing the finding lines).python3 scripts/validate-carve-manifest.pyat the repository root →NO MANIFEST …/docs/opendox-carve-manifest.yaml (nothing to validate), exit 0.Verifier round 1 —
2bf3764cThe independent verification of
122ec3fewas PASS WITH NOTES over 81 adversarial runs against four self-built fixture repositories: no attack got a wrong digest, a wrong mode, a missing file, a duplicated row, an unknown vocabulary word, an inconsistent disposition, a misordered file or a wrong revision past the validator, and no right manifest was refused. The nine wrong outcomes were all permissiveness at the edges of the row grammar. All seven should-fixes are taken, with three of the recorded notes. Each is pinned by a test that fails against122ec3feand passes at this head — 14 of the new cases fail against the old script, and the two fixture-side ones fail against the oldScratch.blobs().--manifest <absent>exited 0. The seat-holding pass now keys offargs.manifest is None(default path only); a named absent path refusescarve-unreadable, and--jsonsaysrefused, notno-manifest.test_a_named_manifest_that_does_not_exist_refuses,…_in_jsonnot_moved+destination/destination_pathpassed (and the destination was even validated againstdestinations:). The row grammar is now per-disposition in ONE place (ROW_KEYS_BY_DISPOSITION), and the top level is closed as well (TOP_LEVEL_KEYS,header:optional).editsstays legal on every disposition deliberately — check 6 owns the contradiction andcarve-disposition-inconsistentis the more precise finding.test_a_not_moved_row_carrying_a_destination_refuses(3 cases),test_an_unknown_top_level_key_refuses,test_the_optional_header_key_is_still_acceptedschema_version: trueand1.0verified whole manifests (True == 1,1.0 == 1). Nowisinstance(v, int) and not isinstance(v, bool) and v == 1.test_a_schema_version_that_is_not_the_integer_one_refuses(5 cases)moved_paths:prefix matching NO blob at the carve commit passed silently. New codecarve-surface-vacuous, raised in check 4 because the finding is a claim about the tree that check 1 cannot make, and the remedy is to re-derive the prefix, not to fix a grammar. (The leaky direction — a row outside every prefix — already refused; its test stands.)test_a_moved_paths_prefix_that_matches_nothing_refusescarve-unreadablewhile an empty one wascarve-shape-invalid— two codes from two vocabularies for one kind of defect, one of them outside the closed tuple. A YAML parse error is nowcarve-shape-invalidwith the parser's line and column;carve-unreadablemeans the environment and the encoding only, and is now inREFUSAL_CODES, which is asserted complete by a scan of the script's own raise sites.test_an_unparseable_manifest_is_a_document_defect,test_every_code_the_validator_can_emit_is_in_the_vocabulary,test_the_refusal_vocabulary_is_the_ratified_listScratch.blobs()claimed to read the tree "the way the validator reads it" with neither-znorsurrogateescapenor a segment-aware prefix test. Without-zgit quotes a path it cannot print, so the helper silently dropped exactly the filenames S7 needs. Fixed rather than re-documented, and duplicated rather than importingin_surface(a fixture that borrowed it would agree with a brokenin_surfacetoo).test_the_fixture_reads_the_tree_the_way_the_validator_doestest_the_path_order_key_survives_a_path_utf8_cannot_holdasserted nothing, ran in process, and used two paths that agree under both orders — so no test distinguishedbytewise_utf8from a code-point sort. Replaced by a subprocess test over two real files whose bytewise order is the reverse of their code-point order (\xff→ U+DCFF = 56575;\xee\x80\x80= U+E000 = 57344): the bytewise order passes, the code-point order refuses. The test asserts the fixture is actually divergent, so it cannot go vacuous again.test_the_row_order_is_bytewise_and_not_by_code_pointNotes taken. (N1)
edits[].linesare bounded by the line count of the blob the digest check has already read —test_an_edit_line_past_the_end_of_the_blob_refuses, withtest_an_edit_on_the_last_line_of_the_blob_passesproving the bound is inclusive. (N2) two moved rows arriving at one(destination, destination_path)refusecarve-file-duplicatedwith "DESTINATION" in the message —test_two_rows_arriving_at_one_destination_path_refuse. (N5) the module docstring now records in one sentence that this manifest'ssha256: "<hex>"diverges from the release-digest inventory'sdigest: sha256:<hex>because the memo's § 1.2 example does, so the two documents' digest fields are not interchangeable —test_the_module_records_the_digest_field_divergence.Notes NOT taken, deliberately. N3 (
destination_pathunvalidated — its shape is the destination repositories' question and the memo's to answer), N4 (now taken as the closed top level), N6 (legfree-form), N7 (--helpdoes not restate the checks; matches the precedent), N8 (anassertinCarveRefusal.__init__— the source scan makes the closure real at zero runtime risk, where an assert inside an exception constructor could itself end a run at exit 1), N9 (PyYAML's silent duplicate keys — contained, and refused downstream), N10, N11 (the line counts in the table above are refreshed), N12, N13, N14 (not this lane's worktrees). None is a hole in the floor.Round-1 verification of the shared checkout: unchanged at
6612d323with an empty index, touched only byfetch; all work in this lane's own worktree.Copilot round 3 —
d97371d1Two more factual findings, both accepted. (1)
destinations.<key>entries were not actually closed despite the module docstring's "closed maps" claim: an unknown key inside one was silently admitted. An entry is now closed to exactlyrepository(must matchowner/name, the same patternsource_repositoryalready requires) andleg(one of the RULEDopenRepoShapelegs —code,spec,assembly— declared as the newLEGStuple); an unknown or missing field refusescarve-shape-invalidnaming the destination key and the offending field. Pinned bytest_a_destination_entry_with_an_unknown_key_refuses. (2) A relative--manifestresolved against the caller's CWD rather than--repo, so--repo <other-tree> --manifest docs/....yamlpointed at the wrong file unless CWD happened to be the repo, despite the help text's "default: /...". A relative--manifestnow resolves against--repo(an absolute one is untouched), and the result is always.resolve()d soNO MANIFEST,OK, a refusal's render and--jsonall print the absolute path actually read. Pinned bytest_a_relative_manifest_resolves_against_repo_not_cwd. Both tests proven to fail against the pre-fix script (git show HEAD:scripts/validate-carve-manifest.py) and pass against the fix; the refusal-code vocabulary is unchanged (no new code).tests/carve_manifestnow passes 75 (was 73);tests/manifest_digests,tests/openspec_cli_pinandtests/openreposhape_pinunchanged.Verifier round 2 —
a1205ef1S8 taken. The RE-VERIFICATION of
d97371d1(2026-09-09) found thecheck_surface()duplicate-arrival check (carve-file-duplicated) keyed on the manifest's owndestinationALIAS —(destination, destination_path)— not the real arrival.destinations:may legally carry two keys sharing one{repository, leg}body, so two rows naming the two different keys with one shareddestination_pathpassed silently: keyed on the alias they look like two different destinations, but they are one real file, and one of them overwrites the other with the manifest not saying which. Now keyed on(destinations[key].repository, destinations[key].leg, destination_path); adestinationnaming no key ofdestinations:falls back to keying on the alias itself, in a 1-tuple shape that can never collide with a resolved 3-tuple — that case is check 5'scarve-vocabulary-unknownand check 4 must not crash ahead of it. Pinned bytest_two_destination_aliases_sharing_a_body_still_refuse_a_duplicate_arrival, proved to fail (exit 0,OK) against the pre-fix script atd97371d1and pass (exit 2carve-file-duplicated) against the fix.Decided: two
destinations:keys sharing one body do NOT themselves refuse at check 1. The re-verifier asked whether a redundant alias should refuse ascarve-shape-invalidon its own. Answered no, and recorded in the module docstring: whether two rows actually collide at a real destination is check 4's question, not check 1's — the document alone cannot answer it — and refusing the alias regardless of row usage would make check 4's own fix permanently unreachable by any subprocess run of this file (check 1 always runs first), which is how every behavioural test in this suite is required to run.Copilot's suppressed comment answered as unreachable, not fixed. Copilot's fifth review (
5155397957, 14:03:37Z, ond97371d1) carries a suppressed comment with no thread to reply on:render()could interpolate asurrogateescape-decoded tree path and crash the "no exit 1" contract on unprintable bytes. The re-verifier proved it unreachable across 14 runs (3 refusal paths × 5 stdio configurations, plain and--json), because CPython pinssys.stderr's error handler tobackslashreplaceregardless ofPYTHONIOENCODING. One sentence recording that guarantee is now inCarveRefusal.render()'s own docstring; no code change. This PR comment is the record, since the review carries no comment thread.N3 stands, declared not taken.
destination_pathremains unvalidated shape (../../etc/passwdand/etc/passwdboth still pass): the shape is the memo's row example to constrain, not this validator's, and closing it is owed at the carve rather than here.One environmental note recorded and left alone.
--repo <typo>with the DEFAULT--manifeststill exits 0NO MANIFEST, because the seat-holding pass fires before any check that--reponames a real git repository — S1's argument, applied to the sibling flag. Reasonable to leave:--repohas no production caller today and the documented invocation is argument-free.tests/carve_manifestnow passes 76 (was 75);tests/manifest_digests,tests/openspec_cli_pinandtests/openreposhape_pinunchanged at 177.python3 scripts/validate-carve-manifest.pyat the repository root →NO MANIFEST …/docs/opendox-carve-manifest.yaml (nothing to validate), exit 0.Copilot round 4 —
3544d07eTwo more factual findings, both accepted. (1) A non-string
destinations:key — PyYAML parses an unquoted1:as the int1, not a label — passedcheck_shape()in silence and reachedcheck_vocabularies()'ssorted(destinations)the moment a row's (always-string)destinationfailed to match it, raising a rawTypeErrorand exiting 1: not one of the two exit codes this file's own docstring promises.check_shape()now requires everydestinations:key to be a non-empty string matching a label pattern (^[a-z][a-z0-9_]*$), refusingcarve-shape-invalidand naming the offending key'srepr— checked before the entry's own shape, the same first-failure-wins discipline every other check here keeps. Pinned bytest_a_non_string_destination_key_refuses, proved to fail (exit 1,TypeError: '<' not supported between instances of 'str' and 'int', a traceback) against the pre-fix script at this round's base commita25a3235, and to pass (exit 2carve-shape-invalid, no traceback) against the fix. (2) The refusal-code closure test's regex matched only a double-quotedCarveRefusal("...")first argument, so a single-quoted raise site would silently miss its own code — the exact blind spot the test exists to close. Replaced with anastwalk overCallnodes namedCarveRefusalwhose first argument is a string constant, which reads either quote style alike and fails loudly (rather than skipping) on a call whose first argument is not a literal. The test's bidirectional contract is unchanged: every raised code is ratified, every ratified code is raised.Swept for every other site a manifest-supplied value reaches a sort, comparison or hash. Every other candidate is already
isinstance(str)-gated incheck_shape()before use —source_pathvia_require_str,edits[].linesvia an explicitisinstance(line, int)check, anddestination/reason/edit["class"]all validated (or their row's disposition refused first) before their respective vocabulary checks run — exceptcheck_vocabularies()'s ownsorted(destinations), which is the same site this fix closes at its source, sincecheck_shape()always runs first. No other independent fix was needed.tests/carve_manifestnow passes 77 (was 76);tests/manifest_digests,tests/openspec_cli_pinandtests/openreposhape_pinunchanged at 177.python3 scripts/validate-carve-manifest.pyat the repository root →NO MANIFEST …/docs/opendox-carve-manifest.yaml (nothing to validate), exit 0.NOT DONE — deliberately, and each is somebody else's step
docs/opendox-carve-manifest.yamldoes not exist and is not created here; it is cut at the carve commit after the OQ-B pre-carve splits land (ruling order, steps 4 and 5).git filter-repo, no destination repository is touched.openspec/**,contracts/**or.github/**edit. No proposal, no spec delta, no schema, no workflow, no task box ticked — § 3.1 and § 8.2 stay unticked until the manifest exists.README.mdto add one to (the 53scripts/validate-*.pymentions are prose in situ, not a table), so no README change was made.Asking for Brett Heap's separate word to land this.
🤖 Generated with Claude Code
https://claude.ai/code/session_0139swz8Tq3FjNveDRR2SNPv