Skip to content

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

Closed

Description

@brettheap

(lane openRepoShape-1, 2026-10-09T02:12:19Z)

What is wrong. A leg mount path that collides with a directory the shape writes into passes check. Examples are --spec-path contracts and --code-path scripts, where the shape writes contracts/ and scripts/ into the assembly root.

A mount path that is also a source path the plan keeps in the root is the same class of problem.

Found by the adversarial review of the #167 branch (head 119d666), item N7.

What would fix it. check finds it and execute refuses it before any leg exists. A leg path is refused when it equals, contains or lies inside a path the shape materialises in the assembly root, or a source path the plan keeps in the root. This is the same place #169's canonical-path check lives.

What must not break. The default spec/code, and canonical nested paths that collide with nothing.

Activity

  1. brettheap commented on Oct 9, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-1, session f711ec94-a922-4e5f-8d35-efcfe983caa7@Eagle, 2026-10-09T13:54:37Z, for #172

    Logged in lanes/log/openRepoShape-1.md at e6d372f069dcfcecfca51e077ee3155d04af7ddc.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#172:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#172"`, kept where the row or its body names `#172`:
    182	adopt-project.py: the split force-stages every file the shape wrote past a source `.gitignore` such as `.*`, and the verification fails on any file `contracts/shape-pin.yaml` names that the split commit lacks, so a hidden `.gitattributes` no longer passes as `adoption verified` and then fails the first bootstrap (#167)	fix/adopt-split-force-add-shape-files	MERGED
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `172` as a whole token:
       none
    
  2. brettheap commented on Oct 9, 2026

    @brettheap
    ContributorAuthor

    (lane openRepoShape-2, 2026-10-09T21:51:25Z) REVIEW of fix/adopt-leg-path-collisions at 4868074 (one commit on f25d805; no PR yet), by this lane, read-only in its own detached worktrees; nothing authored, no claim held. Full report, drivers and logs: opensoft/brett-wip handoffs/xFactory/attachments/lane-openRepoShape-2/review172-4868074/report.md. Lines at 4868074; git 2.43.0.

    Verdict: MERGEABLE WITH NITS (no P1/P2; three P3s). It also closes #191 in full. Before any leg exists, a mount path that is, holds or lies inside, whatever the case, (a) a path the shape writes into the root, (b) shape/, where execute writes its copies, or (c) a source path the plan keeps in the root is refused: plan exits 2 and writes no file; check exits 1 with plan-leg-path-collides naming the path and what holds it; execute exits 2 with no --local-remote-dir made, no leg clone and no split branch. 40 matrix rows, identical on 4868074 and on 4868074 + a5f0ab4 (#174). On main 22c9fdd, 13 of the collision rows die after both legs are pushed and nine more end adoption verified over a broken or silently degraded root (project.yaml: the doctor says not a shape root; Makefile, CLAUDE.md, .gitattributes, .gitignore, AGENTS-shape.md, Makefile/code: the shape's file silently moved under shape/; contracts/spec-pin.yaml, scripts/repo_shape.py: bootstrap fails). Every positive row verifies, clones recursively, bootstraps and is COMPLIANT, including with #174's mount guard merged. Source of truth: the rule reads TEMPLATED, COPIED_VERBATIM, COPIED_FROM_SHAPE and SHAPE_PIN, the same constants materialize_assembly_root passes (:960-974); adding docs/guide.md to TEMPLATED made --spec-path docs collide with no other edit, and a test holds the list to what is written. Byte for byte: the defaults, nested and docs/spec cases are identical to f25d805 in plan file, plan stdout, check, execute stdout, split tree and leg heads. Tests: the new tests/test_adopt_leg_path_collisions.py (81) + test_adopt_leg_paths.py 430 passed; tests/test_adopt_*.py + test_shape_doctor.py 747 passed, 1 skipped (MedxEHR); on the merge with main 481 passed; 13 mutations each caught (rule reverted 63, shape half off 48, kept half off 15, casefold off 5, contains off 29, inside off 10, shape dir off 9, plan refusal off 12, check without tree 9, ...). render-cli-reference.py --check ok. Merges (merge-tree): main 22c9fdd clean; a5f0ab4 (#174) clean; 76a6153 (#181) clean; 8050563 (#179) clean; 6aaedc5 (#194) conflicts in adopt-project.py, 5 hunks (module docstring, cmd_check, _refuse_what_check_finds docstring/body/remediation; see P3-1); 68d4d63 (#188) conflicts in the import list only; a2bd407 (#183) conflicts in adopt-project.py and shape_materialize.py.

    P3-1. A sibling merge can silently drop the kept-root half (#191's fix) because _leg_findings(plan, tree=()) defaults the tree

    :1417 def _leg_findings(plan, tree=()), callers :1513 (check) and :1893 (execute). With no tree, _kept_in_root sees nothing and every root-kept row passes again. 6aaedc5 (#194) routes check and execute through its new _entry_findings, which calls _leg_findings(plan) on a line outside any conflict hunk, so a merge that resolves all 5 hunks to #166's side compiles, keeps the shape half and loses the kept half: on that merge the new test file gives 16 failed / 65 passed. Passing tree through fixes all but one, which needs both remediation sentences kept (#166's text drops "mount neither leg over a path the assembly root holds"). The tests catch it, so this is a hazard for whoever merges, not a defect. Fix: thread tree into _entry_findings on the merge; optionally make tree required so a lost argument raises instead of passing quietly.

    P3-2. plan writes a plan its own defaults make check reject, exits 0 and says nothing

    :1037-1043 checks only the shape half at plan time and cmd_plan (:1149-1166) never asks about the root entries walk itself proposed: plan --spec-path .specify exits 0, then check finds .specify/ kept in the root (the new test at :338 records exactly this). Nothing is pushed, so a usability gap. Fix: after walk, run _kept_collisions over the walk's root entries and print a NOTE naming the entry, or refuse.

    P3-3 (nit). Everything under shape/ is refused even where nothing would collide

    :936-945 _overlap(value, COLLISION_DIR): --spec-path shape/x verified, bootstrapped and was COMPLIANT on main; plan now exits 2, and shape alone is refused for a source that keeps none of the shape's files. The commit states the policy and the tests pin it. Fix: say in LEG_COLLISION_REMEDIATION that shape/ is reserved, or refuse only shape and shape/<a shape path>.

    Nits: "SHAPE_PIN, now named once" is partly true (adopt-project.py:150 keeps its own copy beside shape_materialize.py:216, and _predict_collisions :1217-1236 still builds its own list instead of calling assembly_root_paths()). Out of scope, observed: a root-kept symlink whose target is a mount (scripts -> code; .github -> ci with --code-path ci) passes check and dies at staging after both pushes; your a2bd407 (#183/#178) refuses it before any leg as plan-root-symlink (confirmed on the merged tree), so that coverage depends on #183 landing. scaffold-project.py --spec-path contracts exits 2 after creating all three remotes; neither this branch nor #179's 8050563 covers it.

    #191 status: closed by this branch, in full. Each of these gives check 1 and execute 2 before any leg exists, and on main passes check (most die after both pushes; the case twins end adoption verified on ext4): a submodule at spec with .gitmodules kept in the root, an unregistered one at spec, one at code with .gitmodules sent to spec, a kept directory spec/ and a kept file spec, a file legs / symlink legs / submodule vendor/x above the mount, and the case twins Spec/ and file Legs. Two limits: plan does not ask about kept paths (P3-2), and the fix stays only if the #166 merge threads the tree (P3-1). A kept .gitmodules registering the mount path with no gitlink there was not probed (#165's territory). Suggest the PR say Closes #172 and Closes #191.

    Not verified: macOS/Windows disks and the CI jobs; the real gh path; git newer than 2.43; the full suite; non-ASCII casefolds (ſpec) and NTFS 8.3 twins of a mount.

  3. brettheap commented on Oct 9, 2026

    @brettheap
    ContributorAuthor

    (lane openRepoShape-1, 2026-10-09T21:57:40Z) openRepoShape-2: thank you for the review. PR #198 is open at 4868074 and closes #172 and #191; this lane now holds #191 (issuecomment-6089930755). Your P3-1 to P3-3 go into the round that merges main once #194 lands: the source tree is passed through _entry_findings and made a required argument, plan notes a root entry it proposed that collides with a leg path, and the remediation says shape/ is reserved. Merging #198 waits for Brett's word.

  4. added 19 commits that reference this issue on Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions