Skip to content

adopt-project.py _mount_the_legs runs git submodule add without --force, so a source .gitignore that hides a mount path (* + !.gitignore, or spec/code) dies at the mount AFTER both leg remotes are pushed, and nothing in check warns #174

Closed

Description

@brettheap

(lane openRepoShape-2, 2026-10-09T02:25:55Z) Found by the review of the #167 branch at 119d666 (its P3-6); pre-existing on main 7f84ca4 and unchanged by any open branch. Not claimed.

What is wrong. _mount_the_legs (adopt-project.py:1291 at 119d666) runs git submodule add <url> spec with no --force. When the source's own .gitignore matches the mount path, git refuses: The following paths are ignored by one of your .gitignore files: spec. execute exits 2 at that point, but _create_leg_remotes and the leg pushes have already run, so a corrected re-run meets leg-remote-exists. check says plan ok for the same source: nothing reads the source's ignore rules against the mount paths.

Reproduction (any source; the common case is a catch-all .gitignore):

printf '*\n!.gitignore\n' > Thing/.gitignore && git -C Thing add -f .gitignore && git -C Thing commit -qm ignore-all
adopt-project.py plan --source Thing --project Northwind ... ; resolve the plan
adopt-project.py check --plan plan.yaml                              # plan ok, 0
adopt-project.py execute --plan plan.yaml --yes --local-remote-dir remotes --work-dir work; echo $?   # 2
ls remotes                                                           # Northwind-code.git  Northwind-spec.git

Observed identically on main and on the #167 branch (driver: s_edge.py C1 under the attachments path below). A .gitignore of .* does NOT hit this (the mounts are not dotfiles); *, spec, code, spec/ and code/ do.

What would fix it. Either git submodule add --force at the mount (git's documented way past an ignore rule), or, better, a check/execute refusal before any leg exists: run git check-ignore -q --no-index <spec_path> <code_path> against the source's rules and refuse with a finding naming the rule. Independent of #165, #166, #167 and #168.

Driver and logs: opensoft/brett-wip handoffs/xFactory/attachments/lane-openRepoShape-2/review167-119d666/ (report.md P3-6, tools/s_edge.py).

Activity

  1. brettheap commented on Oct 9, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-1, session f711ec94-a922-4e5f-8d35-efcfe983caa7@Eagle, 2026-10-09T02:59:40Z, for #174

    Logged in lanes/log/openRepoShape-1.md at 4038df66653231d528f0f669265ba46e425c9fd7.

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

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

    @brettheap
    ContributorAuthor

    (lane openRepoShape-2, 2026-10-09T08:45:22Z) REVIEW of fix/adopt-mount-past-gitignore at 51998db (one commit on main 21f5c33; 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/review174-51998db/. Lines at 51998db; git 2.43.0.

    Verdict: CHANGES NEEDED, for one new false pass the --force opens and the safety claim that denies it; the #174 fix itself is right. On main the three sources (.gitignore = * + !.gitignore; naming spec; naming code/) get plan ok and then execute exits 2 at the mount with "The following paths are ignored" after both leg remotes were created and pushed, and the re-run meets leg-remote-exists. On 51998db all three reach adoption verified: both gitlinks at the pushed leg commits, .gitmodules exactly the two canonical sections, the split tree's file list identical to a non-ignoring source's (32 entries each, mode and path), status clean, bootstrap ok. Also verified end to end: * with a source submodule whose .gitmodules goes to code, and * with spec only and a seeded code leg. The 5 new tests pass; all 5 fail with --force removed; the 3 mount tests really run without git-filter-repo (venv off PATH: 3 passed, 2 skipped). tests/test_adopt_*.py: 158 passed, 1 skipped (MedxEHR). docs unchanged, render-cli-reference.py --check ok. Merges clean (rc 0, no conflicting paths) with main and with ca5fb3d (#166), 05fa0e0 (#173), f416e13 (#184), 5ab1a21 and 8a542bd (#187), d4ead9f (#185), 2ead645 (#186).

    P1-1. --force lets the second mount reuse the first when spec_path and code_path are the same path: adoption verified, exit 0, broken assembly

    :1313-1314, loop at :1300, URL write keyed by plan spelling :1315-1318; nothing in check (:1029-1079) or execute compares the two paths. Git 2.43's submodule add refuses an existing index entry unless --force; with --force it refuses only a NON-gitlink entry. So a plan with spec_path: legs and code_path: legs (also legs / legs/, legs / ./legs): main check 0, execute 2 fatal: 'legs' already exists in the index (both legs pushed, the #174 symptom); 51998db check 0, execute 0 adoption verified with ONE gitlink at the SPEC leg's commit registered to the CODE leg's URL ("Adding existing repo at 'legs'", then remote set-url inside the spec checkout), and git clone --recurse-submodules of the split fails (rc 128, "did not contain "). _verify skips every 160000 root entry, so every source path still lands once and it passes. With #173 (05fa0e0) merged: the legs / legs spelling still verifies (its presence check is dict(zip((spec_path, code_path), ...)), which collapses when the two are equal); legs/ and ./legs get adopt-mount-missing. With #187 (5ab1a21, 8a542bd) merged: plan refuses all three, so the false pass exists only if this branch lands before #187. Fix: land after #187 and pin an SP1 test here that asserts no adoption verified; independently of merge order, _verify could compare each mount's gitlink with leg_commits[role], which catches a wrong-commit mount however it arose. (tools/sp1.sh, tools/t2_adopt.py SP1-SP3, tools/probe_git.py.)

    P3-2. Claim (b), "a path the index already holds is still refused", is wrong in the comment (:1308-1312) and the commit message

    Probes on git 2.43: a gitlink already in the index at spec, with the work-tree directory absent, is accepted with --force and REPLACED (and a registered one has its submodule.spec.url rewritten); with the empty directory a fresh clone leaves it is refused, but by 'spec' already exists and is not a valid git repo, not by the index. A file or directory entry is still refused. In the adoption flow a source gitlink kept at root at spec or code (.gitmodules kept, moved or absent) is therefore still refused on 51998db, only because _commit_the_split's fresh clone checks out that empty directory; the same-path case above is where the claim fails outright. Fix: say what actually refuses the mount, and pin it with a test (a source gitlink at the mount path kept at root: refused, no gitlink replaced).

    P3-3 (pre-existing, not introduced; filed as #191). A root-kept source entry AT a mount path still gets plan ok and dies at the mount after both leg pushes

    Submodule, directory or file named spec or code kept at root: main and 51998db both check 0 then execute 2 with both legs pushed (the message on 51998db is the less direct "not a valid git repo" for a gitlink). #187 does not cover it (its rule compares the two leg paths with each other). #174's own preferred option was "refuse before any leg exists"; #191 asks for a check finding when any root-kept entry equals or lies under a leg path, raised before _create_leg_remotes. (tools/t2_adopt.py G1-G4, D1, F1.)

    P3-4 (nit). The new tests pin only the ignore case

    tests/test_adopt_mount_ignored.py:96-101 registrations() reads submodule.*.path only, so the e2e test (:184-185) does not check URLs (the mount unit test does); nothing tests the commit's safety claims or the same-path plan. Fix: assert submodule.*.url in the e2e, add the G1 and SP1 cases.

    Claims: (a) HOLDS: .git/modules holds only code and spec, created by the mount itself; a re-run over a failed work dir never reaches the mount (exit 2 at the leg clone, silent until #171/PR #184). (b) DOES NOT HOLD (above). (c) HOLDS on 2.43 (no renaming there; a root-kept .gitmodules naming spec ends in adopt-lost on both trees; moved to code it verifies); the newer-git renaming the claim cites is unverified here. Latent: :1315 writes submodule.{path}.url keyed by PATH, so a renamed name would get the URL on the wrong section, reachable only through a root-kept .gitmodules, which never verifies.

    Not verified: git newer than 2.43; case-only collisions on a case-insensitive filesystem; the real gh path (_open_the_pull_request runs before _verify, so a P1-1 plan would open a PR: inferred from :1728-1736, not run); behaviour on the moved sibling heads beyond merge-tree; the full suite and Windows/macOS CI.

    Lane openRepoShape-2 re-verifies the next head when its sha is posted here.

  3. brettheap commented on Oct 9, 2026

    @brettheap
    ContributorAuthor

    (lane openRepoShape-2, 2026-10-09T14:02:37Z) RE-VERIFICATION of fix/adopt-mount-past-gitignore at b057733 (51998db + the round-2 commit), 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/review174b-b057733/report.md. Lines at b057733; git 2.43.0; "m" = b057733 merged with main f25d805 (merge-tree clean, tree 70a87ee).

    Verdict: MERGEABLE WITH NITS. Both defects the commit names reproduce on 51998db (spec_path: code ended adoption verified with the spec leg as the only gitlink; legs/spec through a root-kept legs -> outside cloned the spec leg into outside/), and on b057733 alone both exit 2 with a named refusal (adopt-mount-occupied / adopt-mount-unaddable) whose text says the legs were made and pushed; nothing is split and nothing is written outside. On m the equal, legs/, ./legs, nested, absolute, .. and legs/.git paths are refused before any leg exists by #187's plan-bad-leg-path (check 1, execute 2, no remotes). The #174 fix itself still holds: the * + !.gitignore, spec and code/ sources reach adoption verified with gitlinks at the pushed heads, canonical .gitmodules, clean status and bootstrap ok, and mutation M5 (the dry run without -f) shows the -f is what passes the ignored path. Tests: tests/test_adopt_mount_ignored.py 12 passed (8 passed / 4 skipped with git-filter-repo off PATH); tests/test_adopt_*.py + tests/test_shape_doctor.py 329 passed / 1 skipped (MedxEHR); on m, that file + test_adopt_leg_paths.py 361 passed. Each of the 7 new tests fails under the mutation it guards (occupied off: 4; dry run off: 3; icase off: 1; guard removed: 7; --force removed: 5). render-cli-reference.py --check ok on head and m. Merges: rc 0, no conflicts, with main f25d805, 6aaedc5 (#166), 05fa0e0 (#173), f416e13 (#184), d4ead9f and 6c8f50f (#185), 5922521 (#186). The branch is not a fast-forward of main, so it lands with or after f25d805, which is what makes the legs/.git row safe (on b057733 alone it still verifies with no spec gitlink: the #187 defect, refused on m).

    Round-1 findings: P1-1 FIXED (equal paths: head check 0 then execute 2 REFUSED adopt-mount-occupied: the assembly's index already holds the leg mount path code, with a submodule ..., both remotes pushed, no split branch, re-run meets leg-remote-exists; m refuses at plan/check). P3-2 FIXED (the claim is gone; every claim in the new loop comment :1372-1386 and docstring :1291-1318 holds on 2.43, see the report's Claims table; "core.ignorecase is what git clone records on a case-insensitive disk" is not verified here, ext4 only). P3-3 NOT TAKEN, now named: #191 remains open (a root-kept gitlink G1-G4, directory D1 or file F1 at the mount path: check 0 plan ok, then execute 2 adopt-mount-occupied after both legs are created and pushed, on head and m alike). P3-4 PARTIAL (same-path, kept gitlink, case twin, symlink above and other-leg above are tested; the e2e still reads submodule.*.path only, :143-148; no directory-or-file-at-path mount test).

    N-1 (P3, pre-existing, #191 scope). A root-kept FILE above the mount path is not refused by name

    :1322-1341: the occupied check lists entries at or under the path, not above it, and the dry run passes because of --ignore-missing. File legs kept, --spec-path legs/spec (t6 FPAR): head, m and main check 0, then execute 2 REFUSED a git or gh command failed ... could not create leading directories of '.../legs/spec': Not a directory, after both pushes, without MOUNT_REMEDIATION (whose "no symlink or submodule it keeps there on the way" leaves out files). Fix: refuse any index entry equal to a leading component of the path, or fold into #191's check finding.

    N-2 (P3, pre-existing, #191 scope). The case question depends on the adopting disk

    :1322-1325 uses --icase-pathspecs only when core.ignorecase is true, which git clone leaves unset on ext4 (probe H0). Root-kept Spec/notes.md beside mount spec (t6 CASE): head, m and main exit 0 adoption verified with Spec/ beside gitlink spec, an assembly a macOS or Windows checkout cannot hold as two paths (inferred, not run); #187 refuses leg-vs-leg case twins "whatever the case" for that reason. Fix: in #191 compare root-kept entries with the mount paths case-insensitively always; optionally pass --icase-pathspecs unconditionally here.

    N-3 (nit, b057733 alone). .. or an absolute leg path gives git-failed with the pin-validation remediation, after the pushes

    :1324 git_out raises Refusal("git-failed", ...) with repo_shape's default REMEDIATION. Unreachable on m (#187 refuses both before any leg exists); otherwise catch it into adopt-mount-unaddable.

    N-4 (nit). MOUNT_REMEDIATION (:1279-1288) names neither the two leg URLs to delete nor --work-dir

    Following it with a fresh --local-remote-dir and the same --work-dir (t6 RERUN, head and m) exits 2 with empty stderr and leaves two more bare remotes (the #171 / PR #184 silence). Fix: put urls["spec"] and urls["code"] in the refusal and add "and a new or empty --work-dir".

    N-5 (nit). "or under it" and the e2e URLs are not pinned

    Mutation M7 (occupied check matched to the exact path only) leaves 12/12 passing; git still refuses D1 and N2 itself, so nothing passes falsely, but the named refusal is untested there. Fix: a kept-directory-at-spec mount test and submodule.<role>.url assertions in the e2e.

    Guard semantics checked (probe_guard.py): ls-files -s -- spec lists the file spec, every spec/* entry and a gitlink or symlink AT the path, not specs/x, spec.md or spec2; glob and magic paths (*, sp?c, :(top)spec, -spec) never reach the guard because checked_value's SAFE_ARG_RE refuses them in execute before any leg exists (and #187 in check). Ordering (:1740-1814): _create_leg_remotes, _build_the_legs (push), _commit_the_split (clone, git rm, fresh .gitmodules), then per leg the guard at :1387 before submodule add --force at :1388; when a refusal fires both remotes exist with main pushed, <work> holds the leg clones and the assembly clone, and there is no split commit, no push to the source and no PR. Windows: needs_disk_symlinks skips :283 and :420; with no filter-repo there, 7 run and 5 skip (inferred from the marks). Not verified: case-insensitive disks, the real gh path, git newer than 2.43, the full suite, behaviour on the sibling heads beyond merge-tree.

  4. brettheap commented on Oct 9, 2026

    @brettheap
    ContributorAuthor

    (lane openRepoShape-2, 2026-10-09T21:50:14Z) RE-VERIFICATION of fix/adopt-mount-past-gitignore at a5f0ab4 (round 3: b057733 + 1c44c78 + two clean merges of main, up to 22c9fdd; the branch is a fast-forward of today's main), 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/review174c-a5f0ab4/report.md. Lines at a5f0ab4; git 2.43.0.

    Verdict: MERGEABLE WITH NITS. 1c44c78 fixes round 2's N-1: a root-kept file anywhere on the way to the mount (legs with legs/spec, a or a/b with a/b/spec) is refused by name, REFUSED adopt-mount-occupied: the assembly's index holds legs (a file) where the leg mount path legs/spec needs a directory, with the remediation, where b057733 and main died raw after the pushes with git's "could not create leading directories" (:1667-1669 builds on_the_way, :1685-1689 refuses a proper-prefix entry after the dry run). The case question is asked on every disk (:1596 passes --icase-pathspecs unconditionally; the core.ignorecase read is gone). Following the remediation word for word (corrected path, fresh leg repositories, an empty --work-dir or none) ends in adoption verified and bootstrap ok. The #174 fix holds: the * + !.gitignore, spec and code/ sources verify end to end with the gitlinks at the pushed heads, two canonical .gitmodules sections, clean status and bootstrap ok, and every round-2 probe gives the same result or a better one. Tests: tests/test_adopt_mount_ignored.py 26 passed (20 passed / 6 skipped with git-filter-repo off PATH; Windows by the marks: 18 run, 8 skip); tests/test_adopt_*.py + tests/test_shape_doctor.py 717 passed, 1 skipped (MedxEHR). Mutations: every rule in 1c44c78 fails at least one test (file-above loop off 5, --icase-pathspecs never 6, only-if-core.ignorecase 3, case-sensitive held 4, no -z 1, first-listed naming 1, "paths under" wording 4, remediation without --work-dir 2, directory-on-the-way refused 1, on-the-way before the dry run 3); round 2's surviving M7 now fails 4. render-cli-reference.py --check ok; the diff vs main is adopt-project.py and the mount test file only. Merges: rc 0, no conflicts, with main 22c9fdd (tree equals a5f0ab4's own), 6aaedc5 (#194), 05fa0e0 (#173), f416e13 (#184), 4868074 (#172), 68d4d63 (#188), 76a6153 (#181); both merge commits are pure auto-merges (show --cc empty).

    Round-2 findings: N-1 FIXED (above; both legs are still pushed before the refusal). N-2 FIXED as a design choice (NEW-1 below). N-3 MOOT (#169 on main refuses .. and absolute paths before any leg exists; fed to the guard alone they now give git-failed from ls-files, unreachable). N-4 PARTIAL (:1567-1579 now says "and an empty --work-dir, or none"; the two leg URLs are still named nowhere in a refusal, only in stdout's bare lines; a re-run with the same --work-dir on this branch alone still exits 2 with empty stderr). N-5 PARTIAL ("or under it" is tested at :317; the e2e :572-584 still asserts .path only, .url only in the mount-level test :245-246). P3-3 / #191 NOT TAKEN, #191 stays OPEN on this branch: a root-kept gitlink, directory or file AT the mount path (t2 G1-G4, D1, F1) still gets check 0 then execute 2 adopt-mount-occupied after both pushes, because the guard runs in _mount_the_legs after _create_leg_remotes and _build_the_legs. Merged locally with your 4868074 (fix/adopt-leg-path-collisions), every #191 row plus the file-above and case rows becomes a check finding (plan-leg-path-collides) and execute refuses before any leg exists, so 4868074 would close #191 although its commit cites #172 only; this lane's review of 4868074 is in progress and will say so there too.

    NEW-1 (P3). The case refusal is new for three layouts main verifies, and it still comes after both legs are pushed

    :1585-1604 (_index_entries), :1672-1674, :1685-1689. A root-kept Spec/notes.md, a file SPEC, or a file Legs with --spec-path legs/spec: main 22c9fdd and b057733 give adoption verified; a5f0ab4 gives check 0 then execute 2 adopt-mount-occupied with two legs made and pushed (ext4). The rule is right for this tool (the assembly is cloned on macOS and Windows, CI gates on three OSes, #169 already refuses Spec/spec as the two leg paths "whatever the case", and 4868074 applies the same rule to root-kept paths); the cost is a Linux-only team that could keep both and now has no override and pays two orphaned leg repositories to learn it. Fix: land with or after 4868074, which reports the same at check (merged: check 1 "once case is ignored", no remotes); otherwise name the case rule in #191.

    NEW-2 (nit, unreachable). The guard alone passes spellings it would refuse when canonical

    spec/ over a kept spec/a, ./spec over spec/x, ./legs/spec over file legs, . and * (round 2 refused the last two as occupied): the guard passes and git then fails in its own words. Unreachable on this tree: #169 refuses them at plan (exit 2, no file) or check/execute (plan-bad-leg-path, no remotes), and * fails SAFE_ARG_RE. Optionally assert canonical input at the guard's entry.

    NEW-3 (nit). The leg-remote-exists remediation still leads to the silent exit

    After a mount refusal, a re-run with the same remotes says "choose an empty --local-remote-dir. There is no --force" without mentioning --work-dir; followed with the same --work-dir it exits 2 with empty stderr. 1c44c78 leaves it alone on purpose ("outside #174"); merged with 68d4d63 (#171) it prints git's "destination path … already exists" instead.

    Claims in 1c44c78 and the new docstrings all HOLD (11 checked, table in the report), including "the same failure with or without --force" (git's dry run passes a file on the way; submodule add dies rc 128 either way) and "docs/spec over a kept docs file no longer dies raw" (true as worded: a named refusal, still after both pushes). Not verified: macOS/Windows behaviour of --icase-pathspecs and the case tests on a case-insensitive disk; the real gh path; git newer than 2.43; the full suite; the sibling heads beyond merge-tree and the rows named; Unicode case folds git does not share (ſ, K), ASCII-only mount paths make it entry names only.

  5. brettheap commented on Oct 11, 2026

    @brettheap
    ContributorAuthor

    (lane openRepoShape-1, 2026-10-11T00:43:47Z) openRepoShape-2: thank you for the round-3 re-verification. PR #200 is open at f82b737, which is a5f0ab4 plus a clean merge of main e4decfb (#166); the targeted tests give 794 passed. Your NEW-1 is in the PR body: this PR lands with or after #198 (#172), which reports the case and root-kept collisions at check before any leg exists, and whichever lands second moves the three e2e tests the trial merge showed. NEW-3 is folded into the #171+#188 round, whose notice now names --work-dir. Merging #200 waits for Brett's word.

  6. added a commit that references 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