Skip to content

The openDox cutover runbook (OQ-J) and verify-carve-arrival.py, the destination-side check the manifest lacked (split-opendox CARVE arc, step 1) - #875

Merged
brettheap merged 8 commits into
mainfrom
change/opendox-cutover-runbook-and-arrival-verifier
Sep 10, 2026
Merged

brettheap merged 8 commits into
mainfrom
change/opendox-cutover-runbook-and-arrival-verifier

Conversation

@brettheap

@brettheap brettheap commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Lane: openxfactory-4-opendox-extraction

Refs #656 — step 1 of the CARVE arc, the first act after the manifest landed (#865 → 17167481).

Two authors, one tree — the collision is disclosed. Two windows dispatched an author for this step into the same worktree and branch. The first authored commits 1 and 2; it was stopped mid-flight and will not resume. The second (this author) re-read both files in full, re-ran their suites, and added commit 3. During the overlap both authors made whole-file writes to scripts/verify-carve-arrival.py and tests/carve_arrival/test_verify_carve_arrival.py, so the committed versions were re-read end to end rather than assumed intact: 131 tests green on the base of commit 2, 139 after commit 3, collection clean at 11,105.

What lands

docs/opendox-cutover-runbook.md (RULED OQ-J — "author the runbook before the first move") — 810 lines, Status: draft, Kind: runbook, in the estate's runbook style, on the openXwallet extraction's task 3.2 discipline: a rollback written before each phase is taken, because a rollback written afterwards is a description of what happened.

  • § 0 preconditions — the manifest landed at 17167481; carve_commit = b075fd91dc8fced8e1373825ba80220c33536bae; tag opendox-carve-0, a LABEL beside the commit and never the referent; validate-carve-manifest.py as the gate, not a courtesy.
  • § 1 the three provenance records (RULED OQ-I) — carved_from: in each assembly root's hand-authored contracts/manifest.yaml, carve_commit: in both pin files, and this runbook. No bare CARVE_COMMIT file — the wallet arc rejected that by name.
  • § 2 the floor's per-row form — 172 moved_verbatim, 146 moved_with_declared_edit, 136 not_moved (18 of them replicas) across 454 rows; the per-destination census opendox_code 123 / opendox_spec 56 / openxdox_code 92 / openxdox_spec 47 / opendox_root 0.
  • § 4 Phase 1 — RULED OQ-O levelling first, one small PR per repository, with the import root riding it (pytest.ini, conftest.py, pinned pytest), so a carve failure is never confounded with a scaffold difference.
  • § 5 Phase 2 — the legs, one destination at a time (RULED OQ-H): git filter-repo --paths-from-file <that destination's rows> --force from a fresh mirror of the now-public openxFactory, paths rewritten to the destination layout, the path file generated FROM the manifest. The shape, and why it is not a graft onto the scaffold's root: the wallet's carve pushed its filtered history as the new repository's OWN history and committed the scaffold ON TOP — it had no scaffold to graft onto. Here all six destinations already carry scaffold history and a required validate, so the filtered orphan is joined to the scaffold as a pull-request branch with --allow-unrelated-histories; rewriting the carved commits to sit on the scaffold's root would change every carved sha and the arrival would stop being reproducible from a re-run of filter-repo. No protected main is ever rewritten.
  • § 5.5 the two-commit leg shape — commit A places every row's bytes as at the carve commit, provable per row; commit B applies the declared edits[].lines (import rewrites / path constants / adapter calls) and nothing else, each re-verified. A reviewer reads 782 declared lines rather than 172,627.
  • § 5.6 what lands with commit B and has no row — the replicated_at_destination copies, and the RULED OQ-C creations named with --allow-created.
  • § 6 Phase 3 — the assembly roots: carved_from + gitlink + pin in ONE commit.
  • § 7 Phase 4 — RULED OQ-L: the openXdox assembly root as a git submodule of openxFactory, the gitlink IS the commit pin, with the estate's three-things-in-one-commit gitlink discipline and git cat-file -t verification.
  • § 8 Phase 5 — the § 5 remainder PR; § 9 the tags; § 10 rollback collected per phase; § 11 the re-cut procedure; § 12 Brett Heap's acts collected — every destination PR admin-merged on his word, the ruleset promotions, the tags, the pins, any re-cut.
  • RULED OQ-N (carve arc then build arc) and RULED OQ-K (FLOOR PART 2 restated as a mapping with declared replica multiplicity) are carried where they bite.

scripts/verify-carve-arrival.py (930 → 1,474 lines) — the destination-side check the manifest lacked, named by the moves memo § 2.3: "This needs a verifier that does not exist." It lives in openxFactory beside the manifest and is never copied into six repositories.

