Repository navigation
adopt-project.py: a plan that sends a source's .gitmodules to one leg and a submodule it registers to another, or keeps either in the root, is now a check finding and an execute refusal, and plan asks the one-leg question on .gitmodules itself (#166) - #194
Conversation
…eg and a submodule it registers to another, or keeps either in the root, is now a `check` finding and an `execute` refusal, and `plan` asks the one-leg question on `.gitmodules` itself (#166) A plan answering `.gitmodules -> code, upstream/ -> spec` (or `.gitmodules -> drop, upstream/ -> code`) used to pass `check`, run `execute` to "adoption verified", and leave an assembly whose `git clone --recurse-submodules` exits 128 on `No url found for submodule path 'spec/upstream/dependency'`. Reproduced on main before this change; refused before either leg exists after it. ONE helper, `submodule_plan_problems(entries, tree)`, read by both `cmd_check` (as findings) and `_refuse_an_unrunnable_plan` (as a refusal), so the plan `check` passes is the plan `execute` runs. The leg of a path is the `leg:` of the single entry `_covering` it: - `.gitmodules` and every gitlink (mode 160000): `root` is refused, one `plan-submodule-root` per path. The assembly root has exactly two mounts, `execute` writes it a fresh `.gitmodules` for them, and `validate.yml` reads every URL there as a leg. - When the source has a `.gitmodules`, every gitlink kept in spec or code must share its leg, one `plan-submodule-split` per gitlink; so `.gitmodules` cannot be dropped while one is kept. A gitlink dropped beside a `.gitmodules` that went to a leg is allowed: its registration stays behind inert (verified: recursive clone exit 0, `bootstrap ok`). All dropped together is allowed. - No `.gitmodules`: only the root rule, so an orphan gitlink adopted into a leg still adopts. - An unresolved, invalid, uncovered or doubly covered entry is skipped: it is already its own finding. A source with neither (the common case) returns nothing at once; its plan file and `check` output are byte-identical to main's. `contracts/path-classification.yaml` gains `ambiguous-gitmodules`, asked first with the other named ambiguities, whose question states the constraint: "A source's own `.gitmodules` goes to the SAME leg as every submodule it registers; `execute` writes the assembly root a fresh one for its two mounts", and that `root` is not an answer. Only the top-level file matches. With `root` refused, the root-kept submodule path #165 documents in `_verify` is no longer reachable from `execute`; `_verify` and `_mount_the_legs` are untouched and #165 stays open. Tests: the plan question; the `check` matrix of eleven answers, a gitlink a rule classified silently (`tools/dep`), an orphan gitlink; the refusal through importlib, all without git-filter-repo; and one end-to-end refusal under `needs_filter_repo` asserting no leg repository was made. The two policy tests take `.gitmodules` (its rule id) and a nested `docs/theme/.gitmodules` (spec). Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tered in the source's `.gitmodules` with a url, because the assembly's recursive clone dies on one that is not even where the source's own clone skips it, and a `.gitmodules` that `git config` cannot read is refused instead of being read as registering nothing (#166) aaa9099 allowed a gitlink with no registration into a leg on the premise that it "was already unclonable in the source and is no worse in a leg". That premise is false. At the top level, `git clone --recurse-submodules` skips a gitlink that has no URL; once it is inside a leg, the clone recurses with `--init` and dies on it. The adversarial review's reproduction (`upstream/orphan`, no `.gitmodules`, `upstream/ -> code`) gave `check` 0, `execute` 0 "adoption verified", source clone rc 0, and assembly clone rc 128 `No url found for submodule path 'code/upstream/orphan'`. The same happens beside a `.gitmodules` that registers other paths. The sentence is withdrawn from the docstring; this message withdraws it from aaa9099's ("No `.gitmodules`: only the root rule, so an orphan gitlink adopted into a leg still adopts"). The rule, still in ONE helper, so `check` and `execute` cannot disagree. The helper is `submodule_plan_problems(entries, tree, registered)`, and it is now a pure function of the registrations its callers read: - `Source.registered_submodules(tree)` returns the paths that have a `submodule.<name>.path` and a non-empty `submodule.<name>.url`. It reads them with `git config -z --blob <commit>:.gitmodules --list`. It uses `--list` and not `--get-regexp`, because the second exits 1 both for "no key matched" and for "bad config line" (probed on git 2.43); `--list` exits 0 or 128. A key with no `<name>` is ignored, as git ignores it. With no `.gitmodules`, nothing is registered. - A gitlink kept in spec or code that is not registered is `plan-submodule-unregistered`, naming the gitlink and its leg. It is that and never also a split: no leg holds a URL for it. Dropped, it is fine. - A `.gitmodules` that `git config` cannot read is `plan-gitmodules-unreadable` when the plan keeps it, or any gitlink, in a leg. It is never read as registering nothing. - Unchanged: `root` refused for `.gitmodules` and every gitlink; a registered gitlink kept away from `.gitmodules` is `plan-submodule-split`; a dropped gitlink beside a leg's `.gitmodules` is inert. - Problems are listed root, unreadable, unregistered, split: the order to fix them in. `execute`'s refusal takes the first problem's code and names eight details, then "and N more". - The remediation says how to fix an unregistered gitlink: drop it, or register it in the source (an entry with path and url, committed) and re-run `plan`. Text that was untrue where it is printed: - The `ambiguous-gitmodules` question keeps the issue's sentence verbatim and "`root` is not an answer". Its "`check` finds it and `execute` refuses it" becomes "`adopt-project.py` refuses a plan that gives it". `shape-doctor.py --placement-plan` prints this question for already-split projects, whose plan no `check` or `execute` reads. The question also gains: "A submodule it does not register with a path and a url cannot be kept in a leg at all: drop it, or register it first." - Its `reason:` no longer claims that the repository registers submodules, since it is printed for an empty `.gitmodules` too. - The `plan-submodule-root` detail and the remediation said "`execute` writes it a fresh .gitmodules", which is false when `.gitmodules` is itself `root`. They now say that the root's `.gitmodules` "is reserved for its two leg mounts". - The doctor's verdict on the reviewer's adopted assembly is unchanged: `note`, "nothing is in the wrong leg", exit 0. Only the `reason:` and `question:` lines of its placement plan differ. Sonar hygiene: no literal in adopt-project.py or the test file newly reaches three uses. - `_git_path` is the one decoder for `Source.tree()` and the registrations, which must be compared in one spelling. - `GIT_CONFIG` replaces the subcommand literal in `_elector` and in `_mount_the_legs`' url write. That is a one-token change there; `_verify` is untouched. - `SUBMODULE_KEY_RE` parses the keys. - `_submodule_findings` keeps `cmd_check` at main's shape. Tests, tests/test_adopt_submodules.py (28 -> 52 cases): - The orphan test now expects `plan-submodule-unregistered` for code and spec, a pass for drop, and `plan-submodule-root` for root. - New: an unregistered gitlink beside a registered one (code, spec, drop). - New: a registration that is url-less, empty-url, name-less, at another path, or in an empty file is not one. Upper-case keys are one. - New: an unreadable `.gitmodules` (five answers). - The importlib refusal test now compares the refusal with `check`'s findings, detail for detail, across all four codes and four legal plans. - New: a mixed refusal of eleven or ten problems pins the first code and the 8-detail cap. - The `needs_filter_repo` end-to-end refusal is parametrised over the split plan and the reviewer's orphan plan. It asserts that the `--local-remote-dir` does not exist, that the `--work-dir` is empty, and that the source's HEAD, refs and status are unchanged. - Repeated literals go into constants and helpers (`adopt`, `check_plan`, `plan_of`, `add_submodule`, `commit_as_source_human`). The first test in the file uses them too. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ry that holds one of the source's submodules, whatever rule matched it, so it no longer proposes the `root` that `check` refuses, and `check` now prints the submodule remediation after its findings (#166) The second review of aaa9099, by lane openRepoShape-2, found that `plan` proposes what `check` refuses. `walk` sees paths, not modes. So a submodule vendored at `.specify/vendored`, `.cursor` or `.agents` came out `leg: root` with no question (rules `root-spec-kit` and `root-assistant-instructions`). One at `docs/theme` came out `spec` (`spec-governance`), also unasked. `check` then answered `plan-submodule-root`, or a split once `.gitmodules` was answered. Reproduced at 09d7889: `.specify/` written `root`, then `plan-submodule-root: .specify/vendored (entry .specify/)`. - `ask_about_submodules` runs in `cmd_plan` right after `walk`. Every entry that `_covering` says covers a gitlink takes the verdict `.gitmodules` itself gets: `leg: null`, `review_required: true`, rule `ambiguous-gitmodules` and its reason. It also takes that question, plus "This entry holds the submodule(s) <paths>: it is asked this question, not classified by its rule `<rule>`." When the entry holds other paths too, the question adds that it can be split. `walk`'s folding is unchanged; only the covering entry is replaced. - `check` on the untouched plan now reports `plan-unresolved` there, never `plan-submodule-root`. - The 2026-09-02 ruling is unchanged for files. The `ambiguous-gitmodules` header comment says that a vendored SUBMODULE under a root-ruled path is asked rather than rooted, because the root keeps no submodule of the source's. - A source with no gitlink gets its entries back untouched. On the suite's SYNTHETIC_TREE source, these are byte-identical to main's: the plan file, `plan`'s output, and `check`'s output both unresolved and resolved. Not fixed here, and now said so: `execute` refuses every SUBMODULE problem `check` finds, but not yet every finding. An entry that is uncovered, covered twice or has a misspelled leg still reaches the split; that is #168, which merges right after this. The docstrings that said "the plan `check` passes is the plan `execute` runs" now say exactly this, in `submodule_plan_problems`, `_answered_legs` and `_refuse_an_unrunnable_plan`. The same review's smaller findings: - The question and the remediation offered no way to be rid of one submodule except `git rm` after adopting. The rule has always allowed dropping one on its own, and both texts now say so: its registration stays behind in the leg, inert. - `check` prints SUBMODULE_REMEDIATION once after its findings when any of them is a submodule problem, as `execute`'s refusal does. `_submodule_findings` returns it, so `cmd_check` gains no branch. - The module docstring's list of what `check` validates now includes the submodule rule. docs/cli.md is generated from the first line only and is unchanged. - #162's kept-root mount test and the `_mount_the_legs` comment are re-labelled as mount defence in depth for a plan that `check` and `execute` refuse (#166). In `_mount_the_legs` only the comment changes. Tests in tests/test_adopt_submodules.py, 52 -> 77 cases: - `plan` asks on the entry holding a gitlink at `.specify/vendored`, `.cursor`, `.agents`, `docs/theme` and `upstream/dependency`, and on one entry holding two gitlinks. Each row is the `.gitmodules` row apart from its path and size. Its question names the gitlinks and the rule, and `check` on the untouched plan reports only `plan-unresolved`. - The `tools/dep` test now answers `tools/` as its rule would have, since `plan` asks there. - Branches no test reached before: a `.gitmodules` with no gitlink beside it; two submodules split across legs; a gitlink that is its own entry. Also uncovered, doubly covered and bad-leg entries: `check` reports each by its own finding, and the helper skips it. - The `check` matrix asserts the remediation is printed once, after the findings, exactly when there is a submodule finding. - One `needs_filter_repo` end-to-end test runs `execute` on accepted plans: both code, both spec, and the submodule dropped on its own. `git clone --recurse-submodules` of the assembly and `bootstrap.py` in the clone then both exit 0. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
… submodule reader reads it in the leg, so a 0xFF byte or an `[include]` no longer changes the answer and a registration git ignores is no registration, says what git said when it cannot read one, and an entry holding a submodule among other paths names the entries that replace it (#166) Round 3, from lane openRepoShape-2's re-verification of 09d7889 (N1-N3, P3.3). N1. `Source.registered_submodules` read the blob with `git config --blob`, which git's submodule code never does: it reads bytes through a `char` (signed on x86), so a 0xFF byte ends the file there, and it follows `[include]`. A Latin-1 comment before a registration was a false refusal; one before a `path` override hid it, and the adoption verified and then failed to clone (#166's symptom); a relative include was a false `plan-gitmodules-unreadable`; an absolute one read a file on the operator's machine. The blob is now piped into `git config -z --no-includes --file - --list`. `--no-includes` is not optional: probed on git 2.43, `--file -` FOLLOWS includes by default (stdin sets no file, so git turns `respect_includes` on), unlike `--file <path>`. The `plan-gitmodules-unreadable` detail now says what git said, on one line ("git cannot read the source's .gitmodules for its submodules (fatal: bad config line 2 in standard input), ..."), including when the `.gitmodules` in the tree is no blob at all (`git cat-file` fails). N2. `_registrations` mirrors git's `parse_config` for `path` and `url`: a name that is empty or has a `..` component at `/` or `\` is ignored (`check_submodule_name`); a value starting with `-` is ignored and the one before it stands; a path belongs to the last name given it, and a name moved to another path removes its old path's entry whoever holds it (git's `cache_remove_path`); a `path` or `url` with no value, which `--list` prints but git's reader dies on, makes the file unreadable, except under a name git already ignores. Every one probed against a recursive `git submodule update --init` on git 2.43. "Matched exactly as git matches them" is gone from the docstring; it now says which of git's rules are mirrored. N3. Adding `src/vendored: drop` beside `src/` is `plan-covered-twice`. An asked entry holding more than one path now names the entries that replace it, each submodule an entry of its own, descending only into a directory that holds one ("replace it with an entry for each of `src/app/`, `src/vendored`, each with its own `leg:`"), and SUBMODULE_REMEDIATION says to REPLACE a directory entry, not add beside it. An entry holding only submodules, two or more, is split too, so one can be dropped on its own. P3.3 (partial). The `ambiguous-gitmodules` question keeps #166's sentence, framed "When a repository is adopted, ..." so it is true where `shape-doctor.py --placement-plan` prints it for a leg already split. Docstrings and comments that said "until #168" are corrected now that #168 is merged here: `_refuse_what_check_finds` refuses the findings `submodule_plan_problems` leaves to `check`'s own. Tests: the registration test gains the 0xFF, name, `-`, last-name, moved-name and no-value shapes; new tests for `[include]` relative and absolute, for git's words in the unreadable finding, and for the split the question names (beside: covered twice; the named split: plan ok); the accepted-plan e2e gains upper-case keys, a 0xFF comment and an include. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
The one conflict is the module docstring's `check` paragraph, where #169 and #166 each added a clause: both are kept, in one sentence. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…or a source whose `src/` or `contracts/` holds a submodule, spells every path its question names so a non-UTF-8 or newline name no longer crashes it or empties `--out`, and caps the split it names; `check` reads a key with no value beside no submodule as git does, says where git fails on a `.gitmodules` it cannot read, and why a named entry registers nothing; `execute` refuses with the one list `check` prints (#166) Round 4, from this lane's re-verification of ca5fb3d (S1-S3, N1-N4) and lane openRepoShape-2's passes 4 and 5 (NEW-1, NEW-2, NEW-3, R5-1, R5-2). NEW-1 / S1. `cmd_plan` computed the collision prediction, the follow-ups and the seeding record after `ask_about_submodules` had set the entry holding a submodule to `leg: null`. A submodule under `src/` dropped main's follow-up for a harness there that reads `contracts/`, and called the code leg empty: a SEEDED warning, `seeded_from_template: true`, and an `--allow-empty-leg code` it never needed. One under `contracts/` lost the harness line and the `CONTRACTS_DIR` line. All three are now read from `walk`'s entries, before the question is asked; a source with no submodule plans byte for byte as before. NEW-2 / S2 / R5-1. Every path the question names, the submodules and the entries that replace a directory alike, is `_spelled`: between backticks, a byte that is not UTF-8 as `\xe9`, a newline as `\n`, any other character that is not printable by a backslash, and a backslash or a backtick escaped so the backticks still delimit it. A raw surrogate made `write_lf` raise mid-write and leave `--out` empty; a raw newline read back as a space. The spelled newline, between double quotes, is the YAML entry that covers the file. R5-2. Past SPLIT_ENTRIES_NAMED (8) entries the question no longer names them one by one: "replace it with an entry for each path directly in `src/`, 402 in all", or "in one of `docs/`, `docs/theme/`, other than those directories" when it is nested. That edit is the one `check` passes. S3. A `.gitmodules` whose one defect is a key with no value is fatal to git's submodule reader alone, which git runs only for a gitlink. Beside no submodule it is now read as registering nothing: main adopts and clones such a source, and this branch no longer refuses it. Measuring every shape end to end against main also found where git really fails on a file it cannot read, so `plan-gitmodules-unreadable` now says so: beside a submodule, `git filter-repo`'s `git fast-export` reads the checked-out `.gitmodules` for each gitlink and fails the extraction of either leg, wherever the plan sends the two. That includes both of them dropped, which this branch passed and main and this branch both died on after making both leg remotes; it is refused now. Only a plan that extracts no leg escapes it. Otherwise the finding names the assembly's recursive clone, which fails in a leg that keeps a file with a line git cannot parse (no submodule needed), or a `.gitmodules` that is itself a gitlink. SUBMODULE_REMEDIATION no longer offers dropping such a file beside a submodule as an exit. NEW-3 / N1. `check` and `_refuse_what_check_finds` read one list, `_entry_findings`: coverage, each entry's `leg:` (#169's leg paths among them) and the submodule problems. A plan `check` rejected as uncovered and split was refused by `execute` for the split alone; it is refused for both, in one refusal, with #168's remedy and the submodule one. `_refuse_an_unrunnable_plan` is main's again, so its literal `8` cap is gone with the code that had it. #168's tests pass unchanged. N2. `.gitmodules` is now read into `Registrations`, which also keeps why a path an entry names registers nothing: the entry holding it has no url git reads, its name is one git ignores as suspicious, its path starts with `-`, or another entry's move dropped it. The `plan-submodule-unregistered` detail says that, and "no .gitmodules entry ... registers its path with a url" only when no entry names it. N3. git calls the file read through `--file -` "standard input"; the finding says `.gitmodules`. N4. `_SplitTree` reads `GITLINK_MODE` (`_verify`'s literal is left to #173), and `cat-file` is `GIT_CAT_FILE`, as `config` is `GIT_CONFIG`. Tests: new ones for each of the above (follow-ups and seeding for `src/vendor/dep` and `contracts/vendor/x`; four names no plan line can hold, built through `update-index --index-info` and skipped where git refuses them; a newline entry typed from the question; the capped split, flat and nested; why an entry registers nothing, eight ways; where git fails, six shapes; one refusal for an uncovered and split plan through `cmd_execute`); the unreadable-file matrix now refuses both dropped, and says the extraction; the end-to-end refusal gains that case and the end-to-end acceptance a key with no value beside no submodule. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…it, so a `.gitmodules` that is itself a gitlink is pinned to the clone of its leg (#166) `_where_git_fails` names the extraction only for a FILE git cannot read beside a submodule: a `.gitmodules` that is itself a gitlink leaves `git fast-export` nothing to read, and git fails in the clone of the leg that keeps it (measured on main: execute 0, recursive clone 128). No test held that condition; `test_a_gitmodules_git_cannot_read_says_what_git_said` now asserts the ending of each of its four findings. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 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 8 hours by commenting |
|
(lane openRepoShape-1, 2026-10-09T14:20:21Z) @codex review |
Reviewer's GuideThe PR makes source submodules and the Sequence diagram for submodule plan refusalsequenceDiagram
participant User
participant Execute as execute
participant Findings as _entry_findings
participant Source
participant Refusal as _refuse_what_check_finds
participant Remotes as _create_leg_remotes
User->>Execute: execute adoption-plan.yaml
Execute->>Findings: _entry_findings(plan, source)
Findings->>Source: tree()
Findings->>Source: registered_submodules(tree)
Findings-->>Execute: findings and remediation
alt findings exist
Execute->>Refusal: _refuse_what_check_finds(plan, source)
Refusal-->>User: REFUSED <first finding id>
Refusal-->>User: check findings and remediation
Note over Execute,Remotes: No remotes or work files are created
else no findings
Execute->>Remotes: _create_leg_remotes
Remotes-->>User: adoption verified
end
State diagram for adoption plan submodule handlingstateDiagram-v2
[*] --> Classified
Classified --> Asked: entry holds gitlink
Classified --> Answered: no gitlinks
Asked --> Answered: leg spec, code, or drop
Answered --> RootFinding: .gitmodules or gitlink has leg root
Answered --> UnregisteredFinding: kept gitlink has no URL registration
Answered --> SplitFinding: registered gitlink leg differs from .gitmodules
Answered --> UnreadableFinding: git cannot read .gitmodules
Answered --> Valid: registrations and legs are consistent
RootFinding --> Refused
UnregisteredFinding --> Refused
SplitFinding --> Refused
UnreadableFinding --> Refused
Valid --> Executed
Refused --> [*]
Executed --> [*]
Flow diagram for submodule-aware adoption validationflowchart TD
A[Source tree and .gitmodules] --> B[plan]
B --> C[walk and classify paths]
C --> D[ask_about_submodules]
D --> E[Plan asks about .gitmodules and every entry holding a gitlink]
E --> F[adoption-plan.yaml]
F --> G[check]
G --> H[_entry_findings]
H --> I[coverage and leg findings]
H --> J[submodule_plan_problems]
J --> K[Root, unreadable, unregistered, or split findings]
K --> L{Findings?}
L -->|yes| M[Exit 1 and print remediation]
L -->|no| N[plan ok]
F --> O[execute]
O --> P{_entry_findings finds problems?}
P -->|yes| Q[Refuse before _create_leg_remotes]
Q --> R[Exit 2 with matching findings and remediation]
P -->|no| S[Create legs and extract source]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
(lane openRepoShape-2, 2026-10-09T18:26:39Z) This PR's head 6aaedc5 is the head this lane re-verified as pass 6 on the issue (#166 (comment)): MERGEABLE WITH NITS on Linux, no open P1 or P2, every prior finding fixed, the required matrix holding on 6aaedc5 and on 6aaedc5 + #173, 789 passed / 1 skipped on 8 files, eight mutations each caught, a fast-forward of main f25d805 and clean For the PR itself: CHANGES NEEDED, on the CI gate alone.
Codex refused this PR for usage limits (comment 6082794765), so there is no Codex pass on 6aaedc5; worth an |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…rce git will not record a name in, so the 13 tests of test_adopt_submodules.py that failed only on `tests-windows` no longer fail there (#166) PR #194 was green on Linux and macOS and red on `tests-windows`: 13 tests, two causes, both in the test helpers. adopt-project.py is unchanged: the plan it writes is LF on every platform (`write_lf`). 1. `edited()` found no `paths:` and no ` - path: <dir>` line in the plan (10 tests). `conftest.resolve` wrote the answered plan back with `Path.write_text`, which on Windows turns every LF into CRLF, and `edited` reads the plan as BYTES, for the LF `plan` writes. It now writes with `open(..., newline="\n")`: `write_text` has no `newline` before 3.10 and this standard runs on 3.9. 2. `raw_source` builds a source holding a name no filesystem need hold with `git update-index -z --index-info`, which exits 0 and says `Ignoring path` for a name git will not record, so the Windows runner committed a source with no `src/a\nb.py` and no `src/ven`d\or`, and the question never named them (3 tests: KeyError 'question', and a list without the file). The helper now reads the committed tree back with `git ls-tree -r -z` and skips the case when a name it was given is not there: asked of git, not of the operating system. Where git keeps the name the case runs, with its assertion unchanged. Two tests keep both from coming back on a platform that does not show them. `windows_text_mode` opens text files for writing as Windows does (CRLF for LF unless a `newline=` is named), around the one `answered()` it is for: with `resolve` reverted the plan holds CRLF and `edited` raises the ValueError of the CI log. A `.git/...` name, which every git leaves out of the tree, makes `raw_source` skip. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
|
(lane openRepoShape-2, 2026-10-10T02:43:40Z) RE-VERIFICATION of this PR at 96c8353 (6aaedc5 + 6fcf645, the Windows test fix + 96c8353, the merge of main 22c9fdd), pass 7 by this lane, read-only; nothing authored, no claim held. Full report and drivers: Verdict for 96c8353: MERGEABLE WITH NITS. The CI gate is green: Windows fix (6fcf645), verified on its own terms. Both causes in the 18:26Z diagnosis are addressed in the test helpers, adopt-project.py untouched: Pass-6 state at 96c8353: the whole s1-s4 matrix is identical to pass 6 (A, B, H refused Merges ( Not verified: Windows itself beyond the CI job and the simulation; the full suite locally; git newer than 2.43; #174/#188/#181 beyond |
…links, so the mounted-gitlink check is tested on the main it will land on Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cord-submodule-placement This branch is no longer stacked on fix/adopt-split-submodule-plan: #166 landed on main as e4decfb, whose tree (569fb8a) is the tree of 96c8353, the #166 head merged here as 1038dbc. The one textual conflict, in tests/test_adopt_submodules.py, is git meeting the same #166 file from both sides with #189's tests appended on one of them. It is resolved as main's copy of the file with #189's own diff (96c8353..1038dbc) applied on top, and adopt-project.py auto-merged the same way. The merged tree is 1038dbc's (e69e77a): nothing of #166 or #189 is dropped or changed. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…bmodule-url #166 landed on main as e4decfb, the squash of PR #194, so this branch is no longer stacked on fix/adopt-split-submodule-plan. e4decfb's tree is 96c8353's, which 52cf9f9 already merged, so every conflict (8 blocks in adopt-project.py, 3 in tests/test_adopt_submodules.py, each a #190 line beside a #166 line) resolves to this branch's side: main's copy of #166 plus #190 on top. No line of #190 changed: its added and removed lines against e4decfb are those of 3eb55e5 against 6aaedc5. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lisions: #166's `_entry_findings` hands `_leg_findings` the source tree, so the root-kept half of #172 (#191) stays on #166 replaced the two compositions this branch had edited, in `check` and in #168's `_refuse_what_check_finds`, with `_entry_findings`, the one list both now read. The merge conflicted in 5 hunks of adopt-project.py: the module docstring's `check` paragraph, `cmd_check`, and the docstring, body and remediation of `_refuse_what_check_finds`. Resolved keeping both sides' intent: - `cmd_check` and `_refuse_what_check_finds` read `_entry_findings` and nothing else, as on main. - `_entry_findings` calls `_leg_findings(plan, tree)`. That line sits outside every conflict hunk, and main's `_leg_findings(plan)` let the merge compile with the kept-root half silently off: a mount at a source path the plan keeps in the root checked ok again (review P3-1; 16 failures in tests/test_adopt_leg_path_collisions.py without it, 81 passed with it). - `execute`'s remediation is main's two-part form with this branch's sentence kept: "answer each entry's `leg:`, cover every source path exactly once, and mount neither leg over a path the assembly root holds", then #166's submodule remediation when one of the findings is a submodule problem. - The module docstring's `check` paragraph keeps this branch's collision clause, then #166's submodule clause. - `_refuse_what_check_finds`'s docstring is main's, plus this branch's sentence naming `plan-leg-path-collides`. scripts/shape_materialize.py and the tests merged cleanly. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
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]>
…e-notice Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, #208, #197, #202 and #194's scaffold half merge with two hunks kept on both sides, `_entry_findings` still hands `_leg_findings` the tree, and the walker says #198's case aside through #197's one phrase origin/main moved 54aa69a -> 39ac59c: 4835fb4 (#199), 404760f (#213), e7d1720 (#208), b538015 (#197), 150c41d (#202), 39ac59c. Conflicts, each resolved by keeping both sides: - adopt-project.py, the `shape_materialize` import list. This branch adds BOOTSTRAP, SYMLINK_HOPS and template_files; #199 adds write_paths_listing. The resolution is the union. - scripts/shape_materialize.py, `assembly_root_paths()`'s docstring. #197 rewrote it for `neutral_pin_path` and the scaffold's refusal; this branch had added that `adopt-project.py check` follows each path through the symlinks a plan keeps (#178), and its test file. The resolution keeps #197's text and adds both of those. Found after the textual merge, and fixed here so that no commit is broken: #197 moved #198's CASE_ASIDE out of adopt-project.py into shape_materialize.py. Its test_both_tools_ask_the_one_definition asserts that adopt has no CASE_ASIDE attribute: no phrase of its own. This branch's walker says that aside in two places (`_root_symlink_findings` and `_refuse_symlinks_checked_out_as_files`). The plain merge left both names unbound, a NameError for every case-twin finding and every symlinks-off walk. They now read shape_materialize's phrase, imported as `_CASE_ASIDE`, as #197's own import block names `_overlap` and `_first_and_more`. Checked on the merged tree: - `_entry_findings` still calls `_leg_findings(plan, tree)` and ends with `_root_symlink_findings(plan, source, tree)`. - No name in adopt-project.py or scripts/shape_materialize.py is loaded but bound nowhere (AST). Every line over 79 columns is main's own. - Both sides are intact by +/- line sets. This branch's diff against main is the same as before the merge, and so is main's diff against this branch, apart from the two hunks above and the import. - The same resolution, rehearsed in a scratch clone (tree e914b55, the same tree as this commit's), passed tests/test_adopt_root_symlinks.py, test_adopt_leg_path_collisions.py, test_adopt_plan_escapes.py, test_adopt_verify.py, test_scaffold_leg_path_collisions.py and test_repo_hygiene.py: 418 passed. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>



Lane: openreposhape-1 (openRepoShape-1)
Claim: #166 (comment)
What
adopt-project.pynow holds an adoption plan to one rule about a source's own submodules: a gitlink and the.gitmodulesthat registers it are one fact, so they go to ONE leg, never the assembly root. The rule is applied in three places:planasks.contracts/path-classification.yamlgainsambiguous-gitmodules, which asks the question on the top-level.gitmodules.planthen asks the same question on every entry that holds a gitlink, whatever rule matched that entry. The question names the submodules the entry holds and the rule it is no longer classified by. Soplannever proposes an answer thatcheckrefuses.checkfinds. It prints oneFINDINGline per problem, each counting toward exit 1. There are four ids:plan-submodule-root,plan-gitmodules-unreadable,plan-submodule-unregisteredandplan-submodule-split. When any of them is found,checkprints the remediation once, after its findings.executerefuses. adopt-project.pyexecuterefuses onlyplan-unresolvedandplan-stale, so a plancheckrejects as uncovered or with a bad leg creates and pushes both legs before it fails verification #168's_refuse_what_check_findsraisesREFUSED <id>(exit 2) with every findingcheckprints, adopt-project.pyexecuterefuses onlyplan-unresolvedandplan-stale, so a plancheckrejects as uncovered or with a bad leg creates and pushes both legs before it fails verification #168's remedy and then the submodule remediation. It runs before_create_leg_remotes, so nothing exists yet: no--local-remote-dir, an empty--work-dir, and the source's HEAD, refs and status unchanged.checkandexecuteread ONE list of findings,_entry_findings: coverage, each entry'sleg:(#169's leg paths among them), thensubmodule_plan_problems(entries, tree, registered). Soexecuterefuses every problemcheckfinds, incheck's words, all at once. The helper's callers readregisteredthroughSource.registered_submodules(tree), so it is a function of its arguments alone.registered_submodulesreads the source's.gitmodulesthe way git's own submodule reader will read it inside the leg (below).Why
On
main, a plan answering.gitmodules -> code, upstream/ -> specrunsexecuteto exit 0 and printsadoption verified: every source path is in exactly one place. The assembly is then unclonable:The same happens to a gitlink that no
.gitmodulesregisters, once it is kept in a leg. Take a source withupstream/orphan(asgit addof an embedded clone leaves one), no.gitmodules, and the planupstream/ -> code:main:check0,execute0 "adoption verified";git clone --recurse-submodulesexits 0;No url found for submodule path 'code/upstream/orphan'.At the top level, git skips a gitlink with no URL. Inside a leg, the clone recurses with
--initand dies on it. So for such a gitlink a leg is worse than the source, not "no worse".With this branch, both plans are a
checkfinding (exit 1) and anexecuterefusal (exit 2):The rule as implemented
A path's leg is the
leg:of the single plan entry_coveringfinds for it, a file entry or an ancestor directory. Gitlinks are the160000entries ofSource.tree(). The problems are listed in this order, andexecute's refusal is named by the first:rootis refused for.gitmodulesand for every gitlink, oneplan-submodule-rootper path. The assembly root has exactly two mounts, and its.gitmodulesis reserved for them.templates/assembly-root/.github/workflows/validate.ymlreads every URL in that file as a leg..gitmodulesthat git cannot read for its submodules is never read as registering nothing; the finding says what git said, on one line (git cannot read the source's .gitmodules for its submodules (fatal: bad config line 2 in .gitmodules), ...), and where git fails on it, measured end to end on git 2.43:git filter-repo: itsgit fast-exportreads the checked-out.gitmodulesfor each gitlink in the history, so the extraction of either leg fails, wherever the plan sends the two, after both leg remotes exist. Refused for every plan that extracts a leg, both dropped included ("and the source holds a submodule, sogit filter-repofails on that file whenexecuteextracts a leg, wherever the plan sends the two");.gitmodulesthat is itself a gitlink ("... where the assembly's recursive clone fails on it");pathorurlwith nothing after it) is fatal to git's submodule reader alone, which git runs only for a gitlink. Beside no submodule it is read as registering nothing, asmainadopts and clones it when the tip holds no submodule (a gitlink only in history is a follow-up, same onmain).plan-submodule-unregistered, naming the gitlink and its leg. Registered means: the path belongs, by git's own rules, to a<name>whoseurlis non-empty.git config -z --no-includes --file - --list. Not--blob, which git's submodule code never uses: it reads bytes through achar(signed on x86), so a 0xFF byte reads as the end of the file, and it follows[include]. Not--file -alone either: probed on git 2.43, stdin config FOLLOWS includes by default, unlike--file <path>.Registrations, after submodule-config.c'sparse_config): a name that is empty or has a..component at/or\is ignored; apathorurlstarting with-is ignored and the value before it stands; a path belongs to the LAST name given it, and a name moved to another path removes its old path's entry whoever holds it (git'scache_remove_path); apathorurlwith no value at all, which--listprints but git's reader dies on, makes the file unreadable beside a submodule, except under a name git already ignores.Registrationskeeps how a named path came to register nothing, and the finding says it instead of "no.gitmodulesentry ... registers its path with a url": the entry holding it has no url git reads (none, empty, or starting with-; or a later url-less name took the path), git ignores its suspicious name, its path starts with-, or another entry's move dropped it.--list, not--get-regexp: the second exits 1 both for "no key matched" and for "bad config line";--listexits 0 or 128.<name>is ignored, as git ignores it. With no.gitmodules, nothing is registered. A.gitmodulesthat is no blob (a gitlink) is unreadable, withgit cat-file's words..gitmodulesgoes, oneplan-submodule-splitper gitlink kept elsewhere. So.gitmodulescannot be dropped while one is kept.dropis fine, registered or not, and any one submodule may be dropped on its own. A registered one leaves its registration behind in the leg, inert: git walks the gitlinks in the index and looks each one up in.gitmodules, never the other way round. Dropping.gitmodulesand every gitlink together is allowed. Pinned end to end (below):.gitmodules -> code, upstream/ -> dropverifies, the recursive clone exits 0, and bootstrap printsbootstrap ok.planasks on every entry that holds a gitlink.walksees paths, not modes, so before this a submodule vendored at.specify/vendored,.cursoror.agentscame outleg: rootwith no question, and one atdocs/themecame outspec.checkthen refused the first and could find the second split.ask_about_submodules, run right afterwalk, replaces each entry that covers a gitlink. The replacement carries the.gitmodulesverdict:leg: null,review_required: true, ruleambiguous-gitmodules, its reason, and its question.<paths>: it is asked this question, not classified by its rule<rule>."\xe9, a newline as\n, any other character that is not printable by a backslash, and a backslash or a backtick escaped. Written raw, a non-UTF-8 name raised mid-write and left--outempty, and a newline read back as a space. The spelled newline between double quotes is the YAML entry that covers the file.walk's entries, so a submodule undersrc/orcontracts/keepsmain's harness follow-up andCONTRACTS_DIRline, and no false SEEDED warning orseeded_from_template: true.src/app/,src/vendored, each with its ownleg:. An entry added beside this one for a path it covers isplan-covered-twice." That holds for an entry of submodules only, too, so one can be dropped on its own. Past eight entries the question says how to make them and counts them instead of naming each: "replace it with an entry for each path directly insrc/, 402 in all, ...", or "in one ofdocs/,docs/theme/, other than those directories" when nested. Addingsrc/vendored: dropBESIDEsrc/isplan-covered-twice(andexecuterefuses it); the named split checksplan ok, and end to end it verifies, the recursive clone exits 0 and bootstrap printsbootstrap ok.walk's folding is unchanged. Only the covering entry is replaced..specify/and the assistant directories still stay in the root. Only a vendored SUBMODULE there is asked rather than rooted, because the root keeps no submodule of the source's. The policy comment aboveambiguous-gitmodulesrecords this..specify/split into.specify/vendored -> codeand.specify/memory/ -> root, with.cursor(a submodule) and.gitmodulessent to code.executeverifies, the recursive clone exits 0 and bootstrap printsbootstrap ok. The constitution stays in the root.checkalready rejects are skipped. An entry that is unresolved, uncovered, covered twice or has a misspelled leg already produces its owncheckfinding, and is not reported again as a submodule problem.executerefuses all four: the unresolved one in_refuse_an_unrunnable_plan, the other three in adopt-project.pyexecuterefuses onlyplan-unresolvedandplan-stale, so a plancheckrejects as uncovered or with a bad leg creates and pushes both legs before it fails verification #168's_refuse_what_check_finds, in the same one list as the submodule problems..gitmodulesin the root makes every registered kept gitlink a split. An unreadable one hides which gitlinks are registered. An unregistered gitlink may need a commit in the source and a freshplan, which would discard any answers already given.execute's refusal is named by the first ofcheck's findings and lists up toREFUSED_FINDINGS_SHOWN(8) of them, then "and N more"..gitmodulesreturns nothing from the helper at once, and gets its plan entries back untouched. Re-checked at this head againstmain:plan's output, andcheck's output (unresolved and resolved) are byte-identical;executeare identical;--local-remote-dir.The remediation, printed by
checkafter its findings and byexecutewith its refusal, gives the ways out:.gitmodulesand its submodules to one leg, or drop them together;plan;.gitmodulesthe same way (in a source with no submodule, dropping it is enough);plan-covered-twice;The question is true wherever it is printed
shape-doctor.py --placement-planprints the samereason:andquestion:for an already-split project. Akind: placement-planfile never reachescheckorexecute, so the question names the tool that refuses (adopt-project.py), not those two subcommands. Thereason:claims nothing that an empty.gitmoduleswould contradict (".gitmodulesis where a repository registers its submodules"). The issue's sentence is kept verbatim but framed, "When a repository is adopted, a source's own.gitmodulesgoes to the SAME leg as every submodule it registers;executewrites the assembly root a fresh one for its two mounts.", so that it is also true of a leg already split.Re-checked at
ca5fb3don an assembly adopted with.gitmodulesandupstream/dependencyboth in code (round 4 changes neither the policy file nor the doctor):794828c's doctor andca5fb3d's:note, "nothing is in the wrong leg";ca5fb3d's doctor exits 0 (794828c's exits 3 only because its checkout cannot resolve the shape commit the assembly pins);code/.gitmodules'question:is the only line that differs from794828c's.Known and not changed here. The doctor's placement audit classifies leg paths by glob, as
walkdid, and cannot see a gitlink. On an assembly adopted as #166 requires, with a submodule at.cursoror.specify/vendoredsent to the code leg, it reportsFINDING placement ... code/.cursor: root by rule root-assistant-instructions; code/.specify/: root by rule root-spec-kit.main's doctor reports the same row. That is ashape-doctor.pyfollow-up: a leg entry holding a gitlink should be asked, never "root by rule".Five reviews, seven commits
aaa9099introduced the rule: root and split refused,planasking on.gitmodules.aaa9099.09d7889took from it:checkandexecute, and the assembly's recursive clone then failed. It is nowplan-submodule-unregistered, and an unreadable.gitmodulesis nowplan-gitmodules-unreadable.shape-doctor.py's output too.roottext now says the root's.gitmodules"is reserved for its two leg mounts".reason:no longer claims registrations.--local-remote-dir, an empty--work-dir, and the source unchanged._verifyskips every root gitlink and compares a kept root.gitmodulesbyte for byte, so any plan that keeps a source submodule or its.gitmodulesin the root ends with exit 1 andadopt-lost#165: N5, the"160000"literal in_verify. Left with adopt-project.pyexecuterefuses onlyplan-unresolvedandplan-stale, so a plancheckrejects as uncovered or with a bad leg creates and pushes both legs before it fails verification #168: P1 below.aaa9099, by two reviewers. Its P1 was review 1's B1, already fixed in09d7889; re-run at this head, its three reproductions (G, J and K2) are each acheckfinding and anexecuterefusal, and no leg remote is made.326fb25took the rest:planasks on every entry that holds a gitlink (above).needs_filter_repoe2e runs accepted plans throughexecute, the recursive clone and bootstrap._mount_the_legscomment are re-labelled as mount defence in depth for a plancheckandexecuterefuse. Only the comment changed in_mount_the_legs.checkvalidates includes the submodule rule.checkprints the remediation.executedoes not refuse everycheckfinding) is adopt-project.pyexecuterefuses onlyplan-unresolvedandplan-stale, so a plancheckrejects as uncovered or with a bad leg creates and pushes both legs before it fails verification #168. This branch only corrects the docstrings that claimed "the plancheckpasses is the planexecuteruns". They now say thatexecuterefuses every SUBMODULE problemcheckfinds, and that adopt-project.pyexecuterefuses onlyplan-unresolvedandplan-stale, so a plancheckrejects as uncovered or with a bad leg creates and pushes both legs before it fails verification #168 extends this to every finding.09d7889. P3.6 is adopt-project.py_verifyskips every root gitlink and compares a kept root.gitmodulesbyte for byte, so any plan that keeps a source submodule or its.gitmodulesin the root ends with exit 1 andadopt-lost#165's.794828cmergedmain(b18cca9, adopt-project.pyexecuterefuses onlyplan-unresolvedandplan-stale, so a plancheckrejects as uncovered or with a bad leg creates and pushes both legs before it fails verification #168 via adopt-project.py:executerefuses every findingcheckreports, so a plan with an uncovered path, a badleg:, a path covered twice, a duplicated path or an entry that covers nothing is refused before the first leg repository exists, and the corrected plan no longer meetsleg-remote-exists(#168) #170) into this branch, clean.09d7889: P1 fixed, no new P1 or P2, four new P3s.ca5fb3dtook:git config --blob(above). Before, a Latin-1 comment before a registration was a false refusal, a 0xFF byte before apathoverride hid it (check0,execute"adoption verified", assembly clone 128), a relative[include]was a falseplan-gitmodules-unreadable, and an absolute one read a file on the operator's machine. The review's suggested pipeline was--file -alone; on git 2.43 that still follows includes, so--no-includesis added and pinned.-value, last-name and no-value rules (above); "Matched exactly as git matches them" is replaced by a docstring that says which rules are mirrored.upper-case-keys, and two shapes--blobrefused: a 0xFF comment and a relative include.executeexits 2 with an empty stderr whengit filter-repofails) is pre-existing and is adopt-project.pyexecuteexits 2 with nothing on stderr whengit filter-repofails, after both leg remotes exist:_build_the_legsswallowsCommandFailedon the premise thatrunalready reported it, andrunonly raises #171, on its own branch.5bef216anda037228mergedmaintwice:21f5c33(adopt-project.py_commit_the_splitstages withgit add -A -- ., so a source.gitignoreof.*silently drops.gitattributesandvalidate.ymlfrom the split,executestill saysadoption verified, and the assembly fails its first bootstrap #167 via adopt-project.py: the split force-stages every file the shape wrote past a source.gitignoresuch as.*, and the verification fails on any filecontracts/shape-pin.yamlnames that the split commit lacks, so a hidden.gitattributesno longer passes asadoption verifiedand then fails the first bootstrap (#167) #182), clean, thenf25d805(adopt-project.py accepts a non-canonical leg path such as--spec-path spec/, so the mount and its.gitmodulesregistration disagree andmainstill saysadoption verified#169 via adopt-project.py: a leg's mount path must be canonical or it is refused, soplan --spec-path spec/no longer checks ok and executes into a.gitmodulesthat registers the mount twice and still saysadoption verified(#169) #187), whose one conflict, the module docstring'scheckparagraph, keeps both clauses in one sentence.ca5fb3d(S1-S3, N1-N4), and review 5 lane openRepoShape-2's passes 4 and 5 (NEW-1, NEW-2, NEW-3; R5-1, R5-2).ce5e52dand6aaedc5took all of them:planread its collisions, follow-ups and seeding record after the question had nulled the entry holding a submodule, so a submodule undersrc/lostmain's harness follow-up and got a false SEEDED warning andseeded_from_template: true, and one undercontracts/lost the harness andCONTRACTS_DIRlines. All three are read fromwalk's entries now; on the reviewers' sources they equalmain's.--out; a newline sibling no longer reads back as a space; a backtick no longer breaks the delimiting.main. Measuring every shape end to end also found that a file git cannot read beside a submodule failsgit filter-repowhatever the plan answers, both dropped included: this branch passed that plan andexecutedied after making both leg remotes, as onmain. It is refused now, and eachplan-gitmodules-unreadablesays where git fails (above).checkandexecuteread one list (above). A plancheckrejected as uncovered and split was refused byexecutefor the split alone; it is refused for both, at once._refuse_an_unrunnable_planismain's again, so its literal8went with the code that had it. adopt-project.pyexecuterefuses onlyplan-unresolvedandplan-stale, so a plancheckrejects as uncovered or with a bad leg creates and pushes both legs before it fails verification #168'stests/test_adopt_execute_refusals.pypasses unchanged..gitmodules. N4:_SplitTreereadsGITLINK_MODEandcat-fileisGIT_CAT_FILE;_verify's literal is left to adopt-project.py: verification passes over the two leg mounts and no other gitlink, so the source's own submodule kept in the root isadopt-root-submodule, any other root gitlinkadopt-unexpected-gitlink, one in a leg AND the rootadopt-duplicated, and a missing mountadopt-mount-missing(#165) #173.mainand is a follow-up of its own.Merge order
#168, #167 and #169 are on
main(f25d805) and merged into this branch (794828c,5bef216,a037228). #168 makesexecuterefuse a plan with anycheckfinding, so an entry with a misspelled leg, or a path no entry covers, can no longer keep.gitmodulesor a gitlink in the root and reach the split. That also settles the hazard review 2 inferred (not executed) for #165, which changes_verifyto skip only the two leg mounts: with #168 in, no such plan reaches_verify.git merge-treeof this head with each open sibling is clean: #173 (05fa0e0, #165), #184 (f416e13, #171),fix/adopt-mount-past-gitignore(#174),fix/doctor-gitlink-placement(#176, PR #186) andfix/scaffold-force-add-shape-files(#175)._verifyis untouched here._mount_the_legschanges by one token (itsgit configsubcommand is now the sharedGIT_CONFIGconstant) and one comment;_SplitTreeand_pinned_shape_paths(#167) by one constant each.Tests
In
tests/test_adopt_submodules.py(28 cases ataaa9099, 52 at09d7889, 77 at326fb25, 101 atca5fb3d, 128 now), every #166 test except theneeds_filter_repoend-to-end ones runs without git-filter-repo, so the Windows job runs it:.gitmodulesentry:review_required: true, ruleambiguous-gitmodules, the issue's sentence as framed, the unregistered clause, the drop-on-its-own clause, the tool-namedrootclause, and thereason:;planasks on the entry holding a gitlink at.specify/vendored,.cursor,.agents,docs/theme,upstream/dependency,src/vendoredanddocs/theme/sub, and on one entry holding two gitlinks:.gitmodulesrow, apart from its path and size;root-spec-kit,root-assistant-instructions,ambiguous-assistant-project-memory,spec-governance,default,code-source-and-tests), and, exactly where the entry holds more than one path, the entries that replace it (docs/theme/subopensdocs/theme/and nothing else);checkon the untouched plan reports onlyplan-unresolved, neverplan-submodule-root;src/vendoredundersrc/, addingsrc/vendored: dropbesidesrc/isplan-covered-twice, and the named split, read back out of the question, checksplan ok;src/, 14 in all"; nested, "one ofdocs/,docs/theme/, other than those directories, 10 in all"), and the entries made by that rule checkplan ok;src/vendor/depandcontracts/vendor/x, the follow-ups and the seeding record equal those of the same source without the submodule, the harness andCONTRACTS_DIRlines among them, and there is no SEEDED warning;git update-index --index-infoand skipped where git refuses one (Windows and a newline): a non-UTF-8 submodule, a non-UTF-8 file beside one, a newline file beside one, and a submodule with a backtick and a backslash.planwrites over the--outfile that was there, and the question spells each; the spelled newline, typed between double quotes, is the entry that covers the file;checkmatrix of eleven.gitmodules/upstream/answers. It now also asserts that the remediation is printed exactly once, after the findings and before the count, when there is a submodule finding, and not otherwise;tools/: answeredcode, as its rule would have, beside.gitmodules -> spec, it is found split;.gitmodules: refused when kept in code or spec, allowed dropped, refused in the root;-url, shadowed by a later url-less name, a suspicious name, moved off its path (by its own name and under a later one), a-path, and no entry at all (the old words);../escape,a\\..\\band""are ignored,a..bis not;url = -oopsis ignored, and apath = -...after a good path leaves the good one; the last name given a path wins, url or none; a name moved off a path takes the path's registration with it; a no-value key under an ignored name is ignored;[include]: a registration beside a relative include counts, and one only in an absolute include (a file on this machine) does not;.gitmodulesbeside a submodule: refused wherever the two go, both dropped included, and named as the extraction's failure;rootis refused as well; the finding carries git's words, "in .gitmodules" and not "in standard input", for a bad config line, apathorurlwith no value, and a.gitmodulesthat is a gitlink, which is named as the clone's;pathorurlwith no value beside no submodule passes; a bad line beside none is the clone's when kept and passes when dropped; a key with no value beside a dropped submodule is the extraction's; and a plan that extracts no leg passes;.gitmoduleswith no gitlink beside it: code, spec and drop pass; root is refused;.gitmodules -> code: each one kept away from it is its own split, and only those;(entry ...);.gitmodules:checkreports exactly its own finding and no remediation, and the helper returns nothing for the plan;_refuse_what_check_findsthrough importlib on eleven plans. The refusal must listcheck's findings, code and lines, for all four ids, and end with the submodule remediation, including the replace-the-entry sentence; for four legal plans it must not be raised;root, elseunregistered), and listsREFUSED_FINDINGS_SHOWNofcheck's findings plus "and N more";cmd_execute, a plancheckrejects as uncovered and split is refused once, asplan-uncovered, listing both findings, with adopt-project.pyexecuterefuses onlyplan-unresolvedandplan-stale, so a plancheckrejects as uncovered or with a bad leg creates and pushes both legs before it fails verification #168's remedy and the submodule one, before the remotes directory exists;needs_filter_repo:executeon the split plan, on the orphan plan, and on an unreadable.gitmodulesdropped with its submodule, exits 2 with itsREFUSEDline andcheck's finding. Afterwards the--local-remote-dirdoes not exist, the--work-diris empty, and the source's HEAD, refs and status are unchanged;checkpasses,executeverifies and the assembly's recursive clone exits 0;executeon accepted plans (both in code, both in spec, the submodule dropped on its own, and, hand-written, upper-case keys, a 0xFF comment, a relative include) verifies. The assembly'sgit clone --recurse-submodulesand itsscripts/bootstrap.pyboth exit 0. The leg's.gitmodulesstill registers the submodule; kept, it is checked out; dropped, it is absent.tests/test_adopt_plan.pyadds.gitmodulesto the ambiguous-path test, which now pins each case's rule id. It also addsdocs/theme/.gitmodules -> specto the classification test, so that only the top-level file matches the new rule.Every case of every new or changed test fails under at least one of the 24 named mutations in
326fb25's revert table.ca5fb3d's table has 31 rows: round 3 reverted whole; N1, N2, N3 and P3.3 each reverted by part; over-strict variants; and round 2's mutations re-run for the cases round 3 re-parametrised or whose helper it renamed. Every case of every new or changed test (61 cases in 11 functions) fails under at least one. One row fails nothing, by design: the name regex put back to.+, since the empty-name filter then catches nothing the regex lets through.Round 4's table has 34 rows, each a fresh clone of
ce5e52dwith the final test file and one mutation,tests/test_adopt_submodules.pyrun with only #162's two slow end-to-end tests deselected: the baseline (126 passed, none failed); round 4's code reverted whole (51 failed); 24 single reversions and over-strict variants (NEW-1's two reads, the spelling's four parts, the cap and the opened directories, S3's relief both ways, the extraction rule, its leg and file conditions, the clone rule both ways, "standard input", each of N2's reasons and a reason for every path, the submodule refusal apart again,executewithout the submodule findings, without their remedy); and round 3's reader rules re-run through the newRegistrations, plus a dropped gitlink held to the rules and the split comparison inverted. Every case of every new or changed test (66 cases in 16 functions) fails under at least one, except #162's mount test, whose only edit is a named literal; its moved case fails when_mount_the_legs'-fis dropped.Eleven test files (
test_adopt_submodules,test_adopt_plan,test_adopt_e2e,test_adopt_spec_only,test_adopt_execute_refusals,test_adopt_ignored_shape_files,test_adopt_leg_paths,test_shape_doctor,test_windows_paths,test_cli_reference,test_repo_hygiene), run at this head:SHAPE_MEDXEHR_CLONEtest);SHAPE_MEDXEHR_CLONEtest.tests/test_adopt_execute_refusals.py(#168) andtests/test_adopt_leg_paths.py(#169) are unchanged frommainand pass.The full suite was last run at the first commit,
aaa9099: 1262 passed, 1 skipped. It was not rerun for326fb25,ca5fb3dor this head.The 13 tests
tests-windowsfailed at6aaedc5were two test-helper faults, not the tool:conftest.resolvewrote the plan CRLF on Windows (soedited()found no LF line), andraw_sourcekept a name git left out of the tree (update-index --index-infoexits 0).resolvenow writes LF andraw_sourceskips a case whose name is not in the committed tree, asked of git; two new tests hold both on Linux, and I reproduced all 13 failures on Linux (a simulated Windows text mode and a git that ignores a backslash and a newline) with no Windows machine.README.md, AGENTS.md and docs/cli.md are unchanged. The rule is stated in the policy's own
question:, which is what the person resolving the plan reads.render-cli-reference.py --checkpasses.Closes #166
🤖 Generated with Claude Code
Summary by Sourcery
Enforce that source submodules and their
.gitmodulesregistration are kept together in one leg or dropped safely throughout planning, checking, and execution.New Features:
.gitmodulesand every source gitlink should be assigned.Bug Fixes:
Enhancements:
checkandexecute, including consolidated remediation guidance.Documentation:
Tests: