Skip to content

bootstrap.py, validate-family.py and siblings.py: a root or holder whose .git this user cannot read is refused git-repo-unreadable, exit 2, not a traceback or not-a-git-repo, and the doctor's members row names it once, never drift (#1148) - #1172

Merged
brettheap merged 17 commits into
mainfrom
fix/1148-pinned-find-repo-root-refuses
Nov 9, 2026

Conversation

@brettheap

@brettheap brettheap commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What

The four other pinned callers of find_repo_root, which #1146 left as they were (its Known limits): the assembly root's scripts/bootstrap.py, and the family holder's validate-family.py, bootstrap.py and siblings.py. Also the doctor's members row over a holder whose own .git cannot be read.

Was stacked on #1147 (base fix/1146-root-git-unreadable-not-drift, whose head was b75babee when this was measured and reviewed). #1147 has landed, as its squash 51a9c5f1 on main, and this branch was restacked onto main by real merges, with its own change unchanged (see "Restacked after #1147 landed"). This PR is outside v1.2.0 by Brett Heap's ruling of 2026-10-21T10:32:04Z ("leave the follow-ups out of v1.2.0"). It lands after the tag, on a later word.

Measured in a scaffold's recursive clone and a family holder, with base b75babee (#1147's head then) and this head, on Python 3.12.3. It was also measured under a 3.14-like sitecustomize, in which Path.is_file, is_dir, exists and is_symlink answer False to any OSError. Each tool ran from the root, as make runs it.

Tool .git a link into a folder at 000 .git a directory at 000 readable
assembly bootstrap.py, base 3.12: PermissionError traceback, exit 1. Shim: REFUSED not-a-git-repo: no .git found at or above <root>, exit 2 step (a) says no gitlink recorded; leaving as is of each leg. Then pins refuses git-repo-unreadable and bootstrap REFUSED, exit 2 bootstrap ok
assembly bootstrap.py, head REFUSED git-repo-unreadable: .git: cannot be read (Permission denied) and the chmod cure, exit 2, no traceback, nothing on stdout, both Pythons the same refusal, before anything is placed bootstrap ok
validate-family.py (and --no-members), base 3.12: traceback, exit 1. Shim: not-a-git-repo, exit 2 REFUSED gitlinks-unreadable over git's not a git repository, with the remedy to ask git status, exit 2 family ok
validate-family.py (and --no-members), head REFUSED git-repo-unreadable: .git: cannot be read (Permission denied), exit 2, both Pythons the same family ok
family bootstrap.py, base 3.12: traceback, exit 1. Shim: not-a-git-repo, exit 2, with or without --no-fetch --skip-members plain: FETCH INCOMPLETE (git exit 128) with the advice to set SHAPE_LEGS_TOKEN, each member fails its pins, family bootstrap FAILED, exit 1. With --no-fetch --skip-members: family bootstrap ok, exit 0, over a run that read nothing family bootstrap ok
family bootstrap.py, head REFUSED git-repo-unreadable: .git: cannot be read (Permission denied), exit 2, both Pythons, with or without the flags the same, with or without the flags family bootstrap ok
siblings.py (plain and --dry-run), base 3.12: traceback, exit 1. Shim: not-a-git-repo, exit 2 places every member, siblings ok, exit 0; the holder's branch shown ? siblings ok
siblings.py (plain and --dry-run), head REFUSED git-repo-unreadable: .git: cannot be read (Permission denied), exit 2, both Pythons unchanged, by design: places every member, exit 0 siblings ok
the doctor over the holder, base 3.12: INVALID (family). The family row says crashed ... PermissionError, and members says .git: cannot be read through run_checks' generic handler. Shim: DRIFTED (a member is not at its pin), members says checked out at ? DRIFTED (a member is not at its pin) on both Pythons; family refuses gitlinks-unreadable COMPLIANT
the doctor over the holder, head INVALID (family), both Pythons. members: FINDING .git: cannot be read (Permission denied), so no gitlink is read and no member is compared with its pin, NEXT this doctor again, WHY the chmod cure. family: the project's own scripts/validate-family.py refuses (exit 2): REFUSED git-repo-unreadable: .git: cannot be read (Permission denied) the same COMPLIANT

The doctor's other family rows (manifest-kinds, shape-currency, agent-files) were ok in every state, on both sides. placement is unchanged (placement is n/a for a holder).

Lane 1's ruling. The family bootstrap's new refusal under --no-fetch --skip-members over a .git directory at 000 is ACCEPTED. Base said family bootstrap ok there, over a run that read nothing. Head refuses git-repo-unreadable, exit 2, as the other tools that read the holder's repository through git do.

The gate's regression, fixed in the test's fixture. Lane 1's gate found tests/test_validate_family_unreadable.py failing 6 of 53 at 05e6ab0f, where base passes all 53.

  • What failed. Each row expects REFUSED member-unreadable: members/IRRS/.git: cannot be read (Permission denied), and got REFUSED git-repo-unreadable: .git: cannot be read (Permission denied).
  • The tool was right and the fixture was stale.
    • Those rows run validate-family.py's main in process after refused_stat(monkeypatch, ".git"). That call refuses the stat of every path named .git: the holder's own as well as the member's.
    • On base, only find_repo_root asked the holder's .git, and the file's gate() stubs it to answer the holder.
    • This PR's _run_checks asks _refuse_an_unreadable_root(start) first. The stub did not cover it, so it met the holder's refused .git and refused it by its own name, .git.
  • The fix. gate() now gives the holder as the whole root: find_repo_root answers it, and _refuse_an_unreadable_root asks nothing. No assertion changed.
  • A real run never reaches a member. The walk asks only the start and the folders above it. The file's mode rows (member-000, members-000, variant-000, staged-removal-000) run the whole gate in a subprocess, the new check included. They passed at 05e6ab0f too.
  • The other three tools. Each carries its own copy of the walk, from the same start upward. None of their tests runs main in process after refusing .git by name. Their .git rows call one function alone (checkout_tracking_branch, unfetchable, run_member_target, fetch_members, _print_pinned_row), and the gate passed them.

Why

Tests

tests/test_pinned_root_git_unreadable.py, new, has 76 rows.

  • Mode cases. A real mode, each tool run as a person runs it. They skip on Windows and as root (CANNOT_RUN_AS_ROOT), and restore the mode after:
    • the issue's case, a .git linked into a folder at 000, for each tool;
    • .git at 000 and at 444, for each git reader;
    • a gitfile into a locked folder, named by its git directory, whole;
    • the doctor over the holder, link and directory: INVALID (family), members held whole, never checked out at ?.
  • Stand-in cases. In process, on every platform and as root (refused_stat, refusing, as_python_314):
    • each tool, both causes (permission and I/O error);
    • the walk, per tool: a .git above the --root given, named whole; the same under a folder whose name holds an ESC, the whole path spelled; a relative --root . run from contracts/; a .git above the root never asked; a stop at a readable gitfile, and at a gitfile that names no directory (added after review r1: test_the_walk_stops_at_a_gitfile_that_names_no_directory, one id per git reader);
    • per git reader, what .git is or names: a git directory's HEAD, a gitfile that cannot be opened, a git directory outside the root and inside it, a gitfile ending in CR LF, an unprintable folder (POSIX only);
    • siblings.py asks only the stat;
    • the members row in process, both causes, and drifted_reasons with a readable member beside an unread one.
  • Controls. A readable root and holder: COMPLIANT, each tool goes on past the question. Five roots that answer absent or that git answers for: no tool refuses. siblings.py over a .git directory at 000 still places the members.

Base vs head. Base is b75babee with the new file laid over it.

3.12.3 3.14-like shim
base b75babee 74 failed, 2 passed 74 failed, 2 passed
head 5aa0f116 76 passed 76 passed

The 2 rows that pass on base are controls: test_siblings_still_places_the_members_of_a_holder_whose_git_is_at_000 and test_roots_whose_git_can_be_read_are_unchanged.

The other rows fail on base for two reasons:

  • 38 on base's own answers (unchanged by the review round): the 3.12 traceback and the shim's not-a-git-repo (link at 000, every tool, in process, --root contracts, --root ., and the ESC folder); no gitlink recorded, gitlinks-unreadable, gitmodules-unreadable and FETCH INCOMPLETE (the git readers at 000, 444 and through a gitfile); DRIFTED (a member is not at its pin) and a members row that is ok, not FINDING; drifted_reasons counting the unread entries;
  • 36 only on a name base does not have (_refuse_an_unreadable_root, AttributeError): the 33 before review r1, and the 3 ids of test_the_walk_stops_at_a_gitfile_that_names_no_directory.

Mutants: 58 of 58 killed (the 55 below, and the 3 review r1 added). Each was applied once to a scratch clone of the head (never the worktree), the new file was run there with -x on 3.12, and the file was put back in a finally. The clones were checked clean after.

  • Per git reader (A, V, F), the mutants were: the call removed; continue made return on absent; no .resolve(); the final return removed; CR not stripped; no normpath; the git directory named as .git; the HEAD step removed; relative naming removed or named against the candidate; the ValueError fallback removed; spelled removed (F); the code changed; the reads or what text dropped.
  • siblings.py (S): the call removed; the return removed; an absent .git stopping the walk; no resolve; the relative naming and its fallback; spelled removed; the code dropped or ignored; the what text dropped.
  • The doctor (D): no root_git_read in check_members; the drift filter removed; the null keys dropped; why or next None; status ok; the reason changed; the line not carried.
  • Review r1's three (issuecomment-6351621763). It ran 42 of its own 85 mutants: 39 killed and 3 survived. The 3 were A-, V- and F-gitfile-naming-nothing-continues: in each git reader, the return made continue where .git is a gitfile that does not start with gitdir: . The 73 rows had no row that held that line. test_the_walk_stops_at_a_gitfile_that_names_no_directory was added for them: the root's .git is a gitfile reading no gitdir, the parent's .git is refused with as_python_314, and _refuse_an_unreadable_root(root) answers None. Run in a scratch clone of this tree, the file with -x on 3.12.3, each mutant is KILLED by its own tool's id: [assembly-bootstrap], [validate-family], [family-bootstrap] (1 failed, 45 passed, 1 failed, 47 passed, 1 failed, 46 passed), restored in a finally. The review's other 43 mutants were not run by it and were not run again here.
  • 54 were killed by the file's first 69 rows. S-spelled-removed survived those (69 passed), because the only unprintable row was the git readers'. The row test_a_root_git_named_whole_is_spelled was added for it, over all four tools, and its [siblings] id kills it.

The regression in tests/test_validate_family_unreadable.py, on 3.12.3:

b75babee (base) 05e6ab0f (before the fix) 3a389565 (the fix; 53 passed again at the head 5aa0f116, measured by r1172b)
53 passed 6 failed, 47 passed 53 passed
  • The six rows: test_a_path_whose_stat_is_refused_is_refused_by_name at [member-checkout], [member-checkout-pins], [unregistered-member-checkout], [staged-removal-checkout] and [variant-checkout], and test_a_stray_whose_rm_takes_no_f_asks_nothing_of_its_git.
  • Two mutants of the fix, each in a scratch clone of the head, with the files put back in a finally:
    • The new stub removed. Killed by test_a_path_whose_stat_is_refused_is_refused_by_name[member-checkout], and by the other five, as before the fix.
    • validate-family.py's check walking from members/IRRS instead of the start. Killed by the mode row test_a_folder_this_user_cannot_search_is_refused_by_name[member-000]. A root check that reached a member's .git is still seen with the stub in place.
  • The new file, again at 3a389565: 73 passed on 3.12.3, and 73 passed under the shim. At 5aa0f116, with review r1's 3 rows: 76 passed on 3.12.3, and 76 passed under the shim; tests/test_validate_family_unreadable.py, 53 passed.

