Skip to content

tests/test_adopt_symlink_target_bytes.py: check names the pair each #1138 row keeps in the root once as plan-case-twins, and still names each twin at the copy, above it, at the manifest and at a pin's file, and each bad link by its own finding - #1293

Merged
brettheap merged 1 commit into
mainfrom
fix/1189-case-twin-rows-after-1170
Nov 10, 2026

Conversation

@brettheap

@brettheap brettheap commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1189 and #1170. This mends main's red tests run after #1189 landed. It changes rows of one test file and no code.

Cause

The decision, row by row

I measured this at 370a23cd. Each row's scenario was rebuilt with the file's own helpers (planned_root, check_root), and every finding was printed. In each row, every finding #1170 demands is made. The one extra line is plan-case-twins for the assembly root, naming exactly the row's pair. So each row should expect it, and the code stays.

Row plan-case-twins names #1170's findings, still made at main
test_a_named_link_leaves_out_its_own_finding_and_no_other[a-case-twin-of-the-readme-copy] Shape/README.md and shape/README.md plan-bad-symlink-target for the link shape/README.md, once; plan-root-blocks-shape-copy for the file Shape/README.md once case is ignored
...[a-case-twin-after-the-readme-copys-link] shape/README.md and shape/readme.md plan-bad-symlink-target for shape/README.md, once; the copy's finding for the file shape/readme.md
test_a_case_twin_beside_a_link_git_makes_at_the_copy_is_named_too[a-twin-before-the-link] Shape/README.md and shape/README.md the copy's finding for the symlink shape/README.md, and one for the file Shape/README.md
...[a-twin-after-the-link] shape/README.md and shape/readme.md the copy's finding for the symlink shape/README.md, and one for the file shape/readme.md
test_a_link_twin_at_the_copy_is_named_once_by_the_copys_finding[a-link-twin-after-a-file] shape/README.md and shape/readme.md the copy's finding for the file shape/README.md, and one for the symlink shape/readme.md; no plan-root-symlink
...[a-link-twin-after-a-link] shape/README.md and shape/readme.md the copy's finding for each symlink; no plan-root-symlink
test_each_file_twin_above_a_place_the_shape_writes_is_named[a-file-after-a-named-link-above-the-copy] SHAPE and Shape plan-bad-symlink-target for SHAPE; the copy's finding, inside the file Shape once case is ignored
...[a-file-after-a-named-link-above-the-shapes-scripts] SCRIPTS and Scripts plan-bad-symlink-target for SCRIPTS; plan-root-blocks-shape, inside the file Scripts
test_a_case_twin_after_a_submodule_at_the_copy_is_named shape/README.md and shape/readme.md the copy's finding for the file shape/readme.md; plan-submodule-root for shape/README.md
test_each_case_twin_at_the_manifest_is_named[a-file-twin-after-a-link-git-makes] Project.yaml and project.yaml plan-root-blocks-manifest for the symlink project.yaml, and one for the file Project.yaml
...[a-file-twin-after-a-named-link] PROJECT.yaml and Project.yaml plan-bad-symlink-target for PROJECT.yaml, with the manifest's tail; the manifest's finding for the file Project.yaml
...[a-named-link-after-a-file-twin] PROJECT.yaml and Project.yaml plan-bad-symlink-target for Project.yaml, with the manifest's tail; the manifest's finding for the file PROJECT.yaml
test_a_case_twin_after_a_named_link_at_a_pin_file_is_named contracts/SHAPE-pin.yaml and contracts/Shape-pin.yaml plan-bad-symlink-target for contracts/SHAPE-pin.yaml; plan-root-holds-pin for the file contracts/Shape-pin.yaml

Why the rows, and not the code

What changes

Tests

The tests ran under a stub gh with a bogus token, an empty GH_CONFIG_DIR, GIT_CONFIG_GLOBAL=/dev/null and GIT_SSH_COMMAND=false, on CPython 3.12.

The fallback, measured

git revert --no-commit 9cb156a9 on 370a23cd applies cleanly: four files auto-merge and none conflicts. tests/test_adopt_symlink_target_bytes.py then gives 150 passed. No other file was run on that tree. A revert would take back #1189's plan-case-twins; this PR keeps both changes.

Known limits

  • apart_from_the_twins takes a pair, joined as check joins two paths ("A and B"). A row that keeps three twins would need the three-way join check prints.
  • The rows assert the finding's head and the pair, not its place among the findings. _entry_findings puts it after the source's own findings, such as plan-bad-symlink-target, and before the findings about the answers.

Not in this PR

This is outside v1.2.0, by Brett Heap's ruling at 2026-10-21T10:32:04Z.

Lane: openreposhape-1 (openRepoShape-1)

🤖 Generated with Claude Code

Summary by Sourcery

Align case-twin test expectations with the repository checker’s findings without changing production code.

Enhancements:

  • Update symlink-target byte tests to account for and validate the additional plan-case-twins finding while preserving existing finding assertions.

Tests:

  • Add shared test coverage that verifies case-twin findings name the expected paths and distinguishes findings from NOTE-only cases.

…1138 row keeps in the root once as `plan-case-twins`, and still names each twin at the copy, above it, at the manifest and at a pin's file, and each bad link by its own finding

This mends main's red `tests` run after #1189. #1170 (squash 40cb808, Closes #1138) added rows that keep a pair of case twins in the assembly root and count every finding `check` makes. #1189 (squash 9cb156a, Closes #1161) then made `check` name each set of case twins a plan keeps in one repository as `plan-case-twins`. #1189's H0 was tested before #1170 landed, so the two never ran together until main, where 13 rows of this file failed with `assert 3 == 2` (or `3 == 1 + 1`).

Each of the 13 still gets every finding #1170 demands: each twin is named by the copy's, the shape's, the manifest's or the pin's finding, and each bad link once, by its own. The one extra line is #1189's `plan-case-twins` for the root, naming exactly the row's pair. It is the pair's finding, fixed by a rename in the source, and not a second finding for what a path blocks where the shape writes. So the rows change and the code does not.

- `apart_from_the_twins(result, *twins)` asserts one `plan-case-twins` finding for the root naming the pair, in tree order, or none where the row keeps no pair, and returns the other findings for the row to count as before.
- The 7 tests that met it call it, 18 ids: the 13 that failed, and 5 that passed and now also assert that no such finding is made (3 keep no pair; 2 keep two files of one blob, which #1189 makes a NOTE).
- The module docstring and one row's docstring say so.

At 370a23c: 13 failed, 137 passed. At 5c662f7 (before #1189): 150 passed. At this head: 150 passed.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brettheap brettheap added this to the v1.2.1 milestone Nov 9, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 9, 2026

Copy link
Copy Markdown

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 4 days and 18 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Nov 9, 2026

Copy link
Copy Markdown

Reviewer's Guide

Tests

Add a helper that verifies the root’s plan-case-twins finding and removes it from the findings counted by existing assertions, then use it in the affected rows so their prior copy, manifest, pin, and bad-link checks remain focused on those findings.

  • tests/test_adopt_symlink_target_bytes.py L45-49, L825-851 (+8 small edits)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-11-09T23:46:03Z) r1293's independent review of #1293 at d3143d84, posted by lane 1: READY. r1293 is lane 1's independent reviewer, and it wrote none of this PR. Its full review follows the line.

Lane 1 takes the NITs as follows:

#1293 lands when tests passes on d3143d84, under one HOLD, while every other landing waits. Lane 1 then posts on #473 when main's push run is green.


Independent review of PR #1293 (r1293)

Reviewed head: d3143d84a4a7e03b492399323647dcbd697a8233, one commit on main 370a23cd23e9a4295bfaf8de546b726cff3677bf.

Verdict: READY

I found no MUST and no SHOULD. There are three NITs, none of which blocks landing.

One caveat: the PR's own tests check was still pending when I last read it. Every measurement below is local. SonarCloud, package and tests-git-bash pass.

Claim check

Claim Result
The diff touches only tests/test_adopt_symlink_target_bytes.py Confirmed. git diff --stat 370a23cd d3143d84 shows 1 file, 46 insertions, 8 deletions.
The PR is one commit on main Confirmed. d3143d84^ equals 370a23cd.
Main's push run on 9cb156a98 had 13 failures, all in this file Confirmed. The job log reads 13 failed, 21142 passed, 405 skipped in 5846.42s, and the 13 FAILED ids are the same 13 I reproduce.
#1273's tests run failed the same 13 and nothing else Confirmed. The log reads 13 failed, 21186 passed, 405 skipped, with no FAILED line outside this file.
#1170 changed only adopt-project.py and this file Confirmed. git show --stat 40cb8086f shows those two files.
No other test file imports this one Confirmed by grep.
adopt-project.py is unchanged Confirmed.
The test file is the same at 5c662f75 and 370a23cd Confirmed. The diff is empty, so the pre-#1189 comparison below uses the same scenarios.
merge-tree against current main is clean Confirmed. git merge-tree --write-tree d3143d84 origin/main exits 0 with tree a7b3f5c0…. origin/main is still 370a23cd, so that tree equals the head tree.

Reproduction counts

All runs used the probe environment: a stub gh, GH_TOKEN=bogus-r1293, an empty GH_CONFIG_DIR, GIT_CONFIG_GLOBAL=/dev/null, GIT_SSH_COMMAND=false, [email protected] and env -u LANES_LANE. CPython is 3.12.

Tree File Result
370a23cd (main) tests/test_adopt_symlink_target_bytes.py 13 failed, 137 passed in 199.83s
d3143d84 (head) same file 150 passed in 199.49s
5c662f75 (before #1189) same file 150 passed in 187.44s

The 13 ids that fail on main are exactly the 13 in the CI log.

The decision, row by row

Method.

Result for all 18 rows.

The 13 failing rows. In every row, head has one plan-case-twins finding for the assembly root, with "1 set, 2 paths", naming exactly the row's pair in tree order. The other findings are the ones #1170 demands.

Named-link rows:

Row Pair named Other findings
a-case-twin-of-the-readme-copy Shape/README.md and shape/README.md plan-bad-symlink-target for shape/README.md, then plan-root-blocks-shape-copy
a-case-twin-after-the-readme-copys-link shape/README.md and shape/readme.md plan-bad-symlink-target for shape/README.md, then plan-root-blocks-shape-copy

Manifest rows:

Row Pair named Other findings
a-file-twin-after-a-link-git-makes Project.yaml and project.yaml two plan-root-blocks-manifest findings
a-file-twin-after-a-named-link PROJECT.yaml and Project.yaml plan-bad-symlink-target for PROJECT.yaml, then plan-root-blocks-manifest for Project.yaml
a-named-link-after-a-file-twin PROJECT.yaml and Project.yaml plan-bad-symlink-target for Project.yaml, then plan-root-blocks-manifest for PROJECT.yaml

Pin row (test_a_case_twin_after_a_named_link_at_a_pin_file_is_named):

  • Pair named: contracts/SHAPE-pin.yaml and contracts/Shape-pin.yaml.
  • Other findings: plan-bad-symlink-target for contracts/SHAPE-pin.yaml, then plan-root-holds-pin for the file contracts/Shape-pin.yaml.

The other 6 failing rows behave the same way:

  • the two rows of test_a_case_twin_beside_a_link_git_makes_at_the_copy_is_named_too;
  • the two link-twin rows of test_a_link_twin_at_the_copy_is_named_once_by_the_copys_finding;
  • the two named-link rows above the copy and above scripts/;
  • the submodule row.

The 5 rows that passed.

Is naming the pair right?

The helper (apart_from_the_twins)

Could it pass when it should not? I ran mutants of adopt-project.py, of the helper and of its callers against the 7 test functions (18 ids). Each file was restored and its blob checked against HEAD's after every mutant. adopt-project.py stayed 62be4fa93a=62be4fa93a and the test file 00baff9d5e=00baff9d5e, and both clones were clean at the end.

Control: C0-none (a no-op edit) gives 18 passed.

Mutant Result
C1: pair named reversed killed, 13 failed
C2: finding made twice killed, 13 failed
C3: root named "the spec leg" killed, 13 failed
C4: root pair also found for the spec and code legs, so three findings killed, 13 failed
C5: path count off by one killed, 13 failed
C6: every root set a NOTE killed, 13 failed
C7: no set a NOTE killed, 2 failed (the two one-blob rows)
C8: finding dropped killed, 13 failed
C9: pair names a third path (README.md) killed, 13 failed
C8+C8b: finding moved to after the leg findings survives, 18 passed
T1: if links else () replaced with always a pair killed, 2 failed
T2: manifest pair reversed killed, 3 failed

That is 11 of 12 killed. The survivor is the position of the finding, which the PR lists as a known limit.

Is each helper assertion load-bearing? I weakened one assertion at a time and paired it with the mutant it should catch.

Weakened assertion + mutant Result
H2 (no head check) + C3 survives, 18 passed
H2 (no head check) + C5 survives, 18 passed
H3 (no pair check) + C1 survives, 18 passed
H3 (no pair check) + C9 survives, 18 passed
H1 (len(sets) >= 1) + C2 still killed, 13 failed
H1 (len(sets) >= 1) + C4 still killed, 13 failed
H4 (no "no finding" check) + C7 still killed, 2 failed
  • The head check and the pair check are load-bearing.
  • The "wrong repository" and "two findings" cases are caught: C4 and C2 die.
  • The wrong-order case is caught: C1 dies.

Findings

MUST: none.

SHOULD: none.

NIT-1: the PR body overstates the M4 mutant.

  • Body: "M4, no set a NOTE: 2 fail… Only the new 'no such finding' assertion kills it."
  • Evidence: weakening that assertion (H4) and applying the same mutant (C7) still fails the same 2 rows, because the callers' count assertions (len(found) == len(own) + len(named)) catch the extra finding.
  • The new assertion is correct and gives a clearer message, but it is not the only kill.
  • Fix: say "the count also kills it", or drop the word "only". This is a comment-only change.

NIT-2: no closing form in the body.

NIT-3: the finding's position is not pinned by these rows. C8+C8b survives. This is the PR's declared limit and not a new gap.

Other measurements

Pytest summary lines, all of them:

What I did not cover

State

  • The review worktree /workspace/projects/openRepoShape-worktrees/l1-r1293 is at d3143d84 and git status --short is empty. It holds only ignored __pycache__ folders that my pytest runs created. I cannot remove them under the no-rm rule.
  • Scratch is /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1293/. It holds two clones with detached worktrees base370 and base5c66, the plugin, the mutant driver mut.py and the logs.
  • No pytest process of mine is left running.

Lane: openreposhape-1 (openRepoShape-1)

@brettheap
brettheap merged commit 9304069 into main Nov 10, 2026
5 checks passed
@brettheap
brettheap deleted the fix/1189-case-twin-rows-after-1170 branch November 10, 2026 01:23
brettheap added a commit that referenced this pull request Nov 10, 2026
…mber-id-malformed` in every mode, and so is a mounted member's own `project.yaml` `id:`, with the `bump` that writes the row from that file (#1204) (#1273)

`validate-family.py` asked `PROJECT_ID_RE` of one id only, the family's own. A member row's `id:` met two checks, and neither is a pattern: the mounted `project.yaml` compared with it as text (`member-id-mismatch`), and `_check_member_ids_unique`. So under `--no-members`, the run a private family's CI falls back to, an id that ends in a line feed, holds a space or opens with `-` was `family ok`; and with the members checked, so was a row that spelled the same malformed text as its member's own `project.yaml`: the row a `family.py add` older than #1166 wrote for a member whose own `id:` read `"irqs\n"`.

- `_check_member_ids_well_formed`, beside `_check_member_ids_unique`, asks `PROJECT_ID_RE.fullmatch` of every row that check asks, from `_check_members` before the `--no-members` return (it reads `family.yaml` alone). So `--no-members`, `--pins` and a full run all ask it, and a malformed row id is `member-id-malformed`, exit 1.
- `_check_member_identity` takes `root` and asks the mounted `project.yaml`'s own `id:` as `add` asks it, `PROJECT_ID_RE.fullmatch(str(id or ""))`, so with the members checked the gate refuses every member `add` would refuse (`member-bad-id`) and none it would pin. The finding names that file, `members/IRQS/project.yaml:`, as the source.
- One finding for one fault: where either id is malformed, `member-id-mismatch` is not said as well, since it named no command and over a malformed member told the person to copy a malformed id into the row. `_is_project_id` is the one reader both checks call, and it uses `fullmatch`, not `match` (#1139), because `PROJECT_ID_RE` ends in `$`, which matches before a trailing line feed. No import is added.
- A value that is not a string is asked as its text: a number reads as its digits, so a row a holder wrote before #259 as `id: 2026` still passes; `true`, `1.5`, `-3`, a list and a mapping are refused. `id: null` and a row with no `id:` stay `member-id-absent`'s, with the members checked, and nothing under `--no-members`.
- The remedy is `bump`, not the issue's `remove` and then `add`: `bump --to <the row's pinned commit>` writes the row's `id:` from the member's own `project.yaml` at that commit and leaves the pin (measured: exit 0, one commit, gitlink unmoved, `validate-family.py` exit 0), and refuses with `member-bad-id` where that file is malformed too, so it is mended in the member's repository first. The issue's `remove` and `add` do not run as it prints them: measured on a hand-edited row, `add --at <the pinned commit>` after `remove` exits 2 as `member-git-dir-cached`, and without `--at` it moves the pin to the member's tip. `--to` is the row's `pin.commit` where `COMMIT_RE.fullmatch` takes it, and `<commit>` otherwise; the holder's path is POSIX-quoted in `_bump_to`.
- `AGENTS.md` item 4 of the family section names `member-id-malformed` on its own line, so the file stays at its 494-line cap, and `ID_READERS` in `tests/test_value_pattern_line_break.py` counts 2 `fullmatch` readers in `validate-family.py`. The new `tests/test_validate_family_member_id_pattern.py` holds 44 rows.
- Measured with git 2.43.0 on Python 3.12.3, in the probe environment, base `ccc2c2d2` against head: a row `id:` of `"irrs\n"`, `"irrs\r"`, `"IRRS Capital"` or `"-x"` was exit 0, `family ok`, under `--no-members` and `member-id-mismatch`, exit 1, with the members checked; it is now `member-id-malformed`, exit 1, under both, alone. The controls (`"0"`, and `irrs`) are as before. The pre-#1166 holder, IRQS `"irqs\n"` on both sides, went from exit 0, `family ok` with 3 members, to exit 1 with the row's finding, and with the members checked the member's own as well.
  - The new file at base: 29 failed and 15 passed; at `0657e396`, 44 passed. Mutants: 10 of 10 killed, and the four of r1204's 14 that had survived (R6, R7, R11, R12) are killed by the three rows round 1 added.
- It was built after #1227 (lane 5's), which changes the same `validate-family.py`, and restacked by three merges once #1227 landed; its own lines keep out of #1227's.
- Known limits:
  - Under `--no-members`, a member's own malformed id behind a well-formed row is not seen, since that run reads no member. `add` and `bump` refuse such a member, so only a hand edit, or an `add` older than #1166, leaves one.
  - The row's remedy needs the member checked out (`bump` refuses one that is not, as `member-uninitialized`). Where the pin is no commit and the members are checked, `member-pin-commit` refuses the run first, as it did before this PR, and the row's finding follows once the pin is mended; under `--no-members` the finding stands alone and names `--to <commit>`.
  - `bump` to the commit already pinned commits as "Bump IRRS to `<sha>`", which does not say the row's id changed.
  - A member's own `id:` that reads as a positive number (`id: 7`) is accepted, as `add` accepts it, though the member's own `validate-manifest.py` refuses it as no string. A row with no `project:` is skipped, as `_check_member_ids_unique` skips it.
  - Measured with git 2.43.0 and Python 3.12.3 only: the issue's git 2.47.1 was not run, and CI runs 3.14. `AGENTS.md`'s item 4 line is 129 characters, to name the code without a 495th line.
- Not in this PR: #1205, the other values of a member row (`repository:`, `path:`, the pin); any change to `scripts/family.py`, whose `add` gives the `member-bad-id` this check copies; and the loader `_run_checks`, which #1172 changes.

Review: lane 1's independent reviewers reviewed each round. r1204 found `d56f2084` READY, with no MUST, no SHOULD and seven NITs (#1273 issuecomment-6726873431). Round 1, `0657e396`, answers NITs 1 to 3 (a docstring, and rows for the `<commit>` fallback, a quoted holder path and a bare `id: 0`) and changes no behavior of `validate-family.py` (issuecomment-6727138789). NITs 4, 5 and 7 stay as the Known limits above. r1204b found the round READY, with no MUST, SHOULD or NIT (issuecomment-6727217672). After #1227 landed as `5c662f75`, the branch was restacked by three merges with no rebase, `062f5983`, `75b12a96` and `2eadb5df`, and its changed lines equal the reviewed delta: 658 `+`/`-` lines over the same 4 files, sha256 `ca4df1a9`.

Tests, under a stub `gh` with a bogus token, on Python 3.12.3 and git 2.43.0: the restack's gate at `2eadb5df` gave 75 passed for the PR's two test files (`tests/test_validate_family_member_id_pattern.py` and `tests/test_value_pattern_line_break.py`), 184 passed for #1227's three (`tests/test_family_gitmodules_values.py`, `tests/test_validate_family_index_gitmodules.py` and `tests/test_validate_family_index_value_unmerged.py`), 343 passed for the other nine `tests/test_validate_family_*.py` files, 283 passed and 2 skipped for `tests/test_path_guard_hygiene.py` and `tests/test_no_auto_maintenance.py` with `tests/test_scaffold_leg_path_collisions.py`, and 171 passed for the doc trio. The first three calls had passed at `75b12a96` too, with the same counts, before main's last merge; all five ran again at `2eadb5df`, since that merge changes `adopt-project.py`, which the first call runs.

It lands by fast refresh (Brett Heap, 2026-10-15T22:48:35Z). Its `tests` run at the restacked head `2eadb5df` failed only on main's 13 red rows, which #1293 mended; the branch was then refreshed over #1293, and that head, `5fbb9c3d`, is its H0. Its H0 `5fbb9c3d` is green on Linux and SonarCloud. The branch was never rebased. Any commit after H0 is update-branch's clean merge of main, and the head that lands, 5fbb9c3, is green on SonarCloud and Git Bash. Lane 1's gate passed on its tree: 5 pytest calls over `tests/test_validate_family_member_id_pattern.py`, `tests/test_value_pattern_line_break.py`, `tests/test_family_gitmodules_values.py`, `tests/test_validate_family_index_gitmodules.py`, `tests/test_validate_family_index_value_unmerged.py`, `tests/test_validate_family_branch_step.py`, `tests/test_validate_family_duplicates.py`, `tests/test_validate_family_git_not_runnable.py`, `tests/test_validate_family_member_path_glob.py`, `tests/test_validate_family_remedies_typed.py`, `tests/test_validate_family_typed_states.py`, `tests/test_validate_family_unnamed_mounts.py`, `tests/test_validate_family_unreadable.py`, `tests/test_validate_family_without_git.py`, `tests/test_scaffold_leg_path_collisions.py`, `tests/test_path_guard_hygiene.py`, `tests/test_no_auto_maintenance.py`, `tests/test_pinned_copy_text.py`, `tests/test_agents_md_codes.py`, `tests/test_cli_reference.py`, `tests/test_repo_hygiene.py`: 1,143 passed, 2 skipped.

Closes #1204

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 10, 2026
…e `.gitattributes` it leaves and reads its exit code, so the root's failing filter is `plan-attributes-reencoded` alone, and a refused compare is named in git's words (#1192) (#1253)

On main at `93d29314` (#1169's squash), `adopt-project.py check` asked the mount's `git rm` as a content compare: `update-index -q --refresh` over its `TAKEN` index, then `diff-files --name-only`. That index holds what the plan sends to a leg or drops, and also every `.gitattributes` of the tree, the root's own kept one included, so the refresh ran the clean filter of rules `git rm` never compares, and nothing read its exit code. Under a required clean filter that fails for the root's `.gitattributes`, the refresh died there and `diff-files` listed every file it had not reached. `check` then added a false `plan-file-reencoded`, naming a file the split stores as its blob (`specs/001-feature/spec.md`), to the one true finding, `plan-attributes-reencoded`.

Outside v1.2.0 by Brett Heap's ruling of 2026-10-21T10:32:04Z

- The compare now asks what `git rm` asks. Each `.gitattributes` the mount leaves stays in `TAKEN`, so git still reads the rules from the index, and is marked with `update-index -z --assume-unchanged --stdin`, which `update-index --refresh` and `diff-files` both skip. A `.gitattributes` the plan sends to a leg or drops is in `moved` and is still compared. The root's own failing filter is then `plan-attributes-reencoded` alone (#530's D5(a) question), and a kept nested `.gitattributes` whose filter fails is named by the split's `git add -u` (`STORE_REFUSED`).
- The refresh's exit code is read. `-q` makes a file that needs an update no error, so a nonzero exit is git refusing the compare. Its list is then not read, and the finding is git's last line (`COMPARE_REFUSED`, through `_refused_finding`), in the groups' order: the store's, the compare's, the copies'. The plainest reading, "read the code and name nothing on a failure", was not taken: for a filter that fails for a file the plan sends to a leg or drops, `execute` with `check`'s refusal patched out made both leg repositories and stopped extracting one, so naming nothing would have been a false `plan ok`.
- `STOPS_AT_A_READ` says where `execute` stops for such a refusal: "at the first step that reads that file again: extracting the spec leg, extracting the code leg once the spec leg is pushed, or, once both legs are pushed, cloning the source for the split or mounting the legs". Which of them it is, the clock decides (`READ_AGAIN`). `STOPS_AT_A_CLONE`'s comment now says each leg is extracted and then pushed in turn, the spec leg first.
- Not changed: D5(a)'s question (`_stored_as_written`), the split's side (`git add -u`), the pinned copies' question, `execute`'s own commands, what `TAKEN` holds, and any doc, `--help` text or doc-trio row. `tests/test_adopt_check_throwaway_repos.py` holds 27 new ids in 10 functions: 18 by `18c2aaef`, and 9 in the review round (3 in `898e9a5e`, 6 in `ad70474d`).
- Measured with git 2.43 and CPython 3.12.3, base `93d29314` against head `18c2aaef` (the review round changes the stop text, comments and rows, not the compare):
  - #1192's case (a side-branch tree named by `attr.tree` says `/.gitattributes filter=w1136` and `*.md text`; `filter.w1136` is `clean=false`, `smudge=cat`, `required=true`, set in a global config, in `GIT_CONFIG_PARAMETERS` and in `GIT_CONFIG_COUNT`) went from exit 1 with `plan-attributes-reencoded` and the false `plan-file-reencoded`, to exit 1 with `plan-attributes-reencoded` alone. In process on base, the refresh gave exit 128 (`fatal: .gitattributes: clean filter 'w1136' failed`) and `diff-files` listed `.gitattributes specs/001-feature/spec.md`; at head the `--assume-unchanged` call and the refresh give exit 0 and `diff-files` lists nothing.
  - A root rule `/notes.txt filter=w1136`, with `notes.txt` sent to the spec leg, the code leg or dropped, went from `plan-file-reencoded` read off the files the dead compare never reached, to the refusal in git's words (`fatal: notes.txt: clean filter 'w1136' failed`). `execute` refuses before any leg on both.
  - The 18 rows: 11 failed and 7 passed on base, 18 passed at head. The 7 are the controls, which give the same result on both: a spec committed with CRLF (the compare runs to its end and names it), a CRLF `docs/.gitattributes` sent to the spec leg under the root's `* text eol=lf` (only the rules `git rm` leaves are skipped), and the side tree's `*.md text` alone (`plan ok`). The 9 round rows: 9 failed on base, 3 failed at `18c2aaef` (the `execute` ids that run as if each extraction trusted the file's stat data), 9 passed at `ad70474d`. On base, a kept `.github/<folder>/.gitattributes` whose filter fails, its folder named in UTF-8 or not, got a second finding, a false `plan-file-reencoded` naming `specs/001-feature/spec.md`: a second form of #1192, cured by the change and held by no row until the round.
  - Mutants of the changed lines, each run in a scratch clone and restored after (the blob read back): 10 of 10 killed at `18c2aaef`, and 11 of 11 at `ad70474d`. r1253's mutants R2 and R9 survived every row at `18c2aaef`; the kept row kills both. r1253b's own 14 are killed too.
  - Where `execute` stops with `check`'s refusal patched out, over 72 runs at `ad70474d`: extracting the spec leg 47, extracting the code leg once the spec leg was pushed 1, and, with the filter kept out of both extractions, cloning the source for the split with both legs pushed 24 of 24. All 72 passed, none skipped. r1253b's 144 runs under load all passed, none skipped (72 at the spec leg, 72 at the split's clone).
- Known limits:
  - Where git refuses the compare, only its first refusal is named. The files it did not reach are not named until it no longer refuses, as with the split's refused `git add -u`.
  - Where `execute` stops for such a refusal is the clock's. The mount's `git rm` was never the first to read the file in any run: after a checkout that trusted the file's stat data, no later index write falls in the second it was written, unless the clock steps back. In r1253b's probe the mount was the first read only with the index's mtime set by hand (r1253b's NIT-A). In a run where no step reads the file again, `execute` may go on: the finding names a source that can fail, as the moved-files finding does (`READ_AGAIN`).
  - git's words are its last line in this machine's locale, as for every refusal the rehearsal names. Measured with git 2.43 only: that `update-index --refresh` and `diff-files` skip an `--assume-unchanged` entry is git's documented behaviour, and CI's git was not measured.
  - A path that is not UTF-8 prints as U+FFFD in git's words (pre-existing, r1253's NIT-2). `_SplitRehearsal.refused` decodes git's stderr with `replace`, so the round's row holds every word of that finding but the folder's name. It reaches every refusal the rehearsal names. Follow-up text, if wanted: "adopt-project.py: `_SplitRehearsal.refused` decodes git's stderr with `replace`, so a path that is not UTF-8 in a refusal `check` names prints as U+FFFD, not as `_spelled`'s escape (measured on #1253's branch with git 2.43: `fatal: .github/caf<U+FFFD>/.gitattributes: clean filter 'w1136' failed`)".

Review: lane 1's independent reviewers reviewed each round. r1253 found `18c2aaef` NOT READY, for two SHOULDs and two NITs with no MUST (#1253 issuecomment-6723519114): SHOULD-1, the stop text left out cloning the source for the split, and SHOULD-2, no row for a kept nested `.gitattributes` or a name that is not UTF-8. The fix round `ad70474d` (`845666aa`, `898e9a5e`, `ad70474d`) answered both and NIT-1, the `STOPS_AT_A_CLONE` comment, and left NIT-2 as a Known limit (issuecomment-6724083501). r1253b found `ad70474d` READY, with no MUST or SHOULD and two NITs (issuecomment-6724522433). NIT-A's sentence is applied to the body and to this message. NIT-B, an optional rewrite of the optional row so that it forces each read instead of waiting for the clock, is left as a follow-up idea.

Tests, under a stub `gh` with a bogus token, at `ad70474d` with CPython 3.12.3 and git 2.43, each call under 9 minutes and at most two at once: the #1192 section (10 functions) 27 passed; `tests/test_adopt_check_throwaway_repos.py` 178 passed and 1 skipped (the row that needs a disk that ignores case); `tests/test_adopt_reencoded_files.py` with `tests/test_adopt_nested_attributes.py` 126 passed; `tests/test_adopt_printed_sentences.py` with `tests/test_adopt_single_repository_record.py` 93 passed; `tests/test_scaffold_leg_path_collisions.py` 104 passed; `tests/test_path_guard_hygiene.py` with `tests/test_no_auto_maintenance.py` 179 passed and 2 skipped (both `test_no_auto_maintenance.py:222`, which the probe environment's `GIT_CONFIG_GLOBAL=/dev/null` causes); the doc trio 171 passed; `tests/test_shape_doctor.py` in 4 shards 112 passed and 1 skipped, 111 passed and 1 skipped, 112 passed, and 111 passed and 1 skipped (the skip is the PowerShell row, which runs only on a Windows host). r1253b's summary lines at `ad70474d` equal every one of those counts but the shards, which its brief forbade; on a clean merge of `origin/main` at `12122952` it got 178 passed and 1 skipped for the throwaway file. At `18c2aaef` the same files gave the same counts, summed over each pair, but for the throwaway file's 169 passed and 1 skipped, the 9 round ids being the difference.

It lands by fast refresh (Brett Heap, 2026-10-15T22:48:35Z). Its first H0, `ad70474d`, ran `tests` on 2026-11-08; after #1293 mended main, the branch was refreshed over it, and that head, `dcd5d8b0`, is its H0. Its H0 `dcd5d8b0` is green on Linux and SonarCloud. The branch was never rebased. Any commit after H0 is update-branch's clean merge of main, and the head that lands, 91c8932, is green on SonarCloud and Git Bash. Lane 1's gate passed on its tree: 23 pytest calls over `tests/test_adopt_check_throwaway_repos.py`, `tests/test_adopt_reencoded_files.py`, `tests/test_adopt_nested_attributes.py`, `tests/test_adopt_printed_sentences.py`, `tests/test_adopt_single_repository_record.py`, `tests/test_scaffold_leg_path_collisions.py`, `tests/test_path_guard_hygiene.py`, `tests/test_no_auto_maintenance.py`, `tests/test_agents_md_codes.py`, `tests/test_cli_reference.py`, `tests/test_repo_hygiene.py`, `tests/test_adopt_tracking_branch.py`, `tests/test_adopt_unreadable_git_parts.py`, `tests/test_chain_link_fold.py`, `tests/test_naming_policy_line_break.py`, `tests/test_pinned_copy_columns.py`, `tests/test_siblings_family_name.py`, `tests/test_update_shape_apply_lines_and_headers.py`, `tests/test_update_shape_header_comments.py`, `tests/test_update_shape_messages.py`, `tests/test_update_shape_unreadable.py`, `tests/test_validate_family_member_id_pattern.py`, `tests/test_validate_family_unreadable.py`, `tests/test_validate_pins_spelled_and_named.py`, `tests/test_value_pattern_line_break.py` and `tests/test_shape_doctor.py` in 4 shards: 2,257 passed, 7 skipped.

Closes #1192

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 10, 2026
…`family-holder-already-here` say the branch their lines run on, and that `add` line is `_cited`, so each runs as printed from the tracking branch (#1228) (#1264)

**#1228: every `add`, `bump` and `remove` line that a `family.py` remedy prints says the branch it runs on, whichever route reached the refusal. The dry runs of `add` and `bump` that end in `member-duplicate-id`, and the `family-holder-already-here` that `init` ends in, now say it as #1201 makes `member-unknown` and `member-already-present` say it, and that `add` line is `_cited`. rv1201's one surviving mutant of #1201's rows, R5, is killed.**

**Built on #1201 at `eac177af` (itself on #1117 at `219e57c2`). Both have landed, and this PR is restacked on `main`** (#1117 as `9252ef208`, #1201 as `8cf6477fe`; see "Restacked after #1201 landed"). Its change is two commits: `b54520cea` (5 files, 442 insertions and 57 deletions) and the review round's `43d2e8b26`, 5 files, 503 insertions and 64 deletions in all (`git diff --stat eac177a 43d2e8b`). Against main `370a23cd2`, the restacked head `54b9cb20a` gives the same 5 files, the same lines and the same patch-id. It answers lane 5's review of #1201 (issuecomment-6372152028): SHOULD-1's optional code fix, and NIT-1 to NIT-3.

At `eac177af9`, as rv1201 measured it (probes p6, p7, p9) and as this PR's rows show failing there (below), three printed lines were reached with no branch read, named none, and were refused `family-on-tracking-branch` when typed where a fresh clone stands:

- **(a) `add --dry-run`'s `member-duplicate-id`.** Under `--dry-run`, `cmd_add` skips `_checked_branch` and still asks `_checked_member_id`. Its remedy printed a `remove` line and a `bump` line and no branch.
- **(b) `bump --dry-run`'s `member-duplicate-id`.** `_bump_dry_run` asks `_checked_bumped_id` before anything reads the branch. Its remedy printed a `remove` line and no branch.
- **(c) `init`'s `family-holder-already-here`.** Its remedy printed `_add_command`'s line between plain backticks: no branch clause, and not through `_cited`, so under a folder named with a backtick the first span ended at the path's backtick (RV1117's N6 shape).

- **`scripts/family.py`, (a) and (b).** `_checked_member_id` and `_checked_bumped_id` take a keyword-only `dry_run`, false by default. `cmd_add` passes `args.dry_run`, and `_bump_dry_run` passes true. The real runs' calls (`_mount_and_pin`, and `cmd_bump`'s) are unchanged, and so are their words. Set, the remedy puts `_off_the_tracking_branch` before its line or lines and ends with `BRANCH_LEFT`, as `member-already-present` does. The clause names "`bump` and `remove` refuse" for (a), whose remedy names both lines, and "`remove` refuses" for (b). Its `switch -c` names `family/remove-<id>`, the branch the `remove` line's own refusal names, so the clause and the refusal after it agree.
- **`scripts/family.py`, (c).** The remedy now says the clause with `init`'s own `git -C <holder> switch -c family/add-<Project>`, then the `add` through `_cited`, then `BRANCH_LEFT`. The issue left the branch word to the owner. This PR takes `family/add-<Project>`, bare, as the NEXT STEPS block prints it: quoted, it would read as a value.
  - Two helpers carry it. `_add_branch_switch` spells that `switch -c` line, and NEXT STEPS now calls it too, with the same bytes as before. `_branch_clause` holds the clause's words around a `switch -c` line already spelled, and `_off_the_tracking_branch` now calls it.
  - The code comments at the two `member-duplicate-id` asks and `_off_the_tracking_branch`'s docstring now say that a dry run states the refusal before the branch is read, and a real run after it.
- **`tests/test_readme_windows_quoting_sentence.py`.** `NAMED` moves one host-quoter call from `_print_next_steps` to `_add_branch_switch`, and `FAMILY_LINES` moves the `switch -c` kind with it. README's sentence already lists `switch -c`, so README.md and `docs/handbook.html` are unchanged. The changed remedies' words appear in no doc. The release notes name `member-duplicate-id` as a code (v1.0.0) and the `family/add-<Project>` spelling (v1.1.0). AGENTS.md and `templates/family-root/` show `git -C <path> switch -c family/add-<Project>` as NEXT STEPS print it. None of that changes.
- **`tests/test_family_remedy_lines.py`.** The new rows type each line as printed from the tracking branch. Typed alone, each line is refused `family-on-tracking-branch`. Typed after the clause's `switch -c`, it exits 0, and the holder is clean and its gate green:
  - (a): `test_add_dry_runs_duplicate_id_lines_run_from_the_tracking_branch`, `[remove]` and `[bump]`;
  - (b): `test_bump_dry_runs_duplicate_id_remove_runs_from_the_tracking_branch`;
  - (c): `test_init_holder_already_heres_add_runs_as_printed_after_its_switch`, `[plain]` and ``[a`b]``.
  - **NIT-1:** `test_a_rows_name_with_a_space_is_one_word_in_both_lines` now asserts the `switch -c` line, `family/bump-irrs`, which is built from the row's `id:`. That kills R5, which builds it from the name and gets `family/bump-member`.
  - **NIT-2:** `typed()`'s docstring says that it asserts the interpreter's name and does not look it up on PATH.
- **`tests/test_family_bump_to_checks.py`.** Its two `member-duplicate-id` rows used to assert that both runs print the same words. They now pin the real run's words as at `eac177af9` and the dry run's with the clause (`both_refused`, `duplicate_id_refusal(dry_run=True)`).
- **`tests/test_family_dry_run.py`.** `duplicate-id` leaves the parametrized "same under `--dry-run`" row and gets a row of its own, `test_add_dry_runs_duplicate_id_names_the_branch_the_real_run_has_read`. It pins the same code, detail, stdout and exit for both runs, and the dry run's remedy as the real one with the clause added and `BRANCH_LEFT` at the end.
- **NIT-3 is left.** `member-already-present` still suggests `family/bump-<id>` for both of its lines. (a)'s clause likewise names one branch, `family/remove-<id>`, for both its `remove` and its `bump`. Either branch works for both verbs, since anything but the tracking branch does.

rv1264 (opus) found this PR READY at `b54520cea` with two NITs (issuecomment-6724775227). The round's commit, `43d2e8b26`, is the PR's second: 2 files, 67 insertions and 13 deletions (`git diff --stat b54520c 43d2e8b`), `scripts/family.py` and `tests/test_family_remedy_lines.py`. With both commits the change is 5 files, 503 insertions and 64 deletions (`git diff --stat eac177a 43d2e8b`). The Goal, `What held on #1201's head`, `What changed` and `Rows that fail on #1201's head` describe `b54520cea`, the first commit. Mutants, Runs, Merge-trees and one bullet of Limits are read again at `43d2e8b26`.

- **NIT-1: the fourth bare `"Remediation: "`.** SonarCloud reported it on this PR as python:S1192 (key `AaG7-FM2kL7yTWvgodeV`): the (c) hunk's `"Remediation: "` at `scripts/family.py:2530` was a fourth copy of that literal after #1201's three (`:1713`, `:6577`, `:9497`). `_landing` now builds the clause first, ``clause = _branch_clause(_add_branch_switch(into / family), "`add` refuses")``, and the third argument of the `Refusal` starts `f"Remediation: {clause}"`. #1201's three are untouched, and `grep -n '"Remediation: "' scripts/family.py` lists exactly those three. SonarCloud's analysis of `43d2e8b26` is not read here.
  - **The refusal's words are byte for byte what they were.** A probe (`probe/remedy.sh`) ran `init` over a family folder that already holds its holder, once with `b54520cea`'s `family.py` and once with this commit's, swapped into the same detached tree, from the same working directory and by the same script path, for a plain folder and for one named ``a`b``. The two refusal lines (the `REFUSED` line and the remediation) are identical under `cmp`: plain 1156 bytes, ``a`b`` 1148 bytes, each with exit 2 and an empty stdout. The swapped run printed one `WARNING ... DIRTY` line before them, which the swap itself caused (it dirtied that tree); the file was restored with its sha256 checked (`88ad8766f4e2...`) and `git status` clean.
  - **The rows that pin the text pass.** `test_init_holder_already_heres_add_runs_as_printed_after_its_switch[plain]` and ``[a`b]`` compare the remediation with the expected words and pass at `43d2e8b26` (gate A, below), on git 2.43.0 and 2.47.1.
- **NIT-2: M10a and M10b are killed.** They survived because every fixture row's `id:` is its name lowercased, so a branch built from the name is the same word. Two rows in `tests/test_family_remedy_lines.py`, after (a) and (b)'s dry-run rows, rename a row by hand to a valid name that is not its id, and assert the clause's `switch -c` line as printed:
  - `test_add_dry_runs_clause_branch_is_made_from_the_rows_id`: `IRRS` renamed `Orrs`. `add --dry-run` of `IRRS2` is refused `member-duplicate-id`, and the clause names `family/remove-irrs`, not `family/remove-orrs`.
  - `test_bump_dry_runs_clause_branch_is_made_from_the_other_rows_id`: `IRSS` renamed `Osss`. `bump --dry-run` of `IRRS` to the commit whose `project.yaml` records `irss` is refused the same way, and the clause names `family/remove-irss`, not `family/remove-osss`.
  - The hand edit of the row's `project:` line is a helper, `renamed_by_hand(holder, project, name)`, which the ``IR RS`` row (RV1201's NIT-1) now calls too, so it is written once. That row's asserts are unchanged.
  - **Each row fails on its mutant and passes at the head.** M10a alone fails the first row and only that row (`family/remove-orrs` against `family/remove-irrs`), and M10b alone fails the second row and only that row (`family/remove-osss` against `family/remove-irss`): 1 failed, 18 passed in each run of the file's 19 ids. `scripts/family.py` came back to sha256 `b7f0d8c5f2db...` after each, with `git status` clean.
  - **Both rows fail on #1201's production code.** With `eac177af9`'s `family.py` (sha256 `b8199379c23f...`) swapped in under this commit's tests, in the same detached tree: 2 failed, each on `[] == [the switch line]`, since #1201's dry runs print no clause. Restored (sha256 `b7f0d8c5f2db...`), `git status` clean.

#1201 landed as the squash `8cf6477fe`. Its final head was `d1ecf815`, a fast refresh of `24b6a0af`. #1117 had landed before it, as `9252ef208`, and #1201's head already carried #1117's final head, its squash and main (`85909e973`, `24b6a0af6`, `d1ecf8159`), so the first step of the restack plan this body named on 2026-11-08 was #1201's own. Once #1201's branch was deleted, GitHub retargeted this PR to `main`, where it was CONFLICTING. The restack is three merges on top of `43d2e8b26`, with no rebase, amend or force:

| step | merged | commit | result |
|---|---|---|---|
| 1 | #1201's final head `d1ecf815` | `5b5e652a9` | clean; tree `913e2e4b5`, as `git merge-tree` predicted |
| 2 | #1201's squash `8cf6477fe` | `db82ce1d4` | 21 blocks in 4 files, all #1201's own, each resolved to this branch's side; the tree stays `913e2e4b5` |
| 3 | main `370a23cd2` (#1164) | `54b9cb20a` | clean, no block to resolve; tree `245b4d057`, as `git merge-tree` predicted on git 2.43.0 and 2.47.1 |

- **Step 2's resolutions.** The 21 blocks are 7 in `scripts/family.py`, 2 in `tests/test_family_bump_to_checks.py`, 10 in `tests/test_family_remedy_lines.py` (add/add) and 2 in `tests/test_readme_windows_quoting_sentence.py`. All four are files of #1201's squash. Each block takes this branch's side, because that side already holds all of #1201: step 1 merged `d1ecf815`, and the squash's tree is `d1ecf815`'s tree (`4daf6ffbc` both). So the merge changed no file (`git diff 5b5e652 db82ce1` is empty). The blocks arise only because the squash has another history, so git meets #1201's lines from both parents.
- **Step 3.** Main was still the squash itself when steps 1 and 2 were made, so step 3 was first a no-op. #1164 (for #1110, lane 1's) landed after, as `370a23cd2`. It changes `scripts/family.py` (121 insertions, 19 deletions), `templates/family-root/scripts/siblings.py`, `tests/test_family_gitmodules_unreadable.py` (new) and `tests/test_path_guard_hygiene.py`. Git merged `scripts/family.py` by itself, and no block needed a resolution:
  - #1164's hunks are the `.gitmodules` readers (`_gitmodules_on_disk`, `_gitmodules_names`, `_sections_giving`, `_stages_as`), `PinRollback`, and two new constants. None is one of this PR's functions.
  - #1164 gives `_stages_as` a third argument, and nothing in this PR calls it.
  - `gitmodules-unreadable`'s remedy names no `add`, `bump` or `remove` line, so #1228's rule does not reach it.
  - Main's side arrives whole: `git diff db82ce1 54b9cb2` has #1164's own patch-id (`6e4840bd5eb9` stable, `f7efc1a3949e` verbatim, as `git diff 8cf6477 370a23c` has).
- **The diff is the reviewed one.** The PR's diff against main is rv1264b's reviewed change, `eac177af9..43d2e8b`, line for line:

| diff | files | lines | `git patch-id --stable` | `--verbatim` |
|---|---|---|---|---|
| reviewed, `git diff eac177a 43d2e8b` | 5 | +503/-64 | `1b6607fb4fb6` | `cd18d2c2923a` |
| restacked, `git diff 370a23c 54b9cb2` | 5 | +503/-64 | `1b6607fb4fb6` | `cd18d2c2923a` |

  - Per file, both ids match for each of the five: `scripts/family.py` `c7ba1df7d359`/`5493f2e74dc9`, `tests/test_family_bump_to_checks.py` `aae56e7a6cc6`/`1f54d542931a`, `tests/test_family_dry_run.py` `b616211c203d`/`9e7124f21c75`, `tests/test_family_remedy_lines.py` `1820a6895cf4`/`9f3e05c13738`, `tests/test_readme_windows_quoting_sentence.py` `dc8eb3e39264`/`1d81e0e45ca9`. The same ids come out of git 2.43.0 and 2.47.1.
  - The four test files have the same blobs on both sides of both diffs.
  - `scripts/family.py`'s pre-image is main's, so its hunks start later by the lines main added above them: 6 lines (#1166's `105b5daf9`, for #1139) up to `cmd_add`, and 89 from `_checked_bumped_id` on (46 more from #1098's `ac5f28d2a`, for #1086, 37 from #1164). With the `index` lines and the hunk line numbers masked, the two diffs are byte-identical (888 lines); unmasked, they differ in 34 lines, all `index` and `@@` lines.
  - No hunk differs, so no file's patch-id changed, and no resolution in the three merges touched this PR's lines.
- **The PR lists 12 commits now.** A squash does not carry its branch's commits by ancestry, so GitHub also lists #1117's and #1201's own commits (`10dc011c9`, `eac177af9`, `219e57c28`, `8cb9c729a`, `85909e973`, `24b6a0af6`, `d1ecf8159`) beside this PR's two and its three merges. Its diff is the 5 files above.

The commit's new and changed rows (73 ids: the 5 new `test_family_remedy_lines.py` ids and the NIT-1 row, the 2 `test_family_bump_to_checks.py` rows, `test_family_dry_run.py`'s new row and the 18 ids of its parametrized row, and the 46 ids of `test_readme_windows_quoting_sentence.py`) were run with `eac177af9`'s `scripts/family.py` (sha256 `b8199379c23f...`) swapped in under this commit's tests, in a second worktree. The file was restored after the run and its sha256 checked: `88ad8766f4e2...`, matching, with `git status` clean. Result: **9 failed, 64 passed**, every failure an `AssertionError` on the remedy text:

| row | on `eac177af9`'s `family.py` |
|---|---|
| (a) `[remove]`, `[bump]` | fail: the remedy ends "...not in the family." with no clause and no `BRANCH_LEFT` |
| (b) | fail, the same way |
| (c) `[plain]`, ``[a`b]`` | fail: the remedy ends "There is no --force." with no clause |
| `test_family_dry_run.py`'s new row | fail, as (a) |
| the 2 `test_family_bump_to_checks.py` rows | fail on the dry run's assert; the real run's assert just before it passes, so the real run's words are unchanged |
| `NAMED[scripts/family.py]` | fail: there is no `_add_branch_switch` |
| the NIT-1 row, the 18 parametrized ids, the other 45 sentence ids | pass, as they should: #1201 already builds the branch from the `id:` (the assert kills R5, below), and the rest pin unchanged behaviour |

Each was applied alone in the second worktree at `b54520cea` (clean), run through lane 5's runner, and restored, with the sha256 of every touched file checked and `git status` clean after each. The #1228 mutants ran against all 73 ids above (84 with the rest of `test_family_remedy_lines.py`); M8 also ran against `tests/test_git_bash_dialect.py` and `tests/test_family_switch_branch_exists.py`, which read NEXT STEPS.

| id | mutation | result |
|---|---|---|
| M1 | (a)'s clause dropped | killed, 3: (a) `[remove]`, `[bump]`, `test_family_dry_run.py`'s new row |
| M2 | (b)'s clause dropped | killed, 3: (b), the 2 `test_family_bump_to_checks.py` rows |
| M3 | (c)'s clause dropped | killed, 2: (c) `[plain]`, ``[a`b]`` |
| M4a | `dry_run` ignored in `add` (always false) | killed, 3, as M1 |
| M4b | `dry_run` ignored in `bump` (always false) | killed, 3, as M2 |
| M5 | (c) without `_cited`: the `add` between plain backticks | killed, 1: (c) ``[a`b]`` |
| M6 | (a)'s branch is `bump`'s, not `remove`'s | killed, 3, as M1 |
| M7 | (a) without `BRANCH_LEFT` | killed, 3, as M1 |
| M8 | (c)'s placeholder branch quoted for the shell | killed, 2: (c) both; the two NEXT STEPS files pass (the shell reads the quoted word the same) |
| M9 | (c) without `BRANCH_LEFT` | killed, 2: (c) both |
| M10a | (a)'s branch from the row's name, not its `id:` | **killed**, 1: `test_add_dry_runs_clause_branch_is_made_from_the_rows_id` (it survived at `b54520cea`, 84 passed) |
| M10b | (b)'s branch from the row's name, not its `id:` | **killed**, 1: `test_bump_dry_runs_clause_branch_is_made_from_the_other_rows_id` (it survived at `b54520cea`, 84 passed) |
| M11 | (a)'s `dry_run` inverted: the real run gets the clause | killed, 3, as M1 |
| M12 | (c)'s `switch -c` names `--into`, not the holder | killed, 2: (c) both |
| M14 | (a)'s clause names one verb, "`remove` refuses" | killed, 3, as M1 |
| M15 | `_branch_clause` prints its `switch -c` bare | killed, 11, across every clause row |
| M3b | NIT-1's `f"Remediation: {clause}"` without its clause | killed, 2: (c) `[plain]`, ``[a`b]`` |
| R1 | rv1201's: `_cited` always prints the command bare | killed, 15 of the file's 17 |
| R2 | rv1201's: the typed owner is the first path segment | killed, 6 |
| R3 | rv1201's: `_family_line` quotes for `sh` on every host | killed, `NAMED[scripts/family.py]` |
| R4 | rv1201's: `member-already-present` loses its clause | killed, 4 |
| R5 | rv1201's: `member-already-present`'s branch from the name | **killed** by NIT-1's assert, `test_a_rows_name_with_a_space_is_one_word_in_both_lines` (it survived at `eac177af9`) |
| R6 | rv1201's: `member-already-present` names the typed project | killed, 4 (3 in `test_family.py`) |
| R7 | rv1201's: README and the handbook drop `cd` from the sentence | killed, `test_the_kinds_of_family_lines_are_the_ones_the_sentence_lists` |

M1 to M9 are n1228's, and they cover the issue's list: the clause dropped from each of (a), (b) and (c), `dry_run` ignored, and `_cited` dropped from (c). M10a to M15 are the first commit's own, and M3b the second's. R1 to R7 are rv1201's again: R1 to R6 against `test_family_remedy_lines.py`, with R6 also against `test_family.py`'s spelling row, and R3 and R7 against the sentence file. `scripts/family.py` came back to sha256 `88ad8766f4e2...` after each run, README.md to `71d9fecafbd6...` and `docs/handbook.html` to `1d01f0823e60...` after R7, and `git status` was clean after the last one. At `43d2e8b26`, M10a, M10b and M3b each ran alone in the same detached tree, clean at that commit, over `tests/test_family_remedy_lines.py`'s 19 ids (1 failed and 18 passed, 1 failed and 18 passed, 2 failed and 17 passed), with `scripts/family.py` back to sha256 `b7f0d8c5f2db...` after each and `git status` clean after the last. The other rows' results are those of `b54520cea`, which rv1264 re-ran and matched.

### At the restacked head `54b9cb20a` (after #1201 landed)

All through lane 5's `run10.sh`, in the environment the next section names. Every `START` line reads `head=54b9cb20ac18be672fedad4f69e648f97a85e4e8` and `dirty=0`, on Python 3.12.3, with git-filter-repo 2.47.0 (CI's pin) on PATH. Each run held at most 100 ids, taken from a fresh collect at the head. The 2.47.1 runs put lane 5's git 2.47.1 first on PATH, and each log's first line reads `git version 2.47.1`.

- **The gate** (32 files, 1712 ids, 18 runs on each git):
  - this PR's four test files;
  - every file that names `family.py`'s remedy lines or the codes and functions this PR changes, and `test_windows_paths.py` for the family landing: `test_bump_remedies_family_root.py`, `test_remove_add_remedies_family_root.py`, `test_family.py`, `test_family_add_member_id.py`, `test_family_printed_quoting.py`, `test_family_init_landing.py`, `test_family_init_values.py`, `test_family_members_not_a_list.py`, `test_family_bump_to_a_tag.py`, `test_family_switch_branch_exists.py`, `test_family_tracking_branch.py`, `test_git_bash_dialect.py`, `test_branch_left_bump_leg_setup.py`, `test_bump_leg_paste_lines.py`, `test_dry_run_parity.py`, `test_windows_paths.py`, and the `test_validate_family_*` five (`branch_step`, `duplicates`, `remedies_typed`, `typed_states`, `unnamed_mounts`);
  - the hygiene five (`test_repo_hygiene.py`, `test_agents_md_codes.py`, `test_cli_reference.py`, `test_pinned_copy_text.py`, `test_path_guard_hygiene.py`) and `tests/test_no_auto_maintenance.py`;
  - and #1164's new `tests/test_family_gitmodules_unreadable.py`.
- **#1164's `family.py` files** (2 files, 106 ids, 2 runs on each git): `tests/test_family_py_unreadable.py` and `tests/test_family_bump_remove_rollback.py`. #1164's own gate ran them for the `family.py` code it changes, so main's side is shown to hold on the merged tree.

| run | git | result | logs |
|---|---|---|---|
| the gate, 1712 ids in 18 runs | 2.43.0 | **1691 passed, 21 skipped**, none failed (1056.2s in all) | `work/n1228g/logs/g243-gate-part-00.log` to `-17.log` |
| the gate, 1712 ids in 18 runs | 2.47.1 | **1691 passed, 21 skipped**, none failed (1047.2s in all) | `work/n1228g/logs/g2471-gate-part-00.log` to `-17.log` |
| #1164's two `family.py` files, 106 ids in 2 runs | 2.43.0 | **106 passed** (99.6s) | `work/n1228g/logs/g243-extra-part-00.log`, `-01.log` |
| #1164's two `family.py` files, 106 ids in 2 runs | 2.47.1 | **106 passed** (98.1s) | `work/n1228g/logs/g2471-extra-part-00.log`, `-01.log` |

- **The 21 skips are the same on both gits:**
  - 16 at `tests/test_family_init_values.py:229`: "this template quotes the placeholder: the run is fine, and test_a_quoted_value_is_held_as_typed runs it";
  - 3 at `tests/test_family_init_values.py:301`: "this template quotes `id:`: the derived id reads back";
  - 2 at `tests/test_no_auto_maintenance.py:222`: "the session began with GIT_CONFIG_GLOBAL set, and its file includes that one" (the runner sets `GIT_CONFIG_GLOBAL=/dev/null`).
- **No run failed, and none was run again.** `tests/test_family_dry_run.py::test_bump_dry_run_of_a_repair_to_the_pinned_commit_is_a_move[digest]`, which failed once before the restack (see Limits), passed on both gits. The full suite was not run.

### Before the restack (`b54520cea` and `43d2e8b26`)

All through lane 5's `run10.sh`: a `gh` stub first on PATH, `GH_TOKEN` bogus, an empty `GH_CONFIG_DIR`, a blank git identity, `GIT_SSH_COMMAND=false`, `GIT_CONFIG_GLOBAL=/dev/null`, `EMAIL` exported, and git-filter-repo 2.47.0 (CI's pin) on PATH. Every `START` line reads `head=b54520cea716b44df1a95139a46901a478d616fd` and `dirty=0`, with three exceptions. The swapped run and each mutant read `dirty=1`, the one file changed, except R7, which changes two and reads `dirty=2`. The predicted merge's run names its own head. Python 3.12. The second commit's runs, marked in the table, read `head=43d2e8b26...` and `dirty=0`, except the mutants' and the swapped runs, which read `dirty=1`, and the pre-commit run of the new rows, which read `head=b54520cea...` and `dirty=2`.

- **Gate A** (13 files): the issue's eight (`test_family_remedy_lines.py`, `test_readme_windows_quoting_sentence.py`, `test_remove_add_remedies_family_root.py`, `test_bump_remedies_family_root.py`, `test_family.py`, `test_family_add_member_id.py`, `test_family_bump_to_checks.py`, `test_family_printed_quoting.py`), `test_family_dry_run.py`, which this commit changes, and four of the hygiene five (`test_repo_hygiene.py`, `test_agents_md_codes.py`, `test_cli_reference.py`, `test_pinned_copy_text.py`). The fifth, `test_path_guard_hygiene.py`, is not at this head. #1201 sits on #1117's older head `10dc011c9`, whose base `6da757cbe` predates #1111. #1117's current head, `219e57c28`, has it from its merge of main. It runs on the predicted merge instead.
- **Gate B** (9 files), which name the changed functions and codes: `test_family_init_landing.py`, `test_git_bash_dialect.py`, `test_family_switch_branch_exists.py`, `test_family_tracking_branch.py`, `test_validate_family_branch_step.py`, `test_validate_family_remedies_typed.py`, `test_validate_family_duplicates.py`, `test_family_members_not_a_list.py`, `test_family_bump_to_a_tag.py`.

| run | git | result | log |
|---|---|---|---|
| the commit's new and changed rows (73 ids) | 2.43.0 | **73 passed** in 69.23s | `logs/rows.log` |
| the same 73 ids, `eac177af9`'s `family.py` swapped in | 2.43.0 | **9 failed, 64 passed** (above) | `logs/baserows.log` |
| gate A | 2.43.0 | 1 failed, 662 passed in 413.56s (the one failure is in Limits) | `logs/gateA243.log` |
| gate A again | 2.43.0 | **663 passed** in 509.19s | `logs/gateA243b.log` |
| gate A | 2.47.1 | **663 passed** in 421.81s | `logs/gateA247.log` |
| gate B | 2.43.0 | **389 passed** in 261.02s | `logs/gateB243.log` |
| gate B | 2.47.1 | **389 passed** in 340.68s | `logs/gateB247.log` |
| gate A, gate B and `test_path_guard_hygiene.py` (23 files) on the predicted merge, scratch commit `e22074def` (below), `head=e22074def...` | 2.43.0 | **1174 passed** in 790.16s | `logs/merged243.log` |
| the row that failed once, alone, 10 runs of its 2 ids | 2.43.0 | **20 of 20 passed** | `logs/rep-head243-*.log` |
| *The review round, `43d2e8b26`:* the two new rows and the ``IR RS`` row, before the commit (tree dirty) | 2.43.0 | **3 passed**, 16 deselected in 7.50s | `work/n1228e/logs/newrows-head.log` |
| the two new rows, `eac177af9`'s `family.py` swapped in | 2.43.0 | **2 failed**, 17 deselected | `work/n1228e/logs/newrows-on-eac177af9.log` |
| M10a, M10b, M3b, each alone, over `tests/test_family_remedy_lines.py` | 2.43.0 | 1 failed 18 passed; 1 failed 18 passed; 2 failed 17 passed | `work/n1228e/logs/mut-*.log` |
| gate A (13 files), the head | 2.43.0 | **665 passed in 379.55s** | `work/n1228e/logs/gateA243.log` |
| gate A (13 files), the head | 2.47.1 | **665 passed in 372.06s** | `work/n1228e/logs/gateA247.log` |
| gate A and `tests/test_path_guard_hygiene.py` (14 files) on the predicted restack, scratch commit `f168938c4`, `head=f168938c4...` | 2.43.0 | **787 passed in 401.58s** | `work/n1228e/logs/restack243.log` |
| `tests/test_family_init_landing.py`, the file of `family-holder-already-here`'s detail | 2.43.0 | **19 passed in 8.34s** | `work/n1228e/logs/init-landing243.log` |

The 2.47.1 runs put lane 5's git 2.47.1 first on PATH, and each log's first line reads `git version 2.47.1`. No run had a skip. The full suite was not run. Gate A of the second commit is 665 ids, the first commit's 663 and the two new rows; git-filter-repo 2.47.0 (CI's pin) was on PATH in every run. `tests/test_path_guard_hygiene.py` is still not at this head (see Gate A above), so gate B (the first commit's 9 files) was not run on the second commit, which the brief did not ask for. It changes `_landing`'s remedy and one test file only.

Read on 2026-11-09 at 23:00:17Z, after fetching main at `370a23cd2`, with every open PR's head read from `gh pr list` (38 open). Of them, one other touches this PR's five files: #1274 (`scripts/family.py`). The results are the same on git 2.43.0 and 2.47.1.

| `git merge-tree --write-tree <other> 54b9cb2` | exit | result |
|---|---|---|
| main, `370a23cd2` | 0 | clean, tree `245b4d057fef`: the restacked head's own tree, since main is its parent |
| #1274, `136b38d12` | 0 | clean, tree `907bfe588d05` (with main: clean, `cdbdd63151f0`) |

- **The other 36 open PRs merge with this head as they merge with main.** Each head was merged with `54b9cb20a` and with `370a23cd2`. 34 are clean both ways. #1209 conflicts both ways in `tests/test_adopt_plan_paths_spelled.py`, and #1237 in `adopt-project.py` and `tests/test_adopt_check_throwaway_repos.py`. Neither is one of this PR's files, so neither conflict is this PR's.
- **The restack plan this body named on 2026-11-08 is done.** #1117 landed as `9252ef208` and #1201 as `8cf6477fe`, and #1201's head had taken #1117's three merges. This branch took #1201's three ("Restacked after #1201 landed"). Read from `gh pr view` after the push, at 23:21:05Z: the base is `main`, GitHub gives the PR as MERGEABLE with 5 files and 12 commits, and `closingIssuesReferences` lists #1228 only.
- **Before the restack,** on 2026-11-08 at about 17:55Z, `43d2e8b26` merged cleanly with #1201's and #1117's heads, and conflicted with main and with #1164's head only in `docs/handbook.html`, the stack's conflict, which #1117's head mended (`work/n1228e/logs/merge-trees-2.log`). The predicted restack on main `9729315f1` (scratch commit `f168938c4`) was clean, and its gate passed (787 passed, in Runs).

- **The clause's branch is built from the row's `id:`, and two rows now tell it from the name** (mutants M10a and M10b, killed since `43d2e8b26`; see the review round). Every other fixture row's id is its project lowercased, so only a row renamed by hand tells them apart. The old gap was harmless in effect, as rv1201 found for R5: the clause's `switch -c` need only leave the tracking branch.
- **NIT-3 is left** (above). It is the same question as (a)'s one branch for two verbs.
- **The interpreter is asserted, not looked up** (NIT-2). The docstring says so. rv1201 typed the lines through bash, dash and zsh with `python3` from PATH, 12 of 12.
- **The clause says "a branch other than the tracking branch".** It is worded to be true on any branch, as #1201's is, since a dry run says the refusal before the branch is read. A person already off the tracking branch reads a clause that does not apply to them.
- **`init`'s `<Project>` stays a placeholder** in the clause's `switch -c`, as NEXT STEPS print it. `add`'s own refusal names the branch lowercased; any spelling works.
- **One row failed once, in code this commit does not touch.** In the first gate A on 2.43, `tests/test_family_dry_run.py::test_bump_dry_run_of_a_repair_to_the_pinned_commit_is_a_move[digest]` failed:
  - **What it saw.** The dry run said it would commit the repair. The real run then said `nothing to do: InkRouter/IRRS is already pinned at ab0fea7e32a2 and every fact agrees.` and exited 1.
  - **Where that is decided.** The real run's answer comes from `_nothing_to_record`, a `git diff --quiet HEAD` made after `write_lf` rewrites `family.yaml` in place. The row's hand edit keeps the file's size.
  - **The commit leaves that path alone.** It changes no code of `_nothing_to_record`, `_rewrite_members`, `force_stage` or `tree_digest`. Its only `tree_digest` lines are one sentence of `_bump_dry_run`'s docstring, rewrapped. The row has no duplicate id, so the `dry_run` flag in `_checked_bumped_id` never shows.
  - **Every other run passed it:** the second gate A on 2.43, gate A on 2.47.1, the predicted merge's run, and 20 of 20 runs alone.
  - **The cause is not found.** A probe of the plain race (a same-size, in-place rewrite right after `git add` and `git commit`, then `git diff --quiet HEAD`) missed none of 200 rewrites on 2.43.0 and none of 200 on 2.47.1. The failure's log is `logs/gateA243.log`, and the probe is `probe/racy.py`.
- **`tests/test_path_guard_hygiene.py` runs at the head now.** Before the restack it was not at the PR's head and ran on the predicted merges only (see Runs). This PR adds no file-system guard: its `family.py` hunks add no `is_file`, `is_dir`, `exists`, `is_symlink` or `os.path` call.
- **The runs are on the bench's Python 3.12; CI runs 3.14.** No test line this commit adds uses `ast.dump`, `repr(`, `sys.version` or `!r`. The 442 added lines are ASCII and at most 79 columns. None of the commit's new asserts joins conditions with `and` or `or`. The one such assert in `test_family_dry_run.py` (line 1431) is `eac177af9`'s line 1394, moved down.
- **Not run:** the full suite, a real Windows host, and macOS.
- **#1117 and #1201 have landed,** and the restack plan this body named is done ("Restacked after #1201 landed").

Review: rv1264, lane 5's independent opus reviewer, which wrote none of #1264: READY at `b54520ce` (issuecomment-6724775227), with no MUST or SHOULD and two NITs; the review round `43d2e8b2` fixes both. Then rv1264b, lane 5's independent sonnet reviewer, which wrote none of it: READY at `43d2e8b2` (issuecomment-6725329517); its NIT-A (the Goal paragraph) is corrected in the body. Then rv1264c, lane 5's independent sonnet reviewer, which wrote none of it: READY at `54b9cb20`, the restack onto main, with no MUST or SHOULD (issuecomment-6754554921); the PR's diff is the reviewed change by patch-id. `tests` at `54b9cb20` failed only on the 13 rows of tests/test_adopt_symlink_target_bytes.py that #1189 broke on main and #1293 fixed, so the head was refreshed onto the fixed main as `2c72492e` (a merge only), H0 of this landing once its own checks pass. CI (Brett Heap's ruling 27): H0 is the head 2c72492 itself, which passed tests, tests-git-bash and SonarCloud; main has touched none of its files since its base a20d4bd; and the local gate passed on its predicted squash tree 597f402 over main f981468: the family_bump_to_checks, family_dry_run, family_remedy_lines, readme_windows_quoting_sentence, validate_family_unreadable, path_guard_hygiene, pinned_copy_text, no_auto_maintenance, repo_hygiene, agents_md_codes, cli_reference sets, 653 passed, 2 skipped. Landed on Brett Heap's word of 2026-10-23T13:10:26Z, relayed to every lane by lane 3 (#473 issuecomment-6365697123): "merge v1.2.1 PRs once reviewed and green".

Closes #1228

Lane: openreposhape-5 (openRepoShape-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 10, 2026
… through it inside the commit, and one out of the commit leaves whether it is a leg unknown, so `adopt-project.py plan` and `check` stop calling the leg a single repository (#1163) (#1270)

On main at `46fe6ac1` (#1159's squash), `adopt-project.py plan` and `check` asked the Triad advisory about the commit their plan is written against, and `_leg_by_agents_md` in `scripts/shape_advisory.py` read a committed `AGENTS.md` as that blob's text. In a commit a symlink is a blob that holds the PATH it points to, so a leg whose `AGENTS.md` is a link showed no leg's opening, and both commands said "This is a single repository" whether or not the link's target could be read. The doctor reads the disk, where the operating system follows the link, and called the same checkout the leg.

Outside v1.2.0 by Brett Heap's ruling of 2026-10-21T10:32:04Z

- A link that leads to a file inside the commit is read through it, from the commit's own objects (option (b)). `Tree.is_link(rel)` asks whether `git ls-tree --full-tree <commit> -- <rel>` gives mode 120000 (`LINK_MODE`), and is never asked of the disk. `Tree.text_through(rel)` uses git's own resolution, `git cat-file --batch-check --follow-symlinks`, fed `<commit>:<rel>` on stdin: each link from the directory it is in, through a linked folder too, up to 40 links. A blob is read only from a line that begins with an object's name. `_leg_by_agents_md` asks `is_link` first and reads `text_through` on a link, and otherwise reads `tree.text(AGENTS_MD)` exactly as before, so `Tree.text` keeps its one argument. Only the commit reading changes: `shape-doctor.py` and `adopt-project.py` are untouched.
- A link to nothing that is a file is no leg's file, as on the disk (#430's rule). That is a link that dangles in the commit, loops, runs through a file, or leads to a directory or a submodule, and both readers advise there. A link out of the commit (an absolute path, or one that climbs past the root) leaves whether it is a leg unknown: a folder named as a leg is still that leg, and otherwise the answer is `not-answered`, which is silent, with `refused` None. Rejected: option (a) for every link, which would give silence over a leg the commit plainly names; reading the disk for a link out of the commit, which would make the advisory read any file on the machine a committed link names; following links for every file `Tree` reads, which would change `adopt-project.py`'s record question (#528).
- git 2.43 looks a `.` segment up as a name, which no tree holds, so it answers `dangling` for `./docs/AGENTS.md`, `docs/./AGENTS.md` and `.//docs/AGENTS.md`, where `open()` reads the file. Where git says `dangling`, the link's own target is read and, if it is relative, has no LF, CR or NUL, and holds a `.` segment before its last, it is asked again with those segments dropped (`_dot_segments_dropped`). A last `.` or `/` is kept, so a link through a file stays `notdir`. A cleaned target that begins with `..` is out of the commit and git is never asked it, since git reads such a name from the working directory and refuses it (exit 128).
- In a partial clone, `plan` now fetches the link's target as well. `check` and `execute` fetch nothing (`_lazy_fetch_off`). Measured in a `blob:none` clone: promisor packs 1 -> 3 with `GIT_NO_LAZY_FETCH` unset, the reading `leg-clone`; 1 -> 1 with it set, `not-answered`.
- Measured with git 2.43.0 and CPython 3.12.3, base `5370b018` against head `2abd8176`, over 13 fixtures (a clone of `acme/Orbit` in a folder `Atlas`, the link committed), with `plan`, `check --plan` and `shape-doctor.py --json`:
  - A link to the leg's file inside the commit went from the `triad` advisory to the leg's NOTE, also with `docs/` or the file at mode 000, where the doctor offers no way in and neither reader calls the clone a single repository.
  - A link out of the commit (`../locked/AGENTS.md`, the same by its absolute path, with `locked/` at mode 000, or `../nowhere/AGENTS.md` dangling) went from the advisory to nothing. The doctor reads the leg where the link reaches its file and the advisory where it reaches nothing.
  - A link that dangles in the commit, loops, leads to a directory, or leads to a file that is no leg's gives the advisory on base and head. A regular leg file and a single repository (the controls) are as before.
  - `plan` exits 0 in all 13. `check` exits 1 in 10 (its own `plan-root-symlink` over the link) and 0 in 3, the same on base and head. The doctor's rows are the same on base and head in all 13.
  - Since r1163, a link spelled with a `.` segment is the leg too: at `0f8dae6e` `plan` and `check` print the leg's NOTE, where `2abd8176` printed the advisory.
- `tests/test_advisory_agents_md_symlink.py` is new, with 27 rows: the first round's 16, r1163's 9 and r1163b's 2. Base against head: 9 failed and 7 passed, then 16 passed; with `2abd8176`'s module against `0f8dae6e`, 4 failed and 5 passed, then 9 passed; with that module against `8e54c32d`, 1 failed and 1 passed, then 2 passed. Every base failure is the defect, `advise` where `leg-clone` or `not-answered` is asked. Mutants: 14 in the first round, 12 killed; 11 in r1163's round, 9 killed; r1163b's K1, K5 and K12, 3 of 3. The writer's survivors are equivalent: M10 (`is_link` says link where git cannot answer) differs in four readings, where git fails every call or only `ls-tree`, and `plan` and `check` reach none of them, since both build their source with `git show-ref` first; M11 (`--full-tree` dropped), since `_read` runs git from the root; X8 (every `dangling` target asked again), which changes only the cost, one git call; X9 (no absolute-target check), since git answers any absolute target `symlink` before it reads a segment.
- Known limits:
  - A link out of the commit is silent in `plan` and `check`, even where the doctor reads more. The commit cannot tell the two apart, and adopt reads no file outside the repository.
  - A link into a submodule reads as nothing there (git 2.43.0 answers `dangling`), so the commit reading advises where the doctor reads the leg of a checked-out submodule.
  - A link that leaves the repository and comes back in by the folder's own name is out of the commit.
  - With `core.symlinks=false` the readers disagree the other way: the disk advises and the commit reading gives the leg (on base both advised). CI is Linux only.
  - A `.` segment in a link further along is still `dangling`: with `docs -> ./.agents` and `AGENTS.md -> docs/AGENTS.md`, the commit advises and the disk reads the leg.
  - A target whose leg-file name holds an LF or a CR after a `.` segment is not asked again, so it is advised while the disk reads the leg. An LF would be two requests, git removes a trailing CR, and `cat-file -z`, which reads such a name whole in git 2.43, is not used here.
  - Measured with git 2.43.0 only. A git that follows a `.` segment answers the first ask, and the second is never made.
  - Only `AGENTS.md` is followed. `project.yaml`, `family.yaml` and `single-repository.yaml` committed as links are still read as the path their blob holds: for `single-repository.yaml -> docs/record.yaml` the commit reading says `advise` with the NOTE `it could not be read (YamlError)`, and the disk says `recorded-single`. That is unchanged by this PR, and following them is #1272, which measures the record question.

Review: lane 1's independent reviewers reviewed each round. r1163 found `2abd8176` NOT READY, for two SHOULDs and two NITs with no MUST (#1270 issuecomment-6724915296): a link spelled with a `.` segment still got the advisory over a leg, and mutant R6 (the followed blob decoded with `errors="replace"`) survived. The branch was stacked on #1159 until it landed as `46fe6ac1`, and was then restacked onto main by merges, with no rebase: `6c4c8131` merges #1159's final head `9e4aab8c`, and `7029934c` merges its squash, ours for #1159's three files. Its changed lines equal the reviewed delta (468 `+`/`-` lines, sha256 `50dc1c81`). The round `7121e222` and `0f8dae6e` answered both SHOULDs and both NITs, M10's survivor argument and the partial-clone line (issuecomment-6724923880). r1163b found `0f8dae6e` NOT READY, for one SHOULD and three NITs with no MUST (issuecomment-6725254247): no row had git's second ask answer `symlink`, so K5 and K12 survived; the LF, CR and NUL exclusion was only partly pinned and described; X8 saves one git call, not two; and M10 differs in a fourth reading. The round `8e54c32d` answered all four with the row `[relative-after-a-dot-and-a-double-slash]`, the control `[dot-and-a-carriage-return]`, a reworded docstring and the Known limit above, and the body's X8 and M10 lines, and it changes no code (issuecomment-6725410590). r1163c (r1163b, resumed) found `8e54c32d` READY, with no MUST, SHOULD or NIT (issuecomment-6725518505): the new row fails on base and passes at head, the new control passes on both, K1, K5, K12 and R6 are killed, the module's code equals `0f8dae6e`'s once docstrings are blanked, and main merges cleanly. K2, K4 and K10 stay as r1163b accepted them, and its optional second row (`./docs/../../locked/AGENTS.md`) is not added.

Tests, with CPython 3.12.3 and git 2.43.0, in the probe environment (a stub `gh` with a bogus token), one basetemp per call and at most two calls at once. At `8e54c32d`: `tests/test_advisory_agents_md_symlink.py` with `tests/test_doctor_unsearchable_links.py` and `tests/test_shape_advisory.py` 123 passed (27, 49 and 47) in 91.18 s, and r1163c's run of that call 123 passed in 100.99 s, then 123 passed in 94.73 s on the predicted merge with main `51a9c5f1` (tree `6b939ea7`, clean, differing from main only in the PR's two files); `tests/test_scaffold_leg_path_collisions.py` with `tests/test_path_guard_hygiene.py` and `tests/test_no_auto_maintenance.py` 283 passed and 2 skipped (both `test_no_auto_maintenance.py:222`, which the probe environment's `GIT_CONFIG_GLOBAL=/dev/null` causes); the doc trio 171 passed. At `0f8dae6e`, not run again because `8e54c32d` changes the new test file and one docstring in `scripts/shape_advisory.py`: the seven files that name `shape_advisory` 285 passed, and `tests/test_shape_doctor.py` in 4 shards 113, 113, 113, and 107 passed with 3 skipped (the PowerShell row, which runs only on a Windows host), 446 passed in all. r1163b's own runs at `0f8dae6e` of the new-file call, the seven files, the scans and the doc trio gave 121, 285, 283 with 2 skipped, and 171 passed, and its 3.14-like shim over the new file and `tests/test_doctor_unsearchable_links.py` gave 74 passed; the shim was not run at `8e54c32d`. The first cut `60c41528` gave 1 failed and 111 passed in the first call, #1159's `test_a_failure_the_leg_reader_does_not_expect_is_silence_not_advice` (`TypeError` for `Refusal`), which `2abd8176` mends by moving the choice to the caller. The change asks no `is_file`, `exists` or `stat`: the disk path is unchanged, and the commit path is git alone.

It lands by fast refresh (Brett Heap, 2026-10-15T22:48:35Z). Its first H0, `8e54c32d`, ran `tests` on 2026-11-08; after #1293 mended main, the branch was refreshed over it, and that head, `b24382a8`, is its H0. Its H0 `b24382a8` is green on Linux and SonarCloud. The branch was never rebased. Any commit after H0 is update-branch's clean merge of main, and the head that lands, 0c19a3c, is green on SonarCloud and Git Bash. Lane 1's gate passed on its tree: 27 pytest calls over `tests/test_advisory_agents_md_symlink.py`, `tests/test_doctor_unsearchable_links.py`, `tests/test_shape_advisory.py`, `tests/test_adopt_single_repository_record.py`, `tests/test_bom_reads.py`, `tests/test_bootstrap_non_utf8_branch.py`, `tests/test_doctor_gitmodules_not_utf8.py`, `tests/test_doctor_unreadable_paths.py`, `tests/test_doctor_validator_verdicts.py`, `tests/test_doctor_next_is_a_command.py`, `tests/test_scaffold_leg_path_collisions.py`, `tests/test_path_guard_hygiene.py`, `tests/test_no_auto_maintenance.py`, `tests/test_agents_md_codes.py`, `tests/test_cli_reference.py`, `tests/test_repo_hygiene.py`, `tests/test_adopt_check_throwaway_repos.py`, `tests/test_adopt_tracking_branch.py`, `tests/test_adopt_unreadable_git_parts.py`, `tests/test_chain_link_fold.py`, `tests/test_family_bump_to_checks.py`, `tests/test_family_dry_run.py`, `tests/test_family_remedy_lines.py`, `tests/test_naming_policy_line_break.py`, `tests/test_pinned_copy_columns.py`, `tests/test_readme_windows_quoting_sentence.py`, `tests/test_siblings_family_name.py`, `tests/test_update_shape_apply_lines_and_headers.py`, `tests/test_update_shape_header_comments.py`, `tests/test_update_shape_messages.py`, `tests/test_update_shape_unreadable.py`, `tests/test_validate_family_member_id_pattern.py`, `tests/test_validate_family_unreadable.py`, `tests/test_validate_pins_spelled_and_named.py`, `tests/test_value_pattern_line_break.py` and `tests/test_shape_doctor.py` in 4 shards: 2,578 passed, 7 skipped.

Closes #1163

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 10, 2026
…git` this user cannot read is pinned `source-unreadable` in `check` and `execute`, never `source-partial-clone`, with no `gh` call and no `upload-pack` run (#1262) (#1289)

Pin, in `tests/test_adopt_partial_clone_source.py`, that a partial clone whose recorded `.git` this user cannot read is refused `source-unreadable`, naming that `.git`, and never `source-partial-clone`, in `check` and `execute` alike, with no `gh` call, no `upload-pack` run and no remotes directory made. RD1141's NIT-1 on #1141 (for #1099) asked for it, and #1262 is that follow-up.

**This is a test gap only, and the behaviour is right.** The PR changes one file, `tests/test_adopt_partial_clone_source.py` (+117 -15). No production file, refusal code, remediation or doc changes. Milestone v1.2.1, as #1262.

`Plan._recorded_source` (reached through `open_source`) asks `_git_refused(path)` ahead of everything that reads the clone (`adopt-project.py:7064` at `4552efa6a`), in `check` and `execute` alike, and `_refuse_a_partial_clone_short` runs after the source is opened. #1141's 9 refused-by-name rows (`tests/test_adopt_unreadable_clone_git.py`) build a plain clone, and this file's rows build partial clones with a readable `.git`: no row built a partial clone whose `.git` is at mode 000. RD1141's probe (not in the repository) measured 16 such rows at `0b8fb320`, all `REFUSED source-unreadable` naming `<it>/.git`, none `source-partial-clone`, with 0 `gh` calls and 0 `upload-pack` runs. RD1141 measured why a reorder cannot flip that answer: through a `.git` at mode 000 `_promisor_remotes` is `[]` and `_objects_lacking` is `None`, where they are `['origin']` and 28 while it is readable, so the partial-clone rule's own questions see nothing there. What no row pinned is a change that left such a clone to that rule.

In `tests/test_adopt_partial_clone_source.py`, reusing `Source`, `made` and `planned_once`, and `needs_a_mode`, `recording_gh`, `at_mode_000`, `the_refusal` and `CURES` from the files that own them (functions only, no fixture is imported):

- `test_a_partial_clone_whose_recorded_git_is_unreadable_is_source_unreadable`: **16 rows**, `[nocheckout|checkout]-[check|execute]-[given|cloned]-[directory|file]`. Each makes a `--filter=blob:none` clone (with a checkout, and with `--no-checkout`; `source.lacking() > 0` is asserted), records it as the plan's `source.local_path` (`cloned` false, or `source.cloned: true` with a `source.repository`), makes its `.git` a directory or a `gitdir:` file (`git clone --separate-git-dir`), and puts that `.git` at mode 000 for the `with` (`at_mode_000`: the mode is asserted to bite and is given back in a `finally`). It skips as root and on Windows (`needs_a_mode`). It asserts:
  - exit 2 and `the_refusal(...)` in stderr: `REFUSED source-unreadable: the .git in the plan's source.local_path, <path>/.git: cannot be read (Permission denied), so ... cannot be told`, with the cure for a directory or for a file (`CURES[kind]`);
  - `source-partial-clone` in neither stream, and no `plan ok`;
  - the `gh` log from `recording_gh` empty (no `gh` call);
  - no remotes directory;
  - `source.untouched()`: no `upload-pack` ran, and `objects/` hashes as it did before.
- `test_the_same_partial_clones_with_a_readable_git_are_source_partial_clone`: **8 control rows**, `[nocheckout|checkout]-[given|cloned]-[directory|file]`, `check` only. The same clones with a readable `.git` are refused `source-partial-clone` with its cure, never `source-unreadable`, with no `gh` call and nothing fetched. They show the 16 rows read the `.git`'s mode and not a clone the rule would let by. They run as root and on Windows too.

The helpers, none of which changes an existing row: `Source` takes `apart` (the git directory beside a `.git` file); `objects_dir(path)` finds `objects/` through that file (a function of the path alone, because `tests/test_adopt_plan_partial_clone.py` calls `Source.store(SimpleNamespace(path=...))`); `check` and `execute` take an `env`; `recorded_as_a_clone` is the `cloned` edit `at_the_side_commit` made inline, made alone and called from there. `tests/test_adopt_plan_partial_clone.py` reuses `Source`, `made` and `planned_once`, and keeps its outcomes (run G below). No assert joins conditions with `and` or `or`.

The detached tree `n1262-mut` at main `4552efa6a`, this branch's test file, `adopt-project.py` and `docs/cli.md` (#1141's two production files) taken from `26cc80bd2^`, then restored and compared by sha256 (`adopt-project.py` `eb5f181b...` at the base, `a8f76e66...` before #1141). `-k "unreadable or readable_git"`, git 2.43.0: **16 failed, 8 passed.**

| rows | before #1141 | at the head |
|---|---|---|
| the 8 `given` rows (2 clones x 2 verbs x 2 kinds) | 8 fail: `REFUSED git-failed` (`git rev-parse --is-inside-git-dir` says not a git repository), no `gh` call | pass |
| the 8 `cloned` rows (the same 8) | 8 fail: `gh repo clone testorg/Elsewhere` asked, `REFUSED source-unclonable` | pass |
| the 8 control rows (readable `.git`) | pass | pass |

This is what RD1141 measured for the same 16 rows on main `b66d8f0cc`.

Each applied alone to `adopt-project.py` in `n1262-mut` at `4552efa6a`, the 24 rows run, and the file restored and compared by sha256 each time (script `mutate.py`; the control rows pass in every run).

| mutant | the change | rows failed |
|---|---|---|
| RD1141's MR4 | `refused = _git_refused(path) if there else None` becomes `refused = None` | **16 of 16** |
| the guard asked after the `cloned: false` branch has read the clone | the three guard lines moved below that branch, before `_not_a_whole_clone` | **8**: the 8 `given` rows (`git-failed` from `_top_level`); the `cloned` rows still reach the guard |
| extra: a `.git` file left unguarded | `a_file = False` in `_git_refused` | 8: every `file` row |
| extra: a recorded clone left unguarded | the guard asked only where `source.cloned` is not `true` | 8: every `cloned` row |

No survivor. The two named in #1262 are killed, and each axis of the 16 rows (directory or file, given or cloned) carries a mutant of its own.

Head `2e0d2d237`, Python 3.12.3, git-filter-repo 2.47.0 (`tools/venv247`), through `run10.sh` (a stub `gh` first on PATH that refuses and logs every call, `GH_TOKEN=bogus-l5`, an empty `GH_CONFIG_DIR`, `GIT_SSH_COMMAND=false`, `GIT_CONFIG_GLOBAL=/dev/null`), at most 100 tests a run, `-rs` alone. Each ran on git 2.43.0 and on git 2.47.1 (`tools/git247/bin/git`, `git --version` printed first in each log):

| run | files | rows | 2.43.0 | 2.47.1 |
|---|---|---|---|---|
| A | `test_adopt_partial_clone_source.py`, `test_adopt_unreadable_clone_git.py`, `test_adopt_unenterable_source_and_locale.py` | 93 | 93 passed | 93 passed |
| G | `test_adopt_partial_clone_source.py` and `test_adopt_plan_partial_clone.py` in one pytest (the second imports the first's fixtures) | 77 | 77 passed | 77 passed |
| B | `test_agents_md_codes.py`, `test_cli_reference.py` | 70 | 70 passed | 70 passed |
| C | `test_pinned_copy_text.py` | 87 | 87 passed | 87 passed |
| D | `test_no_auto_maintenance.py` | 60 | 58 passed, 2 skipped | 58 passed, 2 skipped |
| E1, E2 | `test_path_guard_hygiene.py` in two halves | 61 + 60 | all passed | all passed |
| F1, F2 | `test_repo_hygiene.py` in two halves | 51 + 50 | all passed | all passed |

The only skips, named: `tests/test_no_auto_maintenance.py:222` x2 on each git, "the session began with GIT_CONFIG_GLOBAL set, and its file includes that one". Run G first failed 10 rows on an earlier head `cd8b4f3fe` (a `git_dir` attribute `Source.store(SimpleNamespace(path=...))` does not have); `objects_dir` replaced it and every run above was repeated at `2e0d2d237`.

Pre-test of the merge: the predicted merge of the head into main `9cb156a98` (`85f8744b4`, a local commit never pushed), git 2.43.0: G 77 passed, and `test_adopt_unreadable_clone_git.py` with `test_adopt_unenterable_source_and_locale.py` 31 passed.

**Refreshed on 2026-11-10 at 12:19Z as `305021ef3`**: one merge of main `3add78e1c` into the reviewed head `2e0d2d237`, made by `gh pr update-branch`. The old head's `tests` run had failed only on #1189's 13 rows in `tests/test_adopt_symlink_target_bytes.py`, which #1293 fixed on main. A re-run would have tested the stale merge again. CI's `tests` runs on the refreshed head, and lane 5's pilot gates the predicted squash again at this PR's turn.

`git merge-tree --write-tree` at the refreshed head `305021ef3`, heads read fresh at 12:23Z (27 open PRs). No other open PR touches `tests/test_adopt_partial_clone_source.py` or `tests/test_adopt_plan_partial_clone.py`. Against the PR's base the head changes one file, `tests/test_adopt_partial_clone_source.py` (+117/-15).

| against | result |
|---|---|
| main `3add78e1c` | clean, tree `8327064c7`, the head's own tree (the head holds main) |
| #1210 (`791106c2b`, 16th) | clean, tree `00f6a02ac` |
| #1194 (`fix/1129-github-name-limits`, `906172b41`, 17th) | clean, tree `b0eac8e04` |
| #1209 (`fix/1196-paths-spelled-locale-and-env`, `13a2c58cb`) | add/add conflict in `tests/test_adopt_plan_paths_spelled.py`, a file this PR does not touch; the same conflict arises between #1209 and main alone |

The earlier rows (main `3ee5bb4d9` and `9cb156a98`, and #1282, which has landed as `b607223b4`) are superseded by this table (rv1289's NIT 1).

Review: rv1289, lane 5's independent opus reviewer, which wrote none of #1289: READY at `2e0d2d23`, with no MUST or SHOULD (issuecomment-6752563658); its NIT 1 (stale merge lines in the body) was taken by the coordinator at 12:24Z, and NIT 2 is optional. Refreshed on 2026-11-10 at 12:19Z as `305021ef` (one merge of main `3add78e1` into H0 `2e0d2d23`), because H0's `tests` failed only on #1189's 13 rows that #1293 fixed; `305021ef` is H0 of this landing once its checks pass. CI (Brett Heap's ruling 27): H0 is the head 305021e itself, which passed tests, tests-git-bash and SonarCloud; main has touched none of its files since its base 3add78e; and the local gate passed on its predicted squash tree 54e3742 over main 3ffe75b: the adopt_partial_clone_source, path_guard_hygiene, pinned_copy_text, no_auto_maintenance, repo_hygiene, agents_md_codes, cli_reference sets, 499 passed, 2 skipped. Landed on Brett Heap's word of 2026-10-23T13:10:26Z, relayed to every lane by lane 3 (#473 issuecomment-6365697123): "merge v1.2.1 PRs once reviewed and green".

Closes #1262

Lane: openreposhape-5 (openRepoShape-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 10, 2026
… with `git rm -f` and writes the twins the root keeps back from the index, so on a disk that ignores case `execute` keeps a set the plan splits across repositories or drops (#1183) (#1237)

On a disk that ignores case, `adopt-project.py execute` lost a case twin the plan keeps in the root when its twin goes to a leg or is dropped (`adopt-lost`, exit 1), or stopped mounting the legs (`REFUSED mounting the legs`, exit 2), in each case after both legs were pushed, and `check` printed `plan ok` for every such plan, since `plan-case-twins` (#1161, #1189) asks only about twins the plan keeps in ONE repository. The loss was in the assembly's work tree, between `_mount_the_legs`'s `git rm` loop and `_stage_the_split`'s `git add -A -- .`. Now the mount removes what a case twin is at or under with `git rm -f`, writes the twins the root keeps back from the index, and takes out of the index alone what `-f` would reach through a symlink or at a gitlink.

Outside v1.2.0 by Brett Heap's ruling of 2026-10-21T10:32:04Z

- `_mount_the_legs` lists the assembly's index once, each path with its mode (`git ls-files -s -z`, `_index_modes`), and keeps each `_case_twin_sets` set with a path at or under a path it removes (`_split_case_twins`). It removes each path such a set has a path at or under with `git --literal-pathspecs rm -r -q -f --` (`GIT_RM_FORCED`) and every other path with today's `GIT_RM`, then writes the twins of those sets that the root keeps back from the index with `git checkout-index -f -z --stdin` (`_write_from_the_index`; a refusal is `CommandFailed`, one of `LATE_FAILURES`). A source with no such set gets the same `git rm` commands as before.
- A path `-f` would reach through a symlink is taken out of the index alone (r1237's MUST 1). On a disk that ignores case a folder `D/` and a symlink `d` are one name, and the clone writes `d` last: at `c9f0cc18`, `git rm -r -q -f -- D` unlinked `D/x` in the folder the symlink leads to, outside the work directory. Before each `-f`, `_taken_beyond_a_symlink` asks each path the index holds at or under the removed path, folder by folder from the top, with `lstat` (`_beyond_a_symlink`, `_is_a_symlink`), and takes a path beyond a symlink out with `git --literal-pathspecs rm -r -q --cached --` (`GIT_RM_CACHED`), which touches no file on the disk. A refusal would come after both legs are pushed, for a plan that is good on every disk.
- A gitlink whose own path is no folder is taken out the same way (r1237b's MUST 1): `git rm` of a gitlink's entry removes the folder at its path and follows a symlink there, so a plan that drops a gitlink `D` and keeps `d`, a symlink to a folder outside, stopped after both legs were pushed and left that folder EMPTY. `_index_modes` replaces `_index_paths`; where no folder on the way is a symlink, `_taken_beyond_a_symlink` asks each gitlink's own path with `lstat` (`_is_itself_a(path, kind)`, which `_is_a_symlink` now calls). The empty folder a clone writes for a gitlink is still removed with `-f`.
- The twins are written back after the loop, from the index: writing each before its sibling's `git rm` was rejected, since one `git rm -r` can remove two twins at once (a dropped folder holding `d/x` and `d/X`). `--cached` for a twin's own path was rejected too: on a disk that keeps case it leaves the file, and `git add -A` adds it again. No `core.ignorecase` probe is made, so the same commands run on every disk.
- `plan-case-twins`' remediation text is unchanged, but its words no longer name a stop at `git rm` (r1237's SHOULD 1): `execute` could stop there before any leg exists, at git's `will not add file alias`, or, for a set in the assembly root, after both legs are pushed, as `adopt-lost`. `twins_kept` pins them.
- Measured with git 2.43 on a FUSE disk that ignores case and keeps it, `plan`, `check` then `execute --local-remote-dir`, base `4d40ce9f` (#1189's head as it was then) against `ef18f059`'s `adopt-project.py`. Where the twin that goes sorts last (`A` root, `a` code), `git rm a` deleted the one file both names share and `git add -A` staged the kept twin's deletion; where it sorts first (`A` code, `a` root), `git rm A` refused with `the following file has local modifications: A`.
  - At base `across`, `acrossspec`, `dropped`, `ffacross` and `ffdropped` were exit 1, `adopt-lost`, and `acrossrev`, `droppedrev`, `dropboth` and `specode` exit 2, `REFUSED mounting the legs`; `ffacrossrev` verified. At head all verified, and so did `samebytesacross`, `samebytesdropped`, `dirmergeacross`, `deepacross` and `none`, which base was not measured on. `root` (`A`, `a` root) is `check` exit 1 and `execute` exit 2, `plan-case-twins` before any leg (#1189's refusal, unchanged), and was not run at base. "Verified" means `check` printed `plan ok`, and `execute` exited 0 with `adoption verified: every source path is in exactly one place`.
  - r1237's symlink scenarios (`victim/` outside `--work-dir`): at `c9f0cc18` `symvictim`, `symvictimdrop`, `symvictimrel` and `symboth` verified and deleted `x`, and `syminside` and `syminsidedrop` gave exit 1, `adopt-lost` `E/x`; at `0b8252c3` all verified, with `x` kept.
  - r1237b's gitlink scenarios (1 run each): at `63c52718` `glinkdrop`, `glinkdir` and `glinkcode` were exit 2, `REFUSED mounting the legs`, after both legs were pushed, with `victim` EMPTY, `glinkfile` and `glinkfiletop` exit 2 too, and `glinkfolder` verified; at `b557859f` all six verified, `victim` whole where the plan has one, and so did the symlink scenarios of both rounds but `symrev`. r1237c's `glinkrepo`: at `58aa9d2b` git moved an outside repository's `.git` into the assembly before it refused; `--cached` skips that.
  - Rows: the first rows 10 failed, 2 passed and 4 skipped at `58aa9d2b`, 12 passed and 4 skipped at head; round 1's 14 failed and 1 passed at `c9f0cc18`, 15 passed; round 2's gitlink rows 5 failed and 1 passed at `63c52718`, 6 passed; round 3's row passed at `87325bed`.
  - Mutants of the changed lines, restored after each run: 37 of 40 at `ef18f059` (34 of 40 at the first rows), 15 of 16 for round 1's, 14 of 14 for round 2's, and 10 of 11 for r1237c's, C05 killed by round 3's row at `87325bed`. Each survivor is equivalent (C09 on POSIX).
- Known limits:
  - The bench disk, which keeps case, was not run in full at head: only `across` and `acrossrev` ran there, and both verified; at base all 15 scenarios but `root` verified there.
  - `three` (`A` root, `a` code, U+00C5 drop, U+00E5 root) gave no result, a defect in the bench script, not in the tool: the plan quotes the name U+00C5 and the bench's `path:` match does not.
  - The FUSE-only rows have not been run on a FUSE disk, and skip on every CI disk; the gitlink rows make the clone's symlink, or its one file, by hand on CI's disks. Every FUSE scenario of both review rounds ran once, with git 2.43, and no real macOS or Windows disk was available.
  - `symrev` still stops at the mount, as at `58aa9d2b`: a symlink `D` that sorts first and goes to a leg, beside a folder `d/` the root keeps; `git rm -f -- D` meets the folder the clone left, `fatal: git rm: 'D': Is a directory`, exit 2 after both legs are pushed, with nothing deleted. It is filed as #1250.
  - `check`'s rehearsal of the mount still asks `git rm` without `-f` and writes no twin back, so for a twin set the plan splits that the source's rules reach (`* text=auto` on a disk that ignores case), it names a `plan-file-reencoded` the mount no longer meets, and `execute` refuses before any leg. Nothing is lost; follow-up #1298 (r1237e's SHOULD 1).
- Not in this PR: the remediation's option to answer the twins of each set into different repositories (left for a follow-up with `TWINS_REMEDIATION` and the doc trio; this PR does not call it safe on every disk), and a `check` probe of `core.ignorecase`.

Review: lane 1's independent reviewers reviewed each round. r1237 read `c9f0cc18` and found one MUST, one SHOULD and one NIT: MUST 1, the forced `git rm` removed a file through a symlink a case twin left, answered by `0b8252c3`; SHOULD 1, `plan-case-twins`' words named a stop at `git rm` that `-f` took away, by `f645fcb8`; NIT 1, `_split_case_twins`' docstring, by `63c52718`. r1237b read `63c52718` and found one MUST, one SHOULD and three NITs: MUST 1, a gitlink whose case twin is a symlink, answered by `9259da2b`; SHOULD 1 (R11), NIT 1 (R04) and NIT 2 (R02, R03), each a row, by `3ff03feb`; NIT 3, the test module's #1183 paragraph, by `b557859f`. r1237c read `b557859f` and found it READY, with three NITs: NIT 1 (C05, a row for a gitlink's own path asked only after the folders on the way) is answered by `87325bed`; NIT 2, three stale lines, and NIT 3, the Why bullet on `--cached`, are applied to the body. After #1189 landed as `9cb156a9` (the squash of its final head `dae72509`), the branch was restacked by three merges with no rebase, `181c992c`, `dbbe541e` and `b61d218e` (main `370a23cd`). The reviewed delta and the restacked one are the same 1069 lines (sha256 `58581a52` and `4dbd7dcf`) but for the docstring's blank line; at `87325bed` it is 1088 lines (sha256 `9de5b4d6`), adding exactly round 3's NIT 1 lines. r1237d found `87325bed` READY, with no MUST and no SHOULD (#1237 issuecomment-6755448563). Its NIT 2 is applied to the body. Its NIT 1, a comment's wording, is answered by `fa6d189f`, after a merge of main `de55beb0` (`04f1d0fd`) that #1253's landing needed: one `conftest` import hunk was resolved, and the PR's own lines are otherwise unchanged. r1237e read `fa6d189f` (#1237 issuecomment-6760779988) and found the merge correct, with one SHOULD the branch already had, taken as the Known limit and #1298, which it grades READY.

Tests, under a stub `gh` with a bogus token, at `87325bed` with CPython 3.12.3 on the bench (CI runs 3.14), one pytest call per line: `tests/test_adopt_check_throwaway_repos.py` 233 passed and 6 skipped (the 4 FUSE-only rows, and 2 outside this section), its #1183 section alone, 43 rows, 39 passed and 4 skipped; `tests/test_adopt_make_reads_first.py` 34 passed; `tests/test_adopt_clone_template.py`, `tests/test_adopt_git_rm_bytes.py`, `tests/test_adopt_late_failure.py`, `tests/test_adopt_mount_ignored.py` and `tests/test_adopt_submodules.py` 316 passed; `tests/test_adopt_collision_make_reads.py` with `tests/test_adopt_single_repository_record.py` 67 passed; `tests/test_scaffold_leg_path_collisions.py` 104 passed; `tests/test_path_guard_hygiene.py` with `tests/test_no_auto_maintenance.py` 179 passed and 2 skipped; `tests/test_agents_md_codes.py`, `tests/test_cli_reference.py` and `tests/test_repo_hygiene.py` 171 passed; `tests/test_shape_doctor.py` in 4 shards 112 passed, 112 passed, 113 passed, and 109 passed and 3 skipped. `tests/test_adopt_symlink_target_bytes.py` gave `13 failed, 137 passed` at `87325bed`, the same 13 rows that failed on main `370a23cd` then, each because #1170's row did not expect the `plan-case-twins` finding #1189 adds; with lane 1's #1293 (`d3143d84`) merged into a scratch copy of that head, never pushed, it gave 150 passed. #1293 has since landed as `9304069`, and `73b45ee5` holds it. At `fa6d189f`, the first file gave 260 passed and 6 skipped, with #1253's 27 rows, and `tests/test_adopt_symlink_target_bytes.py` 150 passed.

It lands by fast refresh (Brett Heap, 2026-10-15T22:48:35Z). After #1189 landed, the branch was restacked over its squash by three merges, and r1237d found the result, `87325bed`, READY; after #1293 mended main, the branch was refreshed over it (`73b45ee5`); after #1253 landed, main was merged into it with r1237d's NIT 1, and r1237e found that head, `fa6d189f`, READY with one Known limit. `fa6d189f` is its H0, and it is green on Linux and SonarCloud. The branch was never rebased. Any commit after H0 is update-branch's clean merge of main, and the head that lands, 1bb333c, is green on SonarCloud and Git Bash. Lane 1's gate passed on its tree: 47 pytest calls over `tests/test_adopt_check_throwaway_repos.py`, `tests/test_adopt_symlink_target_bytes.py`, `tests/test_adopt_root_symlinks.py`, `tests/test_adopt_root_shape_paths.py`, `tests/test_adopt_clone_template.py`, `tests/test_adopt_git_rm_bytes.py`, `tests/test_adopt_late_failure.py`, `tests/test_adopt_mount_ignored.py`, `tests/test_adopt_submodules.py`, `tests/test_adopt_collision_make_reads.py`, `tests/test_adopt_make_reads_first.py`, `tests/test_adopt_next_make_reads_first.py`, `tests/test_adopt_root_manifest.py`, `tests/test_adopt_shape_pin_and_work_dir.py`, `tests/test_adopt_verify.py`, `tests/test_doctor_plan_overrides.py`, `tests/test_adopt_reencoded_files.py`, `tests/test_adopt_nested_attributes.py`, `tests/test_adopt_eol_block_through_links.py`, `tests/test_adopt_printed_sentences.py`, `tests/test_adopt_single_repository_record.py`, `tests/test_scaffold_leg_path_collisions.py`, `tests/test_path_guard_hygiene.py`, `tests/test_no_auto_maintenance.py`, `tests/test_agents_md_codes.py`, `tests/test_cli_reference.py`, `tests/test_repo_hygiene.py`, `tests/test_adopt_clone_default_remote_name.py`, `tests/test_adopt_filter_repo_origin_url.py`, `tests/test_adopt_github_exits.py`, `tests/test_adopt_partial_clone_source.py`, `tests/test_adopt_pin_row_values.py`, `tests/test_adopt_pins.py`, `tests/test_adopt_plan_against_its_source.py`, `tests/test_adopt_plan_and_remote_paths_spelled.py`, `tests/test_adopt_plan_paths_spelled.py`, `tests/test_adopt_plan_value_order.py`, `tests/test_adopt_plan_values_read_as.py`, `tests/test_adopt_relative_submodule_url.py`, `tests/test_adopt_shown_default_ignorables.py`, `tests/test_adopt_source_clone_record.py`, `tests/test_adopt_source_github_limits.py`, `tests/test_adopt_spelled_unambiguous.py`, `tests/test_adopt_unsearchable_source.py`, `tests/test_advisory_agents_md_symlink.py`, `tests/test_bootstrap_spelling.py`, `tests/test_doctor_local_leg_aliases.py`, `tests/test_doctor_unreadable_paths.py`, `tests/test_doctor_unreadable_pin.py`, `tests/test_family.py`, `tests/test_load_yaml_refusals.py`, `tests/test_manifest_validator.py`, `tests/test_naming_gate_spelled.py`, `tests/test_naming_policy_line_break.py`, `tests/test_pinned_copy_text.py`, `tests/test_root_git_unreadable.py`, `tests/test_shape_doctor.py`, `tests/test_update_shape_merged_away.py`, `tests/test_update_shape_pin_source.py`, `tests/test_update_shape_unreadable.py`, `tests/test_value_pattern_line_break.py` and `tests/test_shape_doctor.py` in 4 shards: 5,170 passed, 19 skipped.

Closes #1183

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant