Repository navigation
scaffold-project.py: a leg's mount path must be canonical or it is refused before anything is created, so --spec-path spec/ no longer scaffolds a project whose recursive clone fails once the work directory is gone (#179) - #201
Conversation
…fused before anything is created, so `--spec-path spec/` no longer scaffolds a project whose recursive clone fails once the work directory is gone (#179) `scaffold-project.py --spec-path spec/` exited 0 and pushed three remotes. Git records the mount at `spec`, but the `.gitmodules` write names a second section, `spec/`, so the real `spec` registration kept the operator's work directory as its URL and `git clone --recurse-submodules` of the new project failed (`Failed to clone 'spec' a second time`) as soon as that directory was moved. It is #169's bug in the other tool that writes `legs.spec_path` and `legs.code_path`; its argument check was `checked_value` alone, which lets `spec/`, `./code`, `legs//spec`, `.git` and equal or nested paths through. The rule that #169 gave `adopt-project.py` (`leg_path_problem`, `leg_path_problems`, the spelling and name checks and the remediation text) moves, unchanged, to `scripts/shape_materialize.py`, which both tools already import, and `adopt-project.py` imports it back: its own edit is the removal and the import. It is NOT `scripts/repo_shape.py`, which is a shape copy that every project carries and `contracts/shape-pin.yaml` digests: two hundred lines there would put an `upstream-changed` row in front of every project for a rule no project's copy asks. The scaffold asks it first, as `scaffold-bad-leg-path` (exit 2, its own refusal style), before a work directory, a remote or a `gh` call exists and also under `--dry-run`, with the same sentence adopt says and the canonical spelling where one exists. A shell metacharacter in a leg path is now refused under that code instead of `unsafe-value`, with `checked_value`'s own sentence. Tests: tests/test_scaffold_leg_paths.py (each refused class and each collision, nothing created, no `gh` call, the issue's repro, the defaults and nested paths still scaffold and clone with the work directory gone, one definition for both tools). Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…as a statement of its own, so the materializer import lists stay as they were and this branch merges with the two that rewrite them (#179) `fix/adopt-late-failure-notice` rewrites adopt-project.py's `from shape_materialize import (...)` list and `fix/scaffold-force-add-shape-files` adds a name to scaffold-project.py's, and a name added to the same list here conflicted with both. The moved names now arrive in their own import statement in each tool, and the lists are byte-identical to main's. No behaviour changes: the same names, the same one function behind them. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…nt, so no literal is spelled three times (#179) Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
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 23 hours by commenting |
Reviewer's GuideThe PR prevents scaffolding projects with non-canonical, unmountable, unsafe, or colliding leg mount paths by moving adoption’s validation rule into the shared materializer and invoking it before any scaffold side effects, with extensive regression coverage for refusal behavior and valid recursive clones. Sequence diagram for scaffold leg-path validationsequenceDiagram
participant User
participant Scaffold as scaffold-project.py
participant Materializer as shape_materialize
participant GitHub as gh
participant Filesystem as WorkDirectoryAndRemotes
User->>Scaffold: _scaffold(args)
Scaffold->>Materializer: refuse_bad_leg_paths(scaffold-bad-leg-path, spec_leg, code_leg)
Materializer->>Materializer: leg_path_problems(spec_leg, code_leg)
alt invalid, unsafe, unmountable, or colliding paths
Materializer-->>Scaffold: Refusal(scaffold-bad-leg-path)
Scaffold-->>User: exit 2 with refusal, no stdout
else valid leg paths
Materializer-->>Scaffold: no refusal
Scaffold->>Scaffold: checked_value(--spec-path, spec_path)
Scaffold->>Scaffold: checked_value(--code-path, code_path)
Scaffold->>Filesystem: create work directory and local remotes
Scaffold->>GitHub: probe gh and create project resources
end
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
(lane openRepoShape-1, 2026-10-11T00:56:41Z) @codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Brings in #172 (#198) and #166 (#194). The leg-path helpers #198's code asks of adopt-project.py (leg_path_problems, through _leg_findings) resolve through the import this branch already has; assembly_root_paths sits in the materializer's own import list, where #198 put it. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…is true in this file, so `WINDOWS_ABSOLUTE_RE` no longer points at a `--source` and a `Source.open` that are adopt-project.py's, and the section's size is said as about 250 lines and not two hundred (#179) Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…diation paragraph and a dry run asserts an empty stdout, so a changed remediation, or a plan printed before the refusal, no longer passes the scaffold's own tests (#179) Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
|
(lane openRepoShape-2, 2026-10-11T17:16:40Z) Heads-up: this lane is re-verifying a11a128 read-only against its earlier review of 8050563 (delta since then, P3-1 and nits 1 to 5, the moved rule's AST and a differential run, merges against the current heads including #197's aabfae0 and #199's d566e12). The result follows on this PR within the hour. No hold is requested; Brett's merge word stands. |
Clean merge: #201 moves the leg-path helpers into scripts/shape_materialize.py; this branch's mount guard and tests do not touch them. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…links, so the fail-closed root gitlink check is tested beside the leg-path helpers #201 moved into scripts/shape_materialize.py No conflicts: git merged adopt-project.py, scaffold-project.py, scripts/shape_materialize.py and #201's two test files without a conflicting hunk. #201 moves the leg-path checks out of adopt-project.py into scripts/shape_materialize.py; this branch edits only the verification (`_land_the_root_tree`, `_root_gitlink_finding`, the two exit texts) and two comments, so no hunk touches both. Checked by hand for a conflict git cannot see: - `_leg_findings(plan, tree)` still takes `tree` as a required argument, and `_entry_findings` still passes the source tree. - Every refusal the three gitlink findings name still exists after the move: `plan-bad-leg-path` and `adopt-bad-leg-path`, `plan-submodule-root`, `plan-unresolved`, `plan-uncovered` and `plan-bad-leg`. - The branch's delta over main is the same as before the merge. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e-notice origin/main moved from 20e13f0 to 8df21e6 (#201: the leg-path helpers move into scripts/shape_materialize.py) while this branch was being finished. This merge brings it in. It merged with no conflict. #201 removed `SAFE_ARG_RE` from the `repo_shape` import, and this branch added `REMEDIATION` there; both changes are kept. The `shape_materialize` import is unchanged from the previous merge: `assembly_root_paths` is imported and `RULESET_HINT` is not. `_leg_findings(plan, tree)` is unchanged. The only unused imports are `COMMIT_RE` and `leg_path_problem`, and main has the same two. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
(lane openRepoShape-2, 2026-10-11T18:59:31Z) Closing this lane's 17:16Z heads-up. The re-verification of a11a128 was cut off by the account's usage limit at 17:48Z and never reported. The PR merged at 17:26:42Z as 8df21e6, whose tree (6f575e0f) equals a11a128's. This is a read-only check of main a5b09c3, which holds it, by this lane in detached worktrees, nothing authored, no claim. POST-MERGE: FOLLOW-UP NEEDED (P3-1: YAML-keyword leg paths, now #225)
Tests on a5b09c3 with git-filter-repo, the 13 files the brief named: 920 passed, 1 skipped (the MedxEHR plan test). CI: tests, tests-macos and tests-windows were green on a11a128. The push run on main 8df21e6 is green. Report: |
…200 merge with no conflict, `_entry_findings` still hands `_leg_findings` the tree, and a symlink the plan keeps and the shape writes through is still refused before any leg, ahead of #200's mount guard This brings in 8df21e6 (#201, for #179) and a5b09c3 (#200, for #174). #201 moved the leg-path rule verbatim from adopt-project.py into scripts/shape_materialize.py, and adopt-project.py now imports it back as one unit. #200 added `_refuse_an_unmountable_path` (`adopt-mount-occupied`, `adopt-mount-unaddable`), which runs before each `git submodule add --force`. There was no conflict. `git merge-tree` and the merge both resolved every file without help. Read after the merge: - `_entry_findings` calls `_leg_findings(plan, tree)`, then appends `_root_symlink_findings(plan, source, tree)` after the submodule findings, as at a61ccbe. - `_PlannedRoot` reads `WINDOWS_ABSOLUTE_RE` and `leg_path_problems`. Both now live in shape_materialize.py and arrive through #201's second import block. The first block keeps this branch's `BOOTSTRAP` and `SYMLINK_HOPS`. - In shape_materialize.py, this branch's block sits before `_materialize` and #201's sits at the end of the file. They share no name. - This branch's diff against main in adopt-project.py and scripts/shape_materialize.py has the same lines after the merge as a61ccbe's diff against 20e13f0. - Every remediation sentence is kept: #198's clause in `_refuse_what_check_finds`, #200's `MOUNT_REMEDIATION`, and this branch's `plan-root-symlink`, `adopt-symlinks-off` and `UNWRITABLE_REMEDIATION`. Which fires first. `execute` refuses `check`'s findings in their order before any leg exists: `plan-leg-path-collides` from `_leg_findings`, then `plan-root-symlink`. `adopt-symlinks-off` comes next, also before any leg. #200's guard comes at the mount, after both legs are pushed, and the materializer's refusals come after that. Four plans are refused by more than one of these: - `.github -> ci`, with `ci/` kept and `spec_path: ci`; - `.github -> ../outside-ci`, with `spec_path: .github`; - `.github -> spec/ci`, with `ci/` kept and `spec_path: ci`; - `.github -> ../outside-ci`, with `spec_path: .github/spec`. For each, `check` lists `plan-leg-path-collides` first and `plan-root-symlink` after it. `execute` refuses under the first code with all of them, before any leg exists. With #198's root-kept half switched off, as #200's tests do, `plan-root-symlink` still refuses three of the four before any leg. #198's shape half refuses the fourth. Only with `check`'s list switched off does #200's guard meet them, after both legs are pushed, and it refuses each by name. Each sentence is true of its plan. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brings in #198 (20e13f0: #172 + #191, a leg's mount path must not be, hold or lie inside a path the assembly root holds, and `_leg_findings(plan, tree)` takes `tree` with no default), #201 (8df21e6: #179, the leg-path rule moved verbatim from adopt-project.py into scripts/shape_materialize.py, where scaffold-project.py asks it too) and #200 (a5b09c3: #174, the leg mount passes `--force` behind `_refuse_an_unmountable_path`). One merge, no rebase. Six conflicts, all in adopt-project.py: 1. Module docstring, `check`'s list: main's clause (neither equal to, around or inside a path the shape writes into the root, `shape/`, or a source path the plan keeps there), then this branch's (every value `execute` writes into the project's YAML one its loader reads back as that same text, #181), in one sentence. 2. The first `from shape_materialize import`: this branch's `TEMPLATED` and main's `assembly_root_paths`, both, in main's line layout. 3. The #169 section ("A leg's mount path is CANONICAL, or it is refused"): main replaced it with a pointer to `shape_materialize`, where the code now lives, and this branch had edited it in two places. Main's pointer is taken, and both edits are re-applied to the moved code in scripts/shape_materialize.py, unchanged in substance: `NOT_TEXT_KINDS` gains `type(None): "no value at all"` (an explicit null leg path, the reviewer's question on 76a6153), and `leg_path_problem`'s not-text sentence says "a leg path is text: write the path you mean, or remove the key to mount the leg at its role's own name" instead of "so quote it", with the comment saying why. Only a value read out of a plan file reaches that sentence: `plan`'s flags and scaffold-project.py's are always text, so the scaffold prints nothing new. 4. Two new sections inserted at one place after `_plan_leg_paths`: main's "A leg's mount path overlaps nothing the assembly root holds (#172)" first, beside the leg-path helpers it extends, then this branch's "What `execute` writes into the project is read back as written (#181)". Neither section is edited. 5. `_entry_findings`'s docstring: main's "and the two mount paths", then this branch's sentence on the misread findings. 6. `_entry_findings`'s body: main's `_leg_findings(plan, tree)` (#198 made `tree` required; dropping it raises TypeError on every `check` and `execute`), then this branch's `plan-manifest-misread` findings, whose remediation is still printed ahead of the submodule remediation. Outside the conflicts: main's second `from shape_materialize import` also takes `NOT_TEXT_KINDS`, which this branch's `_the_loader_made` reads, and its comment no longer says "`leg_path_problem` is not called here", because this branch's `_plan_fields` calls it. Everything else merged cleanly, tests/test_adopt_leg_paths.py included (main's `_leg_findings(plan, None)` and this branch's not-text test touch different lines). An explicit null leg path never reaches main's collision check or its mount guard: `_leg_findings` asks `_leg_collision_findings` only when `leg_path_problems` found nothing, and None is a `plan-bad-leg-path` there, and `_checked_plan_values` refuses it before `checked_value` and the mount. The resolution adds no line over 79 columns that neither parent has. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ebreak-names (#199) One hunk conflicted, the `from repo_shape import (...)` list in adopt-project.py: main (#201, 8df21e6) removed `SAFE_ARG_RE`, and this branch added `double_quoted`. Resolved as main's list plus `double_quoted`, nothing else; no `SAFE_ARG_RE` is left in adopt-project.py. Every other file (scaffold-project.py, scripts/shape_materialize.py, the tests) merged without a conflict. Lane: openreposhape-5 (openRepoShape-5) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…te=`, so an operator's `init.templateDir` holding `modules/spec` no longer plants a module store that the leg mount's `--force` reactivates, which pushed a root whose gitlinks were a stranger's commit and whose recursive clone failed (#229) The review of 5878305 found a third refusal of git's that `--force` on the leg mount turns off and that the commit body did not name: a `.git/modules/<path>` already there is REACTIVATED ("Reactivating local git directory") instead of refused. The assembly root was a fresh `git init`, and `git init` copies the operator's template (`init.templateDir`, or `GIT_TEMPLATE_DIR`) into `.git`, so a template that holds a `modules/spec` store (one made by copying a working Triad root's `.git` does) planted one. Reproduced on 5878305: the scaffold exited 0, the pushed root's `spec` and `code` gitlinks were the planted store's commit and neither leg's tip, and `git clone --recurse-submodules` of it exited 128 (`Fetched in submodule path 'code', but it did not contain ...`). On main, without `--force`, the same input exits 2 at the mount, so 5878305 had turned a loud refusal into a quiet wrong success. The cure is `git init -q --template= -b <tracking branch>`: an empty template is git's documented way to copy none. The assembly root is a temporary build directory the tool fills and pushes, so no template content belongs in it, and whoever clones the pushed root still gets their own template from `git clone`. Leaving the default template out also leaves `hooks/*.sample`, `info/exclude` and `description` out of the root's `.git`; nothing in the scaffold reads them, and the targeted set below, which clones the root and runs its bootstrap, passes. The other `git init` calls the scaffold runs never reach a `--force`, so they are left as they were: scaffold-project.py:708 is `git init --bare` for the three local remotes, which are only pushed to and cloned from; `git_init_commit` (scripts/shape_materialize.py:559, called from `_seed_legs` at scaffold-project.py:758) seeds each leg's working tree, which is the SOURCE of the mount and is never mounted into; and the work root is a `mkdir`. The one `--force` is the submodule add in `_build_assembly_root`, and `_refuse_existing_trees` (scaffold-project.py:675) has made the assembly directory empty before its `git init`, so `.git/modules` holds nothing before the first mount and only that mount's store at the second. The comment in `_build_assembly_root` is corrected where the review found it wrong or stale. It named two refusals `--force` turns off and said neither can arise; it now names three, and says why `--template=` closes the new one. "The index holds only the first mount" was incomplete: when the second mount runs the index holds `.gitmodules` and the first gitlink, and no leg path can be `.gitmodules`, which `refuse_bad_leg_paths` refuses (#201). And "a path the SHAPE wrote ... git refuses it after the clone" was wrong about where git refuses (at the mount, exit 128: `already exists and is not a valid git repo` for `scripts` and `contracts`, `destination path ... already exists and is not an empty directory` for `README.md` and `project.yaml`) and would go stale the day #197 refuses those paths up front. It now says a leg AT a path the shape wrote is a collision of another kind, refused up front by the collision check where there is one and by git at the mount where there is not, and that `--force` changes neither, which holds before and after #197 lands. The same wording is corrected in the test module. A correction to 5878305's body, which cannot be amended: it said every file the materializer writes goes through `write_lf`. `copy_out` (scripts/shape_materialize.py:1183-1186) writes byte copies with `shutil.copyfile`. The conclusion stands: `copyfile` follows a source link and writes a regular file, `find templates -type l` is empty and no tracked entry has mode 120000, so the materializer makes no symlink for a mount to lie beyond. tests/test_scaffold_mount_ignored.py gains four tests over ONE more real scaffold, run as an operator whose `init.templateDir` (set through the test's own `GIT_CONFIG_GLOBAL`, as the excludes are) holds a non-bare store at `modules/spec` and at `modules/code`, each with a commit of its own and an `origin` (a store with none dies at `git remote set-url origin`, loudly, which is not the defect). One asks git that a plain `git init` under that configuration plants the store and `--template=` plants none, so the rest cannot quietly stop running the defect. One asserts exit 0 and no "A git directory for". One asserts the pushed root's `spec` and `code` gitlinks EQUAL the tips the legs were pushed at and are not the planted commit. One clones the root recursively with the template config OFF, so the clone itself is clean, and asserts it succeeds and passes the clone's `validate-manifest.py`, `validate-pins.py` and (review N5) `bootstrap.py`. The clone check is now one helper shared with the ignore-rule cases, so `bootstrap.py` runs in all eight clones, about 0.5 s each. Mutation: with `--template=` removed from the `git init` and nothing else changed, the module fails 2 of its 42 tests, the gitlink test (`{'spec': <planted>, 'code': <planted>} != {'spec': <spec tip>, 'code': <code tip>}`) and the clone test (`Fetched in submodule path 'code', but it did not contain <planted>`), and passes the other 40, the premise test and the exit test among them. Against 5878305 itself the same two fail. The targeted set, this module and five existing files, passes on this commit: 161 passed, 0 failed, 0 skipped (tests/test_scaffold_mount_ignored.py, test_scaffold_ignored_shape_files.py, test_scaffold_leg_paths.py, test_scaffold_e2e.py, test_scaffold_pin_and_reuse.py, test_cli_reference.py). `docs/cli.md` is unchanged, since no `--help` text is. Closes #229 Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…, #201, #200 and #173 land beside #190, and `_entry_findings` hands `_leg_findings` the tree while still returning #190's NOTEs Main moved from e4decfb to 54aa69a: 20e13f0 (#172 via #198), 8df21e6 (#179 via #201), a5b09c3 (#174 via #200) and 54aa69a (#165 via #173). Five conflict hunks, all in adopt-project.py, each a #190 line beside a main line. Each takes BOTH sides, by lane 2's recipe (resolve_m5b_r190d.py, which asserts each hunk's two sides before it writes anything): 1. Module docstring, `check`: #198's mount-path clause ("neither equal to, around or inside a path the shape writes into the root ..."), then #190's "each relative url naming the same repository from the leg as from the source". 2. The `repo_shape` import list: main's names, which since #201 leave out `SAFE_ARG_RE` (its one user moved to scripts/shape_materialize.py, and #190 adds none), plus #190's `redacted, remote_key, remote_local_path`. 3. `_entry_findings` docstring, first paragraph: #190's "and the NOTEs it prints beside them" with #198's "and the two mount paths". 4. `_entry_findings` docstring, ONE LIST paragraph: #190's "but in the one place a remote decides it" sentence, then #198's paragraph on why `_leg_findings` is handed the tree. 5. `_entry_findings` body: #198's `_leg_findings(plan, tree)` with #190's three-tuple from `_submodule_findings(plan, source, tree, local_remote_dir)`. This branch's `_leg_findings(plan)` alone is a TypeError on every `check` and `execute`, because #198's `tree` has no default; main's two-tuple alone breaks `check`'s three-way unpack and drops #190 from `execute`. #173's verification (only the two leg mounts passed over; `adopt-root-submodule`, `adopt-unexpected-gitlink`, `adopt-mount-missing`) merges with no conflict: #190 does not touch `_verify`, and a relative url it lets through is the source's `.gitmodules` byte for byte. tests/test_adopt_submodules.py merges with no conflict: #173's `MOVED` and its root-tree test beside #190's absolute default url. #190's added and removed lines against 54aa69a are its lines against e4decfb, but for the reflowed docstring lines of hunks 1 and 3. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…the shape writes into the assembly root, a `--pin`'s `contracts/<product>-pin.yaml` included, is refused before anything is created, under `--dry-run` alike, through the one definition adopt-project.py asks, so `--spec-path contracts` no longer creates three repositories and pushes both legs to die at `git submodule add` (#197) (#234) scaffold-project.py refuses a leg path that is, holds or lies inside any path the shape writes into the assembly root, each `--pin`'s `contracts/<product>-pin.yaml` included. The refusal comes before any process starts and under `--dry-run` alike, and it asks the same question adopt-project.py asks, from one definition. - `scripts/shape_materialize.py`: the shape half of #172's collision rule (`shape_path_collisions`, `path_overlap`, `first_and_more`, `CASE_ASIDE`, `MOVE_THE_LEG`) moves here from adopt-project.py, beside `assembly_root_paths`. That function now takes `neutral_pins` and lists each pin file in the order the materializer writes it, and `neutral_pin_path(product)` is the pin file's one spelling. adopt-project.py imports the helpers back, and its output is byte-identical. - `scaffold-project.py`: `_refuse_colliding_leg_paths` runs straight after the leg paths' own checks, before `_identity`, `_declaration`'s `gh api`, the dry-run return and the work root, and refuses as `scaffold-leg-path-collides`. A malformed `--pin` is now refused by `parse_pin` before `_identity`. - `tests/test_scaffold_leg_path_collisions.py` (new, 104 tests). Non-canonical spellings of a colliding path are refused first by #179's canonical-spelling check (#201). Reviewed adversarially twice (MERGEABLE WITH NITS; its SHOULD, the `--pin` path, is in this change). CI is green on Linux, macOS and Windows. Closes #197 Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cord-submodule-placement Brings in 20e13f0 (#172 via #198), 8df21e6 (#179 via #201), a5b09c3 (#174 via #200) and 54aa69a (#165 via #173) on top of e4decfb. No rebase. Conflicts, and how each was resolved: - adopt-project.py, the module docstring's `execute` paragraph (textual). #173 ended the VERIFIES sentence with "and that the root's only submodules are the two leg mounts"; #189 added the sentence saying the split's `project.yaml` records each kept submodule's leg under `submodules:`. Kept both: main's clause closes the sentence, #189's sentence follows it. The docstring is not part of docs/cli.md (`render-cli-reference.py --check`: ok). - tests/test_shape_doctor.py, `test_a_submodule_in_the_other_leg_from_its_record_is_misplaced` (semantic; the text merged cleanly). #198 made `_leg_findings(plan, tree)` take `tree` with no default, on purpose (tests/test_adopt_leg_path_collisions.py, `test_leg_findings_takes_no_default_tree`), and this branch's test called it with one argument, so it died with `TypeError: _leg_findings() missing 1 required positional argument: 'tree'`. It now passes `None`, as main's other placement-plan callers do: a placement plan has no source tree. This is P2-1 of lane openRepoShape-2's review of e167d8b. `_leg_findings(plan, tree)` is main's, unchanged. `_commit_the_split` auto-merged with the record's `append` intact. #189's 16 tests (36 items) pass on this merge. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>



Lane: openreposhape-1 (openRepoShape-1)
Claim: #179 (comment)
What
scaffold-project.pyasks the same questionadopt-project.pyasks of a leg's mount path (#169), before it creates anything. It refuses, asREFUSED scaffold-bad-leg-pathwith exit 2 (the tool's own refusal style), when--spec-pathor--code-pathis:/, a leading./, a doubled//, a.segment, a backslash, an absolute path, a... Where a canonical spelling exists the refusal names it (spec/is answeredWrite 'spec'.); an absolute path or a..names another place, so no spelling is offered;.git,git~1or.gitmodules(any case), ends in a dot or a space, or is a Windows device name (CON,NUL,COM1.txt);gitcommand line (a shell metacharacter, a leading-): refused under the same code withchecked_value's own sentence, where it used to beunsafe-value;legsandlegs/code,Specandspec), including a path equal to the OTHER flag's default (--spec-path code).The check runs before the work directory, the remotes and the first
ghcall exist, and--dry-runruns it too, so a rehearsal no longer prints a plan the real run would refuse. Both bad paths are named in one refusal.The rule moved, it was not rewritten.
leg_path_problem,leg_path_problems,_spelling_reason,_unmountable_reason,_canonical_spelling,LEG_PATH_REMEDIATIONand their constants moved fromadopt-project.pyintoscripts/shape_materialize.py, which both tools already import. A diff of the two blocks againstmain'sadopt-project.pyshows the code byte for byte the same; the refusal helper's name is the only difference in it (_refuse_bad_leg_pathsthere,refuse_bad_leg_pathshere), and what was added is comment and docstring text: the section header's #179 paragraphs, a docstring on the helper, and a reworded comment onWINDOWS_ABSOLUTE_REthat says--sourceandSource.openare adopt's.adopt-project.pyimports backleg_path_problem,leg_path_problems,WINDOWS_ABSOLUTE_REand the refusal helper, which keeps its private name there throughrefuse_bad_leg_paths as _refuse_bad_leg_paths, so no call site changed (leg_path_problemis imported only so thattests/test_adopt_leg_paths.pykeeps asking it through the adopt module). Its edit is the removal, that import, a section comment that now says where the rule went, and droppingSAFE_ARG_REfrom itsrepo_shapeimport list, which only the moved block used.WINDOWS_ABSOLUTE_REmoved with the rest because the spelling check needs it; adopt still imports it forSource.open.#172 landed while this was open, as #198, and this head merges it (
main20e13f0, a clean merge). The calls into the rule thatadopt-project.pymakes, those #198 reworked among them, resolve through the imports this branch adds:_refuse_bad_leg_pathsfor the refusals inplanandexecute, andleg_path_problemsforcheck's findings.assembly_root_paths, which #198 put inshape_materialize.py, stays in the materializer's own import list. An AST check ofadopt-project.py,scaffold-project.pyandshape_materialize.pyfinds no name used that is bound nowhere in its own file (only__file__).Why
shape_materialize.pyand notscripts/repo_shape.py. #179 asks for the move intoscripts/repo_shape.py, and #180 ("ideally moved to") and its close comment name it too. It is the wrong home:shape_materialize.pyline 148REPO_SHAPE = "scripts/repo_shape.py"is inCOPIED_FROM_SHAPEandFAMILY_COPIED_FROM_SHAPE, so every project carries a copy andcontracts/shape-pin.yamldigests it. About 250 lines added there (this diff adds 251 toshape_materialize.py) would put anupstream-changed scripts/repo_shape.pyrow in front of every project in the estate for a rule no project's own copy asks.shape_materialize.pyis in no copy list and is not pinned, and both tools already import it.The two new imports are their own statements, so the materializer import lists in both tools stay as they were on
main.git merge-treeof this head (a merge withmain20e13f0, which holds #166 and #172) against the current tip of each oforigin/fix/adopt-history-gitlinks,fix/adopt-mount-past-gitignore(#200),fix/adopt-plan-quote-yaml-keywords,fix/adopt-record-submodule-placement,fix/adopt-report-filter-repo-failure(#184) andfix/adopt-verify-mounted-gitlinks(#173) reports no conflict. Two branches edit thefrom repo_shape import (...)list inadopt-project.py, which abuts this branch's removal ofSAFE_ARG_REfrom it, so that list is a conflict hunk with this head which neither has againstmain:fix/adopt-relative-submodule-url(#190, whose four other hunks already conflict withmain) andfix/adopt-plan-linebreak-names(#199, which merges withmaincleanly). Whichever merges second resolves it by keeping that branch's added names (redacted,remote_keyandremote_local_pathfor #190;double_quotedfor #199) and not listingSAFE_ARG_RE, which adopt no longer uses: both branches use it only in the comment and the f-string of the block that moves. Four more branches (fix/adopt-check-unsafe-path,fix/adopt-late-failure-notice,fix/adopt-root-kept-symlinksandfix/scaffold-leg-path-collisions) conflict withmainalready, in as many hunks as they do with this head.tests/test_scaffold_pin_and_reuse.py::test_a_leg_path_with_a_shell_metacharacter_is_refusedis the one existing test changed: the code is nowscaffold-bad-leg-path, the sentence ischecked_value's own, and nothing is created.docs/cli.mdis unchanged (no--helptext changed;render-cli-reference.py --checksays it is what the generator produces).Also answers #180, which was closed as a duplicate of this issue.
Why (repro on
main)The issue's command, in local mode, on
main20e13f0:On this branch the same command exits 2 and creates nothing (no
remotes, nowork):Tests
tests/test_scaffold_leg_paths.pyis new: 27 tests. 26 of them runscaffold-project.py, 25 with--local-remote-dir(no network) and the one that provesghis never asked with a fakeghfirst onPATHinstead; the 27th only compares which function the two tools call. None needsgit filter-repo. By group, and what each asserts:spec/,./code,legs//spec,legs/./code,legs\spec,/spec,../code,.git,legs/.git,.gitmodules,CON,spec., a shell metacharacter, a leading-. Each asserts exit 2,REFUSED scaffold-bad-leg-path, the same sentenceadopt-project.pysays for the same value (asked of the adopt module, not copied), the shared remediation paragraph, the canonical spelling where one exists (and noWrite 'where none does), an empty stdout, and that nothing was created: noremotes, nowork, and no work directory of the tool's own in aTMPDIRmade empty for the run;codeinsidespec,specinsidecode, equal and nested once case is ignored. Each asserts the same, less the spelling and the remediation: exit 2, the code, adopt's sentence for the pair, an empty stdout, nothing created;--spec-path codeagainst the other flag's default: exit 2, the code, its sentence (--spec-path and --code-path are both 'code'), nothing created;--dry-runrefuses as the real run does: exit 2, the code, an empty stdout, nothing created;ghonPATHis never asked: exit 2, the code, noghcall, nowork;Northwind.gitto clone: exit 2,Write 'spec'., noremotesand nowork;legs/spec+impl/codeeach scaffold, hold exactly one.gitmodulesregistration per mount (none naming the work directory), and clone recursively after the work directory is moved;leg_path_problem(s)andrefuse_bad_leg_pathsto the one function inshape_materialize.One existing test changed:
test_scaffold_pin_and_reuse.py::test_a_leg_path_with_a_shell_metacharacter_is_refused(code, sentence, nothing created).tests/test_adopt_leg_paths.pyis unchanged and passes, which is the proof the move changed no behaviour; the review's differential run of the moved functions againstmain's is under Review.Each test fails with its change undone. The scaffold tests, with the one changed test in
test_scaffold_pin_and_reuse.py, were run against a copy with the mutation applied; the rows down to "no case-insensitive equality check" ran at 8050563, the last two at a11a128, which added the assertions NITs 3 and 4 name (see Review):scaffold-project.pyback tomain(the whole fix reverted)mainby designtest_both_tools_ask_one_definition--dry-runreturnsghprobeLEG_PATH_REMEDIATIONTargeted run on the head, a11a128:
tests/test_scaffold_leg_paths.py,test_scaffold_pin_and_reuse.py,test_scaffold_e2e.py,test_scaffold_ignored_shape_files.py,test_adopt_leg_paths.py,test_adopt_leg_path_collisions.py,test_adopt_plan.py,test_adopt_e2e.py,test_adopt_execute_refusals.py,test_adopt_spec_only.py,test_adopt_submodules.py,test_adopt_ignored_shape_files.py,test_shape_doctor.py,test_windows_paths.py,test_cli_reference.py,test_repo_hygiene.py,test_naming_policy.py,test_reference_default.py,test_shape_advisory.py,test_load_yaml_refusals.py,test_free_plan_hint.py,test_commit_trailers.py,test_family.py,test_bump_leg.py,test_park_resume_targets.py,test_update_shape.pyandtest_update_shape_add.py: the eight adopt and four scaffold test files, every other test file that namesshape_materialize, andtest_free_plan_hint.pyandtest_load_yaml_refusals.py.git-filter-repoonPATH: 1707 passed, 1 skipped (exit 0; the skip is the MedxEHR-backed plan test, which needs a read-only clone of MedxSoft/MedxEHR);PATH: 1645 passed, 63 skipped (exit 0; 62 aregit filter-repo is not installed, all in thetest_adopt_*files, and the 63rd is the same MedxEHR test).render-cli-reference.py --check:docs/cli.md is what the generator produces(no--helptext changed). The full suite was not run; the three-OS CI gate is the full check.Review
An adversarial review of
8050563found it PR-READY: no BLOCKER or SHOULD-FIX, eight NITs.main's in 244,744 comparisons, with no difference. Adopt'splan,checkandexecuteoutput is identical in 18 cases, on the reviewed head and on its merge withmaine4decfb.--work-dir, a loggingghshim, and--dry-run).maine4decfb.The follow-up is three commits on this branch: 469d14c merges
main20e13f0, 6cc2a87 takes NITs 1 and 2, and a11a128 takes NITs 3 and 4. What became of the eight NITs:--sourceandSource.openas if they were inshape_materialize.py. Taken, in 6cc2a87: the comment onWINDOWS_ABSOLUTE_REnow says they areadopt-project.py's.git diff origin/main --numstatadds 251 to the file (the review measured 245 and 249; NIT 1's longer comment adds the two).shape_materialize.LEG_PATH_REMEDIATION in result.stderr. With the refusal printing another remediation, none of the 28 tests (these 27 and the changed one) failed at 8050563; now 14 do.main20e13f0.--code-path SPECalone is refused with--spec-path 'spec' and --code-path 'SPEC' differ only in case, and--spec-path codealone with--spec-path and --code-path are both 'code'; both are true, because those are the defaults. Not taken. The sentence is the oneadopt-project.pyshares (leg_path_problems):adopt-project.py plan --spec-path codeprints the same words under its own code, so changing it changes adopt too, andtests/test_adopt_leg_paths.pyasserts parts of it (are both 'spec',differ only in case). It is a wording choice for a change of its own, to both tools.8050563passedtests,tests-macosandtests-windows(1634 passed, 220 skippedon windows-latest, runningpython -m pytest tests -q), andtest_canonical_paths_still_scaffold_and_a_clone_survives_the_work_dircarries no skip marker (only the fake-ghtest isWINDOWS_SKIP), so it ran there.--spec-path contracts, so the adoption fails after both legs are pushed (main: at the first bootstrap) #172 (a canonical leg path that the assembly root holds, such as--spec-path contracts, still kills the scaffold after the three remotes exist) is out of scope here. Filed as scaffold-project.py accepts a leg path that collides with a path the shape writes (--spec-path contracts,--code-path project.yaml), creates all three repositories and pushes both legs, then dies: #172's shape half on the scaffold side #197. adopt-project.py accepts a leg mount path that collides with a directory the shape writes, such as--spec-path contracts, so the adoption fails after both legs are pushed (main: at the first bootstrap) #172's adopt side has landed (adopt-project.py: a leg's mount path must not be, hold or lie inside a path the assembly root holds, so--spec-path contractsno longer checks ok and dies staging the split after both legs are pushed, and--code-path project.yamlno longer saysadoption verifiedover an assembly with no manifest (#172) #198); the scaffold does not askassembly_root_paths()yet, and this PR does not add that.Closes #179
🤖 Generated with Claude Code