The gate, all five calls, on 3.12.3.

  • How it ran. Each call was collected to node ids first (--collect-only; the count of ids equals pytest's own "collected" line). The ids were then run in shards of at most 300 ids, each under 9 minutes, as a person runs them: no gh, a stub gh first on PATH, GIT_SSH_COMMAND=false.
  • Which head. The calls ran at 05e6ab0f. The fix that followed, 3a389565, touches only tests/test_validate_family_unreadable.py. After review r1 the new call ran again at 5aa0f116 (the head, which adds 3 rows to the new file and nothing else).
    • Only the big-22 shard holds that file, and no other test imports it.
    • So new and big-22 ran again at 3a389565, and the other shards stand.
    • tests/test_family_hand_mount_git_rm_lines.py, which names the file in its docstring, also ran again at 3a389565: 29 passed.
Call Files Ids Result
new test_path_guard_hygiene, test_root_git_unreadable, test_pinned_root_git_unreadable, test_doctor_unreadable_pin, test_doctor_unreadable_paths 255 255 passed at 05e6ab0f, 255 again at 3a389565, and 258 passed at 5aa0f116 (3 rows added)
docs test_scaffold_leg_path_collisions and the doc trio (test_agents_md_codes, test_cli_reference, test_repo_hygiene) 274 274 passed
pin test_pinned_copy_text, test_shape_pin_*, test_update_shape* (22 files) 945 in 4 shards 945 run: 237 passed, 234 passed with 3 skipped (junctions are NTFS's, test_update_shape_add_symlink.py:832), 237 passed, 234 passed; 0 failed
sd test_shape_doctor.py, in 4 shards 448 445 passed, 3 skipped (the PowerShell line, printed only on a Windows host), 0 failed
big the 116 other files naming validate-family.py, siblings.py or bootstrap.py, and 6 that read the members row or its keys 8076 in 27 shards 8037 passed, 39 skipped, 0 failed, with big-22 at 3a389565 (300 passed). At 05e6ab0f, big-22 failed 6 of 300: the regression above. The other 26 shards passed

The 39 skips in big are this bench's:

  • git 2.43 here, where CI runs 2.55 (and the reftable backend needs 2.45);
  • rows for Windows or macOS only;
  • GNU make's jobserver form;
  • rows whose template already quotes the value, so the rule has nothing to refuse.

The new file was also run in full under the 3.14-like shim: 73 passed, at 05e6ab0f and again at 3a389565, and 76 passed at 5aa0f116. tests/test_path_guard_hygiene.py with tests/test_repo_hygiene.py: 149 passed at 5aa0f116. The pin, docs, sd and big calls were not run again after review r1, since the only file it changes is the new test file, which no other test imports.

Pinned copy

The four files are in scripts/shape_materialize.py's COPIED_VERBATIM (the assembly bootstrap) and FAMILY_COPIED_VERBATIM (the three holder files). No file is added to or taken from a list, and no digest of them is recorded in the tree, so there is no pin-record edit, as in #1147. Measured against a standard one commit past the pin of a project and a holder scaffolded from base:

Merge with #1147's new head

#1147's head was then a2fc1da8: main with #1200 merged in (569ea056), then placement giving the root's line ahead of #1200's refusal of a leg's git directory. It is merged here as 2eabec8e ("Merge #1146's branch into #1148's branch"), parents 5aa0f116 and a2fc1da8, with no conflict. git merge-tree gave tree c473b237, and the merge commit has that tree. Four files changed on both sides since the merge base b75babee (shape-doctor.py, both bootstrap.py files and validate-family.py), and git merged each with no conflict. Compared line by line, per file, the merge adds to this PR's 7 files exactly the lines a2fc1da8 brings, and keeps exactly the lines this PR added: 902 added and 26 removed, as before.

The members row and #1200 agree. #1200 names a member whose own git directory cannot be read, through mount_read in member_state. This PR's check comes first in check_members: with the holder's own .git unreadable, root_git_read answers and the row returns before any member is read. So the two never meet, and the order is the one a2fc1da8 gives placement: the root's line first. On the merge:

Tests on 2eabec8e, in the probe environment, on Python 3.12.3 and git 2.43.0:

Call Files Result
own tests/test_pinned_root_git_unreadable.py, tests/test_validate_family_unreadable.py 129 passed
unread tests/test_root_git_unreadable.py, tests/test_doctor_unreadable_paths.py 118 passed
scans test_path_guard_hygiene, test_no_auto_maintenance, test_scaffold_leg_path_collisions 283 passed, 2 skipped (test_no_auto_maintenance.py:222: the session began with GIT_CONFIG_GLOBAL set)
members 8 of the ids above: the members rows of both PRs and the readable control, with each row logged 8 passed

That is 532 ids: 530 passed and 2 skipped. Lane 1's gate on a2fc1da8 covers #1147's side: 1,018 passed and 5 skipped. The pin, docs, sd and big calls above were not run again on the merge.

Restacked after #1147 landed

#1147 landed as 51a9c5f1 on main, the squash of its final head 95ea5646. That head is update-branch's merge of main 801a7d6d into 4d299dd3, #1147's last fix: placement gives the root's line only to a leg whose mount mount_read got into, so a mount this user can search and not list keeps spec: cannot be listed. The squash's tree, 2d6db67c, equals 95ea5646's. The branch was restacked from 2eabec8e by real merges, with no rebase, squash, amend or force-push:

  1. 81bc91f8 merges 95ea5646. No conflict. Its tree, f48d7e9e, is the one git merge-tree --write-tree gave beforehand. It brings 4d299dd3 (shape-doctor.py, and a row in tests/test_root_git_unreadable.py) and main's 18 commits after a2fc1da8.
  2. ba81fd7d merges the squash 51a9c5f1, with this branch's side kept for shape-doctor.py, validate-pins.py and validate-manifest.py: a root whose own .git this user cannot read is named .git: cannot be read (<reason>), so the doctor never reads it as DRIFTED, and both pinned validators refuse it, exit 2 (#1146) #1147's files. Those are the five files of git diff --name-only 51a9c5f1^ 51a9c5f1: shape-doctor.py, validate-pins.py, validate-manifest.py, tests/test_doctor_unreadable_paths.py and tests/test_root_git_unreadable.py. git ls-files -u was empty, and git write-tree gave f48d7e9e, the tree of 81bc91f8: the merge changes no file.
  3. No merge of main was needed. Fetched again before this step, at 18:34Z, origin/main was still 51a9c5f1.

The PR's own change is unchanged. The + and - lines of git diff -U0 b75babee 5aa0f116 (the delta r1172b found READY) and of git diff -U0 51a9c5f1 ba81fd7d are the same 928 lines, in the same 7 files and the same order: 902 added and 26 removed. Both have sha256 9eef7395.

Tests on ba81fd7d, in the probe environment, on Python 3.12.3 and git 2.43.0:

Call Files Result
own tests/test_pinned_root_git_unreadable.py, tests/test_validate_family_unreadable.py 129 passed
unread tests/test_root_git_unreadable.py, tests/test_doctor_unreadable_paths.py, tests/test_doctor_unreadable_pin.py 171 passed
scans test_scaffold_leg_path_collisions, test_path_guard_hygiene, test_no_auto_maintenance 283 passed, 2 skipped (test_no_auto_maintenance.py:222: the session began with GIT_CONFIG_GLOBAL set)
docs test_agents_md_codes, test_cli_reference, test_repo_hygiene 171 passed
sd tests/test_shape_doctor.py, 449 ids in 4 shards 446 passed, 3 skipped (test_shape_doctor.py:10516: the PowerShell line, printed only on a Windows host), 0 failed

That is 1,205 ids: 1,200 passed and 5 skipped, none failed. The pin and big calls above were not run again on the restack.

Known limits

Not in this PR

Closes #1148

Lane: openreposhape-1 (openRepoShape-1)

🤖 Generated with Claude Code

Summary by Sourcery

Refuse unreadable repository roots consistently across pinned family tools and report unreadable holders accurately in the doctor's members check.

New Features:

  • Refuse unreadable repository roots consistently across the remaining pinned bootstrap, family validation, and sibling-management tools with git-repo-unreadable and exit 2.
  • Report an unreadable family holder once in the doctor's members row without treating its members as drift.

Bug Fixes:

  • Prevent permission errors, misleading missing-repository results, and downstream git or fetch failures when a root or holder's .git cannot be read.
  • Ensure repository-root discovery handles unreadable git directories and gitfiles consistently while preserving absent and readable repository behavior.

Enhancements:

  • Align root readability checks, diagnostics, remediation guidance, and path naming across the pinned tool copies.
  • Exclude unreadable member entries from drift calculations while preserving drift detection for readable members.

Documentation:

  • Update user-facing tool descriptions and refusal behavior documentation for unreadable repository roots.

Tests:

  • Add comprehensive coverage for unreadable root git links, directories, gitfiles, path traversal, platform behavior, doctor output, and unchanged controls.
  • Update family validation fixtures to account for the new root-level readability check.

Brett Heap and others added 7 commits October 22, 2026 02:33
…ose own `.git` this user cannot read is named, `.git: cannot be read (<reason>)`, so the doctor says INVALID and not DRIFTED, and both pinned validators refuse it by name, exit 2, with no traceback (#1146)

The case: an assembly root whose `.git` is a link into a folder at mode 000.
On main 038dafb the doctor said DRIFTED (2 leg(s) not at the pin), its
`legs` row said `no gitlink recorded` of each leg, and the root's own
`scripts/validate-manifest.py` and `scripts/validate-pins.py` ended in a
`PermissionError` traceback out of `find_repo_root` (3.12), or refused
`not-a-git-repo` (3.14-like shim).

- validate-pins.py and validate-manifest.py (pinned copies): each `.git`
  `find_repo_root` would ask is asked first with the file's own `_is_a`,
  and one whose `stat` is refused is `git-repo-unreadable`, exit 2, in the
  file's `_unreadable_file` words. validate-pins.py, which reads the
  gitlinks through git, also asks the first `.git` that is there what it
  asks a leg's (#968): a gitfile it cannot open, a git directory whose
  `HEAD` it cannot reach.
- shape-doctor.py: `root_git_read` asks the same; the `legs` row says the
  gate's line once, NEXT this doctor again, WHY the gate's advice, each leg
  keeps it in `gitlink_cannot_be_read`, which `drifted_reasons` does not
  count; `placement` says it, n/a.
- tests/test_root_git_unreadable.py: 35 rows, mode and stand-in.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… legs' `.git`, since a root whose own `.git` is refused too is #1146's case, which the `legs` row names once; the new file's one-path stand-in answers `is_file` and `is_dir` as 3.14 and puts `sys.path` back (#1146)

`test_a_mount_whose_git_cannot_be_reached_is_not_one_without_a_git` used
`refused_stat(monkeypatch, ".git")`, which refuses every `.git` by name, the
root's own among them. Its case is a mount this user can list and not
search, so it now refuses `spec/.git` and `code/.git` alone, by path
(`as_python_314`), and says the same lines it always did, on base and head.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… audits a leg whose own repository git reads, and gives the root's line only to a leg git cannot read through it; each `legs` entry carries every key, null; the tests pin both gates' walk (#1146)

r1147's S2. `placement` declined every leg once the root's `.git` could
not be read, so a leg with a `.git` directory of its own lost the path in
the wrong leg the base reported, and the verdict read `INVALID (pins)`
where the ladder's answer is `MISPLACED (1 path)`. `audit_leg` now gives
`root_git_read`'s line to a leg whose `.git` is there and leads to a
repository git names no top level for (`gitlink_cannot_be_read`, and its
`state`); a leg git reads is audited, a leg with no `.git` of its own
keeps git's answer, and a leg refused for its own reason keeps that. The
row says the root's line once, `n/a`, only where it is every leg's.

N7. The `legs` row's entries for an unreadable root carry `pin`,
`populated`, `head`, `own_git` and `unborn`, each null, beside `gitlink`,
so a reader of `--json` finds every key a leg's entry has.

tests/test_root_git_unreadable.py, 35 rows to 45:
- S1: per gate, a relative `--root .` run from `contracts/`, and the walk
  stopping at a readable gitfile with a `.git` above it refused;
- N1: a gitfile ending in CR LF, and one naming an unprintable folder;
- N2: `placement`'s `--json` entries for the root's line;
- N3: `validate-pins.py`'s git-directory step under a subfolder `--root`;
- S2: a leg audited beside one read through the root (MISPLACED), a leg
  with no `.git` of its own, and an in-process row on every platform.
The stand-in row that refuses every `.git` now expects each leg's own
line in `placement`.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…as root, only a leg git names no repository for is given the root's line, and each `legs` entry for an unreadable root is held whole, nulls included (#1146)

The rule `audit_leg` follows, and the `legs` entries' keys (r1147's N7),
were held only by the mode cases, which skip on Windows and as root. One
row puts git's answers in by hand beside a refused root `.git`: the code
leg, whose `.git` is there and git names no top level for, is given the
root's line; the spec leg keeps git's answer where git answers from
another repository, or where it has no `.git` of its own. The stand-in
row that refuses every `.git` now compares each `legs` entry whole.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and the doctor's members row, with a new test file not yet run

Work in progress, stacked on #1147 (b75babe).

Code, smoke-measured by a probe on 3.12 and a 3.14-like shim:
- templates/assembly-root/scripts/bootstrap.py, templates/family-root/
  scripts/validate-family.py and bootstrap.py: `_refuse_an_unreadable_root`
  asks each `.git` find_repo_root would ask, then what validate-pins.py
  asks of the first that is there (a gitfile it cannot open, a git
  directory whose HEAD it cannot reach); `git-repo-unreadable`, exit 2, in
  each tool's own words.
- templates/family-root/scripts/siblings.py: the stat step only, as
  validate-manifest.py asks it; `member_unreadable` takes a `code`.
- shape-doctor.py: `members` says a holder's unreadable `.git` once
  (`members_git_unread_row`), and `drifted_reasons` counts no member that
  carries `gitlink_cannot_be_read`.

tests/test_pinned_root_git_unreadable.py is NEW and HAS NOT BEEN RUN: it
may fail. No mutants, no gate yet.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…, from a folder under one whose name holds an ESC, is spelled by each of the four tools, so dropping `spelled` from siblings.py's own call is seen (#1148)

The 55th mutant, `S-spelled-removed`, survived the file as it stood: its
only unprintable row was the git readers' gitfile row. The new row walks
from `<ESC folder>/root/contracts` with the root's `.git` refused, as
Python 3.14's `exists()` answers it, and expects the whole path spelled.
Base: 4 failed (`not-a-git-repo`); head: 4 passed, 3.12 and the 3.14 shim.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…n the holder as its root whole, so `_refuse_an_unreadable_root` asks nothing there and a row's `.git` refused by name is a member's again, `member-unreadable` (#1148)

Lane 1's gate of #1148 failed 6 of 53 here, 53 of 53 on #1147's head
b75babe: `REFUSED git-repo-unreadable: .git: cannot be read (Permission
denied)` where each row expects `REFUSED member-unreadable:
members/IRRS/.git: ...`.

The cause is the fixture, not the tool. `refused_stat(monkeypatch, ".git")`
refuses the `stat` of EVERY path named `.git`, the holder's own with the
member's. `gate()` stubbed only `find_repo_root`, the one asker of the
holder's `.git` on base (validate-family.py:4193 there). #1148's
`_run_checks` asks `_refuse_an_unreadable_root(start)` first
(validate-family.py:4258), which the stub did not cover, so it met the
holder's refused `.git` and answered for it, named `.git`, relative to the
holder. The six rows are the ones that run `main` in-process after that
refusal; the rows that call one function alone never reach `_run_checks`.

In a real run the walk asks only `start` and the folders above it, never a
member: the mode rows (`member-000`, `members-000`, `variant-000`,
`staged-removal-000`, ...) run the whole gate in a subprocess, the new check
included, and passed on #1148's head before this change.

`gate()` now gives the holder as the root whole: `find_repo_root` answers
it and `_refuse_an_unreadable_root` asks nothing. No assertion changes.
The holder's own `.git` stays held by
tests/test_pinned_root_git_unreadable.py (73 passed).

Mutants, in a clone: the stub removed is killed by
`test_a_path_whose_stat_is_refused_is_refused_by_name[member-checkout]`
(and the five others); validate-family's root check walking from
`members/IRRS` is killed by
`test_a_folder_this_user_cannot_search_is_refused_by_name[member-000]`.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sourcery-ai

sourcery-ai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

The unreadable-holder members row now preserves the member-detail shape while marking each entry with the unreadable gitlink line, so JSON readers retain the expected keys.

  • shape-doctor.py L11214-11245

Implementation

The doctor checks the holder’s repository before comparing members and excludes unreadable-holder entries from drift reasons; the pinned tools add root-readability guards that refuse unreadable .git metadata using each tool’s existing refusal wording and scope.

  • shape-doctor.py L11260-11268, L11286-11289, L12696-12702 (+1 small edits)
  • templates/assembly-root/scripts/bootstrap.py L117-120, L468-523, L2094-2101
  • templates/family-root/scripts/bootstrap.py L184-187, L399-462, L2411-2414
  • templates/family-root/scripts/siblings.py L367-415, L1608-1611 (+4 small edits)
  • templates/family-root/scripts/validate-family.py L522-527, L532-590, L4330-4333 (+2 small edits)

Tests

Add coverage for unreadable root .git handling across the pinned tools and doctor, and adjust the gate fixture so member-specific unreadability tests isolate the member’s .git.

  • tests/test_pinned_root_git_unreadable.py L1-562
  • tests/test_validate_family_unreadable.py L51-56, L100-104, L109-110

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

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-10-22T21:23:31Z) Independent review r1172 of #1172 at 3a389565, partial, cut short when the shared window reached STOP: NOT READY as far as it got. It found no MUST and one SHOULD.

  • SHOULD: in all three git readers, no row holds the line that stops the walk at a .git gitfile naming nothing. Three mutants survive; one cheap row fixes it.
  • NITs: 4.
  • f1148's fixture stub: sound.
  • The four tools: they match the body's table on 3.12 and under the 3.14 shim.

Lane 1 runs the fix round in a later window.

Review of #1172 (r1172, lane openRepoShape-1): partial, cut short by STOP

Verdict: NOT READY, as far as I got. I found no MUST. There is one SHOULD: a key line in all three git readers has no test that catches a change to it. It needs one cheap test row. Coverage is incomplete; see the last section.

State at stop: no runs are live. Each mutant was restored and its blob checked against HEAD. git status --untracked-files=no shows nothing in clone, clone2 or the review checkout l1-r1172, all at 3a389565a.

Your three points

1. f1148's stub (commit 3a389565): sound
  • Before the stub: at 05e6ab0f, tests/test_validate_family_unreadable.py gave 6 failed, 47 passed. They are the six rows the body names, each failing with REFUSED git-repo-unreadable: .git: cannot be read (Permission denied).
  • Base: b75babee gave 53 passed.
  • Head: 3a389565 gave 53 passed on 3.12 and 53 passed under my 3.14-like shim ($S/shim314/sitecustomize.py).
  • The 05e6ab0f run is the "stub removed" mutant. That commit is head without the stub.
  • The stub cannot hide a member's .git. The real walk asks only [path, *path.parents] of the resolved start, never anything below it. So the stub takes away only the holder's own .git, which refused_stat(".git") refuses as a side effect.
  • The subprocess mode rows still hold a member's .git to member-unreadable. They run the gate with no stub, the new check included, and passed in both head runs above: member-000, member-444, members-000, unregistered-member-000, staged-removal-000, other-checkout-000, variant-000 and hand-mount-committed-444.
  • Not re-run: the body's second fixture mutant (the walk started from members/IRRS).
2. The four tools: no wrong refusal, missed refusal or wrong wording found

I probed each tool as make runs it, from the root, on base and head, on 3.12 and under the shim, in seven states: readable, link into a folder at 000, .git at 000, .git at 444, gitfile into a locked folder, gitfile at 000, and HEAD at 000.

  • The body's What table: every cell matches, both Pythons.
    • Base 3.12, link: traceback, exit 1. Base shim, link: not-a-git-repo, exit 2.
    • Base, .git at 000:
      • the assembly bootstrap said no gitlink recorded, then bootstrap REFUSED: pins (exit 2);
      • validate-family.py refused gitlinks-unreadable;
      • the family bootstrap said FETCH INCOMPLETE, exit 1, and family bootstrap ok, exit 0, with --no-fetch --skip-members.
    • Head: REFUSED git-repo-unreadable, exit 2, nothing on stdout, for every refusal on both Pythons.
    • siblings.py over a .git at 000 places IRRS and says siblings ok, exit 0, on both sides.
  • States the body did not list, all as designed:
    • gitfile at 000: the three git readers refuse .git and siblings.py is unchanged;
    • .git at 444: refused;
    • gitfile into a locked folder: the git directory is named whole.
  • The doctor at head: INVALID (family) in the link, 000, 444, gitfile-locked and gitfile-000 states, on both Pythons.
    • members is a FINDING with the gate's line once, NEXT is this doctor again, and WHY is the chmod advice.
    • family is the holder's validate-family.py refusing git-repo-unreadable.
    • The readable holder is COMPLIANT. The base doctor matches the body.
  • Wording: each tool's stderr matches the test's BEFORE and its advice word for word. siblings.py alone leaves out "inside the root".
  • Bench note, not a PR fault: the plain (fetching) runs of the family bootstrap and siblings.py need protocol.file.allow=always here. git 2.43 refuses the file transport for submodules. With it set, the readable cells say family bootstrap ok and siblings ok.
3. The body's numbers
  • New file: head 73 passed on 3.12 and 73 passed under the shim. Base with the file laid over gave 71 failed, 2 passed on both. The two passing rows are the controls the body names. 33 of the 71 call the new function directly (4+4+18+2+5), which matches the body's 33. Confirmed.
  • Mutants: I ran 42 of my 85 and 39 were killed. The body's 55 of 55 is not confirmed, because my set includes one mutant family the body's set did not have, and it survives (SHOULD 1).

Findings

SHOULD 1: a gitfile that names no directory must stop the walk, and no row holds that
  • Where:
    • templates/assembly-root/scripts/bootstrap.py:511
    • templates/family-root/scripts/validate-family.py:569
    • templates/family-root/scripts/bootstrap.py:448
  • What it guards: each of these lines returns when .git is a gitfile that does not start with gitdir: . find_repo_root stops at that .git, so the check must stop there too.
  • Evidence: I changed each return to continue (r1172/mut/mutants.py, run by run.py with -x on the new file, 3.12). All three survived:
    A-gitfile-naming-nothing-continues  SURVIVED 27s restored=True
    V-gitfile-naming-nothing-continues  SURVIVED 27s restored=True
    F-gitfile-naming-nothing-continues  SURVIVED 26s restored=True
    
    With the mutant, a holder whose .git names nothing would be refused over a .git above it that find_repo_root never asks.
  • Fix: add one row over GIT_READERS, beside test_the_walk_stops_at_a_git_that_is_a_gitfile (line 424):
    • the root's .git is b"no gitdir\n" (the ABSENT arrangement);
    • the parent's .git is refused with as_python_314;
    • assert _refuse_an_unreadable_root(root) is None.
NIT 1: 15 control rows cannot pass on base
  • Where: tests/test_pinned_root_git_unreadable.py, lines 411, 424, 479 and 491. Those are test_a_git_above_the_root_is_never_asked, test_the_walk_stops_at_a_git_that_is_a_gitfile, test_siblings_asks_only_the_stat and test_what_answers_absent_is_left_to_find_repo_root.
  • Evidence: base 3.12 lists all 15 as FAILED with AttributeError: ... has no attribute '_refuse_an_unreadable_root'. The review rule is that a control row passes on both sides. The body is open about these rows (its 33).
  • Fix: drive the controls through main (or run_tool) and assert CODE not in stderr, so base passes them too.
NIT 2: the body says placement was ok in every state
  • Evidence: in my doctor runs, placement is n/a in every state, the readable holder included, on base and head alike.
  • Fix: say "unchanged (placement is n/a for a holder)".
NIT 3: without_working_clone: [] beside entries whose working_clone is null
  • Where: shape-doctor.py:10949.
  • Problem: a --json reader is told that no member lacks a working clone, about a question the row did not ask.
  • Fix: None, or compute it. A working clone sits beside the holder, outside its .git.
NIT 4: Known limits could name HEAD at 000
  • Evidence: with a searchable .git whose HEAD is at 000, the same on base and head and on both Pythons:

    • the assembly bootstrap says REFUSED pin-gitlink-absent: no gitlink (mode 160000) recorded at 'spec';
    • the family bootstrap says FETCH INCOMPLETE, or ok with --no-fetch --skip-members;
    • validate-family.py refuses gitlinks-unreadable.

    These are the kind of misleading answers this PR removes, left out by the limit's "stat of HEAD only".

  • Fix: add a sentence to Known limits naming this case.

Parts not covered

  • 43 mutants not run (all defined in /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1172/mut/mutants.py):
    • A: absent-kind-dir, relative-naming-removed, named-against-candidate, reads-dropped;
    • V and F: relative-naming-removed, named-against-candidate, valueerror-fallback-removed;
    • V: reads-dropped, reads-ignored;
    • F: spelled-removed, what-dropped;
    • all 17 siblings.py mutants;
    • all 10 doctor mutants, including D-before-empty-return (the order after the empty-members return);
    • X-walk-from-member. X-stub-removed is covered by the 05e6ab0f run.
  • The gate calls (docs, pin, sd, big; about 9,000 ids) were not re-run. Only test_pinned_root_git_unreadable.py and test_validate_family_unreadable.py were.
  • The Pinned copy section was not measured: the update-shape.py check results and the doctor over a holder that still holds the old copies.
  • Closing form and stacking:
    • Read but not grepped: the body holds one closing line, Closes #1148, and I saw no other close, fix or resolve form before an issue number.
    • Merge-base of head and b75babee is b75babee.
    • Not checked: whether origin's fix/1146-root-git-unreadable-not-drift is still at b75babee (no ls-remote).

Files

  • Scratch: /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1172/
    • mutant results: mut/res1.jsonl, mut/res2.jsonl
    • probe output: probe-{base,head}-{312,314}.jsonl, probe2-{base,head}.jsonl
  • Base worktree: /workspace/projects/openRepoShape-worktrees/l1-r1172-base at b75babee. It holds two untracked test files I copied in; it is not to be committed.

Lane: openreposhape-1 (openRepoShape-1)

…tfile that names no directory stops the walk, so a `.git` above it that cannot be read is never asked, and each git reader's `return` there is now held (#1148)

Review r1 of #1172 (issuecomment-6351621763) found one SHOULD: the line in
each of the three git readers that returns when `.git` is a gitfile not
starting with `gitdir: ` had no test that caught a change to it
(templates/assembly-root/scripts/bootstrap.py, templates/family-root/scripts/
validate-family.py and templates/family-root/scripts/bootstrap.py, each in
`_refuse_an_unreadable_root`). `find_repo_root` stops at that `.git`, so the
question must stop there too. Its three mutants, `return` made `continue`,
all survived the 73 rows.

New row `test_the_walk_stops_at_a_gitfile_that_names_no_directory`, over
GIT_READERS (3 ids): the root's `.git` is a gitfile reading `no gitdir`, the
parent's `.git` is refused with `as_python_314`, and
`_refuse_an_unreadable_root(root)` answers None. A tool that went on to the
parent would raise over a `.git` that `find_repo_root` never reaches. It sits
beside `test_the_walk_stops_at_a_git_that_is_a_gitfile`, which holds the
gitfile that does name a directory.

Mutants, in a scratch clone of this tree, the new file run with `-x` on
3.12.3, the file put back in a `finally`:
- A-gitfile-naming-nothing-continues  KILLED by `[assembly-bootstrap]`
- V-gitfile-naming-nothing-continues  KILLED by `[validate-family]`
- F-gitfile-naming-nothing-continues  KILLED by `[family-bootstrap]`

The file now has 76 rows: 76 passed on 3.12.3 and 76 passed under the
3.14-like shim; with the file laid over #1147's head `b75babee`, 74 failed and
2 passed on both. The new row fails there on the name base lacks
(`_refuse_an_unreadable_root`, AttributeError), as the other 33 do. Also
tests/test_validate_family_unreadable.py 53 passed, and
tests/test_path_guard_hygiene.py with tests/test_repo_hygiene.py 149 passed.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-10-23T08:09:41Z) Independent re-review r1172b of #1172 at 5aa0f116: READY. No MUST and no SHOULD; two NITs, neither blocking.

Review r1172b of #1172 at 5aa0f116: READY

I found no MUST and no SHOULD. r1172's SHOULD is fixed, NIT-2 and NIT-4 are done, and every claim in the body that I checked matches what I measured. There are two new NITs, and neither blocks the PR.

1. The SHOULD is fixed

  • The diff since 3a389565 is one file, tests/test_pinned_root_git_unreadable.py, with 18 lines added (437-453). It adds test_the_walk_stops_at_a_gitfile_that_names_no_directory over GIT_READERS. Nothing imports that file; test_validate_family_unreadable.py:55 names it only in a docstring.
  • Base vs head. I ran the whole file in scratch clones, with base at b75babee plus the head's file laid over it:
3.12.3 3.14-like shim (mine, r1172b/shim314)
base 74 failed, 2 passed 74 failed, 2 passed
head 76 passed 76 passed
  • The new row's 3 ids fail on base and pass at head, on both Pythons. On base each fails with test_pinned_root_git_unreadable.py:452: AttributeError: module 'pinned_root_git_bootstrap' has no attribute '_refuse_an_unreadable_root', and the same for the other two tools.
  • The three mutants that survived r1172, run in r1172b/clone-head with -x on the whole file. Each file was restored in a finally, and its blob matched HEAD's after:
    A-gitfile-naming-nothing-continues KILLED [assembly-bootstrap] 1 failed, 45 passed restored=True
    V-gitfile-naming-nothing-continues KILLED [validate-family]    1 failed, 47 passed restored=True
    F-gitfile-naming-nothing-continues KILLED [family-bootstrap]   1 failed, 46 passed restored=True
    
    Each one fails with REFUSED git-repo-unreadable: <parent>/.git: cannot be read (Permission denied). That is the wrong refusal the row exists to catch, and the counts match the body's word for word. 3/3 killed.

2. NIT-2 and NIT-4

  • NIT-2 is done. The body now says the other family rows were ok and that "placement is n/a for a holder". r1172's probe files (r1172/probe-{base,head}-{312,314}.jsonl) agree: in all 6 states, on both sides and both Pythons, manifest-kinds, shape-currency and agent-files are ok and placement is n/a.
  • NIT-4 is done. I checked the new Known-limits sentence myself on 3.12, with a searchable .git whose HEAD is at 000. Each tool ran from the root, and base and head gave the same answers:
    • the assembly bootstrap: REFUSED pin-gitlink-absent: no gitlink (mode 160000) recorded at 'spec', then bootstrap REFUSED: pins (exit 2);
    • validate-family.py: REFUSED gitlinks-unreadable, exit 2;
    • the family bootstrap: FETCH INCOMPLETE (git exit 128) using credential source 'none': and fatal: not a git repository, with the SHAPE_LEGS_TOKEN advice, exit 1;
    • with --no-fetch --skip-members: family bootstrap ok, exit 0.

3. Reading the diff adversarially

The row is sound. _is_a uses path.stat(), which as_python_314 patches, so a continue really does reach the parent's refused .git. Nothing in it depends on the Python version, and it runs as root and on Windows. Leaving out siblings is right: siblings' stop at any .git that is there is held by test_the_walk_stops_at_a_git_that_is_a_gitfile[siblings].

4. The body's claims

  • Rows and counts: 76 rows; base 74 failed and 2 passed, head 76 passed, both Pythons. Confirmed.
  • The 2 base passes are the two named controls. Confirmed.
  • Why base fails: 36 rows on the AttributeError and 38 on base's own answers. Confirmed: 74 tb lines, 36 of them AttributeError.
  • Hygiene: test_path_guard_hygiene.py with test_repo_hygiene.py gave 149 passed at head. Confirmed.
  • The regression file: test_validate_family_unreadable.py gave 53 passed at 5aa0f116. Confirmed.
  • Gate arithmetic: the counts add up. pin is 237 + (234+3) + 237 + 234 = 945; sd is 445+3 = 448; big is 8037+39 = 8076; new is 255+3 = 258.
  • Closing form: exactly one, Closes #1148. A regex finds no other close, fix or resolve form before any #N.
    • Title: 246 characters.
    • The outside-v1.2.0 ruling is named.
    • The body ends with the lane line and the generated footer.
    • closingIssuesReferences is [] while the base is not main, which is expected for a stacked PR.
  • Stacking is right:

NIT findings

NIT-A: the row holds return against continue, but not against a fall-through

  • Where: tests/test_pinned_root_git_unreadable.py:449-451, against bootstrap.py:510-511, validate-family.py:568-569 and family/bootstrap.py:447-448.
  • Evidence: return made pass survives the whole file in all three readers (76 passed, restored=True ×3).
    • With that mutant, the code parses b"no gitdir\n"[8:], which is b'r', as a git directory. Where <root>/r/HEAD is refused, it gives the wrong refusal REFUSED git-repo-unreadable: r: cannot be read (Permission denied).
    • The case is contrived, so this is only a NIT.
  • Fix: add root.resolve() / "r" / "HEAD": denied to that row's as_python_314 dict.
    • Measured in a scratch copy of the row (r1172b/clone-head/tests/test_r1172b_probe_strong_row.py), it gives 3 passed at head.
    • It kills all three pass mutants (1 failed …) and still kills the three continue mutants.

NIT-B: two stale phrases in the body's Tests section

  • The regression table's header labels `3a389565` (head), but the head is 5aa0f116. Fix: say "3a389565 (the fix)", or add a 5aa0f116 column with 53 passed, which I measured.
  • The "Which head" bullet puts "The fix that followed touches only tests/test_validate_family_unreadable.py" after the 5aa0f116 sentence, so it reads as if 3a389565 came after 5aa0f116. Fix: move it before that sentence.

What I did not cover, and two slips

  • Not re-run: the pin, docs, sd and big gate calls, the new call as a whole, and r1172's other 43 mutants. The diff is a single test file that nothing imports, so those results stand as the body states them.

  • Load rule slips:

    • two of my pytest calls started while the container held 4 pytest processes: the first mutant run (about 07:57Z), and the strengthened-row run (about 08:07Z, after my wait loop timed out);
    • /workspace stood at 12G free during the last runs.

    All of my runs have ended.

State

  • l1-r1172 is clean at 5aa0f116.
  • l1-r1172-base is untouched: b75babee, with r1172's two untracked files.
  • My scratch is /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1172b/:
    • logs: logs/, mutant results: mut/res-*.jsonl;
    • clones clone-head and clone-base, each with untracked probe files only and no tracked diff.

Lane: openreposhape-1 (openRepoShape-1)

@brettheap brettheap added this to the v1.2.1 milestone Oct 23, 2026
brettheap added a commit that referenced this pull request Oct 23, 2026
…w pins path-twice's wording of whose file it puts back, the index's or HEAD's as the index holds none, a row pins the value check's reading of HEAD's where the deletion of `.gitmodules` is staged, and `_listed_as_git_reads`'s docstring says it returns nothing where the work tree's file is on disk (#1181) (#1208)

It follows #1124 (for #1077), which landed as `dea964a`; W1181r restacked it onto main with only its own change (#1208 issuecomment-6371837537). It is the follow-up of RV1124b's review of #1124 (see #1150 for the neighbouring follow-ups from the first review).

## What changed

- `tests/test_validate_family_index_gitmodules.py`
  - **PT7 (NIT 1).** In `test_1077_path_twice_records_its_put_back_for_the_next_finding`, after the existing `` `{put_back}` `` assertion, a second assertion pins the whole put-back wording: `back first from {GONE[how][0]}, `{put_back}`, so that every other section stays`. It rides on the two existing rows, `[deleted]` (the index's) and `[deletion-staged]` (HEAD's, as the index holds none). The row's docstring says path-twice names whose file it puts back.
  - **S1c (NIT 2).** A new row, `test_1077_a_value_head_gives_where_the_deletion_is_staged_puts_head_s_back`. `update = !true` is committed in `members/IRRS`'s section and the deletion of `.gitmodules` is staged, so the index holds no file and git reads HEAD's. The row checks the premise (`git submodule status` exits 128), then that `found_alike(holder, *MODES)` returns the one finding as the issue gives it, whole. It types the two lines in order, runs `git add -- .gitmodules` and a plain `git commit`, and checks that `!true` is not in HEAD, `head_paths` is `{ROW, OTHER_ROW}`, `git status --porcelain` is empty, and `ends_well` passes (the gate in every mode, and a plain clone).
- `templates/family-root/scripts/validate-family.py` (NIT 3): the docstring of `_listed_as_git_reads` only. It opens "Where the work tree's .gitmodules is gone from disk, ..." and says it returns `(b'', '')` where the work tree's file is on disk. The script has no pinned copy and no checked-in digest. Its AST is equal to `8dfa32bd7`'s once that one docstring is dropped (sha256 `63f4b9d5...` there, `30abb4ea...` here).

## Counts

- The rows file has 16 rows: 15 old and 1 new. PT7's assertion adds no row.
- On this head: 16 passed.
- Gate, 14 files, one pytest run on this head: **777 passed** (exit 0). The files are the rows file, `tests/test_repo_hygiene.py`, the eight other test files #1124 changed (`test_family_add_refusals`, `test_family_gitmodules_values`, `test_family_hand_mount_git_rm_lines`, `test_family_holder_bootstrap_texts`, `test_family_holder_remedies_compose`, `test_family_unnamed_gitlink`, `test_validate_family_remedies_typed`, `test_validate_family_unnamed_mounts`), the three more that name the functions and codes it touched (`test_family_add_spelling_leftovers`, `test_family_bootstrap_gate_order`, `test_validate_family_typed_states`), and `test_pinned_copy_text.py`.
- The same 14 files on a scratch merge commit of `origin/main` (`961640c68`) and this head: **778 passed** (exit 0). The one extra id is a new row in `test_repo_hygiene.py` on `main`.

## Mutants

Each mutant was applied to `validate-family.py` in a scratch worktree of this head, run against the new rows file (16 rows) and a copy of #1124's original 15-row file (31 rows together), and restored with its sha256 checked (`30abb4ea...` before and after).

| Mutant | Edit | New file (16 rows) | #1124's 15 old rows |
|---|---|---|---|
| PT7 | path-twice's `f"from {whose}, ` written `f"from the index's, ` | 1 failed: `[deletion-staged]`; `[deleted]` passes | 15 passed (survives) |
| S1c | `_listed_as_git_reads` reads `spec = f":{GITMODULES}"` alone, with no fallback to HEAD's | 1 failed: the new S1c row | 15 passed (survives) |

## Merge-trees

`git merge-tree --write-tree` of each ref against this head was clean:

- `origin/main` (`961640c68`)
- #1124's head (`8dfa32bd7`)
- #1166's head (`5102b4294`) and #1172's head (`5aa0f116d`), the two other open PRs that touch `validate-family.py`; and the head of #1172's base branch (`b75babee3`)

No other open PR touches `tests/test_validate_family_index_gitmodules.py`.

Closes #1181

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ory is inside the root's own the root's line ahead of `mount_read`'s refusal of that directory, so a root's `.git` this user cannot read is said once again, and a leg's own `.git` directory keeps its line (#1146)

Merged with main at 50869f3, #1200's `mount_read` asks each leg's git
directory, and `audit_leg` returned on its refusal,
`code: .git/modules/code: cannot be read (<reason>)`, before #1147's
`root_line` was reached. Where the root's own `.git` cannot be read, the
legs' git directories under it cannot either, so 5 of the 47 rows of
tests/test_root_git_unreadable.py failed on the `placement` reason: the
row named a symptom once per leg instead of the root's line once (lane 3's
note on #1147).

`audit_leg` now gives the root's line first, where `root_line` is set,
`mount_read` refused the leg, and `read_through_the_root` says the leg's
git directory is inside the root's own: under the root's `.git`, or under
the directory a root's gitfile names, which is where git keeps a
submodule's for a root that is a linked worktree or a submodule itself
(measured: `../../main/.git/worktrees/wt/modules/spec` and
`../../.git/modules/root/modules/spec`). Every other refusal keeps
`mount_read`'s line: a mount, a `.git` or a gitfile this user cannot read,
and a leg's own `.git` directory, whose repository is not the root's. With
the root's `.git` readable, `root_line` is None and #1200's refusal stands.
validate-pins.py already refuses the root before any leg, and
validate-manifest.py asks no leg's git directory, so neither changes.

tests/test_root_git_unreadable.py: 3 rows, in process, on every platform
and as root, with every `HEAD`'s `stat` refused: the root's line once for
legs under the root's `.git` and under the directory its gitfile names,
and the control, a leg's own `.git` directory keeping `spec/.git: cannot
be read`. Each fails on the merge.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
#1147's head a2fc1da (over #1200, `placement` gives a leg whose git
directory is inside the root's own the root's line), clean by
`git merge-tree` (tree c473b23).

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-11-08T13:46:07Z) #1172's head is now 2eabec8e: it merges #1147's head a2fc1da8, and lane 1's check finds nothing else in it.

Lane: openreposhape-1 (openRepoShape-1)

Base automatically changed from fix/1146-root-git-unreadable-not-drift to main November 8, 2026 18:27
Brett Heap and others added 2 commits November 8, 2026 18:33
#1147's final head 95ea564 is update-branch's merge of main 801a7d6
into 4d299dd, its S1 fix (`placement` gives the root's line only to a
leg whose mount `mount_read` got into). It brings that fix and main.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
51a9c5f is #1147's squash on main. Its tree equals #1147's final head
95ea564, already merged here, so the branch's side is taken for each
of #1147's own files and the tree does not change.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-11-08T18:47:46Z) #1172 is restacked onto #1147's squash 51a9c5f1, with its own change unchanged, at head ba81fd7d. It stays READY (r1172b, issuecomment-6360478153). It lands by fast refresh once CI's tests passes at ba81fd7d.

Lane: openreposhape-1 (openRepoShape-1)

@brettheap
brettheap marked this pull request as ready for review November 8, 2026 18:48
@sourcery-ai

sourcery-ai Bot commented Nov 8, 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 6 days and 18 hours by commenting @sourcery-ai review. Upgrade to get a review now.

brettheap added a commit that referenced this pull request Nov 9, 2026
…encode, so it passes under Latin-1 where it ended in a traceback, and 45 rows in 11 test files that cannot judge under a one-byte locale skip there on their own premise (#1214) (#1258)

## Goal

#1214 counts 50 tests in 12 files that fail under a Latin-1 locale before and after #1209, and asks of each whether it is a test that cannot judge under a one-byte locale, or a tool that misbehaves there. All 50 are settled here:

- **3 are a tool defect, fixed:** a family holder's `scripts/validate-family.py` ended in a `UnicodeEncodeError` traceback, exit 1, on any stdout that cannot hold U+2026, when the holder passed.
- **45 cannot judge under Latin-1,** and now skip there on their own premise, which the skip reason states. 18 fail in the test process itself, before the tool runs. In the other 27 the tool answers rightly for the bytes Latin-1 gives, and the row expects UTF-8's.
- **2 judge under Latin-1 as they are written, and carry no guard:** `test_a_utf8_source_directory_still_adopts_with_local_remotes` (it passes with the pip-installed git-filter-repo, and fails with a `python -E` one on #1247's tool defect; see "Left") and `test_surrogateescape_reads_the_issues_branch_as_caf_and_u_dce9` (its `if` asks the one thing its assertion needs). Both came out of RV1258's review of the first commit.

Under Latin-1 with the pip-installed git-filter-repo, none of the 50 fails on this head. Under UTF-8 every row keeps its outcome, and the rows added pass.

The classification is W1214's: lane 4's first writer of #1214, who read each test's code and stopped at a checkpoint with half the guards written and nothing run. This branch finishes the guards, runs every gate below, and measures each row. RV1258 reviewed the first commit; the second answers it (next section).

## The second commit

RV1258 reviewed the first commit, `c8641c691` (NOT READY: two SHOULDs, three NITs, no MUST; #1258 (comment)). The second commit, `cd9f3cfd1`, answers it on top of the first, with no rebase. It changes four test files and no tool:

- **S1, a premise guard on a row that passes:** the guard on `test_a_utf8_source_directory_still_adopts_with_local_remotes` is gone, and so is the `A_NAME_HELD_AS_UTF_8` import it alone used in `tests/test_adopt_template_values.py`.
  - The guard skipped a row that passes: on main under Latin-1, with CI's pip-installed git-filter-repo, the row passes. Its skip reason (the tool "names it as" a name that is not UTF-8) was false for it, because `execute` adopts the source.
  - The row now runs under Latin-1 and passes with the pip launcher. With a launcher started as `python -E` it fails on #1247's tool defect (git-filter-repo's `UnicodeEncodeError` on U+FFFD) until #1251 lands. That is a failure of the tool, and #1214's rule sends such a row to an issue of its own, not to a skip.
  - **#1258 and #1251 are now independent of each other.** This PR carries no guard for #1251 to drop, so the earlier plan, that whichever of the two lands second drops this PR's guard, is void. Neither waits for the other.
- **S2, nothing CI runs held the helper's answers:** `tests/test_non_utf8_name_helpers.py` gets 20 rows, written as that file writes its Windows rows: `os.fsencode`, `os.fsdecode` and `sys.getfilesystemencoding` are replaced for one test by UTF-8, Latin-1 and ASCII as POSIX has them.
  - 15 rows (five texts, three locales) hold which question skips the text (none, "cannot spell", "writes" or "reads"), and that the reason names the encoding, ends with the row's premise, and is ASCII.
  - 5 rows hold the emulation to this run's real locale: the helper answers the same with the real `os` as with the emulation of its file system encoding.
  - RV1258's mutant A5 (UTF-8 bytes built with `surrogatepass` instead of `surrogateescape`) now fails 3 rows under CI's UTF-8 locale; before, it made 11 rows skip silently. The mutants that survived, A1, A2 and A4, now fail 5, 1 and 6 rows (see the mutants below).
- **N1:** the first-statement row of `tests/test_bootstrap_spelling.py` also reads `templates/family-root/scripts/validate-family.py`, so RV1258's mutant D3 (the `escape_unencodable_stdout()` call moved after `parse_args`) fails it.
- **N3:** `test_surrogateescape_reads_the_issues_branch_as_caf_and_u_dce9` no longer asks the helper. Its `if` also asks `os.fsdecode(b"\xe9") == chr(0xDCE9)`, so under Latin-1 the row runs its first assertion and passes where it skipped, and under UTF-8 and ASCII it asserts as before.
- **N2, known and left:** under emulated Windows codecs the helper skips the U+DCE9 rows that carry no Windows mark, with a premise that is false on Windows. That is reasoned and emulated, not run on Windows, and CI runs Linux only (#597).

## The 50, by file

Kinds:
- **a1:** the test process itself cannot make or pass the name under Latin-1, so it raises `UnicodeEncodeError` before the tool runs. Guard: the existing `skip_where_the_environment_cannot_carry`.
- **a2:** the tool runs and answers rightly for the bytes Latin-1 gives, and the row expects UTF-8's reading or spelling. Guard: the new `skip_where_the_locale_does_not_spell_it_as_utf_8(text, premise)`, asked only of the text the row's premise is about.
- **b:** a tool defect.
- **c:** the row judges under Latin-1 as it is written, and runs there with no guard.

`test_stdout_encoding.py` comes first, as #1214 asks. 18 a1 + 27 a2 + 3 b + 2 c = 50.

| File | Rows | Kind | Why it fails under Latin-1 | Guard |
|---|---|---|---|---|
| `tests/test_stdout_encoding.py` | 10: `test_plan_reports_every_name_whatever_its_stdout_can_encode` (3), `test_plan_on_the_posix_default_stdout`, `test_every_tool_exits_alike_whatever_its_stdout_can_encode` (6) | a1 | The test makes a file or directory named U+65E5 U+672C, or passes that name on a command line, and Latin-1 cannot encode it. | `skip_where_the_environment_cannot_carry`, in `plan_arguments` and in each of the six builders. (`bump-leg-dry-run` writes the name as bytes and passes, so it has none.) |
| `tests/test_adopt_pins.py` | 5 `[zwj]` rows | a1 | U+200D cannot go on the command line, or through `copytree`. | `skip_where_the_environment_cannot_carry(name)` |
| `tests/test_adopt_pins.py` | 4 `[not-utf-8...]` rows | a2 | The byte 0xFF is read as U+00FF, printable text the tool takes, so `plan` goes on where UTF-8 gives U+DCFF and a refusal. | `A_BYTE_READ_AS_A_SURROGATE`, where the name holds U+DCFF |
| `tests/test_adopt_pins.py` | 5 rows that compare a `pin` or `write` line | a2 | A Latin-1 stdout has no U+2026, so the tool prints the digest's ellipsis as `\u2026`, as #214 designed. | `PRINTED_AS_ITSELF`, just before the line is compared |
| `tests/test_pin_source_unreadable.py` | 3 `[not-ascii-*]` | a1 | The path U+65E5 U+672C `-missing` cannot go on the command line. | `skip_where_the_environment_cannot_carry` |
| `tests/test_pin_source_unreadable.py` | 3 `[not-utf-8-*]` | a2 | `miss<0xFF>ing` reaches the tool as text, and is printed as itself, not as `\udcff`. | `A_BYTE_READ_AS_A_SURROGATE` |
| `tests/test_family_tracking_branch.py` | `test_each_act_refuses_the_tracking_branch_then_lands_on_a_branch` `[add]`, `[bump]`, `[remove]` | **b** | Each act passes until `validate(holder)`. The holder's `validate-family.py` prints `members/X: tree digest recomputes (<12 hex>...)`, ending in U+2026, and never escaped its stdout, so it ended in a traceback, exit 1. | none: the tool is changed |
| `tests/test_family_tracking_branch.py` | `test_a_branch_ending_in_a_no_break_space_is_pushed_as_itself` | a2 | `git switch -c feat<U+00A0>` writes the single byte 0xA0, so the branch is not UTF-8, and the tool rightly refuses it (#765). | `A_NAME_HELD_AS_UTF_8` |
| `tests/test_adopt_template_values.py` | the `--elected-by` and `--reference` rows of `test_plan_refuses_a_flag_no_file_can_hold` whose value holds U+DCE9, and `test_plan_and_check_say_the_same_sentence` | a2 | 0xE9 is read as U+00E9, text `plan` takes. | `A_BYTE_READ_AS_A_SURROGATE` (in the flag test, only where the value holds U+DCE9) |
| `tests/test_adopt_template_values.py` | `test_a_utf8_source_directory_still_adopts_with_local_remotes` | **c** | With the pip launcher it does not fail under Latin-1 on this head or on main: its `caf<U+00E9>` directory is the single byte 0xE9, and `execute` adopts the source all the same. It fails only where git-filter-repo is started as `python -E`, on #1247's tool defect (see "Left"), which is an issue of its own and not a premise to skip on. | none (a guard was here in the first commit, and RV1258's S1 took it out) |
| `tests/test_clone_url_bytes.py` | the 4 `[bidi-override-*]` rows | a2 | The directory is made from U+202E's UTF-8 bytes E2 80 AE. Latin-1 reads them as three characters, one of them the C1 control U+0080, so the tool rightly says "a control character". | `A_NAME_READ_AS_UTF_8`, in `skip_where_this_system_cannot_name` |
| `tests/test_bump_leg_branch_and_push_line.py` | 2 | a2 | The branches `feat<U+00A0>` and `main<U+00A0>` hold the single byte 0xA0. | `A_NAME_HELD_AS_UTF_8` |
| `tests/test_bootstrap_leg_moves.py` | 2 | a2 | `bootstrap.py` prints U+2014 escaped on a Latin-1 stdout. | `PRINTED_AS_ITSELF`, just before the assert |
| `tests/test_update_shape_apply_lines_and_headers.py` | 1 | a2 | The branch `feat<U+00A0>`. | `A_NAME_HELD_AS_UTF_8` |
| `tests/test_adopt_spelled_names.py` | 1 | a2 | The test writes `caf<U+00E9>.md` as 0xE9, so git holds a name that is not UTF-8, and the C-locale child prints `caf\udce9.md`, not `caf\xe9.md`. | `A_NAME_HELD_AS_UTF_8`, after its C-locale probe |
| `tests/test_family_member_branch_not_utf8.py` | `[trailing-no-break-space]` | a2 | `_member_head` reads the byte 0xA0 as U+DCA0, which is the branch git wrote. | `A_NAME_HELD_AS_UTF_8`, only where the branch is not `NOT_UTF_8_BRANCH`: `[not-utf8]` passes under Latin-1 and still runs there |
| `tests/test_family_head_by_hand_bytes.py` | 1 | **c** | Its `if`, `os.fsencode(chr(0xDCE9)) == b"\xe9"`, holds under Latin-1 too, and its assertion, `os.fsdecode(LATIN_1) == branch`, holds only where the locale reads 0xE9 as U+DCE9 (UTF-8, ASCII). Its first assertion holds in every locale. | none (RV1258's N3): the `if` also asks `os.fsdecode(b"\xe9") == chr(0xDCE9)`, so under Latin-1 the row runs its first assertion and passes |

## What changed, file by file

18 files: one tool, `tests/conftest.py`, and 16 test files.

- **`templates/family-root/scripts/validate-family.py`** (the tool):
  - `main`'s first statement is now `escape_unencodable_stdout()`, imported from `repo_shape`, as in `siblings.py` and both roots' `bootstrap.py` (#391, #454).
  - That call adds no version-skew risk. The function shipped in the same commit as `spelled` (ec4a7a0), which the file already imports, and it is not in `test_pinned_copy_text.py`'s `NEWER_THAN_A_KEPT_LIBRARY`.
  - The holder's shape-pin digests are written by `init`, so there is no static digest to move.
- **`tests/test_family.py`:** one new row, `test_the_gate_passes_on_a_stdout_that_cannot_hold_its_notes`. It runs the holder's gate with `PYTHONIOENCODING=latin-1` and expects exit 0, no traceback, and the two notes ending in `\u2026)`.
- **`tests/conftest.py`:**
  - The new helper, `skip_where_the_locale_does_not_spell_it_as_utf_8(text, premise)`, asks three questions, each through `os` at call time: whether `os.fsencode` can spell the text, whether it gives UTF-8's bytes, and whether `os.fsdecode` reads those bytes back as the text.
  - Four premise sentences go with it: `A_BYTE_READ_AS_A_SURROGATE`, `A_NAME_HELD_AS_UTF_8`, `PRINTED_AS_ITSELF` and `A_NAME_READ_AS_UTF_8`. Every skip reason is ASCII.
  - It is never asked inside `skip_where_a_name_cannot_be_not_utf_8`. A branch whose bytes are not UTF-8 is one in every locale, so those rows still judge under Latin-1, and this takes none of #1224's N1 over-skip.
- **The 11 files with guards** are the files of the table above that name a guard. Each guard sits just before the first line that needs its premise. `tests/test_family_head_by_hand_bytes.py` has none: its `if` is narrowed (N3).
- **`tests/test_non_utf8_name_helpers.py`** (the second commit): 20 rows hold `skip_where_the_locale_does_not_spell_it_as_utf_8` under emulated UTF-8, Latin-1 and ASCII (S2, above).
- **`tests/test_bootstrap_spelling.py`** (the second commit): the first-statement row takes `validate-family.py` as a third file (N1).
- **`tests/test_non_utf8_name_callers.py`:** `windows_names_it` now emulates Windows' `os.fsdecode` too (UTF-8 with `surrogatepass`, `windows_fsdecode`).
  - Without it, the bidi guard in `skip_where_this_system_cannot_name` asked this run's real Latin-1 `os.fsdecode` under an emulated Windows.
  - Measured: `test_where_windows_holds_a_bidi_override_the_name_check_does_not_skip` then failed under Latin-1 (1 failed, 35 passed), where it passes on main. With the emulation, the file gives 36 passed in both locales.
  - Real Windows reads UTF-8 in every locale, which is what that row's own reasoning ("NTFS holds U+202E, so the `bidi-override` row ... runs on Windows as it does here") assumes.

## Runs

**Environment.** One runner for every run: `/usr/bin/python3 -m pytest -p no:cacheprovider` (Python 3.12.3).
- A stub `gh` first on PATH, a bogus `GH_TOKEN` and an empty `GH_CONFIG_DIR`.
- `GIT_CONFIG_GLOBAL` an empty file, `GIT_CONFIG_NOSYSTEM=1`, the test identity, and `EMAIL` set.
- `GIT_ALLOW_PROTOCOL`, `GIT_SSH_COMMAND` and the `LANES_*` variables unset.
- **Every run counted here had git-filter-repo 2.47.0 on PATH** (`git filter-repo --version`: `a40bce548d2c`, CI's pin, pip-installed in a venv). An earlier pair of head runs without it skipped 58 adoption rows, and is not counted.
- That git-filter-repo's launcher is the pip one, with no `python -E`, so a test's own `PYTHONIOENCODING` reaches it. The `-E` comparison is the last paragraph of this section.

**Locales.**
- UTF-8: `LC_ALL=C.UTF-8`.
- Latin-1: built with `localedef -c`, as #1153's `test_adopt_one_byte_locale.py` builds one; then `LOCPATH`, `LC_ALL=en_US.ISO-8859-1`, `PYTHONUTF8=0`. Python reports `iso8859-1` and reads 0xFF as U+00FF.
- ASCII: `LC_ALL=C PYTHONUTF8=0 PYTHONCOERCECLOCALE=0`.

**Round one's gate** (the first commit, `c8641c691`, on main `bd3e9c148`, 27 files, F1214's runs): UTF-8 1520 passed and 1 skipped on main, 1521 and 1 on the head; Latin-1 123 failed, 1373 passed, 25 skipped on main, and 44 failed, 1404 passed, 74 skipped on the head. RV1258 re-ran it on 35 files (main `5926ccca`, merge `103ada82`) and got the same transitions. The gate below replaces it.

**The gate: 29 files, on a scratch merge.** The merge is this head (`cd9f3cfd1`) into `origin/main` `46fe6ac19` (local, never pushed, clean); the baseline is `46fe6ac19` itself. Both with the pip launcher.
- The 27 files of round one: the 23 files on main that use `skip_where_a_name_cannot_be_not_utf_8` or `on_a_branch_that_is_not_utf_8`, with `test_repo_hygiene.py` (W1196's 24, less the two files #1209 adds, plus `test_family_leg_path_by_hand_bytes.py`), and four more that run the changed code: `test_family.py`, `test_pinned_copy_text.py`, `test_update_shape_kept_helper.py` and `test_local_remote_dir_urls.py`. They include `test_non_utf8_name_helpers.py`.
- Two more for the second commit: `test_path_guard_hygiene.py` (the second hygiene file) and `test_bootstrap_spelling.py`.

| Run | main `46fe6ac19` | scratch merge with this head |
|---|---|---|
| 29 files, UTF-8 | 1873 passed, 1 skipped | 1895 passed, 1 skipped |
| 29 files, Latin-1 | 128 failed, 1721 passed, 25 skipped | 49 failed, 1775 passed, 72 skipped |
| the 50, UTF-8 | 50 passed | 50 passed |
| the 50, Latin-1 | 49 failed, 1 passed | **0 failed**, 5 passed, 45 skipped |
| the 50, Latin-1, `-E` launcher | 50 failed (on `bd3e9c148`, round one) | 1 failed, 4 passed, 45 skipped |

The 5 that pass under Latin-1 are the 3 tracking-branch rows (the tool fix), `test_a_utf8_source_directory_still_adopts_with_local_remotes` and `test_surrogateescape_reads_the_issues_branch_as_caf_and_u_dce9`.

Main moved twice while this was gated, none of its commits touching a file of the gate or of this PR. The merge was run again on each: on `9729315f1` the same 29 files, with identical outcomes by test id in both locales (1895 passed, 1 skipped; 49 failed, 1775 passed, 72 skipped); on `801a7d6d0` the 50 and the four files the second commit changes (`test_non_utf8_name_helpers.py`, `test_bootstrap_spelling.py`, `test_family_head_by_hand_bytes.py`, `test_adopt_template_values.py`). The 50 give the same as above in all three modes (UTF-8 50 passed; Latin-1 pip 0 failed, 5 passed, 45 skipped; Latin-1 `-E` 1 failed, 4 passed, 45 skipped), the four files give 385 passed under UTF-8, and 6 failed, 371 passed, 8 skipped under Latin-1: the 5 `test_bootstrap_spelling.py` rows and `test_execute_refuses_a_local_source_directory_that_is_not_utf8`, all of which fail on main too.

**By test id, from main to the scratch merge:**
- **UTF-8:** 22 new rows, all passed: the 20 of `test_non_utf8_name_helpers.py`, the `[validate-family]` row of the first-statement test, and the first commit's `test_the_gate_passes_on_a_stdout_that_cannot_hold_its_notes`. Nothing else changes: no new skip, no row from passed to failed. The one skip is `test_stdout_encoding.py`'s Windows default-stdout row, on both.
- **Latin-1:**
  - 0 rows from passed to failed.
  - 0 from passed to skipped. (The first commit had one, the S1 row; it passes now.)
  - 32 from failed to passed: the 3 tracking-branch rows and `test_surrogateescape_reads_the_issues_branch_as_caf_and_u_dce9` of the 50, and 28 other rows of `test_family.py` whose holder's gate ended in the same traceback.
  - 47 from failed to skipped: 45 of the 50, and the 2 bidi rows of `test_local_remote_dir_urls.py`, which share `BAD_DIRECTORIES`.
  - 22 new rows, passed.
  - Each of the 49 failures fails on main too: the rows #1209 settles, the rows under "Left", and 5 rows of `test_bootstrap_spelling.py` (see "Left").

**On a scratch merge with #1209** (main `46fe6ac19`, #1209 at `13a2c58cb`, then this head; local, never pushed, both merges clean). #1209 shares four files with this PR: `tests/conftest.py`, `tests/test_non_utf8_name_callers.py`, `tests/test_non_utf8_name_helpers.py` and `tests/test_stdout_encoding.py`. Run on 8 files: the three test files among those four, #1209's `test_adopt_plan_paths_spelled.py` and `test_run_script_encoding.py`, and `test_adopt_template_values.py`, `test_family_head_by_hand_bytes.py` and `test_bootstrap_spelling.py`. Against main plus #1209 alone:
- UTF-8: 483 passed and 1 skipped, then 504 passed and 1 skipped: the 21 new rows (the 20, and the `[validate-family]` row), nothing else.
- Latin-1: 19 failed, 411 passed, 54 skipped, then 5 failed, 433 passed, 67 skipped: 21 new rows passed, 1 failed to passed, 13 failed to skipped. The 5 failures are the `test_bootstrap_spelling.py` rows, which fail on both. Of the 50, the 15 in these files give 13 skipped and 2 passed, none failed.

**The other 59 test files that name `validate-family`** (round one, on the first commit, UTF-8): 3374 passed, 28 skipped, 0 failed. The second commit changes no tool.

**The same launcher started as `python -E`** (W1247's copy of it with `-E` added, used read-only), Latin-1, the 50: on main `bd3e9c148`, **50 failed**, the 50 exactly as #1214 lists them. On the first commit, 0 failed. On this head, **1 failed**, 4 passed, 45 skipped: the S1 row, `test_a_utf8_source_directory_still_adopts_with_local_remotes`, on #1247's traceback (`UnicodeEncodeError` on U+FFFD in `git_filter_repo.py`'s `_migrate_origin_to_heads`, then `REFUSED extracting the spec leg`). It stays red with that launcher until #1251 lands, and the other 49 rows are as with the pip launcher.

## The new rows, and mutants

Each mutant was made in a scratch worktree at the head and restored afterwards, with each file's sha256 checked. "UTF-8" and "Latin-1" name the locale of the run.

**The second commit's rows.** The helper's own rows run in CI's UTF-8 locale, with the three locales emulated.

| Mutant | Run | Result |
|---|---|---|
| none (the head), `test_non_utf8_name_helpers.py` | UTF-8 | 39 passed (19 before, 20 new) |
| the new rows against main's `tests/conftest.py`, which has no helper | UTF-8 | the file does not import: `cannot import name 'skip_where_the_locale_does_not_spell_it_as_utf_8'` |
| A5: the helper's UTF-8 bytes built with `surrogatepass` | UTF-8 | **3 failed**: the `byte-e9` row in each of the three locales. Before, the same mutant made 11 rows skip silently under UTF-8 and failed none (RV1258). |
| A1: the first question's skip taken as UTF-8's bytes | UTF-8 | **5 failed**: `iso8859-1` and `ascii` for `bidi-override` and `ellipsis`, and `ascii-e-acute` |
| A2: the second question dropped | UTF-8 | **1 failed**: `iso8859-1-e-acute` (it reads the bytes back and says "reads", not "writes") |
| A4: only the third question | UTF-8 | **6 failed**: the rows A1 and A2 fail, together |
| A3: the third question dropped | UTF-8 | **1 failed**: `iso8859-1-byte-e9` |
| A6: the third question inverted | UTF-8 | **9 failed** |
| the encoding in the reason named `utf-8` always | UTF-8 | **7 failed** |
| the row's premise left out of the first question's reason | UTF-8 | **5 failed** |
| the UTF-8 bytes built with `strict` | UTF-8 | **4 failed**: the three `byte-e9` rows, and the row that holds the emulation to the real locale |
| the second and third questions swapped | UTF-8 | **1 failed** |
| the first question catching any exception | UTF-8 | survives, and is equivalent: `os.fsencode` of a str raises only `UnicodeEncodeError` |
| D3: `validate-family.py`'s `escape_unencodable_stdout()` moved after `parse_args` | UTF-8 | **1 failed**: the `[validate-family]` row |
| main's `validate-family.py` under the head's tests | UTF-8 | **2 failed**: the `[validate-family]` row and `test_the_gate_passes_on_a_stdout_that_cannot_hold_its_notes` |
| N3's narrowed `if` taken out (main's `if`, with no helper call) | Latin-1 | **1 failed**: `test_surrogateescape_reads_the_issues_branch_as_caf_and_u_dce9` (it passes under UTF-8) |

On the 50 under Latin-1 the helper's mutants are as in round one, re-measured on this head: A3 gives **10 failed** (it was 11; the N3 row no longer asks the helper), the first question unguarded gives **11 failed**, and A1, A2 and A4 survive (5 passed, 45 skipped), because on Linux the third question alone decides there, as RV1258 found. Only the new rows tell them apart.

**The first commit's rows** (mutants made on `c8641c691`, which the second commit does not change):

| Mutant | Run | Result |
|---|---|---|
| none (the head), the new row of `test_family.py` | UTF-8 | 1 passed |
| main's `validate-family.py` under the head's tests (the new row on main) | UTF-8 | **1 failed**: the new row |
| `validate-family.py`'s `main` without the `escape_unencodable_stdout()` call (import kept) | Latin-1 | **4 failed**: the new row, and the `[add]`, `[bump]`, `[remove]` rows of `test_each_act_refuses_the_tracking_branch_then_lands_on_a_branch` |
| the bidi guard taken out of `skip_where_this_system_cannot_name` | Latin-1 | **6 failed**: the 4 bidi rows of `test_clone_url_bytes.py` and the 2 of `test_local_remote_dir_urls.py`, the same `BAD_DIRECTORIES` |
| `windows_names_it` without the `os.fsdecode` emulation | Latin-1 | **1 failed**: `test_where_windows_holds_a_bidi_override_the_name_check_does_not_skip` |
| the guard of `test_the_member_head_is_the_branch_git_wrote` asked of every branch (its `branch != NOT_UTF_8_BRANCH` dropped) | Latin-1 | `[not-utf8]` goes from passed (the head) to skipped; no row fails. A skip fails no run, so only a comparison of outcomes sees this one. |

## Merge-trees

`git merge-tree --write-tree` of the head (`cd9f3cfd1`):
- against `origin/main` `46fe6ac19`: clean;
- against #1209 `13a2c58cb`, #1185 `d193617c7`, #1154 `8a7828332`, #1251 `abeac66de` and #1198 `d38e4e36d`: each clean;
- against the other open PRs that touch any of these 18 files, at their heads: #1263 `9ef8f0ab5`, #1246 `0deac3a65`, #1231 `aca00dfd9`, #1227 `2d56c1906`, #1178 `c4beba193`, #1172 `2eabec8e0` and #1125 `9549006fe` are clean. #1201 `eac177af9` conflicts at `docs/handbook.html`, which this branch does not touch, and conflicts there against `origin/main` alone too.

#1209 changes `skip_where_a_name_cannot_be_not_utf_8` and the callers fixture `a_system_that_carries_the_byte`. The new helper sits more than 100 lines from the first, and `windows_names_it` 65 lines from the second. #1209 also edits `tests/test_non_utf8_name_helpers.py`, where the second commit adds its rows at the end of the file; the two merge without a conflict, and the merged file's rows pass (see "Runs").

## Left, and outside this issue

- **W1214's filter-repo defect is filed separately, as #1247**, and #1251 (a draft for it) is independent of this PR.
  - What W1214 found: `adopt-project.py execute` fails for a Latin-1 user whose source path holds U+00E9. The leg clone's `remote.origin.url` holds the byte 0xE9, git-filter-repo decodes it with `errors='replace'` and prints U+FFFD to a Latin-1 stdout, and `execute` stops at `REFUSED extracting the spec leg`.
  - **Which launcher runs git-filter-repo decides it.** One started as `python -E` ignores the `PYTHONIOENCODING` the tool gives its children; a pip-installed one, as CI installs it, is not started that way. Measured here (see "Runs"): `test_a_utf8_source_directory_still_adopts_with_local_remotes` passes on main under Latin-1 with the pip launcher, and fails there with a `-E` copy of the same launcher. W1196's list of 50 has this row failing, which this bench gives only with the `-E` launcher.
  - **Independent of #1251.** This PR no longer guards that row (RV1258's S1), so it carries nothing for #1251 to drop, and the earlier plan, that whichever of the two PRs lands second drops this PR's guard, is void. #1251 changes `_extract_leg` in `adopt-project.py` and adds `tests/test_adopt_filter_repo_origin_url.py`, and touches none of these 18 files (`git merge-tree` against its head `abeac66de` is clean). The row passes under Latin-1 with the pip launcher whichever lands first. With a `-E` launcher it fails on #1247's traceback until #1251 lands, which is the tool's failure showing, not a premise this PR can judge.
- **N2 (RV1258), known and left:** under emulated Windows codecs, the helper skips the U+DCE9 rows that carry no Windows mark, with a premise that is false on Windows. It is reasoned and emulated, not run on Windows; CI runs Linux only (#597).
- **5 rows of `tests/test_bootstrap_spelling.py` fail under Latin-1** on main, on this head and on the merge with #1209 alike. It is a file #1214 does not list, read from the failure messages only: four rows end in a `UnicodeEncodeError` on U+2028, which Latin-1 cannot encode, and `test_a_branch_name_is_spelled_in_every_line_that_names_it` fails its assertion. They are left for an issue of their own.
- **8 rows in two files #1214 does not list fail under Latin-1** on main, on this head and on the merge with #1209 alike:
  - 6 rows of `test_pinned_copy_text.py`: the tool prints U+2014 or U+2026 escaped on a Latin-1 stdout, and the row compares the character.
  - `test_family.py`'s `test_init_writes_the_holders_agent_files`: it reads the UTF-8 file it checks in the locale's encoding.
  - `test_family.py`'s `test_commit_one_refuses_a_trailer_that_is_no_text_before_it_stages`: `DID NOT RAISE Refusal`, a byte Latin-1 reads as text.
  - These are read from their failure messages only, not classified per test. They are left for an issue of their own.
- **The fourth row of `tests/test_adopt_template_values.py` that fails under Latin-1 on main** is `test_execute_refuses_a_local_source_directory_that_is_not_utf8`. It is not one of the 50, and this PR leaves it alone.
  - It asks `skip_where_a_name_cannot_be_not_utf_8`, and #1209 gives that helper the locale question. So it skips at #1209's head, where the 50 were counted, and it skips on the scratch merge with #1209.
  - It fails on main and on this head alike, so it is #1196's (#1209's) row, not #1214's.
  - The other three rows of that file that fail on main are among the 50: the two U+DCE9 flag rows and `test_plan_and_check_say_the_same_sentence`. Each skips here.
- **#1224 is untouched.** This helper takes none of N1's over-skip; N2 to N5 stay #1224's.

Closes #1214

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

@brettheap
brettheap merged commit 2fde6c3 into main Nov 9, 2026
5 checks passed
@brettheap
brettheap deleted the fix/1148-pinned-find-repo-root-refuses branch November 9, 2026 14:01
brettheap pushed a commit that referenced this pull request Nov 9, 2026
…efusals kept)

Main at 6740776 (#1172's squash 2fde6c3, then #1120). Two files
conflicted, each resolved inside its hunks only:

- templates/family-root/scripts/siblings.py, the docstring's exit-2
  paragraph: #1172's sentence on the holder's own `.git`
  (`git-repo-unreadable`, #1148) and then #1164's on the holder's
  `.gitmodules` (`gitmodules-unreadable`, #1110).
- templates/family-root/scripts/siblings.py, `member_unreadable`: #1172's
  `code` keyword and docstring sentence are kept, and its body is
  #1164's call of `path_unreadable`, now passed that `code` in place of
  the literal "member-unreadable", so `_refuse_an_unreadable_root`'s
  `git-repo-unreadable` and `submodule_urls`' `gitmodules-unreadable`
  are both raised.
- tests/test_path_guard_hygiene.py, `KNOWN_OPEN`: the base held 11
  entries; #1164 took out the 3 it fixed (family.py's two .gitmodules
  readers and siblings.py's `submodule_urls`) and main took out the other
  8 (shape-doctor.py and shape_advisory.py), so none is left.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 9, 2026
…s `.gitmodules` beside the work tree's and its stage remedies end `git add -- .gitmodules`, an index file git cannot parse is refused, and an unmerged one is read as none (#1150) (#1227)

**#1150: after this PR the family gate's check for values git dies on (`gitmodules-value-refused`) reads the index's `.gitmodules` beside the work tree's, so each remedy that says to stage the file ends with the line that stages it (a later value the work tree alone gives too, once a line above stages the file) and a value only the index gives is named; an index file git cannot parse is refused as `gitmodules-unreadable` instead of read as nothing; and while a merge leaves `.gitmodules` unmerged the checks read no file git would read (neither the index's nor the work tree's), as git reads none then, so `gitlink-unnamed` and the init stop ask nothing in that state. The checks that ask about HEAD, which a clone reads, still read HEAD's file, and the staged-removal check can read the work tree's, as the Limits say.**

This is a DRAFT on `main`. It is the follow-up lane 4 filed as #1150 from RV1124's review of #1124 (pull/1124#issuecomment-6321372469): the review's N1, N2 and N6 were outside #1124's own review round, each is older than #1124, and each was measured again before this change. #1124 has landed as `dea964aa1`, and this branch was restacked onto it (see "The restack"). Fix round 1 answers rv1227's review (issuecomment-6374575208) and merges main `e04826db4` (#1208). Fix round 2 answers rv1227b's and rv1227c's review (issuecomment-6722728204): one SHOULD, test-only (see "Fix round 2"). The one script is `templates/family-root/scripts/validate-family.py`; with its tests the change is four files, +1128 and -78 lines (`git diff --shortstat origin/main...HEAD -- <the four files>`, against the merge base `e04826db4` with main `0d5704b3d`).

rv1227's independent review (issuecomment-6374575208, PARTIAL at `b031f4938`, NOT READY) found M1, M2, S1, S2 and N1 to N6. Each was measured again before the change: git 2.43.0, offline through lane 5's `run9.sh`, on the branch merged with main `e04826db4` (`d95308e95`). The probe is `v124/n1150/d/probes/test_n1150d_probe.py` in lane 5's scratch, never committed; its logs are in `v124/n1150/d/probes-out/merged-d95308e/`.

- **M1, the merge of main.** `d95308e95` merges main `e04826db4` (#1208); its tree is `a151d1110`, the one `git merge-tree` predicted. #1208's new row `test_1077_a_value_head_gives_where_the_deletion_is_staged_puts_head_s_back` pinned the finding's lines ending at `--unset-all` and typed `git add` by hand.
  - **Measured** (`m1-*.log`): `update = !true` committed, the deletion of `.gitmodules` staged. The three printed lines (`git checkout HEAD -- .gitmodules`, the `--unset-all`, `git add -- .gitmodules`) typed in order, then a plain `git commit`: exit 0, HEAD holds no value, the index and the work tree equal it, `git status` is clean, and the gate passes. Typed without the stage line, the commit exits 1 (`no changes added to commit`) and HEAD keeps `!true`. The merged answer is right.
  - **Change** (`8938d17df`): the row expects `git add -- .gitmodules` last and types no `git add` by hand.
- **M2, the reads that turn on "no section" while `.gitmodules` is unmerged.**
  - **Measured** (`m2-*.log`): with `.gitmodules` at stages 1 to 3, git reads no file. `git submodule status` and `git submodule update --init` exit 128 at every gitlink (`no submodule mapping found`, `No url found for submodule path 'tools/x'`, and `'members/IRRS'` for the whole update), and a plain clone of HEAD checks `tools/x` out (exit 0). The head said `gitlink-unnamed` of `tools/x` (no section gives it, a plain clone stops there) and, for a member not checked out, `member-uninitialized` said to write back a section the file gave. The family bootstrap, in the second state, says ``NOT CHECKED OUT, and not for want of a credential: members/IRRS (git reads no .gitmodules while a merge leaves it unmerged). Resolve the merge in .gitmodules and `git add .gitmodules`, then run this again.``
  - **Change:** `_check_gitlinks_elsewhere` (`gitlink-unnamed`) and `_init_stop_said` ask nothing while `.gitmodules` is unmerged, as no section is read then. `gitlink-unnamed` says what a clone does, and which section the commit after the merge records is the merge's to say; resolved and staged, the gitlink is asked about again. `member-uninitialized` gives the plain update, whose `make bootstrap` names the cure.
  - **The hand mount's two reads keep reading none**, since that is what git's own `git rm` reads there (measured): a plain `git rm` of a clone whose `.git` is a directory, at a path a section gives, dies (`could not lookup name for submodule 'members/IRQS'`, exit 128), and `git rm --cached`, the line `_hand_cached` prints because it reads none, exits 0 (main read the work tree's file and printed the plain line, which dies). With the work tree's file deleted, the plain `git rm` exits 0 and takes no section, so `_plain_rm_said` puts nothing back; HEAD's put back would resolve the merge to HEAD's side. `_given_as_git_reads`' docstring says so.
- **S1, a value the work tree alone gives after a staging line.**
  - **Change:** `_value_taken_out` takes `again`, set by `_check_gitmodules_values` once a finding before it ends with the stage line: a later finding whose value the work tree's file alone gives then ends with `git add -- .gitmodules` too, and says why (`STAGED_ABOVE`: "A line above stages the work tree's .gitmodules, this value with it, so the lines below end staging it again.").
- **S2, a sparse checkout that leaves `.gitmodules` out: kept out of this PR, as a Limit and the follow-up #1242.**
  - **Measured** (`s2-*.log`): `git checkout --ignore-skip-worktree-bits -- .gitmodules` puts the index's file back (exit 0, the bit cleared), the `--unset-all` then exits 0, but `git add -- .gitmodules` still exits 1 (`outside of your sparse-checkout definition`); `git add --sparse -- .gitmodules` exits 0, and the lines so typed end well.
  - **Why not here:** the fix is a sparse-aware put-back and a sparse-aware stage line, and the stage line is one constant (`STAGE_LINE`) that about ten findings print, most of them not this PR's. Fixing only this PR's two findings would leave the others failing in the same state.
- **N1.** `_blob_paths` and `_blob_sections` say they refuse an index's file git cannot parse (`gitmodules-unreadable`, through `_blob_listed`) and read none for no `spec`.
- **N2.** A row for the refusal with the work tree's file on disk and clean (rv1227's e1b).
- **N3.** A row for a real modify/delete conflict (stages 1 and 2), and an `[on-disk]` id for the sections row (rv1227's e2f). A value git dies on cannot stand in for the section in the modify/delete row: with one in the work tree's file, `git merge` itself dies (`invalid value`, exit 128, measured: `n3-*.log`).
- **N4.** Where the index's file gives the key another value than the work tree's, the finding names it (``The index's file, which a plain `git commit` records, gives it the value `!false`.``, `INDEX_GIVES`, `_values_said`) in place of "gives it too".
- **N5.** `GIVEN_WHERE`'s comment says what `(False, False)` is.
- **N6.** In Limits.

The independent review (issuecomment-6722728204, at `0d65ea80c`, NOT READY) found no MUST and one SHOULD, S1, which needs a test and no change to the script. `validate-family.py` is byte for byte `0d65ea80c`'s (blob `18a0942d4`, sha256 `30dc80fe29de`). The one commit, `2d56c1906`, changes `tests/test_validate_family_index_value_unmerged.py` alone (109 insertions and 13 deletions), and the branch is a fast-forward of `0d65ea80c`. Git 2.43.0 unless a line says 2.47.1, offline through lane 5's `run10.sh` (stub `gh`, `GH_TOKEN=bogus-l5`, `GIT_SSH_COMMAND=false`, `GIT_CONFIG_GLOBAL=/dev/null`); the logs are in lane 5's folder `work/n1150g/`.

- **S1, the stage line carried to every later finding (test-only).** The code is `staging = staging or committed or staged` in `_check_gitmodules_values`. rv1227c's mutants K6 (`staging = committed or staged`: the stage line is not carried past the next finding) and K8 (`staging = staging or staged`: a committed value's stage line does not carry) each passed all 181 rows of the three files, and its probes showed that each puts a value git dies on into HEAD (p2m: `fetchRecurseSubmodules = sometimes`; p8: `update = !false`). The S1 row pinned only the finding right after a value that is both staged and committed. Two rows are added, and one id; `staged_again` builds the later finding's text for the S1 row and the new rows, which the S1 row spelled out inline.
  - `test_every_later_value_the_work_tree_alone_gives_stages_again` (rv1227c's p2a, a third value). `update = !true` is staged for IRRS, then `update = !false` and `fetchRecurseSubmodules = sometimes` are given in IRSS's section, in the work tree's file alone. The gate gives three findings, and the second and third each carry `STAGED_ABOVE` and end with the stage line. The printed lines are typed in order and a plain `git commit` follows: HEAD is as it was, `git status` is clean, the gate passes in every mode and a plain clone checks both members out. K6 fails it.
  - `test_a_committed_value_the_index_lacks_stages_the_later_ones_again` (rv1227c's p8, a `[committed-not-staged]` id). `update = !true` is committed for IRRS, the index's file is then staged without it, and the work tree's file gives IRRS `!true` again and IRSS `update = !false`. IRRS's finding is committed and not staged, and its `git add -- .gitmodules` stages IRSS's value all the same, so IRSS's finding ends staging the file again. The same typed lines and checks. K8 fails it.
  - `test_another_value_the_index_s_file_gives_the_key_is_named[this-value-and-another]` (rv1227c's p3c, the optional id). The index's file gives IRRS `update` both `!true` and `!false` beside the work tree's `!true`, and the finding names both ("gives it the value `!true` and the value `!false`"). The N4 row is one parametrized row of two ids now: `[another-value]`, the old row, and this one. K11 fails it.
- **The review's NITs.** NIT 7 is the Goal above, and NIT 1 and NIT 2 are in Limits. NIT 1 and NIT 3 are follow-up issues #1254 and #1255, not changes here; the Limits below name NIT 1's. NIT 4 (a gitlink outside `members/` that no file gives gets no question while unmerged; true on main) is the existing Limit's. K1 and K5 (NIT 5) are not touched by this round and were not run again. NIT 6 is optional and unchanged.

**Rows that fail on main (fix round 2).** Run at `2d56c1906` with `validate-family.py` as main held it from `e04826db4` to `11560eb9f` (blob `172647b3e`, sha256 `30abb4ea28e6`), and again with the script as main `0d5704b3d` holds it (blob `ee26aede6`, sha256 `07f843df31b7`, which differs by `105b5daf9`'s 12 added and 3 removed lines). Each was written into the worktree, then the head's script was restored and its sha256 `30dc80fe29de` checked, `git status` clean after (`mut/MAIN.log` and `mut/summary.log`; `mut/MAIN2.log` and `mut/summary2.log`).
- **The three test files in full: 42 failed, 142 passed** in 157.36s with the first, and 42 failed, 142 passed in 158.42s with the second, the same 42 ids in both, of 184 rows (147 + 16 + 21). Fix round 1's run on the same script gave 39 failed and 142 passed of 181; the 42 are those 39 and the 3 ids this round adds (the two new rows and `[this-value-and-another]`), and the 142 that pass are the same 142.
- **The new and changed ids all fail:** `test_every_later_value_the_work_tree_alone_gives_stages_again`, `test_a_committed_value_the_index_lacks_stages_the_later_ones_again` and `test_another_value_the_index_s_file_gives_the_key_is_named[this-value-and-another]`; the old N4 id, `[another-value]`, and the S1 row's `[staged]` and `[committed]` fail as before. Each new id fails at its first assertion, `found == [...]`, at index 0: main's first finding ends at its `--unset-all` line, where the row expects `git add -- .gitmodules` last.

**Mutants (fix round 2).** Each was applied alone in a detached worktree at `2d56c1906` (`work/n1150g/mut/mutants.py`: rv1227c's file, one exact replacement checked to occur once), the three test files were run in full through `run10.sh`, the head's script was restored and its sha256 `30dc80fe29de` checked, and `git status` was clean after each (`mut/summary.log`, one log per mutant beside it). No other run used the worktree while a mutant was applied.

| mutant | what it changes | result |
|---|---|---|
| K6 | S1: `staging = committed or staged` (the stage line is not carried past the next finding) | **killed**, 1 failed, 183 passed (247.87s): `test_every_later_value_the_work_tree_alone_gives_stages_again` (new) |
| K8 | S1: `staging = staging or staged` (a committed value's stage line does not carry) | **killed**, 1 failed, 183 passed (241.32s): `test_a_committed_value_the_index_lacks_stages_the_later_ones_again` (new) |
| K11 | N4: `set(staged) >= set(values)` (the index's file giving the work tree's value and another says "gives it too") | **killed**, 1 failed, 183 passed (256.51s): `test_another_value_the_index_s_file_gives_the_key_is_named[this-value-and-another]` (new id) |
| K2 | M2: `gitlink-unnamed` asks while unmerged where the work tree's file is on disk | killed, 1 failed, 183 passed (225.47s): `test_no_gitlink_outside_members_is_asked_about_while_unmerged[on-disk]` |
| K3 | M2: the init stop asks while unmerged where the file is on disk | killed, 1 failed, 183 passed (231.77s): `test_a_member_not_checked_out_while_unmerged_is_told_the_plain_update` |
| K7 | S1: `again` is not cleared for a finding that stages anyway (`again = again`) | killed, 1 failed, 183 passed (227.21s): `test_two_keys_with_no_gitmodules_in_the_work_tree_put_it_back_once` |
| K13 | N4: `INDEX_GIVES` names the work tree's values | killed, 2 failed, 182 passed (235.91s): both ids of `test_another_value_the_index_s_file_gives_the_key_is_named` |

All seven are killed. K6, K8 and K11 survived the 181 rows of the first run (rv1227c); K2, K3, K7 and K13 were killed then and still are, by the same rows.

**Runs (fix round 2).** All through `run10.sh`, each `START` line recording the head and `dirty=0`; the full suite was not run.

| run | git | filter-repo | result | log |
|---|---|---|---|---|
| the three test files | 2.43.0 | 2.47.0 | **184 passed** in 234.10s | `logs/g243-f3.log` |
| the three test files | 2.47.1 | 2.47.0 | **184 passed** in 243.42s | `logs/g247-f3.log` |
| `tests/test_path_guard_hygiene.py`, `tests/test_repo_hygiene.py`, `tests/test_agents_md_codes.py`, `tests/test_cli_reference.py`, `tests/test_pinned_copy_text.py` | 2.43.0 | 2.47.0 | **379 passed** in 60.45s | `logs/hyg243.log` |
| the three test files and the same five, on the scratch merge `804213b71` of the head with main `b66d8f0cc` | 2.43.0 | 2.47.0 | **563 passed** in 318.46s | `logs/merged243c.log` |
| the same, on `875f5aee3` with main `105b5daf9` | 2.43.0 | 2.47.0 | 563 passed in 287.58s | `logs/merged243b.log` |
| the same, on `fda589e96` with main `11560eb9f` | 2.43.0 | 2.47.0 | 563 passed in 309.07s | `logs/merged243.log` |

All probes are offline: `run9.sh` puts a stub `gh` first on PATH and sets `GIT_SSH_COMMAND=false` and `GIT_CONFIG_GLOBAL=/dev/null`, and git is 2.43.0. The probe is `tests/test_n1150_probe.py`, a scratch file that is not committed; its logs are `probe-main.log` (main `961640c6`, 2026-10-22T20:08Z) and `probe-parent.log` (#1124's head `8dfa32bd`, 20:09Z), in lane 5's scratch `v124/n1150/`. The scratch families have gitlinks at `members/IRRS` and `members/IRSS`. Paths such as `mut/...`, `logs/...` and `probe-*.log` below are in that scratch folder.

**#1124's script was main's script in the first round.** `validate-family.py` is blob `dfb50769f` at `8dfa32bd`, at `dea964aa1` and at `origin/main` (`50ce8ab15`), and `git diff 8dfa32bd dea964aa1` over `validate-family.py` and the two older test files this PR changes is empty. So the column "on #1124's head" below is main's script as it stands.

**N1, the index's file beside the work tree's on disk.**
- **P1.** `update = !true` is in IRRS's section, in the work tree's file on disk and staged; HEAD's file is clean.
  - Main and #1124's head both give `gitmodules-value-refused` (exit 1, in `--no-members` and in members mode), and its one line is `git config -f .gitmodules --unset-all submodule.members/IRRS.update`, with no stage line.
  - A plain `git commit` after that line exits 0 and HEAD then gives `!true` (`P1 HEAD gives !true after: True`). The next gate run names it "in HEAD".
- **P1b.** `update = !true` is in the index's file alone; the work tree's file is clean on disk, and so is HEAD's.
  - Git's `submodule status` exits 0. The gate is `family ok`, exit 0, in `--no-members` and in members mode, on main and on #1124's head.
  - A plain `git commit` records `!true` in HEAD (`P1b HEAD gives !true after: True`).

**N2, an index file with a line git cannot parse.**
- **P9.** The index's file is HEAD's plus `update = !true` in IRRS's section, then the line `this is no config line`; the work tree's file is deleted.
  - Git's `submodule status` exits 128 (`fatal: invalid value for 'submodule.members/IRRS.update'`). `git config --blob` on that file exits 128 too, after it printed the value.
  - The gate is `family ok`, exit 0, in both modes. On main the value check never reads the index's file at all (#1077's cause). On #1124's head `_blob_listed` returns nothing on that exit 128.
- **P9t.** The same file with a stale `members/Old` section in place of the value, then the bad line. Git's `submodule status` exits 0 (`error: bad config line 10 in blob`: git reads up to the line). The gate is `family ok` in both modes, on main and on #1124's head: the sections read nothing on the 128.
- **P9h (reference).** The same file committed, its deletion staged: `gitmodules-unreadable` for HEAD's, exit 2, on main and on #1124's head.

**N6, an unmerged `.gitmodules`** (stages 1 to 3 in the index, none at stage 0).
- **P6a.** The work tree's file is deleted and HEAD's gives `!true`. Git's `submodule status` exits 128 (`no submodule mapping found in .gitmodules for path 'members/IRRS'`): git reads no file.
  - The gate is `gitmodules-value-refused`, exit 1. Main says "in HEAD ... not in the work tree" and puts HEAD's file back with `git checkout HEAD -- .gitmodules`; #1124's head says "here and in HEAD" and "puts back HEAD's, as the index holds none", but the index does hold the file, at its conflict stages.
- **P6b.** The work tree's file is on disk and gives `!true`; HEAD's is clean. Git reads no file (exit 128). The gate, on main and on #1124's head, reads the work tree's file and says "in the work tree, not in HEAD", exit 1.
- **P6c (reference).** The work tree's file is deleted and HEAD's is clean: `family ok` on main and on #1124's head, and git reads nothing (exit 128).

**Why the branch was cut on #1124.** Every item above holds on main `961640c6` too, but the code each change touches (`_blob_listed`, `READ_HERE`, `_listed_as_git_reads`, the "then stage" ending) was #1124's, and a branch on main would have rewritten the hunks #1124 rewrites.

`templates/family-root/scripts/validate-family.py` (+195 and -33 lines against `dea964aa1`):

- **N1: the index's file is read beside the work tree's.**
  - `_index_listed` reads the index's file at stage 0 (`rev-parse --verify --quiet :.gitmodules`, then `_blob_listed`), and `_check_gitmodules_values` asks it where the work tree's file is on disk. Where that file is gone, git already reads the index's (#1124).
  - A value only the index's file gives is named, with a new `GIVEN_WHERE` entry: "in the index's file alone, which a plain `git commit` records, not in the work tree or in HEAD". `VALUE_DIES` says how git dies there: in a clone of the commit that records it.
  - Where the work tree's file and the index's both give the value and HEAD's does not, the finding adds "The index's file, which a plain `git commit` records, gives it too." (`INDEX_TOO`).
  - **Every remedy of this check that says to stage the file ends with the line that does, `git add -- .gitmodules`** (`STAGE_LINE`): `_value_taken_out` where HEAD's file or the index's gives the value, or the work tree's file is gone, and the new `_value_not_here` where the work tree's file does not give it ("Stage [and commit] the work tree's .gitmodules, which does not give it:" and the line).
- **N2: an index file git cannot parse is `gitmodules-unreadable`.** `_blob_listed` refuses with that code, as `_head_listed` does for HEAD's, naming the index's file and git's own `bad config line` text, and its remediation says to mend the file, stage it with `git add -- .gitmodules`, and run again. `git config --blob` prints the entries before such a line and then exits 128; the old read returned nothing on that 128 and so dropped them. This is the second of the two options #1150 names (the refusal), not the first (reading up to the line as bootstrap does); it is the same code HEAD's file already gets (P9h).
- **N6: no file is read while a merge leaves `.gitmodules` unmerged.** `_gitmodules_unmerged` (`git ls-files -s`, no stage 0) is the test, as bootstrap's `gitmodules_source` reads it.
  - The value check reads nothing then (`UNMERGED_HERE`: "the file git reads here, which is none while a merge leaves .gitmodules unmerged") and keeps HEAD's, which a clone reads. Its remedy is "Resolve the merge in .gitmodules by hand, leaving that key out, then stage and commit .gitmodules:" and the stage line, with no put-back line.
  - `_sections_as_git_reads` returns no section while unmerged, so `gitmodules-path-twice` and `gitmodules-path-unnamed` read none and print no `git checkout HEAD -- .gitmodules`.
  - **One finding changes: P6b.** A value only the work tree's file gives, on disk, while `.gitmodules` is unmerged and HEAD's is clean, was `gitmodules-value-refused` and is `family ok` now, until the merge is resolved and staged. Git reads no file there either, so the value is no finding yet. After `git add`, it is named as N1's. See Limits.
- The module docstring's `WHAT IS CHECKED` bullets and the docstrings of the functions above say all of this.

`tests/test_validate_family_index_value_unmerged.py` (new, +410 lines, 9 rows in 7 functions). Every row types only the printed `git` lines, in order, and does by hand only what the text says in words; then a plain `git commit` is made, and the row asserts that HEAD is as it should be, that the gate passes in every mode, and that a plain clone checks both members out (`ends_well`). The premises are measured in each row: git's own exit code, and a plain clone of the commit that records the staged file.
- **P1:** `test_a_value_the_work_tree_s_file_and_the_index_s_give_ends_staging_it`.
- **P1b:** `test_a_value_the_index_s_file_alone_gives_is_named_beside_a_clean_one` (a plain clone of the commit that records it dies, exit 128).
- **The M3 row:** `test_a_value_here_and_in_head_ends_staging_it_with_no_index_s_file`. HEAD's file and the work tree's give `update = !true`, and `git rm --cached` has taken `.gitmodules` out of the index. See "Mutants".
- **P9 and P9t:** `test_an_index_s_file_git_cannot_parse_is_refused_unreadable` (`[a-value]`, `[a-section]`): git's `submodule status` exits 128 and 0, the gate refuses with exit 2 in all three modes, the remediation's `git checkout` and `git add` lines are typed, and then the finding the file gave before the bad line is the one left.
- **P6a:** `test_a_value_head_gives_while_a_merge_leaves_the_file_unmerged` (`[deleted]`, `[on-disk]`).
- **P6b:** `test_a_value_the_work_tree_alone_gives_while_unmerged_waits_for_git`: every mode exits 0 while unmerged; after `git add`, the finding is N1's and its lines, typed, end well.
- **Sections:** `test_no_section_is_read_while_a_merge_leaves_the_file_unmerged`: no finding and no `git checkout HEAD` while unmerged; resolved to HEAD's side and staged, `gitmodules-path-unnamed` names the stale section.

`tests/test_family_gitmodules_values.py` (+27 and -14 lines) and `tests/test_validate_family_index_gitmodules.py` (+11 and -12 lines): older rows re-pinned to the stage line and the refusal.
- `taken_out`, the expected finding every row of the first file builds, ends with `STAGE` wherever HEAD's file gives the value, and `WHERE["head-only"]` ends ":" and the stage line.
- `test_the_index_s_file_cut_short_is_put_back_from_the_index` had as its premise that the gate cannot name the cut line, because it read the index's file as nothing. The premise is now the refusal: exit 2, `REFUSED gitmodules-unreadable: the index's .gitmodules could not be read as git reads it: `, and `bad config line` named. The row's cure is unchanged.
- Two `test_1077_` rows (the index alone gives a value; a url git dies on is written back) expect the stage line last and no longer type `git add` by hand.

Run on 2026-10-24 at this head, `0d65ea80c`, with `validate-family.py` as main `50869f384` holds it (blob `172647b3e`, sha256 `30abb4ea28e6`, unchanged since `e04826db4`) written into the worktree, then the head's script (blob `18a0942d4`, sha256 `30dc80fe29de`) restored and its sha256 checked, `git status` clean after. The logs are in lane 5's scratch `v124/n1150/d/mut/` (`summary.log` holds the runner's lines).

**The three test files in full: 39 failed, 142 passed** (`main-full.log`, 218.81s; the failed ids are listed in `main-full-failed.txt`). They are the 29 rows that failed in the first round's comparison, with main's script then (blob `dfb50769f`, see below), plus the 10 ids this round adds or re-pins. The 142 that pass are rows that name nothing this PR changes, as many as in the first round's comparison.

**The 10 ids of the fix round, run on their own: all fail** (`main.log`, 11 ids, 11 failed in 26.01s; the 11th is the sections row's `[deleted]` id, which the first round added).

| row (fix round item) | on main's script |
|---|---|
| `test_1077_a_value_head_gives_where_the_deletion_is_staged_puts_head_s_back` (M1, #1208's row re-pinned) | the lines end at the `--unset-all`; the row expects `git add -- .gitmodules` last |
| `test_a_value_the_work_tree_alone_gives_after_a_staging_one_stages_again[staged]`, `[committed]` (S1) | the second finding has no `STAGED_ABOVE` sentence and ends at its `--unset-all`, with no stage line |
| `test_another_value_the_index_s_file_gives_the_key_is_named` (N4) | the finding ends at its `--unset-all`; the row expects the index's value `!false` named and the stage line last |
| `test_an_index_s_file_git_cannot_parse_beside_a_clean_one_is_refused` (N2) | `family ok`, exit 0, where the row expects exit 2 and `gitmodules-unreadable` |
| `test_no_section_is_read_while_a_merge_leaves_the_file_unmerged[on-disk]` and `test_no_section_is_read_in_a_modify_delete_conflict` (N3) | one finding, exit 1, whose lines take the stale `members/Old` section out, where the row expects every mode to pass while unmerged |
| `test_no_gitlink_outside_members_is_asked_about_while_unmerged[deleted]`, `[on-disk]` (M2) | one finding, exit 1, whose lines end with `--unset-all submodule.tools/x.url` and the stage line, where the row expects every mode to pass while unmerged |
| `test_a_member_not_checked_out_while_unmerged_is_told_the_plain_update` (M2) | `member-uninitialized`'s remediation says to write the section for `members/IRRS` back, where the row expects the plain update |

The three test files at the first round's head, `b031f4938`, were run against `validate-family.py` as main holds it (blob `dfb50769f`, #1124's script, written into the worktree and restored, sha256 `844c1bee1d62` checked; the run is at `4b70f2ec6`, whose four files are byte-identical to `b031f4938`'s): **29 failed, 142 passed** (`mut/parent-full-4b70f2e.log`). The 142 are rows that do not name anything this PR changes.

| rows | count | on main |
|---|---|---|
| `test_a_value_git_dies_on_fails_bootstrap_and_every_mode_of_the_gate` (8 ids), `test_a_holder_with_every_member_checked_out_fails_on_it_too`, `test_a_value_git_dies_on_in_the_index_s_file_is_named_and_mended`, `test_two_keys_with_no_gitmodules_in_the_work_tree_put_it_back_once`, `test_a_url_no_row_gives_one_for_is_written_back_as_a_placeholder`, `test_a_url_or_path_left_with_no_value_is_written_back_as_add_writes_it` (3 ids) | 15 | the finding ends at its last key line; the row expects `git add -- .gitmodules` after it |
| `test_the_gate_says_which_file_gives_it[head-only]` | 1 | "Stage and commit the work tree's .gitmodules, which does not give it." with no line |
| `test_the_index_s_file_cut_short_is_put_back_from_the_index` (2 ids) | 2 | `family ok`, exit 0, where the row expects exit 2 and `gitmodules-unreadable` |
| the two `test_1077_` rows | 2 | the lines end with the `--unset-all` or the url line, and no stage line |
| **new:** all 9 rows of `tests/test_validate_family_index_value_unmerged.py` | 9 | P1 and the M3 row: the finding has no stage line (P1's also lacks the "gives it too" sentence). P1b, P9 and P9t: the gate passes, exit 0, where the row expects a finding or a refusal. P6b and the sections row: the gate gives a finding where the row expects exit 0. P6a (2 ids): the finding says "here and in HEAD", says nothing of the merge, and with the file deleted puts HEAD's back |

At the first fold (`442615eb3`), the same comparison over the 15-row selection the mutant runner uses gave 14 failed, 1 passed (`mut/parent.log`). The M3 row alone, run on the tree before it was committed: 1 passed on the head's script, 1 failed with #1124's script and 1 failed with main's script `961640c6` (`mut/row1-head.log`, `row1-parent.log`, `row1-main.log`).

Run on 2026-10-24 at this head, `0d65ea80c`, with git 2.43.0. Each of the 10 was applied alone to `validate-family.py` in the worktree (`v124/n1150/d/mut/mutants.py` in lane 5's scratch: one exact replacement, checked to occur once in the committed script), its rows were run through `run9.sh`, and the head's script was restored with sha256 `30dc80fe29de` checked; `git status` was clean after each (`d/mut/summary.log`, one log per mutant beside it). No other test run or gate used the worktree while a mutant was applied. R1 to R5 are rv1227's own (`v129/rv1227/probes/mutants.py`): R1, R2, R4 and R5 byte for byte, and R3 the same change moved to the line N4 rewrote. D1 to D5 are one for each new behaviour of this round. **10 of 10 are killed.** Each ran over its own rows (the `-k` selections in `d/mut/run-mut.sh`), not the full files.

| mutant | what it changes | result |
|---|---|---|
| R1 | `_gitmodules_unmerged` is true only with all three of stages 1 to 3, so not in a modify/delete conflict's two | killed, 1 failed: `test_no_section_is_read_in_a_modify_delete_conflict` |
| R2 | `_sections_as_git_reads` reads the work tree's file on disk before it asks whether `.gitmodules` is unmerged | killed, 2 failed: the sections row's `[on-disk]` id and the modify/delete row (the `[deleted]` id passes) |
| R3 | the `INDEX_TOO` sentence is said wherever the work tree's file gives the value, where HEAD's gives it too (`where[0]` for `where == (True, False)`) | killed, 1 failed: `test_a_value_the_work_tree_alone_gives_after_a_staging_one_stages_again[committed]` |
| R4 | where the work tree's file does not give a value HEAD's gives, the remedy ends "Stage and commit the work tree's .gitmodules, which does not give it." with no stage line | killed, 1 failed: `test_the_gate_says_which_file_gives_it[head-only]` |
| R5 | `_index_listed` reads an index file git cannot parse as nothing where the work tree's file is on disk: the refusal is swallowed | killed, 1 failed: `test_an_index_s_file_git_cannot_parse_beside_a_clean_one_is_refused` (N2) |
| D1 | S1: `again` is never passed (`again=False`), so no later finding stages the file again | killed, 2 failed: the S1 row, `[staged]` and `[committed]` |
| D2 | S1: `staging` is carried only by a value HEAD's file gives (`committed`), not by a staged one | killed, 1 failed: the S1 row's `[staged]` id |
| D3 | N4: "gives it too" (`INDEX_TOO`) for any value the index's file gives the key, not only the same value | killed, 1 failed: `test_another_value_the_index_s_file_gives_the_key_is_named` |
| D4 | M2: `_check_gitlinks_elsewhere` (`gitlink-unnamed`) asks while `.gitmodules` is unmerged | killed, 2 failed: `test_no_gitlink_outside_members_is_asked_about_while_unmerged`, `[deleted]` and `[on-disk]` |
| D5 | M2: `_init_stop_said` asks while `.gitmodules` is unmerged | killed, 1 failed: `test_a_member_not_checked_out_while_unmerged_is_told_the_plain_update` |

Each of the 13 was applied alone in the worktree (`mut/mutants.py`: one exact replacement, checked to apply once), the rows run through `run9.sh`, and the script restored with sha256 `844c1bee1d62` checked; `git status` was clean after (`dirty after: 0`). **13 of 13 are killed.** Twelve of them (all but M3) ran at `442615eb3` over a 15-row selection: the 8 rows the new file had then, plus the 7 older rows the change re-pinned (`test_a_value_git_dies_on_fails_bootstrap_and_every_mode_of_the_gate[update-command]`, both ids of `test_the_gate_says_which_file_gives_it`, both of `test_the_index_s_file_cut_short_is_put_back_from_the_index`, and the two `test_1077_` rows). No later commit of the first round changed the script (blob `b81da47ad` at `442615eb3`, `4b70f2ec6` and `b031f4938`).

| mutant | what it changes | result |
|---|---|---|
| M1 | `_index_listed` returns nothing: the index's file is never read beside the work tree's | killed, 4 failed: P1, P1b, P9 `[a-value]`, P6b |
| M2 | `staged=not present or (name, key) in in_index` cut to `staged=not present` | killed, 3 failed: P1, P9 `[a-value]`, P6b |
| M3 | `if committed or staged:` cut to `if staged:` in `_value_taken_out` | **survived at `442615eb3`**: 15 passed over the selection, and 170 passed over the three full files. **Killed at `4b70f2ec6`**: 1 failed (the M3 row), 170 passed, over the three full files |
| M4 | the loop over the keys leaves out the index's | killed, 1 failed: P1b |
| M5 | the `INDEX_TOO` sentence is not said | killed, 2 failed: P1, P6b |
| M6 | "Stage and commit" for every case | killed, 1 failed: P1b |
| M7 | `_value_not_here` ends with a full stop, no stage line | killed, 2 failed: P1b, `test_the_gate_says_which_file_gives_it[head-only]` |
| M8 | `_blob_listed` returns nothing on the 128, as #1124's did | killed, 4 failed: P9 `[a-value]` and `[a-section]`, both ids of the cut-short row |
| M9 | `_gitmodules_unmerged` is never true | killed, 4 failed: P6a (2 ids), P6b, the sections row |
| M10 | `_gitmodules_unmerged` is true with a stage 0 entry too (`bool(stages)`) | killed, 13 failed |
| M11 | `_sections_as_git_reads` still reads a section while unmerged | killed, 1 failed: the sections row |
| M12 | the value check still reads its file while unmerged | killed, 3 failed: P6a (2 ids), P6b |
| M13 | `_index_listed` reads the blob without first asking whether the index holds one at stage 0 | killed, 2 failed: P6a `[on-disk]`, P6b |

**M3, why it survived and what kills it.** M3 differs from the head only where the work tree's file is on disk and gives the value, HEAD's gives it, and the index's does not. Every existing row with HEAD's value also had it in the index, or no work tree file, so `staged` was true anyway. The M3 row has that state. Under M3 the finding ends at the `--unset-all` line, a plain `git commit` after it records `.gitmodules` gone from HEAD (`ls-tree HEAD .gitmodules` is empty, `?? .gitmodules`), and the gate then finds `member-gitmodules-absent`, exit 1 (`mut/probe-M3.log`). On the head, HEAD keeps `.gitmodules`, `git status` is clean and the gate is `family ok` (`mut/probe-head.log`). The row is the only change of content added since the fold (`4b70f2ec6`, +30 lines).

All through lane 5's `run9.sh`, each `START` line recording the head and `dirty=0`, with the stub `gh`, `GIT_SSH_COMMAND=false`, `GIT_CONFIG_GLOBAL=/dev/null` and `EMAIL` exported. The logs are in lane 5's scratch `v124/n1150/d/logs/`. The full suite was not run. The runs with main's script and with the mutants are in their own sections above.

**At this head, `0d65ea80c`** (2026-10-23T22:03Z to 22:16Z):

| run | git | result | log |
|---|---|---|---|
| the three test files, `tests/test_path_guard_hygiene.py`, `tests/test_repo_hygiene.py`, `tests/test_agents_md_codes.py`, `tests/test_cli_reference.py`, `tests/test_pinned_copy_text.py` | 2.43.0 | **560 passed** in 329.42s | `gate243-e-0d65ea8.log` |
| the three test files | 2.47.1 | **181 passed** in 267.16s | `gate247-e-0d65ea8.log` |
| nine files that pin the script's texts elsewhere, in four runs of under 100 rows: `tests/test_family_holder_remedies_compose.py`, `tests/test_family_unnamed_gitlink.py` and `tests/test_validate_family_remedies_typed.py`; `tests/test_family_holder_bootstrap_texts.py` and `tests/test_family_hand_mount_git_rm_lines.py`; `tests/test_validate_family_typed_states.py` and `tests/test_validate_family_unnamed_mounts.py`; `tests/test_family_bootstrap_gate_order.py` and `tests/test_family_head_lost_gitmodules.py` | 2.43.0 | **330 passed** (89, 86, 83 and 72) | `disc9-A.log` to `disc9-D.log` |

**At `8938d17df`**, the M1 commit (2026-10-23T21:41Z to 21:52Z):

| run | git | result | log |
|---|---|---|---|
| the three test files and the same five hygiene files | 2.43.0 | **551 passed** in 417.67s | `gate243-m1-8938d17.log` |
| the three test files | 2.47.1 | **172 passed** in 264.09s | `gate247-m1-8938d17.log` |

Before `0d65ea80c` was committed, its tree ran on the work tree it was then committed from, byte for byte (`dirty=2`, so these are not gates): the new test file, 18 passed in 85.45s (`disc-new-e.log`); the two older test files, 163 passed in 203.44s (`disc-old2-e.log`).

No row failed in any of these runs.

All through lane 5's `run9.sh`, each `START` line recording the head and `dirty=0`, with the stub `gh`, `GIT_SSH_COMMAND=false`, `GIT_CONFIG_GLOBAL=/dev/null` and `EMAIL` exported. The full suite was not run.

**At the first round's head, `b031f4938`** (2026-10-23T18:24Z to 18:34Z; logs in lane 5's scratch `v129/g1150/`):

| run | git | result | log |
|---|---|---|---|
| the three test files, `tests/test_pinned_copy_text.py`, `tests/test_template_text_placeholders.py`, `tests/test_repo_hygiene.py`, `tests/test_agents_md_codes.py`, `tests/test_cli_reference.py` | 2.43.0 | **571 passed** in 360.06s | `gate243.log` |
| the three test files | 2.47.1 | **171 passed** in 232.96s | `gate247.log` |

**At `4b70f2ec6`** (2026-10-23T12:10Z to 12:15Z; its four files are `b031f4938`'s byte for byte; `v124/n1150/logs/`):

| run | git | result | log |
|---|---|---|---|
| the three test files and `tests/test_repo_hygiene.py` | 2.43.0 | **271 passed** in 271.14s | `gate243-4b70f2e.log` |
| the three test files | 2.47.1 | **171 passed** in 269.78s | `gate247-4b70f2e.log` |

**At `f78107c38`**, a local WIP commit that was folded into `442615eb3` before any push (its tree equals the fold's; 2026-10-22T22:18Z): the three test files, 2.43.0, **170 passed** in 230.25s (`upd-f78107c.log`).

**At `442615eb3`, the fold** (2026-10-22T22:24Z to 22:54Z; same script and same two older test files, the new file one row shorter; these ran on #1124's head as the base, before the restack):

| run | git | result | log |
|---|---|---|---|
| the 60 files of `tests/test_family*.py` and `tests/test_validate_family*.py`, shard A (30 files) | 2.43.0 | **1164 passed, 4 skipped** in 1275.69s (the 4 are `tests/test_family_operation_reftable.py` rows, which need git 2.45 or later) | `gate-shardA.log` |
| the same, shard B (30 files) | 2.43.0 | **1480 passed, 20 skipped** in 1588.90s (16 and 3 in `tests/test_family_init_values.py`, 1 in `tests/test_family_member_make_jobserver.py`) | `gate-shardB.log` |
| the three test files | 2.47.1 | **170 passed** in 182.05s | `gate247.log` |
| `tests/test_path_guard_hygiene.py`, `tests/test_repo_hygiene.py`, `tests/test_agents_md_codes.py`, `tests/test_cli_reference.py`, `tests/test_pinned_copy_text.py`, on a scratch merge `7aefff483` of the fold and main `961640c68` (the stack lacked the first file) | 2.43.0 | **307 passed** in 45.99s | `hyg.log` |

No failure in any run.

The branch was cut on #1124's head `8dfa32bd`. After #1124 landed, lane 5's `restack3.sh` restacked it with three merges; nothing was amended, rebased or forced. First #1124's final head `2d3bea2df` (merge `1004b6a73`). Then its squash `dea964aa1449b62d9c2bbafc972bbc344631e0b2`, taking the branch's side for the three files that conflicted, `validate-family.py`, `tests/test_family_gitmodules_values.py` and `tests/test_validate_family_index_gitmodules.py` (merge `b031f4938fa8604969e523a093da2735d7fb3523`). Then main, which was `dea964aa1` itself when the restack ran at 18:22Z (that commit is dated 18:16Z and the next main commit 18:32Z), so the third merge found nothing to add and made no commit. The push was a fast-forward from `4b70f2ec6`, and `git ls-remote` reads `b031f4938` on `fix/1150-index-gitmodules-stacked`. The four files at `b031f4938` are byte-identical to `4b70f2ec6`'s (an empty `git diff 4b70f2ec6 b031f4938` over them), and against `dea964aa1` the three older ones differ by this PR's lines alone, so the mutants, the rows on #1124's script and the runs at `4b70f2ec6` describe `b031f4938`'s bytes.

**Read again at 2026-11-08T15:50Z by rv1227d:**

- `origin/main` is `dffc42265`.
- `git merge-tree --write-tree origin/main HEAD` exits 0 with tree `c010514b5`, which differs from main by the four files alone (+1128/-78).
- The predicted merge `7317354ef` passed the three test files and the five hygiene files on git 2.43.0 (563).
- Merge-trees against it are clean for #1246 (`0deac3a658`) and #1172 (`2eabec8e05`). #1166 has landed, as `105b5daf9`.

The rest of this section was read at 2026-11-08T15:07:43Z with git 2.43.0: `origin/main` at `0d5704b3d` and the branch at `2d56c1906` (`work/n1150g/logs/merge-trees-final.log` in lane 5's folder). The branch holds main up to `e04826db4` (#1208, merged in fix round 1 as `d95308e95`). Main has moved three times while this round ran, and is at `0d5704b3d`, 11 commits past `e04826db4`; one of the 11 touches this PR's four files: `105b5daf9` (#1166, landed) changes `validate-family.py` (the date and repository patterns end in `\Z`, an id is matched with `fullmatch`), at hunks away from this PR's, and merges clean. So main is not merged again.

- **`git merge-tree --write-tree origin/main HEAD`** exits 0 and writes tree `d0180654c`, which differs from main by this PR's four files alone (`git diff --name-only`, +1128 and -78 lines). `git diff --name-only origin/main...HEAD` names the same four. Main moved while the gates ran, so the three test files and the five hygiene files ran on git 2.43.0 on a scratch merge commit of the head with each of three mains (two parents, no ref), 563 passed each time: with `11560eb9f` (`fda589e96`), with `105b5daf9` (`875f5aee3`) and with `b66d8f0cc` (`804213b71`; `update-shape.py` and one test). The merge with the main read last, `0d5704b3d` (a docstring in `scripts/shape_materialize.py`), was merge-treed, not gated.
- **Open pull requests:** 51 were listed at 2026-11-08T14:44Z with `gh pr list --state open --limit 100 --json number,headRefName,headRefOid,isDraft,files`; none lists more than 9 files, so no list was cut short. Besides this one, three touched any of the four files, all `validate-family.py` alone. Each `git merge-tree --write-tree <head> HEAD` exits 0, with heads read fresh with `gh pr view N --json headRefOid`:
  - #1172 (`fix/1148-pinned-find-repo-root-refuses`, on `fix/1146-root-git-unreadable-not-drift`, head `2eabec8e05`): tree `b371a126a`;
  - #1166 (`fix/1139-anchored-patterns`, head `5c8afefd44`): tree `557564bce`. It has landed since, as `105b5daf9`, which the gated merges above include from the second on;
  - #1246 (`l3-1221-member-git-unreadable`, head `0deac3a658`): tree `ffaedee72`.
- The merges with the three open pull requests were merge-treed, not tested.

- **P6b changes a finding.** Unmerged, the work tree's file on disk giving a value HEAD's does not, was `gitmodules-value-refused` on main and on #1124's head and is `family ok` (exit 0, every mode) now, until the merge is resolved and staged; the row holds it, and lane 5's coordinator accepted it. Git reads no file in that state either (`submodule status` exits 128, `no submodule mapping found`): it dies at the first gitlink, not on the value. After `git add`, the finding comes back, with N1's lines.
- **An unmerged `.gitmodules` is still no finding of its own.** The gate is `family ok` while git's `submodule status` exits 128, and since the fix round (M2) it also asks no question of a gitlink outside `members/` and says no init stop while the file is unmerged: `member-uninitialized` gives the plain update, which exits 128 until the merge is resolved, and its `make bootstrap` names that cure. #1150 cites v1.1.1's release notes, which list the unmerged case as a known limit; this PR makes the checks agree with git on which file is read and adds no finding for the state. No documentation file is changed by this PR, and whether a page that describes the limit should change was not checked.
- **A line set that ends in a commit cannot be committed while a merge leaves `.gitmodules` unmerged:** git refuses any commit then (`Committing is not possible because you have unmerged files`, exit 128). The value check's own remedy there says to resolve the merge first; the others say nothing of it.
- **While any merge is in progress, the hand mount's first line, `git switch -c`, exits 128 (rv1227c's P5, measured; main is the same).** Git says `fatal: cannot switch branch while merging`, in a modify/delete conflict on `.gitmodules`, in a conflict in another file, and after a clean `git merge --no-commit`. With `.gitmodules` unmerged its plain `git rm` exits 128 too (`Cannot change unmerged .gitmodules`), as the next bullet says. A line set that ends in a commit is not the only one that cannot be typed in a merge. Not changed here.
- **A hand mount's plain `git rm` dies while `.gitmodules` is unmerged and on disk** (measured, git 2.43.0, `m2-hand-checkout-section-unmerged-on-disk.log`): `Cannot change unmerged .gitmodules, resolve merge conflicts first`, exit 128, after git removed the checkout from disk; the gitlink stays in the index, and its store under `.git/modules` is kept. Main prints the same plain `git rm` in that state, and `_hand_cached` asks no question of the merge. Not changed here.
- **A sparse checkout that leaves `.gitmodules` out (rv1227's S2), measured:** the put-back `git checkout -- .gitmodules` exits 1 (`did not match any file(s)`), so the `--unset-all` after it exits 5, and `git add -- .gitmodules` exits 1 (`outside of your sparse-checkout definition`) even once the file is back; a plain `git commit` after the lines records what the index held. `--ignore-skip-worktree-bits` and `git add --sparse` work there. This holds for every finding that prints a put-back or a stage line, as on main. The follow-up is #1242.
- **A real content conflict never reaches the unmerged code (rv1227's N6).** It leaves conflict markers in the work tree's file, so the gate refuses `gitmodules-unreadable` on that file first, as main does (rv1227's e2b). The unmerged path is reached by a merge resolved by hand and not yet staged (the rows' synthetic stages 1 to 3), or by a modify/delete conflict (stages 1 and 2, or 1 and 3).
- **`member-gitlink-removal-staged` while `.gitmodules` is unmerged (rv1227c's P4, measured; main is the same).** Where the work tree's file is deleted, its put-back (`_section_back`, through `_gitmodules_put_back`) finds no index entry at stage 0, so it falls to HEAD's file and prints `git checkout HEAD -- .gitmodules`, "from HEAD's, as the index holds none". Where the file is on disk and gives no section for the member, `_section_back` prints the same line itself, in its on-disk branch, with the `SECTION_TAKEN` words ("putting that file back as HEAD has it and dropping any other change to it"), and never calls `_gitmodules_put_back`. So a fix must guard both places (rv1227d's NIT 2). That reading is wrong while the index holds the file at its conflict stages, and the line does more than put a file back.
  - `git checkout HEAD -- .gitmodules` resolves the conflict to HEAD's side: it writes HEAD's blob at stage 0 and drops the other side's stage, and the merge reads as resolved (`git status` clean, the gate `family ok`).
  - With the file on disk and no section for the member, it also overwrites the file, a hand resolution included (`branch = resolved-by-hand` was lost). With a hand resolution on disk that still gives the path, only `git reset -q -- <path>` is printed and `.gitmodules` stays unmerged.
  - The text and lines are the same on main's script in all three forms. Tracked by #1254. Not changed here.
- **The checks that ask about HEAD still read HEAD's file while `.gitmodules` is unmerged,** as the Goal says, since HEAD's is what a clone reads (rv1227d's NIT 1, issuecomment-6723609032):
  - the value check's HEAD side: a value HEAD gives is still named, "in HEAD, which a clone reads, not in the file git reads here" (`test_a_value_head_gives_while_a_merge_leaves_the_file_unmerged` pins it);
  - `member-gitmodules-absent` and `member-gitmodules-url-absent` (`_check_gitlinks_registered`);
  - the hand mount (`member-gitlink-unnamed`), which asks HEAD's sections whether a clone fetches the gitlink (`_gitlink_unnamed_said`), with its helpers `_section_then`, `_gitlink_put_back` and `_move_section`;
  - the staged-removal check, above, which also reads the work tree's file in its on-disk form.
  The script's unmerged guards read nothing from any file. This PR changes none of these reads.
- **What ran where.** At this head (`2d56c1906`), the three test files (184) and the five hygiene files (379) ran on git 2.43.0, together on the scratch merges with main named under Merges (563), and the three test files ran on 2.47.1 (184). The script is byte for byte `0d65ea80c`'s, where the nine files that pin the script's texts elsewhere ran on 2.43.0 (330 passed); no file imports the changed test file, so they were not run again. The 60 files of `tests/test_family*.py` and `tests/test_validate_family*.py` ran at `442615eb3` alone, before the restack and fix round 1, on git 2.43.0, and the 4 reftable rows they skip there ran on no git. Fix round 2's mutants ran over the three files in full, and fix round 1's over their own rows. Main's commits since `e04826db4` are not merged: the one that touches `validate-family.py` (`105b5daf9`) merges clean and the scratch merges ran, and no gate ran on the predicted merge with an open pull request's head: those were merge-treed only. The full suite was not run.

Review: rv1227b and rv1227c, lane 5's independent opus reviewers, which wrote none of #1227: NOT READY at `0d65ea80` on one test-only SHOULD (issuecomment-6722728204); then rv1227d, lane 5's independent sonnet reviewer, which wrote none of it: READY at `2d56c190`, H0 of this landing, after fix round 2 (issuecomment-6723609032), with no MUST or SHOULD; its NITs 1, 2 and 4 are corrected in the body and in #1254, and its NIT 3 is optional. CI (Brett Heap's ruling 27 and his fast-refresh ruling of 2026-10-15T22:48:35Z): H0 2d56c190 passed tests, tests-git-bash and SonarCloud; the head bb4ef4d9 is a clean update-branch merge of main 4552efa6, with tests-git-bash and SonarCloud green; and the local gate passed on its predicted squash tree 46ddfc80 over main 4552efa6: the family_gitmodules_values, validate_family_index_gitmodules, validate_family_index_value_unmerged, repo_hygiene, agents_md_codes, cli_reference sets, 355 passed. 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 #1150

Lane: openreposhape-5 (openRepoShape-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 9, 2026
… this user cannot read, as through a link into a folder it cannot search, is `gitmodules-unreadable`, never no section for `remove`'s rollback or no url for `make siblings` (#1110) (#1164)

`family.py` and the family root's `siblings.py` read a holder's `.gitmodules` by asking `Path.is_file()`. When this user cannot read that file, as when it is a link into a folder at mode 000 or is itself at mode 000, Python 3.9 to 3.13 raise the refused `stat` as a traceback, and from 3.14 `is_file()` answers False to any `OSError`. So `remove`'s rollback ended in a traceback with `members/IRRS` left gone, or from 3.14 said the checkout comes back only from its remote; `remove` named a file at mode 000 as "a git or gh command failed"; and `siblings.py` ended in a traceback, or from 3.14 read no url and planned a clone from github.com.

- `family.py`'s `_gitmodules_names`, `_sections_giving` and `_stages_as` now ask as `_is_a` asks, then `os.access` (`_gitmodules_on_disk`). Nothing at the name, or a directory there, is still no file. A refused `stat` or `os.access` is `gitmodules-unreadable`, exit 2, nothing written: `.gitmodules: cannot be read (Permission denied)`, with the `chmod` cure for a permission and none for any other cause.
  - `_stages_as`, which `remove` and `add` ask before either reader, asks `_gitmodules_on_disk` once `lstat` says the file is regular, so a file at mode 000 is refused one way whatever git's stat cache says (at base it was "a git or gh command failed" in both states). A link is still `gitmodules-unstaged`'s first.
  - The code is `GITMODULES_UNREAD_CODE`, so it is not read for `GITMODULES_UNREADABLE`, the remediation `_submodule_paths` gives a file git cannot parse.
- `remove`'s rollback takes it as it takes a store it cannot read (`READABLE_ONCE_CURED`, in `PinRollback._undo_work_tree` and `_work_tree_by_hand`): exit 2, the mount is made again, empty, and the update is typed after the cure, never "comes back only from its remote". Where it cannot read the current `.gitmodules`, `_file_by_hand` now also types `git checkout -- .gitmodules`, so once the mode is given back the typed commands put the member back on `main` and leave `git status` clean.
- `_file_by_hand` serves every recorded file, so an unreadable `family.yaml` under `bump` and `remove` now gets `git checkout -- family.yaml` after the index entry: with the mode given back, `family.yaml` holds its recorded bytes, where at base it stayed the copy the verb had rewritten.
- `siblings.py`'s `submodule_urls` asks the same way. `path_unreadable(code, ...)` is new and `member_unreadable` delegates to it; `_run_placement` and `dispatch_all` catch the refusal and return 2 before anything is cloned, fetched or run. `siblings.py` (dry run, real run, `--make`) and `family.py siblings` give `gitmodules-unreadable`, exit 2, where base gave a traceback (3.12.3) or, from 3.14, read no url.
- Beside #1172's `git-repo-unreadable` (#1148): the holder's own `.git` is asked first, so where both it and `.gitmodules` cannot be read the run refuses once, by that code, exit 2, and never asks `.gitmodules`. `member_unreadable` keeps #1172's `code` keyword (default `member-unreadable`) and passes it to `path_unreadable(code, ...)`, so `_refuse_an_unreadable_root` still raises `git-repo-unreadable`, `submodule_urls` raises `gitmodules-unreadable`, and every other caller gets `member-unreadable`. The docstring's exit-2 paragraph names #1148's refusal first, then this one.
- `tests/test_family_gitmodules_unreadable.py` holds 42 rows. In `tests/test_path_guard_hygiene.py` the three `KNOWN_OPEN` entries for these sites (`_gitmodules_names`, `_sections_giving` and `submodule_urls`) are taken out, as its stale-entry check demanded. Main took out the other 8 with #1144, so the merged `KNOWN_OPEN` is empty.
- Measured, with a holder whose `.gitmodules` is a link into a folder at mode 000, on Python 3.12.3 and a 3.14-like shim, base `038dafba` against head; the same link into a folder at 755 reads the file at both, as a control.
  - `siblings.py` went from a traceback (3.12.3), or on the shim from "would clone" in the dry run and `CLONE FAILED` in the real run, to `gitmodules-unreadable`, exit 2, with nothing cloned.
  - `remove`'s rollback went from a traceback with `members/IRRS` left gone (3.12.3), or from "comes back only from its remote" (shim), to exit 2 with the cure and typed commands that work.
  - The new file at base: 31 failed and 11 passed on both, the same 31; the 11 are the controls and the order guard. At `74096eb4`, 42 passed on both.
- Known limits:
  - `add` over a `.gitmodules` at mode 000 is refused first by `_submodule_paths`, and the holder's `validate-family.py` does the same in `_gitmodules_listed`. Both give `gitmodules-unreadable` with "mend the file by hand", not the `chmod` cure (measured; the validator's refusal is exit 2). They are other sites of #1110.
  - The rollback step that restores `.gitmodules` gives a permission its own cure, which says "on every directory above it inside the holder", even where the file is a link out of the holder. It is #430's wording for every rollback step.
  - The rollback's leg loop names a member's own unreadable `.gitmodules` by its reason and still raises `member-store-gone`. It cannot be reached in practice, because git has just written that file.
  - The rollback sentence's cure for a cause other than a permission (`OTHER_CURE`) has no row: `_bytes` fails first, so it is reached only in a race.
  - #1172 (for #1148) landed first, as `2fde6c3d`, and changes the same `siblings.py`. The merge keeps both forms, `member_unreadable`'s `code=` and `path_unreadable(code, ...)`, since folding one into the other changes lines outside the merge's hunks.
- Not in this PR: `add`'s `_submodule_paths`, the holder's `validate-family.py` `_gitmodules_listed` and #1110's other sites, each its own slice. The precedence row (no row pins which refusal wins when both apply), the fold of `member_unreadable`'s two forms and the docstring's ragged wrap, which r1164d's review names, are #1287.

Review: lane 1's independent reviewers reviewed each round. r1164 reviewed `4352ac2f`, stopped at LAST STEP, and found it NOT READY for one MUST, two SHOULDs and four NITs (#1164 issuecomment-6350529312). r1164b found `3162b523` NOT READY for one SHOULD, with no MUST (issuecomment-6356410999). r1164c found `74096eb4` provisionally READY with two NITs, both applied to the body (issuecomment-6364558859). Lane 1 then ran r1164c's unrun parts, and #1164 counted READY at `74096eb4`: the 16 mutants r1164c had not run were all killed (20 of 20 for the round with its own four), and the new file passed on the trees merged over #1147 and over #1172, 42 each (issuecomment-6371395973). After #1172 landed, lane 1 merged main into the branch as `16ff9391`, a real merge in which two files conflicted and each was resolved inside its hunks (issuecomment-6746028136). r1164d, lane 1's independent delta reviewer, found `16ff9391` READY with no MUST and no SHOULD (#1164 issuecomment-6752095110); its NITs on code are #1287.

Tests, under a stub `gh` with a bogus token, on Python 3.12.3: lane 1's gate at `16ff9391` gave 333 passed for this PR's files (`tests/test_family_gitmodules_unreadable.py`, `tests/test_family_py_unreadable.py`, `tests/test_family_bump_remove_rollback.py` and `tests/test_update_shape_kept_helper.py`), 412 passed and 2 skipped for #1172's `tests/test_pinned_root_git_unreadable.py` and `tests/test_validate_family_unreadable.py` with `tests/test_scaffold_leg_path_collisions.py`, `tests/test_path_guard_hygiene.py` and `tests/test_no_auto_maintenance.py` (the 2 skips need a session begun without `GIT_CONFIG_GLOBAL`), 171 passed for the doc trio, `tests/test_shape_doctor.py` in 4 shards (113 passed; 113 passed; 109 passed and 4 skipped; 107 passed and 3 skipped), and 2774 passed and 20 skipped, none failed, for the 32 other files that name `siblings`, in 6 calls. Mutants: 4 of 4 killed on the merge's resolved hunks, run at `16ff9391`, and 30 of 30 killed on the changed lines, run before the merge.

It lands by fast refresh (Brett Heap, 2026-10-15T22:48:35Z). Its H0 `16ff9391` is green on Linux and SonarCloud. The branch was never rebased. After H0, the only commit is update-branch's clean merge of main, giving 61f11e6, which is green on SonarCloud and Git Bash. Lane 1's gate passed on its tree: 10 pytest calls over `tests/test_family_gitmodules_unreadable.py`, `tests/test_family_py_unreadable.py`, `tests/test_family_bump_remove_rollback.py`, `tests/test_update_shape_kept_helper.py`, `tests/test_pinned_root_git_unreadable.py`, `tests/test_validate_family_unreadable.py`, `tests/test_validate_family_index_gitmodules.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_family.py`, `tests/test_readme_windows_quoting_sentence.py`, `tests/test_family_printed_quoting.py`, `tests/test_family_remedy_lines.py`, `tests/test_remove_add_remedies_family_root.py`, `tests/test_bump_remedies_family_root.py` and `tests/test_shape_doctor.py` in 4 shards: 1,699 passed, 5 skipped.

Part of #1110

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
…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
…once, with `--upstream` passed too, and refuses a path or a value that is no `owner/repo` in the pin's name; shape-doctor.py answers as it did (#1203) (#1269)

`update-shape.py` asks the shape pin's `source_repository:` once, whichever way a run reaches the upstream, and refuses a value that is no `owner/repo` in the pin's name, never in the name of a flag nobody passed (#1203, from lane 5's review of #1166, findings 3 and 9).

Measured on main `be21751c3` (Python 3.12.3, git 2.43.0, a stub `gh` first on PATH, a bogus token, no network). This branch's rows ran against main's `update-shape.py` and `shape-doctor.py` in a scratch worktree, and two probes ran main's tool directly.

- **No `--upstream`, run from the root.** `source_repository: "contracts"` was `REFUSED update-upstream-not-a-repo: --upstream contracts exists but is not a git repository`, exit 2. So were `scripts/repo_shape.py`, `contracts/shape-pin.yaml` and `~/notes` (a folder under `HOME`). A clone kept at `~/shape` was opened in place: `check` exit 1, the copies compared.
- **The values #1166 already names in the pin** (a line feed, a trailing space, `has space/x`) still had the remedy "or pass `--upstream` a path to a clone of openRepoShape".
- **`--upstream <a local clone>` passed.** The pin's value was never asked, and every value above gave `check` exit 1 with its report. `apply --yes --at <B> --branch shape/fu-lf` over `"opensoft/openRepoShape\n"` exited 0 and made this commit: `Re-sync the shape copies to opensoft/openRepoShape`, then a line feed, then ` @ 4032a512eb2e`. The `gh pr create` line it printed was split inside its `--title` quotes.
- **The pin and `--upstream "opensoft/openRepoShape\n"` both bad:** the refusal named the flag.

- **`update-shape.py`: a new `pin_source(pin, pin_path)`.** `prepare` asks it once, after reading the pin and before opening the upstream, with or without `--upstream`. It asks three questions, under the codes these values already had:
  - **Something is at the value where the command runs, and it holds no git repository:** `update-upstream-not-a-repo`. The value is looked up the way `open_upstream` looks up `--upstream`: `expanduser`, relative to the working directory.
  - **`REPOSITORY_RE` does not take the whole value** (`fullmatch`): `update-upstream-unresolvable`.
  - **`checked_value` refuses it:** `unsafe-value`.
- **What each refusal says.** Each names the pin and its field, ``<root>/contracts/shape-pin.yaml: `source_repository:` ``.
  - Since #1166 the second one said "which is neither a path on this machine nor an `owner/repo` name". It now says "which is not an `owner/repo` name", because a path is never what the pin holds.
  - The remedy no longer offers `--upstream` a path, since passing one no longer gets past the question. For the name refusals it reads: "write `source_repository:` in the pin as the `owner/repo` its shape was copied from, `opensoft/openRepoShape` for this standard's. It is asked with `--upstream` passed too, because `apply` names it in its commit and its pull request; a path to a clone goes to `--upstream`." The `update-upstream-not-a-repo` refusal adds a sentence (N2, below): "The value is also looked up as a path from the directory this runs in: if it is already right, run this from a directory where nothing is at that path."
- **`open_upstream(spec)` asks only about `--upstream` again.** #1166's `pin_path` and its two pin-named branches moved into `pin_source`. Both functions use `_holds_a_repository` as their one repository question.
- **`prepare(args, *, ask_source=True)`.** `shape-doctor.py`'s `check_shape_currency` call passes `ask_source=False`. Its `refusals_ahead` call asks the field (S2 of the review round, below).
  - Why: the doctor reads any `Refusal` out of `prepare` as its own checkout being unable to answer. `update-shape.py`'s comment above `_ABSENT_ERRNOS` documents this.
  - Measured with the field asked there: a hand-edited `source_repository:` turned the `shape currency` row from exit 1 (behind) into CANNOT ANSWER, exit 3. Its NEXT was `git -C <standard> fetch --all`, and its `why` was "this checkout of the standard does not carry the commit the pin names".
  - With the opt-out at `check_shape_currency` the doctor answers as it does on main. Where the root is behind, the doctor's NEXT is `update-shape.py check`, which refuses the field in the pin's name.
- **Codes:** none added, renamed or removed.
- **Tests:**
  - `tests/test_update_shape_pin_source.py` is new, with 36 rows: 22 from the first round, 12 from the review round and 2 from the second round (NIT A, one in each route).
  - `tests/test_update_shape_merged_away.py`: two new rows, the doctor's `pins` row over a hand-edited source (S2) and over a source that `check` cannot read (NIT B). The S2 row's lines that edit the pin moved into a helper, `source_written_as`, which both rows use.
  - `tests/test_value_pattern_line_break.py`: #1166's `WRITE_THE_PIN` remedy and the unresolvable words are updated. `test_an_upstream_passed_with_a_line_feed_is_named_as_passed` now keeps the pin as scaffolded. It used to name the flag "whatever the pin says", which this change ends on purpose; the pin is now named first.
  - `tests/test_update_shape_unreadable.py`: the `temporaries` stand-in wraps `open_upstream(spec)`.

rv1269 (opus) found this PR NOT READY at `86c1e6ea2` on two SHOULDs and six NITs (#1269 issuecomment-6725508050). It confirmed the fix, its rows, mutants, gates and merge-trees, and the writer's three choices. This round fixes the two SHOULDs and N1 to N5, keeps N6 as it was, and changes nothing else. Commits: `175d9b718` (the code and its rows) and `c792615f4` (one more row).

- **S1. A pin value `~<unknown user>/...` was a Python traceback, exit 1.**
  - `Path(declared).expanduser()` raises `RuntimeError: Could not determine home directory.` for a user the machine does not have (measured on 3.12; rv1269 found 3.13 and 3.14 raise the same). Exit 1 is also `check`'s "behind" code. With `--upstream` passed this was new (main exited 1 with a report); with none, main crashed too.
  - Fix: a new `_named_here(declared)` looks the value up as `open_upstream` does and, where `expanduser` raises, keeps the bare path. Nothing is there, so the name question refuses it `update-upstream-unresolvable` in the pin's name, in both routes. The scaffolded value is unchanged.
  - Rows (4, each failing at `86c1e6ea2`): `test_a_tilde_user_who_is_not_there_is_refused_in_the_pins_name`, and `test_a_tilde_user_who_is_not_there_is_looked_up_as_the_bare_path` (a folder of that very name where the command runs, holding no repository, is `update-upstream-not-a-repo`), each in both routes.
- **N1. A first part over 255 bytes was `update-unreadable ... (File name too long)`**, with a permissions remedy, naming neither the pin nor the field.
  - Fix: `_named_here` takes `ENAMETOOLONG`, and only that errno, as nothing there. Every other refused `stat` is raised as it was.
  - Rows (5): `"r" * 300 + "/has space"` is `update-upstream-unresolvable` and `"r" * 300 + "/x"` is `unsafe-value` (`checked_value` refuses over 255 characters), each in the pin's name and in both routes (4 rows, each failing at `86c1e6ea2`); and `test_any_other_refused_stat_of_the_pins_value_is_raised_as_it_was`, a control that passes at `86c1e6ea2` too: a `PermissionError` out of the `stat` is raised out of `pin_source`.
- **S2. The doctor's `refusals_ahead` opt-out made a `pins` row sentence false.**
  - Over two collision copies merged away plus `source_repository: "has space/x"`, the `pins` row said "`update-shape.py check` reports them `merged-away`, and the `apply` it prints drops their pin rows", and its NEXT was that `check`, which exits 2 with `update-upstream-unresolvable` and reports nothing.
  - Fix: `ask_source=False` is dropped at `refusals_ahead` only. `prepare` refuses, so `refusals_ahead` returns None, as its docstring says it does where `prepare` refuses, and the `pins` row keeps the gate's finding. `check_shape_currency` keeps the opt-out. The scaffolded case, with the same two copies, is unchanged: `test_a_merged_away_copys_row_goes_and_the_project_is_green_again` still passes and still asserts `merged_away` and the `check` NEXT. rv1269's mutant R1 (`refusals_ahead` asks) is now the code.
  - Row: `tests/test_update_shape_merged_away.py::test_the_pins_row_keeps_the_gate_where_check_refuses_the_pins_source`, failing at `86c1e6ea2`. It also holds that `check` exits 2 `update-upstream-unresolvable`, and that the `shape currency` row still counts the two rows `merged-away`, with no CANNOT ANSWER.
- **N2. The Limits bullet on a non-repository `opensoft/openRepoShape` folder is now measured** (Limits, below). The remedy of `update-upstream-not-a-repo` for a pin's value ends with "The value is also looked up as a path from the directory this runs in: if it is already right, run this from a directory where nothing is at that path." The other pinned words did not change: `WRITE_THE_PIN` stays what #1166's rows and the name refusals say.
  - Rows (3): the scaffolded pin run from a folder holding a non-repository `opensoft/openRepoShape`, in both routes (failing at `86c1e6ea2`: no such sentence); and the same pin with `--upstream` run from a folder where nothing is at that path, exit 1 as the scaffolded pin gives (a control).
- **N3.** The comment above `REPOSITORY_RE` no longer says it is the pin's value "where no `--upstream` is passed".
- **N4.** `test_the_doctor_does_not_call_a_hand_edited_source_the_standards` also asserts the `shape currency` row's status is `ok`, main's answer (measured on main's code in the scratch worktree, `ok`). Mutant D1 below is what only that assert kills.
- **N5.** The Merges section below is refreshed: main and the PRs were read fresh.
- **N6.** The Sourcery summary below the footer is kept exactly as it was: no closing keyword; body-guard exits 0.

Rows failing at `86c1e6ea2`'s `update-shape.py` and `shape-doctor.py` (this round's tests, the scratch worktree detached at `c792615f4`): **19 failed, 34 passed** of 53 tests. The 19: 8 rows whose expected remedy gained N2's sentence (the issue's three path values in both routes, and `~/notes` in both), the 4 S1 rows, the 4 N1 rows, the 2 N2 rows, and the S2 row. The controls that pass at `86c1e6ea2` are the N1 `PermissionError` row, the N2 run-elsewhere row, and the N4 assert.

rv1269b (sonnet) found this PR READY at `c792615f4`, with three NITs and no MUST or SHOULD (#1269 issuecomment-6726841735). This round fixes NITs A and B as it measured them, refreshes C, and changes nothing else. Commit: `52e5c1883` (two one-line fixes with their comments, three rows and a helper).

- **NIT A. A raw NUL byte after the `~` in the pin's value was a traceback, exit 1.**
  - `Path('~a<NUL>b/x').expanduser()` raises `ValueError: embedded null byte`, which `_named_here` did not catch: it caught `RuntimeError` only. Plain or quoted in the pin, in both routes. It is contrived, since the pin file would be binary. With no `--upstream` main crashed the same way; with one passed, main exited 1 with a report, so there it was new.
  - Fix: `except (RuntimeError, ValueError)`, keeping the bare path. A NUL in the bare path is nothing there (`_mode_of` already answers a NUL in a name that way), so the name question refuses the value `update-upstream-unresolvable` in the pin's name, exit 2. rv1269b's mutant Y3 is the code now.
  - Row (1, in both routes, so 2 ids, each failing at `c792615f4`): `test_a_nul_byte_after_a_tilde_is_refused_in_the_pins_name`. Its NUL byte is built with `chr(0)`.
- **NIT B. The doctor's `pins` row could read "could not be run" in one narrow case.**
  - Setup: two collision copies merged away, a pin value `locked/x`, and an unsearchable `locked` in the directory the doctor runs in. Since S2 the doctor asks the field in `refusals_ahead`, and `pin_source`'s `stat` of `locked/x` raises `PermissionError`. `refusals_ahead` caught `Refusal` only, so the row read `could not be run: [Errno 13] Permission denied: 'locked/x'`, where before S2 it kept the gate's finding. `update-shape.py check`, the row's NEXT, exits 2 `update-unreadable` there. The verdict, the exit and the `shape currency` row did not change.
  - Fix: `except (Refusal, OSError): return None` in `refusals_ahead`, so the row keeps the gate's finding. Its docstring and comment say so. rv1269b's mutant Z1 is the code now.
  - Row (1, failing at `c792615f4`): `tests/test_update_shape_merged_away.py::test_the_pins_row_keeps_the_gate_where_the_pins_source_cannot_be_read`. It uses real modes: `locked` is mode 000 and is given back in a `finally`, and the row skips on Windows and as root, as `tests/test_bump_leg_unopenable.py` does. It also holds that `check` exits 2 `update-unreadable: locked/x`, and that the `shape currency` row still counts the two rows `merged-away`, with no CANNOT ANSWER.
- **NIT C.** The Merges section below is read fresh. The counts in Rows failing on main, Mutants and Runs are this round's.

Rows failing at `c792615f4`'s `update-shape.py` and `shape-doctor.py` (this round's tests, the scratch worktree at `52e5c1883`): **3 failed, 53 passed** of 56 tests. The 3 are the rows above: 2 for NIT A and 1 for NIT B.

**Refused.**

- **Why.** The value is the name `prepare` gives the upstream in both routes. The README `Shape:` line is compared with it, and `apply` writes it into its commit subject, its pull request's title and the lines it prints.
- **Cost.** No tool writes a path there: both templates hold `{{SHAPE_REPOSITORY}}`. So refusing one costs no root that a tool made.
- **One answer for both routes.** The same question is asked whether or not `--upstream` is passed:
  - **A value that names something here holding no repository** (`contracts`, `scripts/repo_shape.py`, `~/notes`) is `update-upstream-not-a-repo`, with or without `--upstream`.
  - **A path not spelled `owner/repo`** (`~/shape`, `/srv/shape`) is `update-upstream-unresolvable`, even where it holds a clone. This is the one answer that changes for a run with no `--upstream`: main opened such a clone in place.
  - **An `owner/repo` spelling that is a repository where the command runs** is taken, as on main. An example is a checkout laid out by owner, run from the folder above `opensoft/openRepoShape`. With no `--upstream` it is opened in place.

Command: this branch's `tests/test_update_shape_pin_source.py` (36 rows), five tests of `tests/test_value_pattern_line_break.py` (the selection the mutants use, 18 ids), and the S2 and NIT B rows of `tests/test_update_shape_merged_away.py` (56 tests), run against main's (`be21751c3`) `update-shape.py` and `shape-doctor.py`, in the scratch worktree detached at `52e5c1883`.

Result: **36 failed, 20 passed** in 39.41s, of those 56 tests (the review round ran the whole of `tests/test_value_pattern_line_break.py`, 31 ids, and gave 33 failed, 33 passed of 66 in 47.41s; the first round's two files gave 21 failed, 32 passed).

The 36 are the first round's 21, the review round's 12 (S1: 4, N1: 4, N2: 2, S2: 1, and the `PermissionError` row, which fails on main because there is no `pin_source`) and the second round's 3 (NIT A: 2, NIT B: 1). The first round's 21:

- **12 rows:** `test_the_pins_source_is_asked_in_both_routes_in_the_pins_name`, the issue's six values (`a-folder`, `a-file-spelled-owner-repo`, `the-pin-itself`, `line-feed`, `trailing-space`, `a-space`) in both routes. On main:
  - `no-upstream`: `--upstream ... exists` for the three paths, and #1166's old remedy for the other three;
  - `upstream-a-clone`: exit 1 and a report.
- **4 rows:** `test_a_source_under_home_is_looked_up_as_open_upstream_looks`, `~/shape` (a clone) and `~/notes` (a folder) in both routes. On main: exit 1 three times, and `--upstream ~/notes exists ...` once.
- **`test_a_source_checked_value_refuses_is_refused_with_upstream_passed`:** exit 1 on main.
- **`test_the_pins_source_is_named_before_a_bad_upstream`:** main named the flag.
- **`test_apply_over_a_refused_source_writes_nothing`:** exit 0 and a commit on main.
- **#1166's `test_a_pins_source_that_is_no_owner_repo_is_named_as_the_pins[line-feed]` and `[space]`:** main gives the old words and remedy.

Four rows pass on main by design, because they hold answers this change keeps:

- the scaffolded pin with no `--upstream` reaches `open_upstream` with `opensoft/openRepoShape` (in-process, with a stand-in that opens the local upstream);
- the `owner/repo` clone where the command runs is opened in place;
- the doctor's `shape currency` row is no `environment` row and the doctor does not exit 3, and its status is `ok`;
- the scaffolded pin with `--upstream` passed, run from a folder where nothing is at `opensoft/openRepoShape`, is exit 1 over the upstream one commit on.

Setup:

- Each mutant was applied alone to this branch's production file (to the test file for N4) in a scratch worktree detached at `52e5c1883`. All the mutants below were run again on this head, the review round's and the first round's too, because `_named_here` and `refusals_ahead` changed.
- Each ran against 56 tests: `tests/test_update_shape_pin_source.py` (36 rows), five tests of `tests/test_value_pattern_line_break.py` (#1166's three `update-shape.py` rows and the two pattern tests, 18 ids), and the S2 and NIT B rows of `tests/test_update_shape_merged_away.py`. The D1 runs are the doctor guard row alone.
- After each, the four files were put back, with their sha256 checked against the commit's bytes (`restored=yes` for all 32 mutants, for the control run with no mutant, and for the two swaps of main's and `c792615f4`'s production files). At the end the worktree was clean at `52e5c1883`.
- The first round's M1-M10 were run again. M4, M5 and M7 are re-aimed: the path question and `expanduser` moved into `_named_here` and `pin_source`; M7 now names the `(RuntimeError, ValueError)` guard.

This round's mutants:

| Mutant | Result | Killed by |
|---|---|---|
| NIT A the guard back to `RuntimeError` alone (the inverse of rv1269b's Y3, which is the code now) | 2 failed | the NUL rows, one per route |
| NIT A `ValueError` alone | 4 failed | the S1 rows (`~<unknown user>`), both routes |
| NIT B the catch back to `Refusal` alone (the inverse of rv1269b's Z1, which is the code now) | 1 failed | the NIT B row |
| NIT B `OSError` alone, no `Refusal` | 1 failed | the S2 row |
| NIT B `(Refusal, PermissionError)` | **survives** (56 passed) | nothing: the row's `stat` is refused `EACCES`, a `PermissionError`, so a narrower catch cannot be told from `OSError` by a real mode; `OSError` is what rv1269b's Z1 catches, and it covers any other errno |
| NIT B the opt-out put back at `refusals_ahead`, the `OSError` catch kept | 2 failed | the S2 row and the NIT B row |

The review round's mutants, run again:

| Mutant | Result | Killed by |
|---|---|---|
| S1 the guard removed (`RuntimeError` and `ValueError`) | 6 failed | the S1 rows (4), both routes, and the NUL rows (2) |
| S1 the bare path not kept (`return None`) | 2 failed | the bare-path row, both routes |
| N1 the `ENAMETOOLONG` test removed | 4 failed | the four long-name rows |
| N1 every `OSError` taken as nothing there | 2 failed | the `PermissionError` row and the NIT B row |
| S2 the opt-out put back at `refusals_ahead` (the inverse of rv1269's R1, which is the code now; the `OSError` catch kept) | 2 failed | the S2 row and the NIT B row |
| N2 the sentence removed from the not-a-repo remedy | 12 failed | the three path values and `~/notes` (both routes each), the two N2 rows, the bare-path rows |
| N2 the sentence added to the name refusals too | 17 failed | the name refusals: the issue's three name values and `~/shape`, the tilde, NUL and long-name rows, named-first, #1166's two |
| D1 the doctor's `shape currency` row asks the field and calls a refusal a plain FINDING (exit 1, no `environment`) | 1 failed | the guard row's new status assert |
| D1 with N4's assert undone | **survives** (1 passed) | nothing: that assert alone kills D1 |
| N4's assert undone, production as committed | 56 passed | a control: the assert holds main's answer |

The first round's mutants, run again:

| Mutant | Result | Killed by |
|---|---|---|
| M1 the question removed from the `--upstream` route | 19 failed | every `upstream-a-clone` row, checked_value, named-first, apply, the S1, N1, N2, S2 and NIT B rows, and the NUL row of that route |
| M2 the question removed from the no-`--upstream` route | 20 failed | every `no-upstream` row, #1166's three pin rows, the doctor row, the S1, N1, N2, S2 and NIT B rows, and the NUL row of that route |
| M3 `fullmatch` put back to `match` | **survives: equivalent** (56 passed) | `REPOSITORY_RE` ends in `\Z` since #1166, so `match` and `fullmatch` agree on every string (rv1269 checked 66,430) |
| M3b `match` and `REPOSITORY_RE`'s `\Z` put back to `$` | 7 failed | the line-feed rows (both routes), named-first, apply, #1166's line-feed rows, the pattern's own row |
| M4 the path question removed | 12 failed | the three path values and `~/notes`, both routes; the bare-path and N2 rows |
| M5 any path refused, a repository or not | 3 failed | `~/shape` both routes, the `owner/repo` clone where it runs |
| M6 `checked_value` dropped | 4 failed | the checked_value rows and the long-name `unsafe-value` rows |
| M7 no `expanduser` | 2 failed | `~/notes` both routes |
| M8 asked after the upstream is opened | 20 failed | every `no-upstream` row but `~/shape`, named-first, the doctor row, #1166's three, the S1, N1, N2, S2 and NIT B rows, and the NUL row of that route |
| M9 the doctor's `shape currency` call asks the field | 3 failed | the doctor row, the S2 row and the NIT B row |
| M10 `ask_source` defaults to False | 19 failed | as M1 |

rv1269b's own mutants (its `mutate2.py`), run on this head:

| Mutant | Result | Killed by |
|---|---|---|
| Y1 `_named_here` takes `ENOENT` where it took `ENAMETOOLONG` | 4 failed | the four long-name rows |
| Y2 `EACCES` taken as nothing there too | 2 failed | the `PermissionError` row and the NIT B row |
| Y4 the not-a-repo remedy's last words changed | 12 failed | the rows that pin the remedy |
| Y7 `_named_here` returns the candidate where nothing is there | 26 failed | the rows that read nothing-there as a path, in both routes |
| Y5 `or not args.upstream` dropped from `prepare`'s condition | **survives: unreachable** (56 passed) | nothing: the only caller that passes `ask_source=False` passes `upstream=` too (rv1269's R2) |
| Y6 `.resolve()` dropped from the path question | **survives: equivalent** (56 passed) | nothing: rv1269b read it as equivalent, since both stats of `_holds_a_repository` follow a link as `resolve()` does |

Gates ran on the commit `52e5c1883` (dirty=0), with a stub `gh` first on PATH, `GH_TOKEN` bogus, an empty `GH_CONFIG_DIR`, a blank git identity, `GIT_SSH_COMMAND=false`, `GIT_CONFIG_GLOBAL=/dev/null`, Python 3.12.3 and git-filter-repo 2.47.0 (`git filter-repo --version` prints `a40bce548d2c`). A first writer ran gate A on 2.43.0 and was stopped for a workstation reboot in gate B; a second writer ran the rest, at the same head.

- **git 2.43.0** (`/usr/bin/git`):
  - **Gate A**: the 20 `tests/test_update_shape*.py` files (this PR's new one among them), `tests/test_value_pattern_line_break.py`, the hygiene five (`test_path_guard_hygiene`, `test_repo_hygiene`, `test_agents_md_codes`, `test_cli_reference`, `test_pinned_copy_text`) and `test_no_auto_maintenance`: 1360 tests, one run. **1355 passed, 5 skipped** in 830.98s (the review round: 1352; this round adds the 3 rows).
  - **Gate B**, run because `shape-doctor.py` changed: `test_shape_doctor`, `test_doctor_unreadable_pin`, `test_doctor_next_is_a_command`, `test_doctor_partial_clone`, `test_doctor_pin_restore_merges`, `test_shape_pin_files_not_a_list`, `test_pin_source_env_collisions` and `test_bom_reads`: 827 tests, by node id in 10 runs of at most 90. **824 passed, 3 skipped** (1194s in all, summed over the runs; the review round: 824 passed, 3 skipped).
- **git 2.47.1** (built from kernel.org's tarball, first on PATH, `git --version` printed into every log):
  - **Gate A**, in 16 runs of at most 90 ids each, so that no run held the slot for over 100 tests: **1355 passed, 5 skipped** (787s in all), the same count as on 2.43.0.
  - **Gate B**, in 10 runs of at most 90: **824 passed, 3 skipped** (1192s in all), the same count as on 2.43.0.
- **The ids** of both gates were collected at this head (1360 and 827, identical to the first writer's lists, which were collected at the same head).
- **The skips are the same on both gits:** 3 `test_update_shape_add_symlink.py:832` (junctions are NTFS's), 2 `test_no_auto_maintenance.py:222` (the session began with `GIT_CONFIG_GLOBAL` set) and 3 `test_shape_doctor.py:10516` (the PowerShell line is printed, and powershell.exe exists, only on a Windows host). The new NIT B row ran, as uid 1000; it skips only as root or on Windows.
- **The review round's runs**, on `c792615f4`: gate A 1352 passed, 5 skipped (699s on 2.43.0) and gate B 824 passed, 3 skipped (1045s), by the writer; rv1269b re-ran both at `c792615f4` with the same counts on both gits. On 2.47.1 the writer's gate A ran as 17 runs under 100 tests.
- **The first round's runs**, on `e1692c147` and `86c1e6ea2`: gate A 1339 passed, 5 skipped and gate B 824 passed, 3 skipped, on both gits. A first doctor run on 2.47.1, at `e1692c147`, had failed three rows of `test_doctor_unreadable_pin.py`: their stand-in for `prepare` took one argument and the doctor now passes `ask_source`. `86c1e6ea2` widens the stand-in. rv1269 re-ran both gates at `86c1e6ea2` with the same counts.
- **The rows on main, the rows at `c792615f4` and the mutants** above ran on git 2.43.0.

Run with `git merge-tree --write-tree <other> 52e5c18` (git 2.43.0) at 2026-11-09T14:14:11Z, at heads read fresh just before the push. All are clean (exit 0, no conflict line):

- main `2fde6c3d0`: tree `35c270e2`. Main is 15 commits past this branch's base `be21751c3`. #1159, #1147 and #1172 have merged (#1172 at 2026-11-09T14:01Z as `2fde6c3d0`, which is main now), so they are no longer listed. #1172's change to `shape-doctor.py` lies well away from `refusals_ahead`, and its merge with this head is clean.
- #1231 `aca00dfd9` (`update-shape.py`): `ba12a305`.
- #1241 `ab137eb5f` (`update-shape.py`, `tests/test_update_shape_unreadable.py`): `052a989f`.
- #1248 `1b747f7ab` (`shape-doctor.py`): `9c022d62`.
- #1273 `0657e3964` (`tests/test_value_pattern_line_break.py`): `9da0792f`.
- #1274 `e39b5d7e3` (`shape-doctor.py`): `a570550a`.

Main, #1248 and #1274 touch `shape-doctor.py`. None of the added or removed lines of any of these heads, against its merge base with this head, in the seven files this PR touches (`update-shape.py`, `shape-doctor.py` and five test files) mentions `open_upstream`, `pin_path`, `prepare(`, `source_repository`, `WRITE_THE_PIN`, `REPOSITORY_RE`, `refusals_ahead`, `ask_source`, `pin_source`, `expanduser`, `ENAMETOOLONG` or this round's `_named_here`, `source_written_as` and `NUL_AFTER_TILDE` (read from `git diff` against each merge base). One name is shared: #1241 uses a `needs_a_mode` mark in `tests/test_update_shape_unreadable.py`, and this round's `needs_a_mode` is defined in `tests/test_update_shape_merged_away.py`, so each file has its own. The rows on the merged tree with current main are left to the landing gate. Lane 3 says the later lander takes the refresh.

- **The doctor does not name a hand-edited `source_repository:` itself**, as on main: where the pin names the standard's commit, its row is `ok`. Naming it on the pin's side would mean teaching `pin_restore`, whose history walk reads pins with `check_pin`, the same question, and the path half of that question reads the working directory. That is a follow-up candidate, not this PR.
- **The path question reads the working directory**, as `open_upstream` does for `--upstream`. So `scripts/repo_shape.py` is refused when run from the root, and taken as an `owner/repo` name when run from elsewhere. For any one directory, both routes give the same answer.
- **A folder holding no repository at `opensoft/openRepoShape` where the command runs** (an unpacked archive, say) refuses the scaffolded pin with `--upstream` passed. On main only the run with no `--upstream` refused it. Measured by rv1269 and by this round's rows: the refusal is `update-upstream-not-a-repo` in the pin's name, in both routes, and its remedy now ends by saying to run it from a directory where nothing is at that path. That run answers as the scaffolded pin does (`--upstream` route: exit 1).
- **The doctor's `shape currency` row, over a hand-edited source and merged-away copies,** still names `update-shape.py check` as its NEXT, and that `check` refuses in the pin's name (exit 2). The row answers as on main by design (the first bullet). The `pins` row, which states what `check` reports, asks the field since the review round.
- **`--upstream ~<unknown user>/x` on the command line** is still a `RuntimeError` traceback out of `open_upstream` (measured in process), as on main, and an argv value whose first part is over 255 bytes is `update-unreadable` naming that path. Both name the value a person passed, not the pin. A follow-up candidate, not this PR.
- **`REPOSITORY_RE` takes `.` and `..` as an owner**, so `../shape` is `owner/repo`-shaped. Unchanged.

Review: rv1269, lane 5's independent opus reviewer, which wrote none of #1269: NOT READY at `86c1e6ea` on two SHOULDs (issuecomment-6725508050), both fixed in `c792615f`. Then rv1269b, lane 5's independent sonnet reviewer, which wrote none of it: READY at `c792615f` with NITs A-C (issuecomment-6726841735), fixed in `52e5c188`. Then rv1269c, lane 5's independent sonnet reviewer, which wrote none of it: READY at `52e5c188`, H0 of this landing (issuecomment-6745471925). CI (Brett Heap's ruling 27 and his fast-refresh ruling of 2026-10-15T22:48:35Z): H0 52e5c18 passed tests, tests-git-bash and SonarCloud; the head a31f0cf is a clean update-branch merge of main e22f295, with tests-git-bash and SonarCloud green; and the local gate passed on its predicted squash tree af35c58 over main e22f295: the doctor_unreadable_pin, update_shape_merged_away, update_shape_pin_source, update_shape_unreadable, value_pattern_line_break, adopt_execute_refusals, adopt_filter_repo_origin_url, adopt_one_byte_locale, adopt_pins, adopt_plan_and_remote_paths_spelled, adopt_plan_source_branch_shown, adopt_spelled_names, adopt_template_values, chain_link_fold, clone_url_bytes, family, non_utf8_name_helpers, pin_source_unreadable, pinned_copy_text, stdout_encoding, update_shape_apply_lines_and_headers, update_shape_header_comments, update_shape_messages, validate_pins_spelled_and_named, path_guard_hygiene, no_auto_maintenance, repo_hygiene, agents_md_codes, cli_reference sets, 1866 passed, 4 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 #1203

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
…ame the file as `shown_path` does, and validate-pins.py, family.py and shape-doctor.py read either spelling (#1168) (#1274)

`repo_shape.load_yaml` names the file it refuses as `shown_path` names a path, in all three of its refusals (`yaml-unreadable` twice, `yaml-unparsable`), and so does `policy-unreadable` on the next line of `NamingPolicy.load`. A U+202E, an ESC or a line feed in a typed `--plan`, `--path-policy`, `--policy`, `--project` or `--root` path no longer reaches the terminal raw from any of the six tools that hand `load_yaml` such a path (eight runs: `adopt-project.py` reads two flags, `validate-repository-naming.py` two). A printable path prints byte for byte as on main. Every reader that finds the path at the start of a refusal's detail by its text keeps working, beside a `repo_shape.py` from before this change or after it.

Probed at `51a9c5f10` with a stub `gh` first on PATH, `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR`, `GIT_SSH_COMMAND=false` and an empty global git config: a folder `pl<U+202E>an` holding a file that is not this reader's YAML (`a: 1` then `: b`). Each run exits 2 with one line, the U+202E in it raw:

```
REFUSED yaml-unparsable: <D>/pl<U+202E>an/<file>: line 2: empty keys are not supported
```

- `adopt-project.py check --plan` (and `execute --plan`, the same `Plan.load`);
- `adopt-project.py plan --path-policy`;
- `validate-repository-naming.py --policy` and `--project`;
- `bump-leg.py --root` (`<root>/project.yaml`);
- `family.py bump --family-root` (`<root>/family.yaml`);
- `update-shape.py check --root` (`<root>/contracts/shape-pin.yaml`);
- `validate-manifest.py --root`, as a root carries it.

On this branch the same eight runs say `'<D>/pl\u202ean/<file>'`. The rows below hold all eight, with U+202E, an ESC and a line feed in turn, and a printable name.

The readers that find the path in the detail by its text, on main: `validate-pins.py`'s `_load` tests `exc.detail.startswith(f"{path}: ")`; `family.py`'s `_read_member_project` swaps `str(manifest_path)` for `<repo> @ <commit>:project.yaml`; `repo_shape.link_declarations` swaps `str(path)` for `shown_path(path)`. Beyond the issue's list, a grep of every shipped `.py` for a detail read by its prefix found two more, both in `shape-doctor.py`: `naming_script_refusal` (`detail.startswith(f"{shape / NAMING_COPY}: ")`) and the `manifest-kinds` row (`exc.detail.removeprefix(f"{path}: ")`). Measured with only `repo_shape.py` changed: `validate-pins.py` named a root that is not printable by its whole spelled path in place of `project.yaml`; `family.py` named the deleted clone in place of the member when `TMPDIR` is not printable (probed with an ESC in the clone's folder); the doctor no longer knew its own policy's refusal, and its `manifest-kinds` row quoted the whole path again. Each is held below.

- `scripts/repo_shape.py`, `load_yaml`: `named = shown_path(path)`, used at the three sites; `NamingPolicy.load`'s `policy-unreadable`: `shown_path(path)`. Same module, no new import. The words after the path are unchanged.
- `templates/assembly-root/scripts/validate-pins.py`, `_load`: the prefix is looked for raw and as the gate's own `_shown` spells it (`_shown` is written in the gate, not imported, under the skew rule), and either is named relative to the root.
- `scripts/family.py`, `_read_member_project`: the swap to `shown` takes the spelled path, then the raw one.
- `shape-doctor.py`: `naming_script_refusal` asks both prefixes (`policy-wrong-kind` still names the policy raw); the `manifest-kinds` row takes the path off with a new `less_the_path`, in either spelling.
- `repo_shape.link_declarations` is unchanged: its `replace(str(path), named)` finds nothing to swap in a spelled detail and the `why` reads as it did (a row says so).
- `tests/test_load_yaml_refusals.py`: the rows below, added to the file that already holds `load_yaml`'s refusals (#192), not a new file.

No refusal code, remediation or word after the path changes, and a printable path is named as before. `README.md`, `docs/cli.md`, the handbook and `AGENTS.md` hold none of `cannot be read (`, `not UTF-8 at byte`, `yaml-unparsable`, `yaml-unreadable` or `policy-unreadable`; the release notes of v1.0.0, v1.1.1 and v1.2.0 name the codes as the record of those releases, with printable paths, and stay as they are; the 46 files under `tests/` that hold them are all in the gates below.

**`scripts/repo_shape.py` and `templates/assembly-root/scripts/validate-pins.py` are shape copies.** Every assembly root carries both, and every family holder carries `repo_shape.py`, so `update-shape.py check` shows each as `upstream-changed` in every project until `apply` re-copies it and re-pins, as #827 and #919 did. `family.py` and `shape-doctor.py` run from a checkout of the standard and are not copied.

A root re-copies its pinned files one row at a time (`update-shape.py apply --accept-local` keeps a copy), so `validate-pins.py` and `repo_shape.py` may be of different ages. Rows, each a real run of the root's own gate over a root under a folder holding the character:

| gate | library | the refusal names | row |
|---|---|---|---|
| this branch | this branch | `project.yaml` | `test_the_gate_names_the_file_from_the_root_beside_this_library` |
| this branch | before #1168 (`51a9c5f10`, raw) | `project.yaml` | `test_the_gate_names_the_file_from_the_root_beside_an_older_library` |
| before #1168 | this branch | the whole path, spelled, nothing raw | `test_an_older_gate_beside_this_library_names_the_whole_path_spelled` |
| before #1168 | before #1168 | `project.yaml` | main |

The third order is the one no change here can reach: that gate's own code asks the raw prefix alone. It still prints nothing raw, and it names `project.yaml` again once the gate is re-copied. A printable root is named `project.yaml` in all four. The two older copies are read with `git show 51a9c5f:...`, a skip where a checkout lacks that history (CI checks out with `fetch-depth: 0`), so `test_the_gates_load_takes_either_prefix` also holds both halves in process with no history. `family.py` and the doctor always import their own checkout's `repo_shape.py`, so they cannot meet another age; they read both spellings all the same, so no reader of the prefix depends on which library it meets, and their rows run beside each.

`adopt-project.py` spells the paths it prints itself with its own `_shown` (backticks, #1115, and #1152's PR #1177 for `--plan`), and `load_yaml` now spells with `shown_path` (`repr`, quotes). Measured, for one plan path:

| path holds | `adopt-project.py` `_shown` | `shown_path` |
|---|---|---|
| U+202E | `` `/d/pl\u202ean/plan.yaml` `` | `'/d/pl\u202ean/plan.yaml'` |
| ESC | `` `/d/x\x1b[31m/plan.yaml` `` | `'/d/x\x1b[31m/plan.yaml'` |
| a line feed | `` `/d/a\nb/plan.yaml` `` | `'/d/a\nb/plan.yaml'` |
| a byte that is not UTF-8 | `` `/d/caf\udce9/plan.yaml` `` | `'/d/caf\udce9/plan.yaml'` |
| a quote and an ESC | `` `/d/it's\x1b/plan.yaml` `` | `"/d/it's\x1b/plan.yaml"` |
| a trailing space | `` `/d/trail /plan.yaml ` `` | `/d/trail /plan.yaml ` |
| nothing unusual | `/d/plain/plan.yaml` | `/d/plain/plan.yaml` |

**Decision: `shown_path` in `load_yaml`, and the two styles stand.** The escapes are the same; only the delimiters differ, and `_shown`'s extra cases (a trailing space, backticks at both ends) are printable, so neither is a hole. A run never shows both for the plan: `check` and `execute` over an unparsable plan each print exactly one line, the `load_yaml` refusal, and stop (measured). `shown_path` is what the other five tools print for the same refusal, and what the three pinned validators' own `_shown` print (`test_the_pinned_scripts_spell_a_path_as_the_library_does` holds them equal). One spelling for `adopt-project.py` too would mean a spelling parameter on a function in a shape copy, or re-raising at `Plan.load` and `PathPolicy.load`, in a file #1177 is changing next to those lines and 20 other open PRs touch, for a difference of quote marks.

112 rows in `tests/test_load_yaml_refusals.py`: 101 new, and the 11 that were there (#192). Run on main's code: this branch's rows in the detached tree at `51a9c5f10`, with main's version of each changed file swapped in, each put back with a sha256 check (measured on the 109 rows at `e39b5d7e3`, and again on all 112 at `136b38d12`: the table is the second run, and the three rows the review round added are the only change).

| rows | on main's 4 files | main's `repo_shape.py` only | main's `validate-pins.py` only | main's `family.py` only | main's `shape-doctor.py` only |
|---|---|---|---|---|---|
| each refusal, U+202E / ESC / line feed x absent / not UTF-8 / unparsable (9) | 9 fail | 9 fail | pass | pass | pass |
| `policy-unreadable`, 3 names (3) | 3 fail | 3 fail | pass | pass | pass |
| each of the 8 tools x 3 names (24) | 24 fail | 24 fail | pass | pass | pass |
| older gate beside this library, 3 names (3) | 3 fail | 3 fail | pass | pass | pass |
| gate beside this library, 3 names, real run (3) and in process (3) | pass | pass | 6 fail | pass | pass |
| family member manifest beside this library, 3 names (3) | pass | pass | pass | 3 fail | pass |
| doctor's own policy in the naming script's output, 3 names x 2 refusals (6) | 2 fail (line feed) | 2 fail (line feed) | pass | pass | 6 fail |
| doctor's `manifest-kinds` row beside this library, 3 names (3) | pass | pass | pass | pass | 3 fail |
| a path typed relative, `adopt-project.py check --plan`, 3 names (3) | 3 fail | 3 fail | pass | pass | pass |
| total failing of 112 | 44 | 44 | 6 | 3 | 9 |

60 of the 101 new rows fail on main's code: the 44 above with main's four files, and 16 more that read the path back (the gate 6, `family.py` 3, the doctor 4 + 3) with main's reader beside this branch's library, the skew this change would otherwise open.

The other 41 new rows pass in every column, as do the 11 that were there. They are the controls the brief asks for: a printable path in each refusal (3), in `policy-unreadable` (1) and through each tool (8), which prints byte for byte as on main; the four readers beside a library older than #1168 (gate real run 4, gate in process 4, `family.py` 4, `manifest-kinds` 4) and beside this one for a printable path (6); `link_declarations` (4), which reads as it did; and the doctor finding `policy-wrong-kind` raw (3). Mutants M5, M8, M10, M12, M13 and M14 each fail some of them; the `link_declarations` rows guard only that its `why` did not move, which nothing in this change can move (M16). The doctor's two line-feed rows fail on main's four files too: a raw line feed splits the naming script's line before the doctor reads it.

Each applied alone in the detached tree, the 109 rows of `e39b5d7e3` run, the file put back and its sha256 checked against the branch's (all 17 matched). 15 killed, 2 survived. The review round adds M18 and M19, both killed by its three new rows (below).

| mutant | killed by |
|---|---|
| M1 `cannot be read` back to `{path}` | the in-process `absent` rows (3) |
| M2 `not UTF-8 at byte` back to `{path}` | the in-process `not-utf-8` rows (3) |
| M3 `yaml-unparsable` back to `{path}` | 31 rows: the in-process `unparsable` rows (3), the 24 tool rows that are not printable, the older gate's (3) and the doctor's line-feed `load-yaml` row |
| M4 `policy-unreadable` back to `{path}` | the three `policy-unreadable` rows, and the doctor's line-feed row |
| M5 `validate-pins.py`: the raw half of the prefix test dropped | gate beside an older library (3), `_load` with an older library (3) |
| M6 `validate-pins.py`: the spelled half dropped | gate beside this library (3), `_load` with this library (3) |
| M7 `family.py`: the spelled swap dropped | family with this library (3) |
| M8 `family.py`: the raw swap dropped | family with an older library (3) |
| M9 doctor `naming_script_refusal`: the spelled prefix dropped | its `load-yaml` and `not-a-mapping` rows that are not printable (6) |
| M10 doctor `naming_script_refusal`: the raw prefix dropped | `policy-wrong-kind` named raw, U+202E and ESC (2) |
| M11 `less_the_path`: the spelled prefix dropped | `manifest-kinds` with this library (3) |
| M12 `less_the_path`: the raw prefix dropped | `manifest-kinds` with an older library (3) |
| M13 `load_yaml`'s `named` always `repr`, a printable path too | 24 rows: the printable rows of each refusal (3) and each tool (8), the four #192 rows that assert `str(refusal).startswith(f"REFUSED yaml-unreadable: {path}")`, and printable rows of the readers |
| M14 `policy-unreadable` always `repr` | its printable row and the doctor's printable `not-a-mapping` row (2) |
| M15 `validate-pins.py`'s spelled half as `repr(str(path))` in place of `_shown(str(path))` | **survived, equivalent**: for a path that is not printable the two are the same text, and a printable one is caught by the raw half first |
| M16 `link_declarations`' `replace(str(path), named)` removed | **survived, equivalent**: the detail already holds `shown_path`'s spelling, so the swap finds nothing to swap; the row `test_a_link_manifest_is_named_in_why_as_it_was` is there to say the output did not move |
| M17 `less_the_path` returns the detail whole | `manifest-kinds`, both libraries (6) and its printable rows (2) |
| M18 `load_yaml`'s `named` from `Path(path).absolute()` (rv1274's X5, which survived the 109 rows) | the relative-path rows (3), and no other of the 112 |
| M19 the same from `Path(path).resolve()` | the same 3 |

Every run through the lane's runner: a stub `gh` first on PATH (and the suite's own `gh` guard ahead of it), `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR`, `GIT_SSH_COMMAND=false`, `GIT_CONFIG_GLOBAL=/dev/null`, a blank git identity, git-filter-repo 2.47.0 (CI's pin; `--version` says `a40bce548d2c`) on PATH, Python 3.12.3 (CI runs 3.14; no row asserts text that depends on the version).

The gate list, 53 files, 4591 tests: the new rows; the hygiene five (`test_path_guard_hygiene`, `test_repo_hygiene`, `test_agents_md_codes`, `test_cli_reference`, `test_pinned_copy_text`) and `test_no_auto_maintenance`; the 46 files under `tests/` that hold `cannot be read (`, `not UTF-8 at byte`, `yaml-unparsable` or `yaml-unreadable`; every `validate-pins` file (`test_pin_validator`, `test_validate_pins_lockstep_lines`, `test_validate_pins_without_git` beside those the grep found); and for the doctor and `family.py` readers, `test_shape_doctor`, `test_doctor_validator_verdicts`, `test_naming_policy`, `test_family_py_unreadable` and `test_validate_family_unreadable`. One run of more than 100 tests at a time.

| run | git | head | result |
|---|---|---|---|
| the gate list | 2.43.0 | `0e5f95db5` | 4579 passed, 12 skipped, 0 failed (40:38) |
| the gate list | 2.47.1 | `e39b5d7e3` | 4586 passed, 5 skipped, 0 failed (46:43) |
| the new rows, the hygiene five, `test_no_auto_maintenance` | 2.43.0 | `e39b5d7e3` | 546 passed, 2 skipped, 0 failed |
| `tests/test_load_yaml_refusals.py` | 2.43.0 | the change before the commit | 109 passed |
| the same, on main's code (5 swaps) and under 17 mutants | 2.43.0 | `51a9c5f10` + this change | as in the tables above |
| `tests/test_load_yaml_refusals.py` (112), the hygiene five and `test_no_auto_maintenance` (439), 14 runs of at most 100 | 2.43.0 | `136b38d12` | 549 passed, 2 skipped, 0 failed |
| the same | 2.47.1 | `136b38d12` | 549 passed, 2 skipped, 0 failed |

`e39b5d7e3` differs from `0e5f95db5` by one comment in `tests/test_load_yaml_refusals.py` (the commit was amended before it was pushed), so the 2.43.0 gate list stands for it, with the small run above on the final head. The 12 skips on 2.43.0: the reftable backend needs git 2.45 (7), the session's `GIT_CONFIG_GLOBAL` (2), a PowerShell line printed only on Windows (3). On 2.47.1, 5: the last two kinds.

`136b38d12` (the review round) changes `tests/test_load_yaml_refusals.py` alone: three rows added and one row's setup moved out of a `pytest.raises` block. The gate list at `136b38d12` is 4594 tests; its other 52 files are not run again, and the new file, the hygiene five and `test_no_auto_maintenance` are, on both gits (the two rows added to the table above). Their 2 skips, on both gits: `test_no_auto_maintenance.py:222`, the session began with `GIT_CONFIG_GLOBAL` set.

`git merge-tree --write-tree` (git 2.47.1) of the head `136b38d12` with main and with the head of each open PR on a file this changes, main fetched and heads read with `gh pr list` at about 16:20Z on 2026-11-09. The table of 2026-11-08, at `e39b5d7e3`, differs in three rows: #1172 was open, #1269 was at `c792615f4`, and #1164 (at `74096eb47`) conflicted in `tests/test_path_guard_hygiene.py`, which this does not touch, and is clean at its new head.

| with | head | result |
|---|---|---|
| main | `ebb87168a` | clean. Main moved since `51a9c5f10`: in `scripts/family.py` (#1117's remedies, not `_read_member_project`) and, since the last table, in `shape-doctor.py` (the `members` row), `bootstrap.py`, `validate-family.py`, `siblings.py`, `adopt-project.py` and `tests/conftest.py`; a grep of its production changes since `8e6f53268` finds no new reader of a `load_yaml` detail. The predicted merge, checked out alone, passes the 112 rows, `test_pinned_copy_text`, `test_family_py_unreadable`, `test_validate_family_unreadable`, main's touched `family.py` tests (`test_family_add_member_id`, `test_family_bump_to_checks`, `test_remove_add_remedies_family_root`) and `test_adopt_plan_source_branch_shown`: 411 passed on git 2.43.0 |
| #1266 (`scripts/repo_shape.py`) | `09697e9c5` | clean |
| #1171 (`scripts/repo_shape.py`, `adopt-project.py`) | `8162b874e` | clean; it leaves `shown_path` as it is |
| #1249 (`scripts/repo_shape.py`) | `3146c3ca5` | clean |
| #1177 (`--plan`'s `_shown`) | `5208e874e` | clean |
| #1263, #1248, #1239 (`validate-pins.py`; #1248 also `shape-doctor.py`) | `9ef8f0ab5`, `1b747f7ab`, `fff421456` | clean |
| #1269 (`shape-doctor.py`) | `52e5c1883` | clean |
| #1201, #1164 (`scripts/family.py`) | `24b6a0af6`, `16ff93917` | clean |
| #1264 (`scripts/family.py`) | `43d2e8b26` | `docs/handbook.html` conflicts, which this does not touch; against main alone it conflicts there and in five more files (`scripts/family.py` and four tests), the same six with this change merged in, and the five conflict blocks of `family.py` are identical with and without it |

#1172 was open in the last table and has merged since: its change is in the main row.

Two independent reviews of `e39b5d7e3` (rv1274, then rv1274b, which continued it after a reboot) found no MUST and called the PR READY. What each point of theirs came to, in `136b38d12` (tests only; no production file changed):

- **SHOULD, the refusals #1168 names and this PR leaves raw:** filed as #1279. It lists eight "unreadable" and "not a mapping" refusals that still name the path as typed, measured at `e39b5d7e3` with their sites, and two sites not probed; the Limits below name the same family. Nothing in this change touches those lines.
- **NIT 1, the dead raw halves:** kept. `family.py` and `shape-doctor.py` import their own checkout's `repo_shape.py`, so the raw swap in `_read_member_project` and the raw prefix in `less_the_path` run only when a row swaps in an older library in process. They are harmless, they make each reader independent of which library it meets (the version mix above), and the doctor's raw prefix in `naming_script_refusal` is live, since `policy-wrong-kind` still names the policy raw.
- **NIT 2, no row typed a relative path:** done. rv1274's mutant X5 (`load_yaml` naming `Path(path).absolute()`) survived the 109 rows, since every tool row types a path under `tmp_path`, which is absolute. `test_a_path_typed_relative_is_named_as_typed_and_spelled` (3 rows: U+202E, ESC, a line feed) runs `adopt-project.py check --plan` with the path typed relative to the working directory and holds the refusal to the path as typed, relative and spelled. On main's `repo_shape.py` all 3 fail; X5 and its `.resolve()` twin each fail exactly those 3 of the 112 rows; every restore matched its sha256 (git 2.43.0). The tools handed a file keep the path as typed (`adopt-project.py check --plan` and `plan --path-policy`, `validate-repository-naming.py --policy` and `--project`, measured); the four handed a root (`bump-leg.py`, `family.py bump`, `update-shape.py`, `validate-manifest.py`) make it absolute before `load_yaml` sees it, so one tool of the first kind is the row.
- **NIT 3, Sonar python:S5778:** done. `unparsable(root / "project.yaml")` ran inside the `pytest.raises` block of `test_the_gates_load_takes_either_prefix`, beside `gate._load`. The file is made first, so only `gate._load` runs inside the block; the row's 8 ids and their verdicts are the same.
- **NIT 4, stale counts:** done. The open PRs touching `adopt-project.py` (20 others than #1177, as of 16:20Z), the merges table (main `ebb87168a`, every head read fresh), and the counts of rows and mutants above (112 rows, 101 new, 44 failing on main's four files; M18 and M19 added).

They also checked, and asked nothing of this change: no reader of a `load_yaml` detail is left outside the five it changes, the gate's `_shown` equals `shown_path`, and neither shape copy's digest is stored anywhere in the tree.

- **An older `validate-pins.py` beside this `repo_shape.py`** names a root that is not printable by its whole spelled path, not `project.yaml`, until the gate is re-copied (the version-mix table). Nothing raw.
- **`policy-wrong-kind`**, the line after `policy-unreadable` in `NamingPolicy.load`, still names the policy raw: the brief kept the scope to the three `load_yaml` refusals and `policy-unreadable`. It is the same one-line change, and the doctor already reads either spelling.
- **The "not a mapping" lines in other files** still name the path raw: `plan-unreadable` (`adopt-project.py`, which #1177 spells), `path-policy-unreadable` and `path-policy-wrong-kind` (`scripts/path_classify.py`), `bump-leg-manifest-unreadable` (`bump-leg.py`), `manifest-unreadable` (`validate-repository-naming.py`, which #1267 and #1236 are changing), `manifest-missing` and `manifest-unreadable` (`validate-manifest.py`), `update-pin-unreadable` (`update-shape.py`) and the doctor's own `policy-raised`. Follow-up candidates.
- **Not probed:** the two `bootstrap.py`, `siblings.py`, `validate-family.py` and `shape_advisory.py`. By reading, each hands `load_yaml` `<root>/<one set name>`; where it does not swallow the refusal (two of `siblings.py`'s three do), it prints the detail whole (`bootstrap.py` through `spelled`, which leaves a spelled path as it is), so each now says the spelled path.
- `link_declarations`' swap now finds nothing to swap. It is left in place: removing it is a further change to a shape copy for no change in output (mutant M16).

Review: rv1274 and rv1274b, lane 5's independent opus reviewers, which wrote none of #1274 (rv1274 stopped for the reboot of 2026-11-08 with no MUST; rv1274b finished its review): READY at `e39b5d7e` with no MUST (issuecomment-6742338962); its SHOULD is the follow-up #1279, and its NITs 2-4 are fixed in `136b38d1`. Then rv1274c, lane 5's independent sonnet reviewer, which wrote none of it: READY at `136b38d1`, H0 of this landing, with no finding (issuecomment-6745586545). CI (Brett Heap's ruling 27 and his fast-refresh ruling of 2026-10-15T22:48:35Z): H0 136b38d passed tests, tests-git-bash and SonarCloud; the head 52a140c is a clean update-branch merge of main 150e401, with tests-git-bash and SonarCloud green; and the local gate passed on its predicted squash tree 2fb87fe over main 150e401: the load_yaml_refusals, adopt_check_throwaway_repos, adopt_e2e, adopt_execute_refusals, adopt_make_bootstrap_followups, adopt_make_reads_first, adopt_pins, adopt_plan_source_branch_shown, adopt_template_values, adopt_tracking_branch, bump_leg_branch_and_push_line, chain_link_fold, doctor_unreadable_paths, doctor_unreadable_pin, family, family_dry_run, path_guard_hygiene, pin_source_unreadable, pinned_root_git_unreadable, root_git_unreadable, stdout_encoding, update_shape_apply_lines_and_headers, update_shape_header_comments, update_shape_merged_away, update_shape_unreadable, validate_family_unreadable, validate_pins_spelled_and_named, pinned_copy_text, no_auto_maintenance, repo_hygiene, agents_md_codes, cli_reference sets, 2432 passed, 6 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 #1168

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
…r own premise or read their UTF-8 file as UTF-8, and the 13th, the assembly root bootstrap.py saying it could not create a branch it made, is left failing for its own issue (#1259) (#1278)

 This PR settles 12 of its 13 rows. The 13th row is a tool defect (kind c below), left failing on purpose, and it is now #1283, the issue of its own that #1259's first "Done when" box asks for, so nothing in #1259 is left open.

## Goal

#1259 counts 8 rows of `tests/test_pinned_copy_text.py` and `tests/test_family.py`, and its comment 5 rows of `tests/test_bootstrap_spelling.py`, that fail under a Latin-1 locale and pass under UTF-8. None had a kind. Each is measured here, by test id, into #1214's kinds:

- **a, cannot judge under a one-byte locale (11 rows):** each skips there on its own premise, which the skip reason states.
- **b, the test reads wrongly (1 row):** corrected; it now runs and passes under Latin-1.
- **c, a tool defect a Latin-1 user would meet (1 row):** not fixed, and the row is untouched. The evidence is under "The tool defect".

Main is `42308f26b`, which holds #1258 (the helper `skip_where_the_locale_does_not_spell_it_as_utf_8` and its premise sentences). This branch is one commit on it. It changes three test files and no tool.

## The 13 rows

| # | Test id | Kind | Measured under Latin-1 | Change |
|---|---|---|---|---|
| 1 | `test_pinned_copy_text.py::test_the_variable_the_warning_offers_reads_the_later_link` | a | Exit 0 and no WARNING, as the row asserts. Stdout reads `openXdox \u2192 openYdox \u2192 openInk`: `scaffold-project.py` calls `escape_what_stdout_cannot_encode()` (#214) at the start of `main`, so the arrow is printed escaped by design. | `skip_where_the_locale_does_not_spell_it_as_utf_8("\u2192", PRINTED_AS_ITSELF)`, after the exit and WARNING asserts |
| 2, 3 | `test_pinned_copy_text.py::test_an_unused_pin_source_is_named_spelled[esc]`, `[forged-line]` | a | Exit 0 and no ESC, as asserted. The note reads `not used \u2014 each declared pin ...`. The root's `validate-pins.py` makes a `strict` or `surrogateescape` stdout `backslashreplace` in `_emit_report` (#295), the reconfigure `escape_unencodable_stdout` does, written there because that file imports nothing but `repo_shape`. | the same guard on `"\u2014"`, after the ESC assert |
| 4 | `test_pinned_copy_text.py::test_a_replaced_pin_source_and_its_replacement_are_spelled` | a | The same: both notes read `not used \u2014 the later ...`. | the same |
| 5 | `test_pinned_copy_text.py::test_a_key_read_as_a_path_is_spelled` | a | The same. | the same |
| 6 | `test_pinned_copy_text.py::test_a_printable_pin_source_is_named_as_typed` | a | The same. | the same, after the exit assert |
| 7 | `test_family.py::test_init_writes_the_holders_agent_files` | **b** | `init` writes the holder's `AGENTS.md` as UTF-8 under Latin-1 too: its first line holds `e2 80 94` for U+2014. The row read it with `read_text()`, in the locale's codec, so U+2014 came back as three characters. | its four `read_text()` calls take `encoding="utf-8"` |
| 8 | `test_family.py::test_commit_one_refuses_a_trailer_that_is_no_text_before_it_stages` | a | `os.fsdecode(b"Co-Authored-By: Jos\xe9")` is `...Jos\xe9` (U+00E9), and `_commit_one` commits the trailer as `Co-Authored-By: Jos\xc3\xa9`, the text a Latin-1 terminal typed. Under UTF-8 the same bytes read as `...Jos\udce9`, and `_commit_one` refuses `trailer-not-utf8` with `a.txt` still untracked. The tool is right in both. | `skip_where_the_locale_does_not_spell_it_as_utf_8("Co-Authored-By: Jos\udce9", A_BYTE_READ_AS_A_SURROGATE)`, before the `pytest.raises` |
| 9 | `test_bootstrap_spelling.py::test_a_register_and_its_path_are_spelled_when_it_cannot_be_read` | a | The TEST raises `UnicodeEncodeError` on U+2028 in `os.mkdir`, before any tool runs. | `skip_where_the_environment_cannot_carry("sp\u2028ec")` |
| 10 | `test_bootstrap_spelling.py::test_a_roots_own_directory_name_is_spelled` | a | The test raises in `os.rename` (`shutil.move`). | `skip_where_the_environment_cannot_carry(renamed.name)` |
| 11 | `test_bootstrap_spelling.py::test_a_family_roots_own_directory_name_is_spelled` | a | The same. | the same |
| 12 | `test_bootstrap_spelling.py::test_a_members_row_and_the_make_target_are_spelled` | a | The test raises in `open` (`write_bytes`) of `ta\u2028rget.py`. | `skip_where_the_environment_cannot_carry(target)` |
| 13 | `test_bootstrap_spelling.py::test_a_branch_name_is_spelled_in_every_line_that_names_it` | **c** | The assembly root's `bootstrap.py` makes the branch and then says it could not. See "The tool defect". | none |

**Why rows 9 to 12 take `skip_where_the_environment_cannot_carry`.** The four `UnicodeEncodeError`s that #1259's comment reads are the test's own: `os.mkdir`, `os.rename` and `open` of a name holding U+2028, which Latin-1 cannot encode. The docstring of #1258's helper gives such a row to that guard ("A name the TEST cannot make or pass at all is `skip_where_the_environment_cannot_carry`'s"), as #1258 did for its 18 "a1" rows. Its reason names the encoding and the name, for example `this system's file name encoding (iso8859-1) cannot spell 'At\u2028las'`.

**No tool traceback hides behind them.** I ran both roots' `bootstrap.py` under Latin-1, with the row's `PYTHONIOENCODING=utf-8:strict`, on the manifests those rows had written before they raised: the leg path `"sp\u2028ec"`, the member path `"members/Ir\u2028s"` and the project `"Bo\u2028x"`. Neither printed a traceback. The assembly root printed `[spec] sp\u2028ec: NOT INITIALIZED ...` and `bootstrap ok`, exit 0. The family root spelled both members and ended at its own `family bootstrap FAILED` for the two members whose `make` the probe ran, exit 1.

**The guards ask only of the text their premise is about,** just before the first line that needs it, as #1258's do. The asserts before each guard still judge under Latin-1 (exit code, no ESC, no WARNING). Under UTF-8 no guard skips. Every skip reason states its premise, for example `this locale's encoding (iso8859-1) cannot spell '\u2014': the row reads this character as itself in what the tool prints, and a stdout in this encoding writes it as an escape (#214)`.

## The tool defect (row 13, kind c): not fixed here

**This defect is #1283.** Lane 4 filed it from the evidence below, as #1259's first "Done when" box asks. This PR changes no tool, and row 13 stays failing and untouched until #1283 is mended.

**What a Latin-1 user meets.** Take a project whose `project.yaml` says `tracking_branch: "tb\udcffx"`, the spelling `bootstrap.py` takes for a branch holding the byte 0xFF (#715). Under Latin-1, `make bootstrap` makes that branch in each leg, with HEAD on it at the pin, then prints:

```
  [spec] spec: could not create branch 'tb\udcffx' at the pin f6d8ff445a2d; leaving detached
          `git checkout -b` exited 0, and HEAD is not on the branch at the pin
          nothing else is tried; the recorded pin is authoritative. Deal with what git said and run bootstrap again.
```

Every later run prints `branch tb\udcffx is at the pin f6d8ff445a2d, and git refused to check it out:` with the same two lines, and exits 0. Both claims are false.

**Measured** in the tree the failed Latin-1 run kept, before and after a second run:
- `git symbolic-ref HEAD` in `spec` and in `code` gives `refs/heads/tb\377x`;
- `git rev-parse HEAD` gives the pin, `f6d8ff44...` and `ce229835...`, which equal `git rev-parse HEAD:spec HEAD:code` in the root.

Under UTF-8 and ASCII the same manifest gives `branch tb\udcffx created at <pin>` and, on the next run, `on tb\udcffx at <pin> (branch tip == pin)`. The row passes in both.

**The code at fault** (`templates/assembly-root/scripts/bootstrap.py`, at main `42308f26b`; on `2fde6c3d0` the same lines are :841, :857, :922, :1505 and :1755):
- `_head_of` (:782) returns HEAD's ref as `os.fsdecode(ref.rstrip(b"\r\n"))` (:798). Its docstring says such a name "reads back as the `refs/heads/<branch>` built from the same name". That holds only where `os.fsdecode(os.fsencode(name)) == name`.
- Under Latin-1, `os.fsencode("tb\udcffx")` is `b"tb\xffx"` (surrogateescape), which is what git is handed. `os.fsdecode(b"tb\xffx")` is `"tb\xffx"` (U+00FF), not `"tb\udcffx"`.
- So the text comparisons of `(pin, f"refs/heads/{branch}")` with `_head_of(sub)` fail with HEAD on the branch:
  - the creation step, `if _head_of(sub) != (pin, f"refs/heads/{branch}")` (:1696), which prints `could not create branch` (:1698);
  - `_check_out`, `if _head_of(sub) == (pin, f"refs/heads/{branch}")` (:863), which returns "`git checkout` exited 0, and HEAD is not on the branch at the pin" (:866), and its caller prints "git refused to check it out" (:1446).

## Runs

The commands, the environment and the logs are W1259's. Pytest is `/usr/bin/python3 -m pytest -p no:cacheprovider` on Python 3.12.3. The environment for every run:
- a stub `gh` first on PATH, `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR`;
- `GIT_CONFIG_GLOBAL` an empty file, `GIT_CONFIG_NOSYSTEM=1`, the test identity, `EMAIL` set;
- `GIT_ALLOW_PROTOCOL`, `GIT_SSH_COMMAND` and `LANES_*` unset;
- git-filter-repo 2.47.0 (`a40bce548d2c`, pip launcher) first on PATH.

The locales:
- UTF-8 is `LC_ALL=C.UTF-8`.
- Latin-1 is built with `localedef -c` as #1153's `test_adopt_one_byte_locale.py` builds one, then `LOCPATH`, `LC_ALL=en_US.ISO-8859-1`, `PYTHONUTF8=0`. Python reports `iso8859-1`.
- ASCII is `LC_ALL=C PYTHONUTF8=0 PYTHONCOERCECLOCALE=0`.

**The gate: 22 test files, on main `42308f26b` and on this head.** They are:
- the three files of the 13 rows;
- the other 14 test files #1258 changed;
- `tests/test_adopt_one_byte_locale.py`;
- the 4 more test files that use a name this PR calls (`skip_where_the_locale_does_not_spell_it_as_utf_8`, `PRINTED_AS_ITSELF`, `A_BYTE_READ_AS_A_SURROGATE`, `skip_where_the_environment_cannot_carry`): `test_adopt_git_reads.py`, `test_non_utf8_git_failures.py`, `test_non_utf8_git_reads.py`, `test_non_utf8_oserror_sites.py`.

The 71 other test files that import from one of the three changed files were collected in each locale, on main and on the head. Each run collects 3782 tests with no error, and the per-file counts are identical.

| Run | main `42308f26b` | this head |
|---|---|---|
| 22 files, Latin-1 | 35 failed, 1144 passed, 87 skipped | 23 failed, 1145 passed, 98 skipped |
| 22 files, UTF-8 | 1265 passed, 1 skipped | 1265 passed, 1 skipped |
| 22 files, ASCII | 52 failed, 1120 passed, 94 skipped | 41 failed, 1121 passed, 104 skipped |
| the three files, Latin-1 | 13 failed, 394 passed | 1 failed (row 13), 395 passed, 11 skipped |
| the three files, UTF-8 | 407 passed | 407 passed |
| the three files, ASCII | 27 failed, 380 passed | 16 failed, 381 passed, 10 skipped |

**By test id, from main to the head:**
- **Latin-1:** 12 rows change, and nothing else: rows 1 to 6 and 8 to 12 go from failed to skipped, and row 7 from failed to passed. No row goes from passed to failed or to skipped. Each of the head's 23 failures fails on main too: row 13, and 22 rows in other files of the gate, which are not among #1259's 13 (see "Left").
- **UTF-8:** nothing changes. The one skip is `test_stdout_encoding.py`'s Windows default-stdout row, on both.
- **ASCII:** 11 rows change, and nothing else: 10 go from failed to skipped and row 7 from failed to passed. Rows 8 and 13 pass under ASCII on main and still do. No row goes from passed to failed or to skipped.

**#1259's "Done when", on a scratch merge.** The merges are main `42308f26b` with #1209's head `13a2c58cb` (`bad3de928`), then with this head (`20fcb11e1`). Both are local, never pushed, and both merged clean.

| Run | main + #1209 | main + #1209 + this head |
|---|---|---|
| `test_pinned_copy_text.py` and `test_family.py`, Latin-1 | 8 failed, 192 passed | **0 failed**, 193 passed, 7 skipped |
| the same two, UTF-8 | 200 passed | 200 passed |
| the same two, ASCII | 23 failed, 177 passed | 16 failed, 178 passed, 6 skipped |
| with `test_bootstrap_spelling.py`, Latin-1 | 13 failed, 394 passed | 1 failed (row 13), 395 passed, 11 skipped |
| with `test_bootstrap_spelling.py`, UTF-8 | 407 passed | 407 passed |
| with `test_bootstrap_spelling.py`, ASCII | 27 failed, 380 passed | 16 failed, 381 passed, 10 skipped |

By test id on the merges: UTF-8 changes nothing; Latin-1 and ASCII change exactly the rows above. The 16 ASCII failures are not among the 13, and fail on main + #1209 as well (see "Left").

**Main moved after these runs**, to `2fde6c3d0`. That commit makes both roots' `bootstrap.py`, `validate-family.py` and `siblings.py` refuse `git-repo-unreadable` where the root's `.git` cannot be read, and changes `tests/test_validate_family_unreadable.py` (one of the 71 files collected above) and adds `tests/test_pinned_root_git_unreadable.py`. It touches none of this PR's three files, and `git merge-tree` of this head with it is clean. The runs above were not repeated on it. Main then moved again, to `674077657` (#1120, `adopt-project.py`). RV1278 re-ran a 20-file gate (the three files, #1258's other 14 test files, `test_adopt_one_byte_locale.py` and #1172's two test files) on a scratch merge of this head with `674077657`: Latin-1 20 failed, 1142 passed, 84 skipped (main: 32 failed, 1141 passed, 73 skipped); UTF-8 1245 passed, 1 skipped on both; ASCII 41 failed, 1124 passed, 81 skipped (main: 52 failed, 1123 passed, 71 skipped). By test id only the rows above change, and every remaining failure fails on main too.

## Mutants

Each mutant was applied in a scratch worktree at the head, inside the one test function named. Its row ran under Latin-1 and ASCII. The file was then restored from HEAD and its sha256 checked equal; all 14 were.

| Mutant | Row | Latin-1 | ASCII |
|---|---|---|---|
| M1: the `PRINTED_AS_ITSELF` guard dropped | 1 | **1 failed** | 1 failed |
| M2: the same | 2, 3 | **2 failed** | 2 failed |
| M3: the same | 4 | **1 failed** | 1 failed |
| M4: the same | 5 | **1 failed** | 1 failed |
| M5: the same | 6 | **1 failed** | 1 failed |
| M6: the `A_BYTE_READ_AS_A_SURROGATE` guard dropped | 8 | **1 failed** | 1 passed: ASCII reads 0xE9 as U+DCE9, so the guard does not skip there and the row judges |
| M7: `AGENTS.md` read in the locale's codec again | 7 | **1 failed** | 1 failed |
| M8: the first read of `AGENTS-shape.md` in the locale's codec | 7 | 1 passed | **1 failed** (`UnicodeDecodeError`) |
| M9: the second read of `AGENTS-shape.md` the same | 7 | 1 passed | **1 failed** |
| M10: the read of `CLAUDE.md` the same | 7 | 1 passed | 1 passed |
| M11: the `skip_where_the_environment_cannot_carry` guard dropped | 9 | **1 failed** | 1 failed |
| M12: the same | 10 | **1 failed** | 1 failed |
| M13: the same | 11 | **1 failed** | 1 failed |
| M14: the same | 12 | **1 failed** | 1 failed |

- **M8 and M9 survive under Latin-1, as expected.** Latin-1 decodes every byte, and the text those two reads are checked for is ASCII. They are killed under ASCII, where #1259 asks the run to be looked at, and where the row now passes.
- **M10 is equivalent in every locale.** `CLAUDE.md` is the 16 ASCII bytes `Read AGENTS.md.\n`, which every codec reads alike. It is changed with the other three, so the row reads every file `init` wrote in one way.

## Merge-trees

`git merge-tree --write-tree` of this head is clean against:
- `origin/main` `42308f26b`;
- #1209 `13a2c58cb`;
- #1282 `f71c28978` (checked by RV1278 on 2026-11-09);
- the two open PRs that touch these files: #1201 `24b6a0af6` (`tests/test_family.py`) and #1171 `8162b874e` (`tests/test_pinned_copy_text.py`).

Neither of those two changes a row this PR touches. #1201's hunks are at an import and `test_add_refuses_a_spelling_of_a_member_the_family_already_pins`; #1171's are at `PINNED_IMPORTERS`.

## Left, and outside this issue

- **Row 13's tool defect**, above. It is #1283, the issue of its own that lane 4 filed for it. Once #1283 is mended, the row passes under Latin-1 as it is written.
- **Under ASCII, 16 rows of the two files still fail,** on main and here alike. #1259 asked that this run be looked at. None of these rows is among the 13, and each passes under Latin-1 and UTF-8. Read from their failure messages only:
  - 15 rows of `tests/test_family.py` read a UTF-8 file the tool wrote (`family.yaml` and others) with `read_text()` and no encoding, and end in `UnicodeDecodeError`: row 7's kind b. They are `test_init_copies_the_siblings_utility_and_the_makefile_target`, `test_the_holder_says_what_its_bytes_are`, the five `test_validate_finds_*` and `test_validate_accepts_*` rows, three `test_bump_*` rows, three `test_update_shape_*` rows, `test_no_members_still_finds_an_edited_copy` and `test_siblings_skips_a_clone_whose_project_id_is_not_the_rows`.
  - `tests/test_pinned_copy_text.py::test_a_printable_pin_source_that_is_not_a_repository_is_named_as_typed[caf\xe9]`: the test itself cannot make `caf\u00e9` under ASCII (`os.mkdir` raises `UnicodeEncodeError`), rows 9 to 12's kind.
- **22 other Latin-1 failures in the gate's other files** fail on main and here alike, and are not #1259's. They are 12 rows of `test_clone_url_bytes.py`, 2 each of `test_family_member_branch_not_utf8.py`, `test_non_utf8_git_reads.py` and `test_stdout_encoding.py`, and one each of `test_adopt_git_reads.py`, `test_adopt_pins.py` (`[not-utf-8]`), `test_adopt_template_values.py` and `test_bootstrap_leg_moves.py`. They were not run on the merge with #1209.

Closes #1259

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 10, 2026
…annot open, under `.git/modules/<path>` or in a `.git` directory, is refused `member-unreadable` by name, where it ended `member-commit-unresolvable` with a fetch (#1256) (#1263)

`templates/family-root/scripts/validate-family.py`'s
`_refuse_an_unreadable_git_dir` asked the `HEAD` of a member's git
directory only by `stat` (#1221, copied from the leg gate's #968). A
`stat` of a file at mode 000 works while its directory can be searched,
so a `HEAD` at 000 passed, and `git rev-parse`, which could not read it,
ended the run in `member-commit-unresolvable`, "the pinned commit ... is
not in that member's object store", with a `git fetch` that cannot help.
It did so for an absorbed member (`.git/modules/members/IRRS/HEAD`,
`fatal: not a git repository`) and for a checkout's own `.git` directory
(`members/IRRS/.git/HEAD`).

After that `stat`, a `HEAD` that is there is now opened by
`_gitfile_opens`, as #1239 opens a leg's: only where it is a regular
file, since the open of a FIFO waits for a writer; an open that finds
nothing (`_ABSENT_ERRNOS`) is a git directory with no `HEAD`, which is
git's to answer for; and a refused open is `member-unreadable`,
`<HEAD>: cannot be read (<reason>)`, exit 2, naming the file with the
member checkout's remedy (`_unreadable`) and the advice for the cause.
The file is named as #1246 names the git directory, relative to the
holder and in POSIX spelling, `.git/modules/<path>/HEAD` for an absorbed
member and `<path>/.git/HEAD` for a checkout's own `.git` directory, and
whole (`str(found / "HEAD")`) where the git directory is outside the
holder, a linked worktree's, so that a Windows path keeps one separator.

Unchanged: a refused `stat` of `HEAD` still names the git directory; a
git directory with no `HEAD`, a gitfile that names no directory and a
`gitdir:` line holding a NUL are still left to git. `_gitfile_opens` and
`_member_git_dir` stay word for word with `validate-pins.py`'s
`_gitfile_opens` and `_leg_git_dir` (compared by `ast.unparse`,
docstrings dropped). `_refuse_an_unreadable_git_dir` is not a copy, as
in #1246, since it names the part relative to the holder, but its `HEAD`
block is the gate's, with the family's `_is_a(head, _any_kind)` where
the gate has `_is_there(head)`. Holders see an `upstream-changed` row
for `scripts/validate-family.py`.

Not changed: a `HEAD` that is a FIFO, which still hangs the run in git's
own open (`git rev-parse` opens it, this check does not, and the leg
gate is the same after #1239); `objects/` or `config` at 000 in a
member's git directory, which still say `member-commit-unresolvable`
with a fetch remedy, as the leg gate's do, since only `HEAD` is asked;
and the holder's own `HEAD`, which is #1172's area. The doctor's
`members` row for this case is #1248's.

`tests/test_validate_family_unreadable.py` gains 8 functions and 18 rows
(102 in the file): the issue's two shapes at mode 000, each passing
again with the mode back (skipped as root and on Windows), a linked
worktree's `HEAD` named whole, in-process stand-ins with the open
refused for permission and for an I/O error, `_check_member_tree` asked
alone, an open that finds nothing, a parity row that holds the family
gate's line to the leg gate's for the same `HEAD`, a directory and a
FIFO `HEAD` that are never opened, and the NUL line. At the bytes before
this change 12 of the 18 fail and 6 pass, the 6 being controls. With
`tests/test_family.py` and `tests/test_validate_family_typed_states.py`
in one pytest, since the new module imports `family` from `test_family`,
it gave 257 passed at the reviewed head `9ef8f0ab` (258 at the restacked
head, with a row main added to `test_family.py`); there the hygiene
guards gave 356 passed, 2 skipped, and the template-text files 421
passed. All 3 mutants run (the open dropped,
`HEAD` named before its `stat`, the regular-file guard dropped) are
killed.

Closes #1256

Lane: openreposhape-3 (openRepoShape-3)
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

1 participant