Six refusal codes, closed and complete (the tuple is held complete by an AST scan of the file's own raise sites): arrival-missing, arrival-digest-mismatch, arrival-undeclared-edit, arrival-undeclared-file, arrival-carved-from-mismatch, arrival-unreadable. Exit 0 or 2, never 1. --manifest, --destination <closed key>, --dest-root, --source-repo, --phase A|B, --allow-created, --replica-at, --json. The ownership split is stated rather than assumed: every carve-* code is a manifest that disagrees with openxFactory and is validate-carve-manifest.py's finding; every arrival-* code is a destination that disagrees with the manifest.

No destination configured is a deliberate exit 0 — NO DESTINATION, keyed off --destination being ABSENT and never off a lookup failing, so a misspelled destination still refuses. It is the same seat-holding branch validate-carve-manifest.py carries, for the same reason: this file lands before the trees it checks, and a required suite that went red for every lane between here and the carve would train the lane to ignore it. It is a BRANCH and never a pytest.skip — pytest-suite.yml pins EXPECT_SKIPPED exactly, and my tests add zero skips.

Tests tests/carve_arrival/test_verify_carve_arrival.py — 71 tests, subprocess driver over throwaway fixtures (a scratch source repository at a carve commit, a manifest generated FROM that tree, a destination materialised from its own rows), one per code, both phases, plus the seat test against the real repository.

Commit 3 — two measured repairs, both found by running against the LANDED manifest

  1. docs/branch-protection.md refused a faultless openDox-spec leg. docs/ IS a declared root for opendox_spec, and the scaffold's posture document sits beside the row placed there, in no leg's REQUIRED_FILES. Admitted as SCAFFOLD, not left to --allow-created: the latter records that the destination ASSEMBLED the file, and a document whose whole subject is provenance may not arrive carrying a false one.
  2. --replica-at SOURCE=DESTPATH. All 18 replicated_at_destination rows carry no destination, no destination_path, no sha256 and no git_mode — measured, and RULED OQ-C is why. Nothing in the document says where a replica landed, so the verifier does not guess; the operator declares it, and a declared replica is answered with the two codes a ROW gets, so the vocabulary stays at six. It withdraws nothing: an undeclared replica is still admitted by identity with its carve blob. test_conformance.py is deliberately left undeclared — its implementation-aware block is rewritten at each destination by design.

Verifier round 1 — head 41849549

INDEPENDENT VERIFICATION of 8aa6f92e returned PASS TO LAND with three BLOCKING corrections owed to § 5.2–5.4 (comment 5610458343), plus five should-fixes and six open bot threads. All of it is now answered in one commit, and every open review thread is replied to and resolved. Nothing has moved: no destination repository holds one carved byte.

The three blocking corrections — the part an operator pastes. Each reproduced against git-filter-repo ed61b405 on a scratch repository of two commits and three files with one listed, and the corrected sequence then proved end to end against the landed manifest.

  1. § 5.3's path file filtered NOTHING. --paths-from-file reads a plain line as a path SELECTOR and a source==>destination line as a RENAME; the generator emitted renames only, so the run renamed what it named and kept everything else — all three scratch files where one was listed, and 5,404 openxFactory files on the real opendox_spec leg. Against a PUBLIC destination that is the difference between publishing 56 files and publishing the repository, and the arrival verifier would not have caught it: its walk is scoped to the declared roots, so openspec/, contracts/ and .github/ would have ridden in silently. § 5.3 now emits both lines per row.
  2. § 5.4's --refs "$CARVE_COMMIT" retargeted NOTHING. A raw object id is not a ref: the rewrite was written and no ref pointed at it, refs/heads/main kept the unfiltered tree, and § 5.5's merge would have taken unfiltered history. § 5.4 now creates carve-src at the carve commit and rewrites that ref; § 5.5 fetches it by explicit refspec, because partial mode leaves the mirror's other refs unfiltered and a bare git fetch carved puts them within reach of a mistyped merge. The neighbouring claim that filter-repo removes origin when it finishes did not hold in any run made for this document and is withdrawn.
  3. § 5.2 + § 5.4 could not run at all. git clone then git checkout "$CARVE_COMMIT" leaves two HEAD reflog entries and filter-repo refuses a clone that is not fresh. § 5.2 now takes a --mirror clone, which needs no --force, and states --force as the fallback with the reason the check exists.

A fourth defect, found while proving those three: § 5.2's CONTROL validated nothing and reported success. validate-carve-manifest.py holds a seat when its default <repo>/docs/… path is not a file — and a mirror has no working tree, and the manifest does not exist at b075fd91 in any case, having landed at 17167481. Both § 5.2 and § 5.5 now name the manifest absolutely; unlike the manifest validator, the arrival verifier is fail-closed about it and refuses arrival-unreadable.

§ 5.2–5.5 PROVED END TO END, 2026-09-09. From a fresh mirror of openxFactory at b075fd91: the opendox_spec leg's 112-line path file carved carve-src to exactly its 56 files under contracts/, docs/ and examples/ and nothing else; single-refspec fetch; --allow-unrelated-histories merge onto a scaffold branch; phase A: 56 rows arrived, 56 digests verified, 57 files walked, none undeclared (1 scaffold). The same three steps as § 5 printed them before this round produced, in order: a refusal to start, a rewrite no ref pointed at, and a tree still holding all 5,404 files.

Five holes in the verifier, each pinned by a test proven to fail against 8aa6f92e.

was is
exit 1 existed — a row missing destination_path: escaped main() as a KeyError traceback, against a docstring that says exit 0 or 2 only (Copilot thread, reproduced on the real manifest) main() owns the contract: every unnamed Exception renders as arrival-unreadable and exit 2; KeyboardInterrupt/SystemExit left alone. The ast.literal_eval guard also names SyntaxError (Copilot's second thread)
directory symlinks were invisible — os.walk puts them in dirnames, never descends, never reads: a tree of undeclared content behind one name returned OK (Codex P2) git stores such a link as a 120000 blob, so it is pulled out of dirnames and answered as any other entry is
an empty rowless file was admitted as "replica" — two of the 18 replica rows are fixtures/empty/*/.gitkeep, so the empty digest admitted any empty created file empty blobs are excluded from the identity set: true of the bytes, false of the file, the same error the .gitkeep-by-name rule already refused. An empty replica is admitted by --replica-at, the stronger claim anyway
--destination openxdox_root was unreachable (Codex P1) — destinations: maps the places rows GO and openXdox's assembly root receives none, so RULED OQ-I's second provenance record could not be checked by the tool that checks the first --assembly-root <owner>/<name> addresses a root by the repository it is, runs the carved_from: check, and reports the destinations: key where there is one. § 6 and § 7 both invoke it
scaffold admission took its allowlist from its subject — SECRET CARVE PAYLOAD at docs/branch-protection.md returned OK; a .gitkeep with content was admitted anywhere; and REQUIRED_FILES was read from the destination's working tree, so an arrival commit adding a path to its own tests/test_leg_shape.py admitted that path the allowlist is read from --dest-base (default origin/main) and every scaffold admission's bytes must equal the destination's own copy there. Without a baseline the run still passes and says scaffold admissions by NAME ONLY, so the weaker claim never passes for the stronger

The admission itself is kept, for the author's stated reason: --allow-created would record that the destination ASSEMBLED a document whose whole subject is provenance. --json with no --destination now carries destinations as a list plus destinations_unreadable, rather than a comma-joined sentence that was sometimes an apology (Copilot thread).

Three further corrections after the first push, from re-review of the new head.

  • SonarCloud pythonsecurity:S8705 (2a08d512 → d4cc2bf3), and right about the shape even though the exploit is narrow: --dest-base is the ONE value this tool hands to git that comes from the COMMAND LINE rather than from the manifest. subprocess is called with an argument list and never a shell, so there is no shell injection — but f"{ref}^{{commit}}" with a ref beginning -- is read by git rev-parse as an option and not a revision. It is now validated at the boundary against a conservative allowlist (never a leading dash, ≤ 256 chars), and --end-of-options is passed as well, so the two defences are independent. Pinned over --dest-base=--upload-pack=/bin/sh, =-x, =origin/main; rm -rf / and =$(id) — the = form matters, because argparse itself rejects a separate dash-leading argument and would have hidden the case.
  • --replica-at and --allow-created could name a path outside --dest-root (two Copilot threads, one defect on two flags; d4cc2bf3 → dad5cb97). Path("/dest") / "/etc/passwd" is /etc/passwd — an absolute right-hand operand REPLACES the root — so --replica-at …=/etc/passwd read a file the run was not about and reported the answer as the destination's; an out-of-root --allow-created value could never match and passed as a silent admission the operator believed they had made. dest_relative() now guards both on scripts/proposal-support.py's own requirement. Non-canonical forms refuse rather than being normalised, because the value has to EQUAL a path the walk produced.
  • dest_relative() did not catch a Windows-style backslash on POSIX (two Copilot threads, one point; dad5cb97 → 6c4876ff). value.replace(os.sep, "/") is a no-op where os.sep is already /, so src\pkg\x.py passed the canonicality test as one long filename and matched nothing under a walk that joins with / — the same silent admission the guard exists to prevent. The replacement still runs first, so a Windows host converts as intended; what refuses is a backslash that survives it. Both regression cases are platform-guarded, because on Windows the value is legitimate.
  • A C: drive or //server/share UNC prefix slipped past posixpath.isabs (Copilot; 6c4876ff → 41849549). ntpath.splitdrive names both on every platform, so that case is asserted everywhere rather than platform-guarded.
  • § 2's declared-roots column carried trailing slashes where a run prints none (Copilot). It is now spelled exactly as the verifier prints it, and the section says that all five cells are asserted against the landed manifest by test_the_real_manifest_declares_the_roots_the_runbook_names — the table is checked rather than described.

Round-1 evidence. pytest -q tests/carve_arrival tests/carve_manifest — 159 passed (71 + 88), 0 skipped. 14 of the first 17 new tests fail against git show 8aa6f92e:scripts/verify-carve-arrival.py; the other three are regression guards (a file symlink still refuses; a declared empty replica still verifies; the landed manifest still gives openXdox's root no key). proposal-support verify → ok. doc-health --single-repo . run in ONE checkout, this round's three files against 8aa6f92e: 76 findings, BYTE-IDENTICAL — same 10 critical / 6 error / 47 warning / 13 info, no line changed. All fourteen review threads answered and resolved; 0 unresolved. SonarCloud green.

Still NOT DONE, unchanged: no file has moved; no scaffold levelling beyond what landed separately; docs/opendox-carve-manifest.yaml, scripts/validate-carve-manifest.py, openspec/**, contracts/** and .github/** untouched. Status: draft, and § 5's own text says why. Asking for Brett Heap's separate word to land this.


Evidence

  • pytest -q tests/carve_arrival tests/carve_manifest — 139 passed (51 + 88), 0 skipped. Collection over tests/ clean: 11,105 collected, 0 errors. The whole suite exceeds 15 minutes locally (killed at ~34%); the required pytest-suite job owns it.
  • Real-manifest dry run at b075fd91, the proof the approach is sound: 56 opendox_spec rows placed byte-identical verify at phase A; the one declared-edit row rewritten on exactly its six declared lines verifies at phase B; phase A over the commit-B tree refuses arrival-digest-mismatch, naming the file and both digests; a declared replica verifies, refuses arrival-digest-mismatch when drifted and arrival-missing when absent.
  • python3 scripts/proposal-support.py . verify → proposal support verification ok.
  • doc-health --single-repo . vs base 17167481: 10 critical / 6 error / 47 warning / 14 info, identical, 77 findings both sides. The finding sets are byte-identical but for ONE line: staged-candidate-aging n=70 → n=71, the new Status: draft runbook joining the draft population. Canon share 39.8% → 39.6% because governance words grew by 5,173 with canon words unchanged — the documented behaviour of the ratio when a draft lands, not a regression. The runbook's Status: header adds no new finding class.

NOT DONE

  • No file has moved. No destination repository holds one carved byte; nothing was pushed to any of the six.
  • No scaffold levelling (RULED OQ-O, Phase 1) — that is the next PR, six small ones.
  • docs/opendox-carve-manifest.yaml and scripts/validate-carve-manifest.py are untouched; so are openspec/**, contracts/** and .github/**.
  • Status: draft and the document says why: § 3 of the ratifying change carries no task naming this file — OQ-J created the obligation, and the change's own text is amended by a later act, not by this runbook. No gate refuses a carve step that skips it.
  • The verifier proves nothing about an UNDECLARED replica's fidelity, and it counts rather than refuses an unapplied declared edit. Both limits are stated in the file and in the runbook.

Asking for Brett Heap's separate word to land this.

🤖 Generated with Claude Code

Summary by Sourcery

Establish the openDox CARVE cutover procedure and add destination-side verification before any carved files are moved.

New Features:

  • Add a draft openDox cutover runbook defining provenance, phased arrivals, verification, rollback, re-cutting, and release responsibilities.
  • Add a destination-side carve-arrival verifier for validating moved files, declared edits, replicas, created files, and assembly provenance.
  • Add subprocess-based coverage for successful arrivals, refusal conditions, provenance checks, replica declarations, and the no-destination seat-holding behavior.

Enhancements:

  • Document the manifest floor and destination-side proof model, including the two-commit arrival workflow and scaffold admissions.
  • Provide structured refusal codes, human-readable remediation, JSON output, and explicit phase handling for carve verification.

Documentation:

  • Document the complete openDox CARVE cutover procedure and link it from the repository README.

Tests:

  • Add comprehensive hermetic tests covering the verifier's refusal vocabulary and destination validation behavior.

brettheap and others added 3 commits September 9, 2026 18:46
RULED OQ-J (Brett Heap, #656, 2026-09-09): author
`docs/opendox-cutover-runbook.md` before the first move. This is that
document, on the openXwallet extraction's task 3.2 discipline — a rollback
written BEFORE each phase is taken, because a rollback written afterwards is
a description of what happened.

It carries: the seven preconditions, with `validate-carve-manifest.py` as the
gate rather than a courtesy; the named carve commit `b075fd91` and RULED
OQ-I's three provenance records (`carved_from:` in each assembly root's
hand-authored `contracts/manifest.yaml`, `carve_commit:` in both pin files,
and the runbook), with no bare CARVE_COMMIT file; the floor's per-row form
and the per-destination row/edit-line census the manifest actually landed
with; RULED OQ-H's history-preserving `filter-repo` method, why the openXwallet
precedent transfers now that the source is public, and the one fact that does
not transfer — six scaffolds that already have history, so the filtered
orphan is joined with `--allow-unrelated-histories` as a PULL-REQUEST branch
and no protected `main` is ever rewritten; the two-commit leg shape (A
byte-identical, B the declared lines and nothing else); RULED OQ-O's
levelling first, with the import root riding it; RULED OQ-L's openXdox
submodule pin and the import mechanism the memo flagged as undeclared; the
§ 5 remainder; RULED OQ-N's carve/build split and RULED OQ-K's restated
FLOOR PART 2; rollback collected per phase; the re-cut procedure; and the six
acts reserved to Brett Heap.

Status: draft, and the document says why: § 3 carries no task naming this
file, so the obligation is OQ-J's and the change's own text is amended by a
later act, not by this runbook.

Lane: openxfactory-4-opendox-extraction

Co-Authored-By: Claude Fable 5.1 <[email protected]>
`validate-carve-manifest.py` validates the manifest AGAINST openxFactory and
says nothing about whether anything ARRIVED — the moves memo § 2.3 names the
gap in one line, "this needs a verifier that does not exist". This is it, and
`docs/opendox-cutover-runbook.md` is the procedure it serves.

Run from openxFactory with a destination checkout in hand; it is never copied
into six repositories, because the manifest lives here and a verifier copied
six ways is six things to keep in step with one document.

FIVE FINDINGS AND ONE ENVIRONMENT CODE, closed, ordered by the check that
raises them: `arrival-missing`; `arrival-digest-mismatch` (bytes AND mode —
every moved row at phase A, every `moved_verbatim` row in BOTH phases);
`arrival-undeclared-edit` (phase B: the diff against the carve blob touches a
line no `edits[].lines` declares — the refusal names the lines and carries a
unified-diff excerpt); `arrival-undeclared-file`;
`arrival-carved-from-mismatch` (RULED OQ-I, at an assembly root);
`arrival-unreadable`. Exit 0 or 2 and nothing else.

THE OWNERSHIP SPLIT IS DELIBERATE: every `carve-*` code is a manifest that
disagrees with openxFactory, every `arrival-*` code is a destination that
disagrees with the manifest. So a manifest defect — an unparseable document, a
source blob whose digest is not the row's — refuses here as
`arrival-unreadable` NAMING `validate-carve-manifest.py`, rather than this
file inventing a second, weaker opinion about the same bytes.

The declared roots are COMPUTED from the manifest (the minimal directories a
destination's rows land under), never configured. Three ordered admission
rules cover what the manifest cannot declare: the scaffold, read from the
DESTINATION's own `tests/test_leg_shape.py` `REQUIRED_FILES` (parsed with
`ast`, never imported — a destination checkout is untrusted input); a replica
admitted by identity with its blob at `carve_commit`, because a
`replicated_at_destination` row carries no destination and no digest by the
row grammar; and `--allow-created`, one exact path at a time and no wildcard,
for the files RULED OQ-C says get no row.

What it does not prove is stated in the file rather than discovered: a
drifted replica is unverifiable by construction, and an unapplied declared
edit is COUNTED and printed rather than refused, because it touches no
undeclared line and the leg's own `validate` refuses it.

The seat-holding pass (no `--destination` -> `NO DESTINATION`, exit 0) is the
manifest validator's own not-fail-closed branch, and for the same reason: this
lands BEFORE the trees it checks, and no destination holds one carved byte
until Phase 2 of the runbook runs. It keys off `--destination` being ABSENT,
never off a lookup failing — a named destination that is misspelled refuses.

Driver: `tests/carve_arrival/test_verify_carve_arrival.py`, 43 tests, every
code pinned by a case that can only pass if that check runs, all through the
documented subprocess invocation over a throwaway source repository and a
destination materialised from the manifest's own rows. Zero skips: the
required suite pins `EXPECT_SKIPPED` exactly, and a skip reads as a pass.

Lane: openxfactory-4-opendox-extraction

Co-Authored-By: Claude Fable 5.1 <[email protected]>
document, and declared replicas

Both findings come from running the verifier against the LANDED manifest
rather than against its own fixtures, and each is one the fixture suite
could not have produced.

1. `docs/branch-protection.md` refused a faultless openDox-spec leg.
   `docs/` IS a declared root for `opendox_spec` — the manifest places
   `docs/ideation-dashboard-session-runbook.md` there — and the scaffold's
   posture document sits beside it, in no leg's `REQUIRED_FILES` and no
   row's `destination_path`. Measured: a 56-row openDox-spec destination
   built from the manifest at b075fd9 refused `arrival-undeclared-file` on
   a file the carve never touched. It is admitted as SCAFFOLD, not left to
   `--allow-created`, because the two claims differ: `--allow-created`
   records that the destination ASSEMBLED the file, and a document whose
   whole subject is provenance may not arrive carrying a false one.

2. `--replica-at SOURCE=DESTPATH` — the replica question, answered where it
   can be. All 18 `not_moved / replicated_at_destination` rows carry no
   `destination`, no `destination_path`, no `sha256` and no `git_mode`
   (measured, not inferred: the row grammar gives a `not_moved` row none of
   them, RULED OQ-C). Nothing in the document says where a replica landed,
   so the verifier does not guess — the OPERATOR declares it, which is the
   runbook's per-leg table in machine form. A declared replica is then
   answered with the two codes a ROW is answered with, `arrival-missing`
   and `arrival-digest-mismatch`, so the vocabulary stays at six; and it is
   admitted in the walk by NAME rather than by a coincidence of bytes.

   This withdraws nothing. An UNDECLARED replica is still admitted by
   identity with its carve blob and still counted, so every run that passes
   today still passes. What declaring buys is the two questions digest
   admission cannot ask — is the replica there at all (the memo's own worry
   about `scripts/corpus_adapter.py`), and is it the carve's bytes at the
   path the operator says. `tests/corpus-adapter/test_conformance.py` is
   deliberately left undeclarable-by-choice: its implementation-aware block
   is rewritten at each destination by design.

The runbook records both, and its per-leg phase-B invocation now carries the
three permanent neutral replicas (RULED OQ-A) plus `corpus_adapter.py` while
it is one (RULED OQ-Q).

Evidence: `pytest -q tests/carve_arrival tests/carve_manifest` 139 passed
(131 before; +8 tests, one per new behaviour). Real-manifest dry run at
b075fd9 — 56 `opendox_spec` rows placed byte-identical verify at phase A;
the declared edit applied on exactly its six declared lines verifies at
phase B; phase A over the commit-B tree refuses `arrival-digest-mismatch`; a
declared replica verifies, and refuses `arrival-digest-mismatch` when
drifted and `arrival-missing` when absent. doc-health `--single-repo`
unchanged at 10 critical / 6 error / 47 warning / 14 info.

Lane: openxfactory-4-opendox-extraction

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 9, 2026 23:25

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 1 day and 6 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

@sourcery-ai

sourcery-ai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR authors the pre-move openDox CARVE cutover procedure and adds the destination-side verifier and hermetic test suite needed to prove arrivals against the landed manifest, while deliberately performing no scaffold levelling, repository carve, or destination push.

Sequence diagram for two-commit destination arrival verification

sequenceDiagram
    participant Operator
    participant Source as SourceRepository
    participant Destination
    participant Verifier as verify-carve-arrival.py
    Operator->>Verifier: invoke phase A
    Verifier->>Source: read carve_commit blobs
    Verifier->>Destination: read destination paths and modes
    Verifier-->>Operator: verify byte-identical rows
    Operator->>Destination: apply declared edits in commit B
    Operator->>Verifier: invoke phase B
    Verifier->>Source: read carve_commit blobs
    Verifier->>Destination: read edited files
    Verifier-->>Operator: verify declared lines only
Loading

Flow diagram for destination-side CARVE arrival verification

flowchart LR
    M["Landed carve manifest"] --> V["verify-carve-arrival.py"]
    S["Source repository at carve_commit"] --> V
    D["Destination checkout"] --> V
    V --> A["Phase A: byte and mode identity"]
    V --> B["Phase B: declared-line edits"]
    V --> R["Declared replica checks"]
    V --> U["Undeclared-file and provenance checks"]
    A --> O["Exit 0: verified"]
    B --> O
    R --> O
    U --> O
    A --> X["Exit 2: arrival refusal"]
    B --> X
    R --> X
    U --> X
Loading

File-Level Changes

Change Details Files
Adds a draft openDox CARVE cutover runbook defining provenance, phased execution, verification, rollback, re-cutting, and operator responsibilities before any destination move.
  • Records the named carve commit, tag semantics, three provenance records, manifest census, and destination mapping.
  • Defines scaffold levelling, filter-repo history preservation, unrelated-history PR joins, two-commit arrival legs, assembly pins/gitlinks, submodule integration, and final source shedding.
  • Documents phase-specific rollback, floor accounting with replica multiplicity, re-cut procedure, tagging, and Brett Heap’s required administrative acts.
  • Links the new runbook from the repository README.
docs/opendox-cutover-runbook.md
README.md
Introduces a destination-side CARVE arrival verifier with closed refusal codes and explicit phase, provenance, admission, replica, and seat-holding behavior.
  • Checks moved rows for presence, git mode, carve-commit digests, and declared-only phase-B line edits.
  • Detects undeclared files under manifest-derived roots while admitting scaffold files, named created files, and replicas under explicit operator declarations.
  • Validates assembly-root carved_from provenance and distinguishes destination arrival failures from manifest-validator findings.
  • Supports human or JSON output, repeatable --allow-created and --replica-at options, strict destination/phase requirements, and exit codes 0 or 2.
  • Keeps an intentional no-destination exit-0 branch so the required suite remains green before destination repositories exist.
scripts/verify-carve-arrival.py
Adds hermetic subprocess tests covering the verifier’s behavior against generated scratch repositories and destinations.
  • Generates manifests and destination trees from throwaway carve commits rather than relying on hand-authored byte fixtures.
  • Covers all six refusal codes, both phases, mode and digest mismatches, declared edits, insertions, undeclared files, created-file and replica admissions, carved_from provenance, malformed inputs, and source-repository ownership errors.
  • Pins the refusal-code vocabulary and uses AST checks to ensure every verifier refusal site stays within the closed set.
  • Tests the real repository’s no-destination seat branch and validates manifest-derived declared roots.
tests/carve_arrival/test_verify_carve_arrival.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The verifier currently has confirmed exit-code contract violations (uncaught exceptions leading to exit 1) and a JSON output structure issue that should be addressed before relying on it operationally.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds the operational and verification foundation for the openDox/openXdox CARVE arc: a draft cutover runbook plus a destination-side “arrival” verifier (with subprocess-driven tests) so the manifest’s declared movements can be proved against a destination checkout before any files are actually moved.

Changes:

  • Add scripts/verify-carve-arrival.py to verify destination checkouts against the carve manifest across phase A (byte-identical) and phase B (declared-lines-only edits).
  • Add tests/carve_arrival/test_verify_carve_arrival.py to pin the refusal vocabulary and exercise each refusal path via subprocess invocation.
  • Add a draft runbook documenting the phased procedure and link it from the README.
File summaries
File Description
docs/opendox-cutover-runbook.md Draft end-to-end CARVE arc runbook (preconditions, phases, rollback, re-cut).
scripts/verify-carve-arrival.py New destination-side verifier with closed refusal vocabulary and JSON/human output modes.
tests/carve_arrival/test_verify_carve_arrival.py Subprocess-based test suite covering verifier behavior, refusal codes, and “seat” behavior.
README.md Adds the runbook link in the core docs index section.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread scripts/verify-carve-arrival.py Resolved
Comment thread scripts/verify-carve-arrival.py Resolved
Comment thread scripts/verify-carve-arrival.py Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8aa6f92ebe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/verify-carve-arrival.py Resolved
Comment thread docs/opendox-cutover-runbook.md Resolved
Comment thread scripts/verify-carve-arrival.py Resolved
@brettheap

Copy link
Copy Markdown
Contributor Author

Lane: openxfactory-4-opendox-extraction

INDEPENDENT VERIFICATION of head 8aa6f92ebe3cd2ef4ee9776f2d8da2b60a77a96a — PASS TO LAND, with three BLOCKING corrections owed to § 5.2–5.4 before the first leg is carved. Adversarial re-verification in an own detached worktree, own fixtures (a scratch source repository at a scratch carve commit, a manifest generated from it, destinations materialised from its rows), plus the two real legs materialised from the landed manifest at b075fd91. Nothing merged, approved, pushed or resolved.

PASS

  1. Scope — exactly four files: the runbook (676), the README index row (+1), scripts/verify-carve-arrival.py (1,085), tests/carve_arrival/ (1,081). Nothing under openspec/**, contracts/**, .github/**; docs/opendox-carve-manifest.yaml and scripts/validate-carve-manifest.py untouched. Merge-base 17167481.
  2. Runbook against the landed manifest — every § 2 figure recomputed from docs/opendox-carve-manifest.yaml and EXACT: 454 rows, 172 / 146 / 136, 18 replicas (all four fields absent on all 18, as claimed), 318 moved, 782 declared lines (import rewrites 635, path constants 121, adapter calls 26), the per-destination census 123/56/92/47/0, and every declared-roots cell (src/opendox,tests; contracts/schemas,docs,examples/ideation-dashboard; scripts,src/openxdox,tests; contracts/schemas,examples/ideation-dashboard) reproduced by my own minimal-prefix computation. Each step cites the ruling it realizes (OQ-H/I/J/K/L/N/O/Q); rollback precedes every phase; Brett's acts collected in § 12; Status: draft + Kind: runbook conform to docs/document-lifecycle.md and to the four other draft runbooks; every task id cited (1.3, 2.2a:613, 2.4, 3.2–3.8, 4.1/4.2/4.6, 5.1/5.4/5.5/5.6/5.7) exists in tasks.md. (Note: the PR body's "759 declared lines / 619 / 116 / 24" is the pre-fix-round count — the landed doc's 782 is right. OQ-O reads as "Phase 1, before any arrival"; the levelling landed ~20 min after this head, so the runbook is correct-as-authored and now one line stale.)
  3. The verifier, attacked — every code fired on my own fixtures, first-failure-wins, and only where it should: row absent → arrival-missing; moved_verbatim byte changed → arrival-digest-mismatch at both phases; mode 644→755 → arrival-digest-mismatch; a declared edit applied at phase A → arrival-digest-mismatch; the same at phase B → OK; an UNDECLARED line → arrival-undeclared-edit naming line [3] with the unified-diff excerpt; unplaced file → arrival-undeclared-file, admitted with --allow-created; --replica-at present+identical → OK, drifted → arrival-digest-mismatch, absent → arrival-missing, malformed / duplicated / naming a moved row → arrival-unreadable; carved_from missing / unparseable / wrong repo / wrong commit / wrong tag → arrival-carved-from-mismatch, correct → OK with 0 rows; unknown destination, missing --phase, --dest-root not a directory, source without carve_commit, unreadable/unparseable manifest, a FIFO under a root → arrival-unreadable. --json shape sound on both the ok and refused paths.
  4. Real-manifest dry run, reproduced independently — opendox_spec 56/56 at phase A (exit 0), and beyond the claim opendox_code 123/123 at phase A; the scaffold posture document admitted (1 scaffold, 57 walked); commit B built by applying only the one row's six declared lines → phase B OK, phase A over the same tree → arrival-digest-mismatch naming both digests; an undeclared line tampered → arrival-undeclared-edit naming line [1].
  5. Tests — pytest -q tests/carve_arrival tests/carve_manifest → 139 passed, 0 skipped (51 + 88); all six codes asserted by literal name; RATIFIED_CODES spelled out rather than imported and the AST scan over the file's own raise sites is real; pytest tests/ collects 11,105, 0 errors; the seat's NO DESTINATION branch keeps it green.
  6. The collision — coherent. Commit 3 amends commit 1's runbook openly (§ 2.1 rewritten for --replica-at and the scaffold admission) and its message says so; no conflict markers, no .orig/.rej, no duplicate defs or duplicate test names, both files compile, tests match the script at head. All three commits are authored and committed as Brett Heap with one identical Co-Authored-By: Claude Fable 5.1 trailer — the two-author fact is disclosed in prose only, nowhere machine-visible.
  7. doc-health / gates — --single-repo . at head vs base 17167481: 77 findings both sides, 10 critical / 6 error / 47 warning / 14 info identical, and after normalising the worktree-derived repo= prefix the finding sets differ on exactly ONE line — staged-candidate-aging n=70 → n=71. Canon share 39.8% → 39.6% with canon words UNCHANGED at 360,528 and governance words +5,173. proposal-support verify → ok. Every check at the head sha SUCCESS, pytest-suite included (23m31s). Body opens Lane:, **Refs #656**, no closing keyword, closingIssuesReferences 0, autoMergeRequest null.

THE THREE BLOCKING CORRECTIONS (runbook § 5.2–5.4 — the part an operator pastes)

I ran the documented sequence against a scratch repository with git-filter-repo ed61b405, the installed one.

  • § 5.3's path file only RENAMES; it filters NOTHING. The generator emits source==>destination lines exclusively. A --paths-from-file containing only rename directives applies the renames and keeps every other path: my run kept all five files where only one was listed. Adding the bare path line beside the rename (p\np==>q) filtered correctly to one. As written, filter-repo would carry the whole of openxFactory into each public destination leg — and the arrival verifier would not catch most of it, because its walk is scoped to the declared roots, so openspec/, contracts/, .github/ would ride in silently. Emit both lines per row.
  • § 5.4's --refs "$CARVE_COMMIT" does not retarget refs/heads/main (Codex P1, independently reproduced): after the run main still held the UNFILTERED tree, so § 5.5's git merge --allow-unrelated-histories carved/main merges unfiltered history. Create a named carve ref and rewrite that. The neighbouring claim "filter-repo removes origin when it finishes" also did not hold in any of my runs — origin survived.
  • § 5.2 + § 5.4 cannot run at all as sequenced. git clone then git checkout "$CARVE_COMMIT" leaves two HEAD reflog entries and filter-repo refuses: "this does not look like a fresh clone … use --force." The PR body names --force; § 5.4 omits it.

SHOULD-FIX (none blocks landing; the file is draft and no bytes moved)

  • Exit 1 exists, and the module docstring says it does not. A manifest row missing destination_path escapes main() as KeyError → exit 1 (Copilot's open thread, reproduced). Widen the handler to a named arrival-unreadable.
  • Directory symlinks are invisible to the walk (Codex P2, reproduced): a symlink under src/opendox/ pointing at a directory of undeclared content lands in os.walk's dirnames, is never read and never counted — exit 0. A file symlink is correctly refused.
  • An EMPTY file with no row is admitted as "replica" — verified against the LANDED manifest, src/opendox/brandnew.py empty → OK … 1 replica. Two replica rows (fixtures/empty/{notes,papers}/.gitkeep) carry the empty digest, so any empty created file (an __init__.py, say) rides in and is mis-recorded rather than requiring --allow-created. The .gitkeep-by-name ordering anticipated half of this.
  • --destination openxdox_root is unreachable (Codex P1, confirmed): the landed manifest declares opendox_code|opendox_root|opendox_spec|openxdox_code|openxdox_spec — there is no openxdox_root key, so § 6's "per assembly root" verification and § 7's openXdox carved_from cannot be checked by this tool at all. That is the manifest's gap, not this PR's, but § 6 should say so rather than showing only the openDox invocation.
  • On admitting docs/branch-protection.md: the right call, but weaker than it needs to be. I smuggled SECRET CARVE PAYLOAD into that exact path under a declared docs/ root and the run returned OK, 2 scaffold. It can only smuggle an EXTRA file — any row it displaced would refuse arrival-missing — and it is one fixed path, so I would not undo it: leaving it to --allow-created really would record a false provenance on a provenance document. But the same by-name structure is looser twice over: a .gitkeep with content is admitted anywhere under a root, and REQUIRED_FILES is read from the destination's own working tree, so adding src/fake/payload.py to the destination's tests/test_leg_shape.py admitted it (OK, 3 scaffold) — the check takes its allowlist from the thing it is checking. The tightening that keeps the author's stated reason: admit a scaffold file only when its bytes equal the destination's own pre-carve main copy (git -C <dest> cat-file blob origin/main:<path>), and read the leg-shape module from that ref rather than from the working tree.
  • Six review threads (3 Codex — two P1 — and 3 Copilot) are open and unanswered at head; @codex review was requested and its reply posted at 23:34:59Z, after the last commit.

Bottom line. The verifier is sound: it refuses everything it claims to refuse, refuses it with the right code, and its four documented non-claims are honestly stated rather than quietly assumed. The runbook's governance content is exact against every ruling and every manifest figure I recomputed. What is not yet safe is the executable half of § 5 — the three corrections above must land before a leg is carved, and the first of them is the difference between publishing 123 files and publishing the repository.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8aa6f92ebe

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/opendox-cutover-runbook.md Resolved
Comment thread docs/opendox-cutover-runbook.md Resolved
The three BLOCKING corrections to § 5.2-5.4, each reproduced against
`git-filter-repo ed61b405` on a scratch repository of two commits and three
files with one listed, and the corrected sequence then proved end to end
against the LANDED manifest:

1. THE PATH FILE FILTERED NOTHING. `--paths-from-file` reads a plain line as a
   path SELECTOR and a `source==>destination` line as a RENAME. The generator
   emitted renames only, so the run renamed what it named and KEPT EVERYTHING
   ELSE — all three scratch files where one was listed, and 5,404 openxFactory
   files on the real `opendox_spec` leg. Against a PUBLIC destination that is
   the difference between publishing 56 files and publishing the repository,
   and the arrival verifier would not have caught it: its walk is scoped to the
   destination's declared roots, so `openspec/`, `contracts/` and `.github/`
   would have ridden in silently. § 5.3 now emits BOTH lines per row.

2. `--refs "$CARVE_COMMIT"` RETARGETED NOTHING. A raw object id is not a ref:
   the rewrite was written and no ref pointed at it, `refs/heads/main` kept the
   unfiltered tree, and § 5.5's merge would have taken unfiltered history.
   § 5.4 now creates `carve-src` at the carve commit and rewrites that ref, and
   § 5.5 fetches it by explicit refspec — partial mode leaves the mirror's other
   refs unfiltered, so a bare `git fetch carved` puts them within reach of a
   mistyped merge. The neighbouring claim that filter-repo removes `origin` when
   it finishes did not hold in any run made for this document and is withdrawn.

3. THE SEQUENCE COULD NOT RUN. `git clone` then `git checkout "$CARVE_COMMIT"`
   leaves two HEAD reflog entries and filter-repo refuses a clone that is not
   fresh. § 5.2 now takes a `--mirror` clone, which needs no `--force`, and
   states `--force` as the fallback with the reason the check exists.

And a fourth defect found while proving them: § 5.2's CONTROL validated nothing
and reported success. `validate-carve-manifest.py` holds a seat when its default
`<repo>/docs/…` manifest path is not a file — and a mirror has no working tree,
and the manifest does not exist at `b075fd91` in any case, having landed at
`17167481`. Both § 5.2 and § 5.5 now name the manifest absolutely.

PROVED, 2026-09-09: the `opendox_spec` leg carved from a fresh mirror to exactly
its 56 files under `contracts/`, `docs/` and `examples/`, fetched by refspec,
merged with `--allow-unrelated-histories`, and verified at phase A — 56 rows
arrived, 56 digests verified, 57 files walked, none undeclared.

Five holes in `verify-carve-arrival.py`, each pinned by a test proven to fail
against this file at `8aa6f92e`:

* EXIT 1 EXISTED and the module docstring said it did not. A row missing
  `destination_path:` escaped `main()` as a `KeyError` traceback. `main()` now
  owns the contract: every unnamed `Exception` renders as `arrival-unreadable`
  and exit 2, `KeyboardInterrupt` and `SystemExit` left alone. The
  `ast.literal_eval` guard also names `SyntaxError` and the rest.
* DIRECTORY SYMLINKS WERE INVISIBLE. `os.walk` puts them in `dirnames`, never
  descends and never reads: a tree of undeclared content behind one name
  returned OK. git stores such a link as a `120000` blob, so it is pulled out
  of `dirnames` and answered as any other entry is.
* AN EMPTY ROWLESS FILE WAS ADMITTED AS A REPLICA. Two of the 18 replica rows
  are `fixtures/empty/*/.gitkeep`, so the empty digest admitted any empty
  created file — true of the bytes, false of the file, the same error the
  `.gitkeep`-by-name rule already refused. Empty blobs are excluded from the
  identity set; an empty replica is admitted by `--replica-at`, which is the
  stronger claim anyway.
* `--destination openxdox_root` WAS UNREACHABLE. `destinations:` maps the places
  rows GO and openXdox's assembly root receives none, so RULED OQ-I's second
  provenance record could not be checked by the tool that checks the first.
  `--assembly-root <owner>/<name>` addresses a root by the repository it is,
  runs the `carved_from:` check and reports the key where there is one.
* SCAFFOLD ADMISSION TOOK ITS ALLOWLIST FROM ITS SUBJECT. `SECRET CARVE PAYLOAD`
  at `docs/branch-protection.md` returned OK; a `.gitkeep` with content was
  admitted anywhere; and `REQUIRED_FILES` was read from the destination's
  WORKING TREE, so an arrival commit that added a path to its own
  `tests/test_leg_shape.py` admitted that path. The allowlist is now read from
  `--dest-base` (default `origin/main`) and every scaffold admission's BYTES
  must equal the destination's own copy there. Without a baseline the run still
  passes and SAYS `scaffold admissions by NAME ONLY`, so the weaker claim never
  passes for the stronger.

`--json` with no `--destination` now carries `destinations` as a LIST with a
`destinations_unreadable` flag, rather than a comma-joined sentence that was
sometimes an apology.

Evidence: `pytest -q tests/carve_arrival tests/carve_manifest` — 156 passed
(68 + 88), 0 skipped; 14 of the 17 new tests fail against
`HEAD:scripts/verify-carve-arrival.py` and the other three are regression
guards. `pytest tests/ --collect-only` 11,122 collected, 0 errors.
`proposal-support verify` ok. doc-health `--single-repo .` in ONE checkout,
this round's three files against `8aa6f92e`: 76 findings, BYTE-IDENTICAL.

Lane: openxfactory-4-opendox-extraction

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 10, 2026 00:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new verifier should fail fast on unsafe user-provided destination paths (--replica-at / --allow-created) to prevent reading outside --dest-root, and the runbook’s declared-roots table should align with the verifier’s printed root spellings.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 3
  • Review effort level: Lite

Comment thread scripts/verify-carve-arrival.py Resolved
Comment thread scripts/verify-carve-arrival.py Resolved
Comment thread docs/opendox-cutover-runbook.md Resolved
SonarCloud's `pythonsecurity:S8705` on `2a08d512`, and it is right about the
shape even though the exploit is narrow: `--dest-base` is the ONE value this
tool hands to git that comes from the COMMAND LINE rather than from the
manifest, and it reached `subprocess.run` untouched. `subprocess` is called
with an argument list and never a shell, so there is no shell injection — but
`f"{ref}^{{commit}}"` with a ref beginning `--` is read by `git rev-parse` as an
OPTION and not a revision, which is argument injection and a real one.

So it is validated where it enters, against a conservative allowlist: letters,
digits, `.` `_` `/` `@` `^` `~` `{` `}` `-`, never a leading dash, at most 256
characters. A revision git would accept can carry far more than that, and
nothing this tool needs to name does. `--end-of-options` is passed to
`rev-parse` as well, so the two defences are independent rather than one
defence written twice.

Pinned by `test_a_dest_base_is_validated_before_a_process_is_started`, which
refuses `--dest-base=--upload-pack=/bin/sh`, `--dest-base=-x`,
`--dest-base=origin/main; rm -rf /` and `--dest-base=$(id)` — the `=` form
matters, because argparse itself rejects a separate argument beginning with a
dash and would have hidden the case. 157 passed (69 + 88), 0 skipped.

Lane: openxfactory-4-opendox-extraction

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 10, 2026 00:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It includes policy-breaking host-absolute paths in committed docs and needs path-validation hardening for --allow-created / --replica-at to prevent reading outside --dest-root.

Review details

Suppressed comments (5)

Previously missed (2) — in code that hasn't changed since the last review.

docs/opendox-cutover-runbook.md:42

  • This runbook embeds a host-absolute path (/usr/bin/git-filter-repo), which violates the repository constitution (“Committed files MUST NOT contain host-absolute paths”; .specify/memory/constitution.md:72-73). Prefer a PATH-based or generic statement instead.
    docs/opendox-cutover-runbook.md:155
  • This uses a host-absolute placeholder path (/path/to/...). The repository constitution forbids host-absolute paths in committed files (.specify/memory/constitution.md:72-73); use a repo-relative placeholder consistent with later sections instead.

This issue also appears on line 166 of the same file.

scripts/verify-carve-arrival.py:737

  • --replica-at SOURCE=DESTPATH accepts DESTPATH without validating that it is destination-relative. If a caller passes an absolute path or .. segments, the verifier can be tricked into reading outside --dest-root (and the error messages will still look like an arrival finding). Reject absolute / traversal paths and normalize both \\ and / separators.
        relpath = relpath.replace(os.sep, "/")

scripts/verify-carve-arrival.py:1341

  • --allow-created paths are normalized with p.replace(os.sep, "/") but not validated. A caller can pass an absolute path or .. traversal segments, causing the walk to treat files outside --dest-root as admitted/allowed. Normalize both \\ and / and reject absolute or traversal paths before passing the set into verify().
        summary = verify(doc, args.destination, dest_root, source_repo,
                         args.phase,
                         {p.replace(os.sep, "/") for p in args.allow_created},
                         parse_replica_placements(args.replica_at, doc),
                         resolve_dest_base(dest_root, args.dest_base))

docs/opendox-cutover-runbook.md:166

  • This uses a host-absolute placeholder path (/path/to/...). The repository constitution forbids host-absolute paths in committed files (.specify/memory/constitution.md:72-73); use a repo-relative placeholder consistent with later sections instead.
    --dest-root     /path/to/openXdox
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Three Copilot threads on `d4cc2bf3`, and the first two are the same defect on
two flags. `Path("/dest") / "/etc/passwd"` is `/etc/passwd` — an absolute
right-hand operand REPLACES the root — and `..` segments walk out of it. So
`--replica-at scripts/pkg/neutral.py=/etc/passwd` read a file the run was not
about and reported the answer as the destination's, and an out-of-root
`--allow-created` value could never match and passed as a silent admission the
operator believed they had made.

`dest_relative()` now guards both, on `scripts/proposal-support.py`'s own
requirement rather than as a nicety: empty, absolute, and `.`/`..` bearing
values refuse `arrival-unreadable`. NON-CANONICAL forms refuse rather than
being normalised, because the value has to EQUAL a path the walk produced and
the walk produces canonical ones — `src/./pkg/x.py` would otherwise silently
never match.

The third thread is the § 2 table: its declared-roots column carried trailing
slashes where a run prints none, and comparing the two is the first thing an
operator does after a leg lands. The column is now spelled exactly as the
verifier prints it, and the section says that the five cells are asserted
against the landed manifest by
`test_the_real_manifest_declares_the_roots_the_runbook_names` — so the table is
checked rather than described.

159 passed (71 + 88), 0 skipped. `proposal-support verify` ok. doc-health
`--single-repo .` in ONE checkout, this round's three files against `8aa6f92e`:
76 findings, BYTE-IDENTICAL.

Lane: openxfactory-4-opendox-extraction

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 10, 2026 00:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

dest_relative() does not currently refuse Windows-style backslash paths on POSIX, which can lead to “accepted but never matches” operator inputs; the verifier and its tests should pin/handle this case explicitly.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (1)

tests/carve_arrival/test_verify_carve_arrival.py:1354

  • Similarly, --allow-created should refuse backslash-separated paths on POSIX so operators don’t accidentally supply a value that can never match any walked path. Add a src\\... hostile case here to pin that behavior.
    for hostile in ("/etc/passwd", "../outside.py", "src/../src/pkg/x.py"):
        done = run(carve, manifest, "--destination", "scratch_code",
                   "--dest-root", str(dest), "--phase", "A", "--json",
                   "--allow-created", hostile)
        assert refusal(done) == "arrival-unreadable", hostile
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread scripts/verify-carve-arrival.py Resolved
Two Copilot threads on `dad5cb97`, one point: `dest_relative()`'s
`value.replace(os.sep, "/")` is a NO-OP on a POSIX host, where `os.sep` is
already `/`. So `--allow-created src\pkg\x.py` passed the canonicality test as
one long filename, matched nothing under the walk — which joins with `/` — and
became the exact failure the guard exists to prevent: a silent admission the
operator believes they made.

The replacement still runs FIRST, so on a Windows host a backslash path is
converted as intended; what refuses is a backslash that SURVIVES it. The
regression case is platform-guarded in both tests for the same reason: on
Windows that value IS a path.

159 passed (71 + 88), 0 skipped. `proposal-support verify` ok.

Lane: openxfactory-4-opendox-extraction

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 10, 2026 01:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new verifier has path-escape cases (Windows drive paths and symlinked directories) that can read outside --dest-root, undermining the verifier’s safety guarantees.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

scripts/verify-carve-arrival.py:997

  • check_undeclared_files() computes relpath = os.path.relpath(full, dest_root) and then reads full. If a declared root (or part of its path) is a symlink that escapes --dest-root, relpath can contain .. and the verifier will read outside the destination tree.
                full = Path(dirpath) / name
                relpath = os.path.relpath(full, dest_root).replace(os.sep, "/")
                walked += 1
                if relpath in placed:
                    continue
                _mode, data = read_arrived(full)

scripts/verify-carve-arrival.py:568

  • check_arrivals() reads dest_root / destination_path directly. If any parent directory in that path is a symlink, path resolution can escape --dest-root and cause the verifier to read (and potentially accept) bytes from outside the destination checkout.
    for row in rows:
        relpath = row["destination_path"]
        target = dest_root / relpath
        if not os.path.lexists(target):
            raise ArrivalRefusal(
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread scripts/verify-carve-arrival.py Resolved
Copilot on `6c4876ff`, and correct: `C:/x` is not POSIX-absolute, so
`dest_relative()` admitted it. On Windows `Path(dest) / "C:/x"` leaves
`--dest-root`; on POSIX it is a filename with a colon in it that can never
match a walked path, which is the silent-admission failure again.

`ntpath.splitdrive` names both forms — a drive letter and a `//server/share`
UNC root — on every platform, so the check does not depend on where this runs
and the regression cases are asserted everywhere rather than platform-guarded
like the backslash one.

159 passed (71 + 88), 0 skipped. `proposal-support verify` ok.

Lane: openxfactory-4-opendox-extraction

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI review requested due to automatic review settings September 10, 2026 01:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The new runbook includes host-absolute paths (e.g. /usr/bin/..., /path/to/...), which violates the repo constitution rule prohibiting host-absolute paths in committed files.

Review details

Suppressed comments (3)

Previously missed (1) — in code that hasn't changed since the last review.

docs/opendox-cutover-runbook.md:42

  • This runbook includes a host-absolute path (/usr/bin/git-filter-repo) in a committed document, which violates the repo constitution rule that committed files must not contain host-absolute paths (use repo-relative paths or runtime resolution).

This issue also appears in the following locations of the same file:

  • line 160
  • line 171

docs/opendox-cutover-runbook.md:164

  • This example uses a host-absolute placeholder path (/path/to/openDox-code), which conflicts with the repository rule to avoid host-absolute paths in committed files. Prefer a repo-relative example (e.g. a sibling checkout) or an environment variable placeholder.
python3 scripts/verify-carve-arrival.py \
    --destination opendox_code \
    --dest-root   /path/to/openDox-code \
    --source-repo .                       \
    --phase A

docs/opendox-cutover-runbook.md:173

  • This example uses a host-absolute placeholder path (/path/to/openXdox), which conflicts with the repository rule to avoid host-absolute paths in committed files. Prefer a repo-relative example or an environment variable placeholder.
python3 scripts/verify-carve-arrival.py \
    --assembly-root opensoft/openXdox \
    --dest-root     /path/to/openXdox
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap merged commit a970fd9 into main Sep 10, 2026
13 checks passed
brettheap added a commit that referenced this pull request Sep 10, 2026
…oxes — bookkeeping on Brett Heap's word (#897)

Bookkeeping on Brett Heap's word "tick the carve boxes" (2026-09-10): the split-opendox-two-layer-product § 3 boxes whose acceptance text is fully met by landed evidence are ticked, each with its citation — § 3.1 (manifest #865 → 1716748 + #889 → 15ebb37), § 3.2 (openDox-code #6 → ce53b489; all 24 design § D3 modules present), § 3.3 (the serve.py/cli.py app-server and neutral halves with the § 2.4 extension points, live in openDox-code). Boxes only partly met (the openXdox legs are not yet carved) and the BUILD-arc, runtime, repository-creation, FLOOR PART 3 and tag boxes stay open. Evidence, all on #656: the mapping manifest #865 → 1716748 and its amendments #889 → 15ebb37; the cutover runbook and arrival verifier #875 → a970fd9; leg 1 openDox-code #6 → ce53b489 (123 rows); leg 2 openDox-spec #4 → fc67332d (56 rows); the openDox root pin openDox #4 → 49a99df2 (gitlinks, pins, carved_from). On the word "tick 0.6, 1.8, 1.9 and 2.5 too when green": § 0.6 (PR-5 #832 → 56e69a1, archived with promotion), § 1.8 (opensoft/xFactory #284 → 05cb5abf, rule 1 confirmed live) and § 2.5 (the D-2 exercise: dispatch PR #176 → 7681e40, refusal 36d07ec; the box names no Omnigent-Install act, so its `[OmI]` tag is a repo tag without a clause) are ticked; § 1.9 stays open because its project-register rows land with § 5.8, still open. No manifest, validator or runbook change; landed under a Rule 6 window.

Refs #656 (stays OPEN).

Lane: openxfactory-4-opendox-extraction
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants