Skip to content

adopt-project.py accepts a non-canonical leg path such as --spec-path spec/, so the mount and its .gitmodules registration disagree and main still says adoption verified #169

Closed

Description

@brettheap

(lane openRepoShape-1, 2026-10-09T01:44:45Z)

What is wrong. adopt-project.py plan --spec-path spec/ (or --code-path ./code) is accepted. plan writes spec_path: spec/ into the plan, and check says plan ok.

Found by the adversarial review of the #165 branch (head d780495).

What would fix it. _checked_plan_values (and plan's own argument check) either canonicalises legs.spec_path and legs.code_path or refuses a non-canonical value. Non-canonical means a trailing /, a leading ./, .., a doubled /, or an absolute path. Then check finds it and execute refuses it before any leg exists.

What must not break. The default spec and code, and canonical nested paths such as legs/spec.

Activity

  1. brettheap commented on Oct 9, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-1, session f711ec94-a922-4e5f-8d35-efcfe983caa7@Eagle, 2026-10-09T01:47:27Z, for #169

    Logged in lanes/log/openRepoShape-1.md at 53579367f90132950f4660560f11d5e1a24a88de.

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

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#169:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#169"`, kept where the row or its body names `#169`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `169` as a whole token:
       none
    

    Posted by hand: lanes-edit.sh claim logged and committed this claim, but its push met a concurrent rebase in the shared register checkout, so the tool never posted this comment. The log line reached origin/main at the sha above, carried by a peer's push.

  2. brettheap commented on Oct 9, 2026

    @brettheap
    ContributorAuthor

    (lane openRepoShape-2, 2026-10-09T03:35:21Z) REVIEW of fix/adopt-canonical-leg-paths, the #169 branch, at 2c1f926 (one commit on merge-base 7f84ca4, not on main b18cca9; touches adopt-project.py and the new tests/test_adopt_leg_paths.py; no PR yet). Read-only, own detached worktrees and scratch clones; nothing authored, no claim held. Full report with the spelling table, drivers and logs: opensoft/brett-wip handoffs/xFactory/attachments/lane-openRepoShape-2/review169-2c1f926/report.md. Lines at 2c1f926.

    Verdict: MERGEABLE WITH NITS, 0 P1 / 2 P2 / 6 P3. #169 as filed is fixed: --spec-path spec/ and --code-path ./code are refused at plan with the canonical spelling offered, a hand-edited plan carrying spec_path: spec/ is refused by check (plan-bad-leg-path) and by execute BEFORE _create_leg_remotes, on the branch alone and on every merged tree, with no regression (nested legs/spec / impl/code still verify). Both P2s are pre-existing siblings of the same kind, not caused by the branch, and both are cheap to take now. Merges: clean with main b18cca9 and with #165's 05fa0e0; with #166's 794828c one conflict, docstring-only (adopt-project.py:26-27 vs 794828c:27-28, resolve as the union: submodules, then canonical paths; the merged tree passes 342 tests); with both, clean on top of that. On every merged tree the refusal precedes any leg, and #165's after-the-fact adopt-unexpected-gitlink / adopt-mount-missing can no longer fire for this cause. Mutation: deleting the refusal in _checked_plan_values fails 30 tests on the branch (29 on the main merge, where #168's _refuse_what_check_finds still refuses plan-bad-leg-path first: defence in depth).

    P2-1. A .git segment passes the new rule, and legs/.git still ends "adoption verified" with the spec leg never mounted: #169's own symptom from a value the rule calls canonical

    :616-632 (_leg_path_reason refuses empty, . and .. segments but not .git, .GIT or the NTFS alias git~1); :635-653 (_canonical_spelling checks the re-spelling only with checked_value). plan --spec-path legs/.git: plan 0, check 0, execute 0 "adoption verified"; the split's .gitmodules registers submodule.legs/.git.path=legs/.git with the spec url, git ls-tree -r adopt/three-repo-shape has NO gitlink and nothing under legs/, only code is mounted; bootstrap.py in the clone: REFUSED pin-gitlink-absent. Identical on main, 2c1f926, and the #166 merge; with #165 merged it is execute 1 adopt-mount-missing and #165's SPLIT_DEFECT text then wrongly says "nothing in the plan does this ... report it". .git, .GIT, git~1 at top level: plan 0, check 0, execute 2 AFTER both leg remotes exist ('.git' already exists and is not a valid git repo / invalid path '.GIT'), and the corrected plan meets leg-remote-exists. Four-line prototype (refuse a case-insensitive .git or git~N segment in _leg_path_reason) turned all four into plan 2 / check 1 / execute 2 with no leg, legs/spec still verifying, 134 tests passing; it exposed the _canonical_spelling gap (it offered "Write '.git'"), so have it offer a spelling only when _leg_path_reason returns None for it. (tools/matrix.py <tree> collide.)

    P2-2. scaffold-project.py has the identical bug, and the helper lives where scaffold cannot call it

    scaffold-project.py:801-807 (same mount loop, submodule add ... path then git config -f .gitmodules submodule.{path}.url), :856-857 (--spec-path/--code-path checked only with checked_value); leg_path_problems is defined in adopt-project.py :675, not in scripts/repo_shape.py; scaffold-project.py is byte-identical at b18cca9 and 2c1f926. scaffold-project.py ... --spec-path spec/ --local-remote-dir: exit 0, three remotes pushed, the assembly's .gitmodules has submodule.spec.url=<work dir>/Northwind-spec plus a stray submodule.spec/.url=<remote>, and after the work dir is moved git clone --recurse-submodules exits 1 Failed to clone 'spec' a second time. The commit's "one helper in the three places that read one" holds for adopt-project.py; scaffold is a fourth reader. Fix: move _leg_path_reason, _canonical_spelling, leg_path_problem(s) and LEG_PATH_REMEDIATION into scripts/repo_shape.py and refuse in scaffold's argument check, in this branch to avoid moving the helper twice. Filed separately by this lane so it is tracked either way.

    P3

    1. A canonical leg path that collides with a shape-written or root-kept path still passes all three gates (pre-existing; this is 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). scripts, .github, contracts verify with the file missing (bootstrap 1); project.yaml is pushed aside to shape/project.yaml and bootstrap EXITS 0 ("has not elected the schema"); Makefile verifies and make says "Makefile: Is a directory"; README.md kept in root, .gitmodules, and upstream (parent of a moved gitlink) fail after both legs exist. materialize_assembly_root runs after _mount_the_legs (:1636-1640), so shape files are written into the mounted leg's tree.
    2. YAML-keyword spellings. plan --spec-path null (or Null) exits 0 and writes spec_path: null unquoted (y() :191-201 quotes only non-plain text), _plan_leg_path (:706-715) maps None to the default, so the leg silently mounts at spec; --spec-path true writes spec_path: true, which check then refuses plan-bad-leg-path ... not text, against the claim that plan refuses first; canonical 2026, 1.5, ~ verify but templates/assembly-root/project.yaml:159 and contracts/spec-pin.yaml:22 substitute {{SPEC_PATH}} unquoted and bootstrap reports manifest-leg-path. Fix: refuse a value repo_shape._scalar(v) != v, and quote in y() and the templates.
    3. check still says plan ok for values execute refuses (spec:x, C:spec, leading/trailing space or tab, spéc in NFC or NFD, fullwidth /, -spec): check 0, execute 2 unsafe-value before any leg, plan 2. Have _leg_findings (:1110) run checked_value on both paths.
    4. Case-only and NTFS-equivalent spellings pass: --spec-path Spec --code-path spec, LEGS/spec with legs, spec. all verify on Linux; one path on APFS/NTFS (UNVERIFIED there; the macOS CI job installs filter-repo and has no such test). Compare .casefold() in leg_path_problems (:687, :692).
    5. Robustness and wording: _print_what_will_happen (:1163-1164) prints the raw plan.legs.get(...) (None/ for a missing key, spec// beside the new finding); legs: 5 or a list makes check and execute die with AttributeError (exit 1, no FINDING line; on 2c1f926 the crash moves into _plan_leg_path :714), so Plan.__init__ (:973) should raise plan-unreadable; an explicit spec_path: null/~/bare key still reads as the default while only "" is refused, consistent with "a key the plan does not carry" but untested and contrary to the :707-713 docstring.
    6. Merge and test nits: once adopt-project.py accepts a non-canonical leg path such as --spec-path spec/, so the mount and its .gitmodules registration disagree and main still says adoption verified #169 lands, the first half of adopt-project.py _verify skips every root gitlink and compares a kept root .gitmodules byte for byte, so any plan that keeps a source submodule or its .gitmodules in the root ends with exit 1 and adopt-lost #165's SPLIT_DEFECT (05fa0e0:1774-1781) becomes unreachable and its second half is false for legs/.git until P2-1 is taken; _canonical_spelling's except Refusal: return None (:651-653) is unexercised; no test for null/true/2026 written by plan itself; --spec-path/--code-path still have no help= (:2001-2002).

    Unverified: case-insensitive filesystems, Windows and macOS CI, the GitHub-side execute path, the full suite. Lane openRepoShape-2 re-verifies the next head on request.

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