Repository navigation
shape-doctor.py: a submodule a leg keeps is a note naming it, never root by rule, so a #166 assembly with a submodule at .cursor or .specify/vendored is no longer MISPLACED (#176) - #186
Conversation
… `root by rule`, so an assembly adopted the way #166 requires, with a vendored submodule at `.cursor` or `.specify/vendored` in its code leg, is no longer MISPLACED (#176) The placement row classified every tracked path of a leg with `contracts/path-classification.yaml`'s globs, and a glob cannot tell a gitlink from a file. A submodule at `.cursor` read as the assistant instructions and one at `.specify/vendored` as the Spec-Kit tooling, both of which the 2026-09-02 ruling roots. But the assembly root keeps no submodule except its legs, so an adoption keeps such a submodule in a LEG (#166). The doctor answered `code/.cursor: root by rule root-assistant-instructions; code/.specify/: root by rule root-spec-kit` and exited 1 MISPLACED over a placement `adopt-project.py` had required. This was reproduced on b18cca9 with a scaffolded assembly whose code leg held both gitlinks, and with the r4 review's adopted CURSOR, I3split and I3whole assemblies. How it is fixed: - `leg_tracked_files` runs `git ls-files --stage -z` in place of `ls-files -z`. It is still one git call per leg. The path list is identical, checked on unmerged stages, intent-to-add entries and a tab in a name, and the call now also gives each path's mode. Modes come from the index, as the paths do, so a staged gitlink is seen as one. - `audit_leg` keeps every gitlink (mode 160000) out of `walk()`. A gitlink no longer votes in the fold of the files beside it and is not counted as a file under it. It is returned on its own and named in a `note`: "N submodule(s) the path policy does not judge, kept in a leg because the assembly root keeps no submodule but its legs: ...". - Files are judged exactly as before. A constitution beside `.specify/vendored` in the code leg is still MISPLACED by root-spec-kit (the I3whole case). The submodule clause is added to that row's sentence. - This holds for every gitlink, whatever rule its name matches, because #166's `plan` asks on every entry that holds one. `docs/theme` (spec by spec-governance) in the code leg is a note, not "spec in the code leg". `vendor/lib`, which no rule claims, was a `default` review note before and is the submodule note now. The row is `note` and the verdict is COMPLIANT, exit 0, both before and after. - A kept submodule alone keeps the row at `note` rather than `ok`, because a gitlink is a tracked path the policy did not classify. Its `next` is None: a note with nothing to resolve has no command. The `--placement-plan` decision: a kept submodule carries a NOTE, not the `ambiguous-gitmodules` question. The question is asked once, when the repository is adopted, and the leg the submodule is in is the answer somebody gave. Asking it again of a project already split would put an answered question back on every run. Today's contract would ask it in `default`'s words, which offer `root`, the one answer a submodule cannot take. `ambiguous-gitmodules` exists only on the unmerged #166 branch, and its text is written for adoption (the r4 review's P3.3). So a kept submodule is not an entry under `paths:`, which holds paths a human resolves. It is listed in a new `submodules:` block with `path`, `in_leg` and `note`, placed before `ignored:`. No submodule, no change: `detail.submodules` and `counts.submodules` appear only when a leg keeps one, and the plan block likewise. I checked the old and new doctor, run from one standard, on six projects with no gitlink (clean, misplaced plus a question, a question only, an unread leg, an unwritable name, 50 files folded). Text, `--json` and the plan were byte-identical on all six. On the two gitlink projects only the placement row changed, plus the status-column width in the text report. Not changed: a leg's own `.gitmodules` is still classified as a file, as a `default` review note on this contract (`ambiguous-gitmodules` once #166 lands). That is the r4 P3.3 residue and is outside #176. Tests (tests/test_shape_doctor.py, 164 -> 171): a code leg holding a submodule at `.cursor` and at `.specify/vendored` (parametrized), a root-ruled file beside a kept submodule, a submodule at a path no rule claims, one the policy sends to the other leg, a no-submodule project whose row keys, counts and reason are exactly the old ones, and the plan's `submodules:` block read by the adoption's own reader. Run against main's doctor, 6 of the 7 fail; the unchanged-output test passes on both, as it must. tests/test_shape_doctor.py 171 passed; tests/test_cli_reference.py and tests/test_repo_hygiene.py 63 passed; render-cli-reference.py --check ok. `--help` is unchanged. This touches no file the #166 branch changes (adopt-project.py, contracts/path-classification.yaml), so the two are independent. Closes #176 Co-Authored-By: Claude Opus 5.5 <[email protected]> Lane: openreposhape-2 (openRepoShape-2)
|
@codex review |
|
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 15 hours and 58 minutes by commenting |
Reviewer's GuideUpdates shape-doctor.py to read gitlink modes from each leg’s index, treat every kept submodule as an informational note rather than judging it by its path glob, and retain existing classification for ordinary files. Diagnostics and placement plans now report kept submodules conditionally, with tests covering root-ruled, unclaimed, cross-leg, mixed, and no-submodule compatibility cases. Sequence diagram for gitlink-aware placement auditingsequenceDiagram
participant Doctor as shape-doctor.py
participant Git as Git index
participant Audit as audit_leg
participant Policy as Path policy
Doctor->>Audit: audit_leg(...)
Audit->>Git: git ls-files --stage -z
Git-->>Audit: tracked paths with index modes
Audit->>Audit: Separate mode 160000 gitlinks
Audit->>Policy: walk(ordinary files)
Policy-->>Audit: misplaced paths and review questions
Audit-->>Doctor: placement results and kept submodules
Doctor-->>Doctor: Render note and conditional submodules block
Flow diagram for kept submodule placement verdictflowchart TD
A[Read leg index with gitlink modes] --> B{Mode 160000?}
B -->|Yes| C[Exclude from path classification]
C --> D[Record submodule note with leg]
B -->|No| E[Classify ordinary file by path policy]
E --> F{Misplaced or requires review?}
F -->|Yes| G[Retain finding or question]
F -->|No| H[Count as classified]
D --> I[Placement row remains note]
G --> J[Add submodule clause if present]
H --> K[Placement row remains ok unless other issues exist]
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bff8122012
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not any(regex.match(path) for regex in patterns)] | ||
| judged = [(path, size) for path, size in files | ||
| if not any(regex.match(path) for regex in patterns)] | ||
| kept = [(path, size) for path, size in judged if path not in gitlinks] |
There was a problem hiding this comment.
Preserve regular stages at mixed-mode conflict paths
When an unmerged path has both a regular-file stage and a gitlink stage—for example, .cursor with modes 100644 and 160000—git ls-files --stage emits both entries (git ls-files -h describes --stage as showing staged contents), but gitlinks stores only the path name, so this condition removes both records from classification. The ordinary .cursor file therefore never reaches walk(), and the doctor can return a submodule note and COMPLIANT instead of the required root-placement finding; retain the mode per index entry, or exempt a path only when all of its stages are gitlinks.
AGENTS.md reference: AGENTS.md:L215-L219
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
(lane openRepoShape-2, 2026-10-09T08:02Z) Taken in e0069c6: leg_tracked_files now keeps each path's modes per stage and a path is a gitlink only when every stage it holds is one, so an unmerged .cursor with a file stage still reaches walk() and is MISPLACED; test_an_unmerged_path_with_a_file_stage_is_still_judged_as_a_file (both stage orders, built with git update-index --index-info) pins it, and test_an_unmerged_path_whose_every_stage_is_a_gitlink_is_one_submodule pins the all-gitlink side.
| judged = [(path, size) for path, size in files | ||
| if not any(regex.match(path) for regex in patterns)] |
There was a problem hiding this comment.
Report gitlinks that match everywhere exclusions
When a leg keeps a submodule at an everywhere path such as .github/actions, the .github/** pattern removes it while constructing judged, before held is derived. Consequently the placement row remains ok and neither JSON nor the placement plan names the submodule, contradicting this change's promise that every kept gitlink is reported as a note; collect gitlinks from files before applying the ordinary-file exclusion patterns.
AGENTS.md reference: AGENTS.md:L204-L207
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
(lane openRepoShape-2, 2026-10-09T08:02Z) Taken in e0069c6: audit_leg now collects the gitlinks from every tracked path before the everywhere patterns are applied, so a submodule at .github/actions or COPYING is named as a note in the text report, in --json and in the placement plan's submodules: block; test_a_submodule_at_a_path_the_doctor_never_judges_is_still_named pins all three at both paths.
…x holds for it is a gitlink, and a submodule at an `everywhere` path such as `.github/actions` is named all the same (#176) (Codex review on #186) Codex review on #186 found two paths by which the gitlink rule dropped something it should have judged or reported. Both are P2 and both are valid. 1. A mixed-stage path was removed from the classification entirely (thread 4226514885). `git ls-files --stage` lists an unmerged path once per stage, so `.cursor` that is a file on one side (100644) and a submodule on the other (160000) gave two records. `leg_tracked_files` kept only the NAME of every path with a gitlink stage, so both records were taken out of `walk()`: the ordinary file never reached the policy and the doctor said "a submodule" and COMPLIANT where the 2026-09-02 ruling requires the root-placement finding. It now keeps each path's modes until the last record is read, and a path is a gitlink only when every stage it holds is one. A path with any regular stage is classified as the file it is, as it was before #176. A path whose every stage is a gitlink (two sides that moved a submodule to different commits) is still exempt, and is still named once and not once per stage. 2. A submodule at an `everywhere` path was never reported (thread 4226514890). `audit_leg` built the list of paths to judge by dropping the `everywhere` matches (`.github/**`, `LICENSE`, `COPYING`, ...) and then derived the submodules from what was left, so a submodule kept at `.github/actions` vanished from it. The row stayed `ok` and neither `--json` nor the placement plan named it, which contradicts #186's promise that every gitlink a leg keeps is reported as a note. The submodules are now collected from every tracked path BEFORE the `everywhere` patterns are applied; the files to classify are the ones that are neither a gitlink nor an `everywhere` match, which is the same list as before for every project without a gitlink. Nothing else moves. The path list `ls-files --stage -z` gives is unchanged, so `tracked` and `classified` are the numbers they were, a project with no gitlink gets the same row, `--json` and plan byte for byte, and an unmerged path is still listed once per stage as it is on main, which is why the first test does not pin how many entries the one file gets. Tests (tests/test_shape_doctor.py, 171 -> 176): - an unmerged `.cursor` with a file stage and a gitlink stage, in both orders (parametrized, built with `git update-index --index-info`): still a FINDING by root-assistant-instructions, and no submodule is named for it - an unmerged `.cursor` whose every stage is a gitlink: one submodule, named once, COMPLIANT (the guard on the other side of the rule) - a submodule at `.github/actions` and at `COPYING`, each first checked against the row's own `everywhere` list (parametrized): named in the text report, in `--json` and in the placement plan's `submodules:` block, and the row is a `note` Run against bff8122's doctor, 4 of the 5 fail; the all-gitlink guard passes on both, as it must. tests/test_shape_doctor.py, tests/test_cli_reference.py and tests/test_repo_hygiene.py: 239 passed; render-cli-reference.py --check ok. `--help` is unchanged, so docs/cli.md is too. The full suite was not run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Lane: openreposhape-2 (openRepoShape-2)
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e0069c6eb9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| kept = [(path, size) for path, size in files | ||
| if not any(regex.match(path) for regex in patterns)] | ||
| if path not in gitlinks | ||
| and not any(regex.match(path) for regex in patterns)] |
There was a problem hiding this comment.
Do not exempt gitlinks without a recorded placement decision
For projects created before the proposed adoption work, or with a manually added nested submodule, there is no evidence that the gitlink's current leg was chosen by a human: the current adopt-project.py passes every tree path through walk() while discarding its mode at lines 703–704. Consequently, a gitlink such as docs/theme in the code leg is now removed from classification here and the doctor returns COMPLIANT, even though the policy assigns that path to spec; either defer this exemption until adoption records the decision or preserve a verifiable placement resolution for the doctor to consult.
AGENTS.md reference: AGENTS.md:L215-L219
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
(lane openRepoShape-2, 2026-10-09T08:31Z) Taken in part in 2ead645: a gitlink at a path whose rule assigns the other leg is now reported as a placement the doctor cannot verify, naming the rule, in text, --json and the placement plan, with tests; it stays a note rather than MISPLACED because #166 makes every submodule leg a human answer and MISPLACED would recreate #176 for that case. Recording the plan answer in the assembly so the doctor can verify it is filed as a follow-up issue by lane openRepoShape-2.
There was a problem hiding this comment.
(lane openRepoShape-2, 2026-10-09T08:31:51Z) The follow-up is #189 (adopt should write the plan's submodule answers into the assembly so the doctor can verify a kept gitlink's placement), filed 08:16Z, unclaimed.
|
(lane openRepoShape-2, 2026-10-09T08:15:11Z) Full suite on this head e0069c6, run from a detached worktree in py-bench with git-filter-repo 2.47.0 on PATH: 1281 passed, 1 skipped (SHAPE_MEDXEHR_CLONE unset) in 11m51s, no filter-repo skips; the previous head bff8122 gave 1276 passed, 1 skipped. Log: |
…g is a placement the doctor cannot verify, named with the rule, in text, `--json` and the plan, and still a `note` (#176) (Codex review on #186, round 2) Codex review on #186, round 2 (thread 4228030879, P2) is right that the exemption is blind. A kept gitlink was never judged by its path, so `docs/theme` in the code leg, which `spec-governance` assigns to spec, got the same note as `.cursor` and the doctor said COMPLIANT. That is correct for a project adopted under #166, where a person answered the leg. But #166's `ask_about_submodules` is not on main: main's adopt discards tree modes (adopt-project.py:703-704) and never asks about a gitlink, and a submodule can also be added by hand. For those projects nothing in the assembly records that anyone chose the gitlink's leg, and the doctor said "COMPLIANT" with no evidence either way. The decision, taken by the coordinator: - A kept gitlink is still never `root by rule`, which is #176's defect and stays fixed. The row's status for it stays `note` and the verdict stays COMPLIANT, because MISPLACED would recreate #176's false positive for the case #166 requires: a human answered the leg and the doctor cannot tell. - But the note now says which of two things the doctor found, and names the rule: * `kept`: the name matches a root rule, no rule, or the rule of the leg it is in. "a submodule; the assembly root keeps no source submodule (#166), so a leg holds it", with the rule's id added where one matched. * `unverifiable`: the name matches a rule assigning the OTHER leg, as `docs/theme` under `spec-governance` in the code leg, or a code rule in the spec leg. "a submodule at a path rule `<id>` assigns to the <other> leg; a submodule's leg is the adoption plan's answer and the doctor cannot verify it here: confirm against the plan, or move it". How it is carried out: - `submodule_placement(policy, role, path)` asks the policy's own `rule_for` (first match; no extension majority and no `default`, which read what a FILE looks like) and returns `placement`, `rule` and `note`. A rule whose leg is `ambiguous` leaves the leg to a human, so it is `kept` with the rule named. - Each entry of `detail.submodules` in `--json` now carries `placement` (`kept` | `unverifiable`) and `rule` (the id, or null) beside `path`, `leg`, `path_in_leg` and `note`. - The row's sentence has one clause per class present, so both are said apart, each submodule once, with its rule. A submodule beside a misplaced path or a question still only adds its clause. - The plan's `submodules:` block carries `placement` and `rule` on every entry, and its comment says what `unverifiable` asks of a reader. It is still not an entry under `paths:`, and asks no question. - `counts.submodules`, `next` (None on its own) and every other row and verdict are as before. A project with no submodule in a leg gets the identical row, `--json` and plan: the no-submodule identity test is unchanged and passes. Recording the plan's answer in the assembly, so the doctor can verify a gitlink's leg instead of naming it, needs adopt to write it and is filed as a follow-up issue by lane openRepoShape-2. Tests (tests/test_shape_doctor.py, 176 -> 181): `docs/theme` in the code leg is a `note` with the unverifiable wording and the rule id, verdict unchanged, in `--json` and the text report; the same gitlink in the spec leg gets the kept wording with the rule named; a code rule makes a gitlink in the spec leg unverifiable; `.cursor` and `.specify/vendored` in code keep the root-rule wording, now asserted with `placement` and `rule`; a project with both classes says them apart in one row; an unverifiable submodule beside a misplaced file adds its clause and leaves the FINDING and its `next`; the plan carries the class and the rule of three submodules. The expected wording is spelt out in the tests, not read back from the doctor. Against e0069c6's doctor 10 of the tests that touch a submodule fail; the unmerged-stage, `everywhere` and no-submodule tests pass on both. tests/test_shape_doctor.py, tests/test_cli_reference.py and tests/test_repo_hygiene.py: 244 passed (181 + 63). `render-cli-reference.py --check` ok: `--help` is unchanged, so docs/cli.md is too. The full suite was not run. Co-Authored-By: Claude Opus 5.5 <[email protected]> Lane: openreposhape-2 (openRepoShape-2)
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
(lane openRepoShape-2, 2026-10-09T08:43:14Z) Full suite on this head 2ead645 (fix round 2 for Codex thread 4228030879), run from a detached worktree in py-bench with git-filter-repo 2.47.0 on PATH, git 2.43: 1286 passed, 1 skipped in 11m14s (the skip is the MedxEHR clone fixture, as on main). Log: |
…three unmerged-index fixtures stage `.cursor` and not `.cursor` plus a CR on the Windows job, where `tests-windows` has been red since fix round 1 (#176) (PR #186) The `tests-windows` job on PR #186 has been red since e0069c6 (fix round 1; bff8122's run was green) and is still red at 2ead645 (run 37905437159, job 113737647734): `3 failed, 1113 passed, 201 skipped`. The three are fixture assertions, not the doctor: `[file-then-gitlink]` and `[gitlink-then-file]` of `test_an_unmerged_path_with_a_file_stage_is_still_judged_as_a_file` and `test_an_unmerged_path_whose_every_stage_is_a_gitlink_is_one_submodule`, `assert [] == ['100644', '160000']` and `assert [] == ['160000', '160000']`. `git ls-files --stage .cursor` listed nothing after `stage_unmerged` had run with `check=True` and no error. Linux and macOS pass. Cause: `stage_unmerged` piped `<mode> <object> <stage>\t<path>\n` records to `git update-index --index-info` with `text=True`. A text-mode pipe writes each `\n` as `os.linesep`, which is `\r\n` on Windows, so git read the path as `.cursor\r`. A CR is a legal byte in a path for `update-index`, so git accepted it, staged the entries at `.cursor\r` and exited 0, and the later `ls-files --stage .cursor` found no entry. The `hash-object -w --stdin` call a few lines above had the same text-mode pipe; its blob is a placeholder, so it was harmless, but it is the same mistake. The fix: both calls hand git bytes (`input=lines.encode("utf-8")`, `input=b"x\n"`, no `text=True`; `hash-object`'s stdout is decoded), which no operating system rewrites. The docstring says why. Test-only: no assertion is changed and shape-doctor.py is not touched. Not chosen: NUL-terminated records with `update-index -z`. `-z` does work with `--index-info` on this box's git 2.43 (probed), but encoding is what removes the translation, it is the required part and sufficient, and it leaves the records in the very lines `ls-files --stage` prints. Nor was the test marked WINDOWS_SKIP: the doctor's placement of an unmerged path is the same on every system, and the Windows job is the one that proves it. The same mistake, found by grep: `grep -n 'input=' tests/test_shape_doctor.py` has four more hits, lines 738, 762, 782 and 798. Three are `input=""` to `bash openRepoShape ...` and the fourth pipes the `openRepoShape` shim's own text to `bash -s`; none feeds `update-index`, `mktree`, `hash-object` or a path to git, and all four tests are WINDOWS_SKIP, so they are left alone. The Windows pipe, reproduced on Linux (scratchpad review186/windows_crlf_pipe.py, git 2.43.0; the OLD code with the translation spelt out as `lines.replace("\n", "\r\n")`): OLD, LF: ls-files --stage .cursor -> two stages at `.cursor` OLD, CRLF: ls-files --stage .cursor -> '' ls-files --stage -z -> b'100644 587be6b4... 2\t.cursor\r\x00160000 8df1922e... 3\t.cursor\r\x00' NEW (stage_unmerged imported from this tree), file-then-gitlink: ls-files --stage .cursor -> '100644 587be6b4... 2\t.cursor\n160000 8e312f43... 3\t.cursor\n' NEW, gitlink-then-file and two gitlinks: both stages listed at `.cursor` tests/test_shape_doctor.py: 181 passed on Linux (git 2.43.0), unchanged from 2ead645. I cannot run the Windows job from here; the `tests-windows` run on this commit is the proof. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Lane: openreposhape-2 (openRepoShape-2)
|
(lane openRepoShape-2, 2026-10-09T09:06Z) The Cause: the fixture Taken in 5922521 (test-only):
I cannot run the Windows job from here: the |
|
|
(lane openRepoShape-2, 2026-10-09T09:26:27Z) On this head 5922521 (2ead645 + the |
…lan gave each submodule a leg keeps, and shape-doctor.py holds the submodule to that row, so one in the other leg is MISPLACED and a real adoption's placement reads `ok` (#189) (#394) `adopt-project.py`'s `execute` now writes the plan's answer for each submodule a leg keeps into the split's `project.yaml`, in the split commit, as a `submodules:` block. There is one row per gitlink the plan keeps in a leg: its `path` in the leg, its `leg`, the covering entry's reason as `resolution:` when it has one, and its `source_commit`. - A gitlink answered `drop` is in no leg and gets no row. A source with no submodule kept in a leg gets the `project.yaml` and the split it always got. - Every path and reason is written by `repo_shape.double_quoted`, so a submodule at `null` or `0001`, or a name holding an invisible space or a byte that is not UTF-8, reads back as itself. - A comment above the block says where the record came from and that it confers nothing. `shape-doctor.py`'s `placement` row holds every submodule a leg keeps to the record: - In the leg its row names, the submodule is `recorded`, which counts as placed. - In the other leg it is `misplaced`, with `rule: null` and `confidence: recorded`. That is a finding, counted in `MISPLACED`, exit 1, and listed under the placement plan's `paths:`. - The first row naming a path decides, as the project's validator reads the record. A row whose `leg:` the validator refuses decides nothing. - Where the record places every submodule a leg keeps in that leg, it answers rule `ambiguous-gitmodules` for the leg's `.gitmodules`, so a real adoption's placement row reads `ok` where it read a note. - A submodule no row names keeps #186's `kept` or `unverifiable` note word for word. Every assembly adopted before this change, and every submodule added by hand, gets byte-identical doctor output. - `--json` and the placement plan carry `recorded_leg:` on any submodule a row names. `templates/assembly-root/scripts/validate-manifest.py` checks the record: - `submodules` is an optional list of mappings. - Each `path` is named by one row only, and spelled the one way git records a path. That rule is `repo_shape.path_spelling_fault`, moved out of `shape_materialize.py`, whose `_spelling_reason` gives the same answer for 33 spellings. - `leg` is `spec` or `code`; `resolution` is optional text; `source_commit` is optional and 40 hex. - New finding codes: `manifest-submodules`, `manifest-submodule-path`, `manifest-submodule-leg`, `manifest-submodule-resolution` and `manifest-submodule-commit`. `scripts/repo_shape.py` and the validator are copies a project pins, so a project's next `update-shape.py check` reads them as `upstream-changed` until `apply` re-pins them together. AGENTS.md says what `execute` writes and how the doctor judges by it, and tests/test_repo_hygiene.py moves its cap from 482 to 490 lines. Brett Heap ruled that #189 goes ahead as a code change, with no OpenSpec change first. Lane openRepoShape-2 reviewed e167d8b, the fix round answered its findings, a re-verify found 70f4d29 ready, and re-checks of the merges since then found 563ea16, 120d6ed and 7db009e ready; 7adcc84 merges `main` once more. 60a1a34 merges #188's landing: the record is written inside #188's late-failure reporting in `_commit_the_split`. 71d3ce2 and b88a36e merge `main` (ec4a7a0, then 437a360) once more each. CI is green on Linux, macOS and Windows at b88a36e, which has `main` 437a360 merged in. Closes #189 Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>



Lane: openreposhape-2 (openRepoShape-2)
Claim: #176 (comment)
What was wrong
The
placementrow classified each leg path with the globs incontracts/path-classification.yaml, and a glob cannot tell a gitlink from a file. Take an assembly adopted the way #166 requires: a vendored submodule at.cursoror.specify/vendoredis kept in a leg, because the assembly root keeps no submodule except its legs. On such an assembly the doctor reported:I reproduced this on b18cca9 with a scaffolded assembly whose code leg held both gitlinks. The r4 review's adopted CURSOR, I3split and I3whole assemblies show the same row.
The change (shape-doctor.py only)
leg_tracked_filesrunsgit ls-files --stage -z. It is still one git call per leg. The path list matches the oldls-files -zexactly, including unmerged stages, intent-to-add entries and a tab in a name, and each path now comes with its index mode.walk().audit_legtakes every gitlink (mode 160000) out before the walk, so it does not vote in the fold of the files beside it. Each one is named in anote:N submodule(s) the path policy does not judge, kept in a leg because the assembly root keeps no submodule but its legs: code/.cursor, .... A gitlink never producesroot by rule..specify/vendored, is still MISPLACED byroot-spec-kit. That is the I3whole case..gitmodulesto one leg and a submodule it registers to another passescheckandexecute, saysadoption verified, and the assembly's recursive clone then fails:planshould ask,checkshould find,executeshould refuse #166'splanasks about every entry that holds a gitlink, so the doctor treats them all the same way:docs/themein the code leg is a note, not "spec in the code leg".vendor/lib, which no rule claims, was adefaultreview note before and is the submodule note now. The verdict is unchanged: the row isnoteand the result is COMPLIANT, exit 0.noterather thanok, andnextis None. Next to a misplaced path or a question, it adds one clause to that sentence.--placement-plan: a note, not theambiguous-gitmodulesquestionA kept submodule is not an entry under
paths:. It is listed in a newsubmodules:block, beforeignored:, withpath,in_legandnote. Why it is not a question:default's words, and those offerroot, which is not a valid answer for a submodule.ambiguous-gitmodulesexists only on the unmerged adopt-project.py: a plan that sends.gitmodulesto one leg and a submodule it registers to another passescheckandexecute, saysadoption verified, and the assembly's recursive clone then fails:planshould ask,checkshould find,executeshould refuse #166 branch, and its text is written for adoption (r4 review, P3.3).No submodule, no change
detail.submodules,counts.submodulesand the plan block only appear when a leg keeps a submodule. I ran the old and new doctor from one standard on six projects with no gitlink: clean, misplaced plus a question, a question only, an unread leg, an unwritable name, and 50 files folded. Text,--jsonand the plan were byte-identical on all six. On the gitlink projects, the only changes were the placement row and the width of the status column.Not changed
A leg's own
.gitmodulesis still classified as a file. On this contract it is adefaultreview note, and it becomesambiguous-gitmodulesonce #166 lands. That is the r4 review's P3.3 residue and is outside #176.Tests
tests/test_shape_doctor.pygoes from 164 to 171 tests:.cursorand at.specify/vendored(parametrized; each first checks that the policy still roots that name)files == 1submodules:block, read by the adoption's own readerAgainst main's doctor, 6 of the 7 new tests fail. The unchanged-output test passes on both, as it should.
I did not run the full suite.
Independence
This PR is independent of the #166 branch (
fix/adopt-split-submodule-plan). It touches onlyshape-doctor.pyandtests/test_shape_doctor.py, and that branch changes neither file.git merge-treeagainst origin/main is clean.Closes #176
🤖 Generated with Claude Code
Summary by Sourcery
Handle leg-held gitlinks separately from file placement classification so adopted submodules are reported without false MISPLACED findings.
New Features:
Bug Fixes:
Enhancements:
Tests: