Skip to content

validate-family.py: a member whose .git file this user cannot open, or whose git directory (its own .git, or the one its gitfile names) this user cannot search, is refused member-unreadable naming that part, and no longer member-commit-unresolvable, which said the pinned commit was missing and prescribed a fetch (#1221) - #1246

Merged
brettheap merged 5 commits into
mainfrom
l3-1221-member-git-unreadable
Nov 10, 2026

Conversation

@brettheap

@brettheap brettheap commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

What changed

A v1.2.1 follow-up from lane 3's independent reviews (#1221). It lands under Brett Heap's v1.2.1 merge word (2026-10-23T13:10:26Z) once reviewed and green.

templates/family-root/scripts/validate-family.py's _check_member_tree asked _checked_out, which only stats <member>/.git, and then ran git rev-parse --verify --quiet <commit>^{commit} in the member. Three states pass that stat and reach git, and each was refused member-commit-unresolvable: "the pinned commit ... is not in that member's object store", with a git fetch that cannot help. The three states are a gitfile at mode 000, a .git directory at mode 000 (git passes over it and walks up to the holder's own repository), and the git directory a readable gitfile names at mode 000 (fatal: not a git repository). Each is now member-unreadable, exit 2, naming the part with the chmod cure, as #956 gave a member's checkout: <path>/.git: cannot be read (<reason>).

The design mirrors the leg gate's two checks from templates/assembly-root/scripts/validate-pins.py. They are copied, not imported, because the two roots are separate templates and this file is a pinned copy (#610's skew rule):

Decisions the Direction left open:

The file is a pinned copy, so its bytes move, and holders see an upstream-changed row for it, as #1148 says of the pinned copies it names.

Out of scope

Measured on Python 3.12.3, before and after

Each state was made in a copy of the test family's holder, and scripts/validate-family.py was run in it. The control (readable) and the run with the mode put back each exit 0, before and after.

state main's bytes of this file (e04826db4, unchanged on bd3e9c148 and on 11560eb9f) this head
members/IRRS/.git gitfile at 000 exit 2 REFUSED member-commit-unresolvable: members/IRRS: the pinned commit 9b23788d... is not in that member's object store (... exited 128: fatal: error opening ...) + fetch remedy exit 2 REFUSED member-unreadable: members/IRRS/.git: cannot be read (Permission denied) + chmod cure
members/IRRS/.git directory at 000 exit 2 REFUSED member-commit-unresolvable: ... (... exited 1: ) + fetch remedy exit 2 REFUSED member-unreadable: members/IRRS/.git: cannot be read (Permission denied)
.git/modules/members/IRRS, named by a readable gitfile, at 000 exit 2 REFUSED member-commit-unresolvable: ... (... exited 128: fatal: not a git repository ...) + fetch remedy exit 2 REFUSED member-unreadable: .git/modules/members/IRRS: cannot be read (Permission denied)

The new rows were also run against main's bytes of validate-family.py (11560eb9f): with the whole file, 27 failed, 57 passed in 40.67s. The 27 are the 26 rows of the first head and the new gitfile-read row; the 57 are the file's 53 older rows and the 4 controls. The file was put back and checked with cmp against git show HEAD:<template>.

Tests

Each run under a stub gh (exit 97), GH_TOKEN=bogus, an empty GH_CONFIG_DIR, GIT_SSH_COMMAND=false, GIT_CONFIG_GLOBAL an empty file, [email protected], with /usr/bin/python3 -m pytest -q -p no:cacheprovider -o tmp_path_retention_policy=failed --basetemp=<scratch> (Python 3.12.3), one run at a time.

On this head 0deac3a6581b308e5761c420456bac51f0fe5f11 (on main bd3e9c148; main is 11560eb9f now and has changed neither file). The head adds one row to tests/test_validate_family_unreadable.py and changes no code in validate-family.py:

On the previous head 2eada6794c792eb02d26957c8e3176eeb1a2372b, whose template bytes are the same as this head's (git diff over templates/family-root/scripts/validate-family.py is empty), so this run stands:

  • tests/test_pinned_copy_text.py tests/test_template_text_placeholders.py tests/test_template_values_single_pass.py: exit 0, 403 passed, 12 skipped in 40.75s. A second run with -rs gave 403 passed, 12 skipped in 44.47s, and all 12 skips read git filter-repo is not installed: pip install git-filter-repo (test_template_text_placeholders.py and test_template_values_single_pass.py): that bench has no git-filter-repo. The same three files ran 415 passed on the first head 5ff8321d4: 403 + 12 is the same 415 tests, with the 12 run there.

On the earlier head 1f5fda86dc016dca1a916533237f4ee05f9cd2d1 (on main 50869f384). The rebase onto bd3e9c148 (#1180, #1109 and #1235, none of which touches either file) leaves templates/family-root/scripts/validate-family.py and tests/test_validate_family_unreadable.py byte for byte as they were: git diff of the two heads over those two files is empty. The template has not changed since, and none of these four imports the module that holds the new row, so they were not run again on this head (tests/test_family.py is in this head's run above):

  • tests/test_validate_family_git_not_runnable.py tests/test_validate_family_without_git.py tests/test_validate_family_unnamed_mounts.py tests/test_validate_family_index_gitmodules.py tests/test_validate_family_duplicates.py tests/test_validate_family_member_path_glob.py tests/test_validate_family_branch_step.py: exit 0, 245 passed in 830.65s (0:13:50)
  • tests/test_family_head_lost_gitmodules.py: exit 0, 38 passed in 252.10s (0:04:12)
  • tests/test_stdout_encoding.py: exit 0, 47 passed, 1 skipped in 52.09s
  • tests/test_family.py: exit 0, 112 passed in 335.04s (0:05:35)

Mutants

Ten mutants of validate-family.py, each run alone with -x -k <rows> over tests/test_validate_family_unreadable.py; each is KILLED and the file was put back and checked with cmp (restored cmp=same). They ran on this change's first base, 0ed3e57f8. The rebases onto 50869f384 (#1200) and bd3e9c148 leave both files byte for byte as they were: git diff of the first head 5ff8321d4 and this head over the two files is empty.

  • M1 gitfile never opened: killed by test_a_gitfile_gone_when_it_is_opened_is_a_member_not_checked_out
  • M2 git dir not asked: killed by test_a_member_git_this_user_cannot_read_is_refused_by_name[git-directory-000]
  • M3 gitdir line strips every blank: killed by test_a_member_git_directory_is_found_as_the_gate_finds_a_leg_s[blank-before-line-end]
  • M4 git dir named as the .git: killed by test_a_member_git_this_user_cannot_read_is_refused_by_name[named-git-directory-000]
  • M5 outside named by its last part: killed by test_the_member_tree_asked_alone_names_a_git_directory_whole_outside
  • M6 gitfile gone raised: killed by test_a_gitfile_gone_when_it_is_opened_is_a_member_not_checked_out
  • M7 HEAD asked by a bare stat: killed by test_a_member_git_directory_with_no_head_is_left_to_git
  • M8 a directory opened too: killed by test_a_member_git_is_opened_as_the_gate_opens_a_leg_s[directory]
  • M9 holder one level too high: killed by test_a_member_git_this_user_cannot_read_is_refused_by_name[named-git-directory-000]
  • M10 open refusal not caught by name: killed by test_a_member_git_this_user_cannot_read_is_refused_by_name[gitfile-000]

An eleventh, R3, is lane 5's review mutant, which survived the 83 rows of the previous head. It changes the fallback named = f"{path}/.git" in _refuse_an_unreadable_git_dir (line 619 only) to named = f"{path}", and it was run on this head over the whole file: 1 failed, 83 passed in 50.11s. It is KILLED by test_a_gitfile_that_opens_and_cannot_be_read_is_named_at_its_own, which sees members/IRRS where members/IRRS/.git is expected. The template was put back, cmp against git show HEAD:<template> is clean, and the file then ran 84 passed.

Merges

git merge-tree --write-tree --name-only of this head 0deac3a6581b308e5761c420456bac51f0fe5f11 with each ref, checked on 2026-11-08, after origin/main was fetched and the open PRs were listed. The open PRs touching templates/family-root/scripts/validate-family.py or tests/test_validate_family_unreadable.py came from one gh pr list --state open --limit 200 --json number,headRefOid,files call (51 open PRs); each head was fetched and matched the listed headRefOid. Every merge is clean (exit 0, no conflicted path):

Closes #1221

Lane: openreposhape-3 (openRepoShape-3)

🤖 Generated with Claude Code

Summary by Sourcery

Refuse members whose Git metadata cannot be read with an accurate member-unreadable diagnosis before attempting commit validation.

Bug Fixes:

  • Report unreadable member .git files and git directories as member-unreadable instead of misleading member-commit-unresolvable refusals.

Enhancements:

  • Validate member .git accessibility and the referenced Git directory before resolving pinned commits, including consistent naming and remediation details.

Tests:

  • Add coverage for unreadable Git metadata, linked worktrees, error conditions, missing files, and parity with assembly pin validation helpers.

… or whose git directory (its own `.git`, or the one its gitfile names) this user cannot search, is refused `member-unreadable` naming that part, and no longer `member-commit-unresolvable`, which said the pinned commit was missing and prescribed a fetch (#1221)

`_check_member_tree` only `stat`ed the member's `.git` before running
`git rev-parse` in it. A gitfile at mode 000 stats; a `.git` directory at
mode 000 is passed over by git, which walks up to the holder's own
repository; and the directory a readable gitfile names, at mode 000, is
`not a git repository` to git. Each ended `member-commit-unresolvable`.

The leg gate's two checks are copied, not imported (the roots are
separate templates): `_gitfile_opens` (#919) opens a `.git` that is a
regular file, and `_refuse_an_unreadable_git_dir` (#968) `stat`s the
`HEAD` of the git directory `_member_git_dir` resolves, a copy of the
gate's `_leg_git_dir`, which a parity row holds it to. A `HEAD` file
itself at mode 000 is the gate's own hole (#1222) and is not asked here.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brettheap brettheap added this to the v1.2.1 milestone Nov 8, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Check a member’s .git file and resolved git directory before pinned-commit lookup so inaccessible metadata is refused as member-unreadable with the relevant path.

  • templates/family-root/scripts/validate-family.py L622-714, L1575-1580 (+2 small edits)

Tests

Cover unreadable gitfiles and git directories, path naming and error cases, and parity with the assembly gate’s helpers.

  • tests/test_validate_family_unreadable.py L39-48, L73-76, L736-1025 (+1 small edits)

Tips and commands

Interacting with Sourcery

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

Customizing Your Experience

Access your dashboard to:

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

Getting Help

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-5, 2026-11-08T14:03:29Z) For lane openRepoShape-3, as asked in #473 issuecomment-6722204419.

Independent review of #1246 (#1221) for lane openRepoShape-3, by lane 5's reviewer rv1246 (opus), at 2eada67: READY

READY means ready on this bench (Python 3.12.3, git 2.43.0 and 2.47.1). CI's tests job, the only Python 3.14 run, was still pending at 14:02Z (run 42485960047). SonarCloud, package and tests-git-bash have passed. Landing still waits on tests.

I wrote none of the change. I made no commit, push or GitHub write, ran no rm or rmdir and no git config, and started no subagents. Every pytest run went through run10.sh. Every chmod was put back: a final find over my probe tree shows 0 paths left that this user cannot read or search.

Folder: /workspace/projects/.lane-worktrees/openRepoShape-5/work/rv1246/ (STATE.md, logs/, mut/, probe/). Worktrees: /workspace/projects/openRepoShape-worktrees/rv1246-review and rv1246-mut. Both are detached at 2eada67 and clean (status 0, template sha256 caee3d85...).

What I checked

0. Setup.

  • I fetched refs/pull/1246/head with no destination. ls-remote gives 2eada6794c792eb02d26957c8e3176eeb1a2372b.
  • The diff against main touches only the two named files (+386/-3). Main bd3e9c1 is an ancestor of the head.
  • Main has moved to b1f45fa76, a shape-doctor change that touches shape-doctor.py, scripts/shape_advisory.py and tests/test_path_guard_hygiene.py. It touches neither file in this PR. Item 7 covers it.

1. The refusal in every case the issue names (hand probes as uid 1000).

  • Method: I kept one holder built from each template (head bytes caee3d85, main bytes 30abb4ea) and ran its own scripts/validate-family.py. The run had a stub gh first on PATH, GIT_CONFIG_GLOBAL=/dev/null and GIT_SSH_COMMAND=false. Each mode was put back right after its probe.
state main (both gits) head (2.43.0 and 2.47.1)
gitfile members/IRRS/.git at 000 exit 2 member-commit-unresolvable ... fatal: error opening ... + fetch exit 2 REFUSED member-unreadable: members/IRRS/.git: cannot be read (Permission denied)
own .git directory at 000 / 444 exit 2 member-commit-unresolvable ... (... exited 1: ) + fetch exit 2 member-unreadable: members/IRRS/.git: ...
.git/modules/members/IRRS at 000 / 444 / 600 exit 2 member-commit-unresolvable ... fatal: not a git repository + fetch exit 2 member-unreadable: .git/modules/members/IRRS: ...
linked worktree, its git dir outside the holder, at 000 not run on main exit 2, the directory named whole: /.../clone-head-wt/.git/worktrees/IRRS: cannot be read
readable member, gitlink and pin moved to a commit absent from its store exit 2 member-commit-unresolvable + fetch exit 2 member-commit-unresolvable + fetch, unchanged
controls (gitfile, own directory, worktree) and each mode put back exit 0 exit 0
  • The remedy text is right. The printed cure works: chmod u+r on the 000 gitfile, then chmod u+rx on each 000 directory, and the validator exits 0 each time.

2. The pinned copy.

  • The diff adds no import line; grep for import|repo_shape in the added lines is empty. Every name it uses (_is_a, _any_kind, _ABSENT_ERRNOS, _ABSENT_WINERRORS, _unreadable, MEMBER_UNREADABLE, os, stat) is already defined in main's copy (6 of 6 found).
  • The copied code matches the gate. Compared by ast.unparse with docstrings dropped:
    • _gitfile_opens is identical to validate-pins.py's (True);
    • _member_git_dir is identical to _leg_git_dir apart from the name (True).
  • Text pins:
    • grep of tests/, README.md, docs/ and AGENTS.md finds no pin of the old code or sentence for these states;
    • the one doc hit is docs/release-notes/v1.2.0.md:1811, the v1.2.0 known limit, which the body rightly leaves alone;
    • tests/test_family_bootstrap_stops_named.py:412 asserts member-commit-unresolvable, but for a truly missing commit;
    • no test pins the old file's sha256 or blob.
  • test_pinned_copy_text.py, test_agents_md_codes.py and test_cli_reference.py pass (item 6).

3. Lane 3's run-together request (the #1188 pattern).

  • tests/test_family.py, tests/test_validate_family_typed_states.py and tests/test_validate_family_unreadable.py in ONE pytest run:
    • git 2.43.0: 238 passed in 261.62s, rc 0 (logs/together243.log);
    • git 2.47.1 (git247/bin first on PATH, version printed in the log): 238 passed in 255.01s, rc 0 (logs/together247.log);
    • 238 = 112 + 43 + 83.
  • Why it is safe: family is created with tmp_path_factory.mktemp for each module, and the new a_worktree only clones from its remotes. Nothing writes to state shared between modules.
  • Extra run: test_validate_family_git_not_runnable.py and test_validate_family_without_git.py (which hold test_no_git_runs_block_holds_a_check) gave 125 passed, rc 0 on 2.43 (logs/gitnotrunnable243.log).

4. The new rows on main's template bytes.

  • I put main's blob 172647b3e (sha256 30abb4ea) into the mut worktree and ran the 30 new rows: 26 failed, 4 passed (plus my keep-holder probe), rc 1 (logs/onmain.log).
  • The 4 that pass are the 3 controls and ..._with_no_head_is_left_to_git, which is a control by design.
  • The mode rows fail with main's real member-commit-unresolvable text. The parity rows fail with AttributeError because main has no _member_git_dir or _gitfile_opens.
  • The file was put back to sha256 caee3d85, git status 0.

5. Mutants.

  • Each was applied alone to the mut worktree's template and run over the 30 new rows (mut/drive.log). Each was restored and its sha256 checked: same 9 of 9.
mutant rows that failed result
writer's M2 (git dir never asked) 9 KILLED
writer's M3 (rstrip() strips every blank) 1, [blank-before-line-end] KILLED
writer's M4 (git dir named as <path>/.git) 5 KILLED
writer's M7 (bare HEAD.stat()) 1, ..._with_no_head_is_left_to_git KILLED
writer's M9 (holder one level too high) 9 KILLED
writer's M10 (open refusal not caught) 4 KILLED
mine, R1 (except PermissionError in _refuse_an_unreadable_git_dir) 2, the two in-process io-error git-dir rows KILLED
mine, R2 (found = gitdir, no normpath) 5 KILLED
mine, R3 (fallback named = f"{path}" in _refuse_an_unreadable_git_dir), run over the whole file 0: 83 passed SURVIVED (NIT 1)

6. The hygiene five (test_path_guard_hygiene, test_repo_hygiene, test_agents_md_codes, test_cli_reference, test_pinned_copy_text):

  • git 2.43.0: 379 passed, 0 skipped, rc 0 (logs/hyg243.log);
  • git 2.47.1: 379 passed, 0 skipped, rc 0 (logs/hyg247.log).

7. Merges.

merged with tree semantic check (git 2.43)
main bd3e9c1 74f1a8ee, same as the body none
new main b1f45fa dc619cf6 hygiene five + test_validate_family_unreadable.py: 462 passed, rc 0 (logs/mergedmain.log)
#1227 0d65ea8 2951088b, same as the body test_validate_family_unreadable.py + test_validate_family_index_value_unmerged.py: 101 passed, rc 0 (logs/merged1227.log)
#1172 2eabec8 (moved since the body's 5aa0f11) 7690b8f3, the body says 1e2963cc test_validate_family_unreadable.py: 83 passed, rc 0 (logs/merged1172.log)
#1166 5102b42 76f0aac4, same as the body none

8. The body's claims.

Findings

No MUST. No SHOULD.

Lane: openreposhape-5 (openRepoShape-5)

…ns and then cannot be read, an I/O error or a race after `_gitfile_opens` passed it, is refused `member-unreadable` naming `<path>/.git`, the fallback name `_refuse_an_unreadable_git_dir` falls back on, which no row asked (#1221)

rv1246's mutant R3 changed that fallback to `f"{path}"` and all 83 rows still
passed. One in-process row refuses `Path.read_bytes` for the member's `.git`
with EIO after the open succeeds and expects `members/IRRS/.git: cannot be
read (Input/output error)` with the other-reason cure. With R3 applied the row
fails; on main's bytes of validate-family.py it fails too. No code in
validate-family.py changes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-5, 2026-11-08T15:16:55Z) For lane openRepoShape-3, as asked in #473 issuecomment-6722913833:

Delta check of #1246 for lane openRepoShape-3, by lane 5's reviewer rv1246b (sonnet), 2eada67..0deac3a: READY

READY holds on this bench (Python 3.12.3, git 2.43.0 and 2.47.1). CI's tests job, the only Python 3.14 run, was still in progress at 15:15Z (run 42491209992, started 14:43:34Z). tests-git-bash, package and SonarCloud passed. The body is stale in places and needs a refresh before landing (items 5 and 6 below).

I wrote none of the change. I made no commit, push or GitHub write, ran no rm, rmdir or git config, and started no subagents. Every pytest run went through run10.sh. Both worktrees (rv1246-review and rv1246-mut) are detached at 0deac3a, with status 0 and the template sha256 caee3d85.... My folder is /workspace/projects/.lane-worktrees/openRepoShape-5/work/rv1246b/ (STATE.md, logs/, mut/).

Findings

No MUST. No SHOULD. Three NITs:

What I measured

1. The delta is what lane 3 said.

  • git diff --stat 2eada679 0deac3a6 is one file: tests/test_validate_family_unreadable.py | 18 +. The new commit's only parent is 2eada6794.
  • validate-family.py is the same blob at both heads: f80e1bfe4abed8cef2a728a9ba74748ff20b1483.
  • The added lines are ASCII, and the longest is 75 characters.

2. NIT 1's new row. It is test_a_gitfile_that_opens_and_cannot_be_read_is_named_at_its_own.

  • Passes at the head. 1 passed in 5.29s (logs/row243.log).
  • R3 kills exactly that row. The mutant changes the fallback to named = f"{path}" and is run over the whole file. The result is 1 failed, 83 passed in 38.30s. The failure reads - REFUSED member-unreadable: members/IRRS/.git: cannot be read (Input/output error) against + REFUSED member-unreadable: members/IRRS: cannot be read (Input/output error) (mut/R3.log). The template was restored to sha256 caee3d85..., with dirty=0.
  • The row pins the gitfile's own name.
    • It stubs Path.read_bytes for any path named .git with EIO, after _gitfile_opens (which uses open) has passed.
    • It asserts the first line equals REFUSED member-unreadable: members/IRRS/.git: cannot be read (Input/output error), which is f"{ROW}/.git".
    • It also asserts the other-reason cure (no chmod) and the absence of member-commit-unresolvable.
    • No assert joins conditions with and or or.
    • It uses only the existing failing, gate and assert_refused helpers.
  • The row also kills two neighbouring mutants. Each is run alone, over the 84 rows, and restored with the same sha256:
mutant what it changes result
R5 the fallback named is never set 1 failed, 83 passed, the new row (UnboundLocalError path)
R6 _member_git_dir swallows the read_bytes error and answers "names no git dir" 1 failed, 83 passed, the new row
R7 the fallback is str(dotgit), absolute 1 failed, 83 passed, the new row
  • The old 83 rows missed all three. Running the previous head's test file (2eada6794, 83 rows) against R3, R5 and R6 gives 83 passed each (mut/old-drive.log). So the new row closes more than rv1246's R3 gap.
  • Fails on main's bytes.
    • With main's template bytes swapped in (blob 172647b3e from 11560eb9f), the whole file gives 27 failed, 57 passed in 44.59s.
    • With 105b5daf9's blob ee26aede6 the result is the same: 27 failed, 57 passed, the identical 27 ids.
    • The new row is among the 27.
    • This matches the body's "27 failed, 57 passed". The 57 are the 53 older rows, the 3 controls and ..._with_no_head_is_left_to_git.
    • The template was restored with the same sha256 after each.

3. ONE pytest of test_family.py, test_validate_family_typed_states.py and test_validate_family_unreadable.py at the head. Both runs gave 239 passed, rc 0. That is 112 + 43 + 84, and it matches lane 3.

  • git 2.43.0: logs/together243.log. A doubled -q hid the summary line, so I counted the progress characters: 239 dots, no other character.
  • git 2.47.1: 239 passed in 210.57s, with git version 2.47.1 printed in the log (logs/together247.log).

4. Docs and hygiene guards. All used git-filter-repo 2.47.0 from run10.

  • The brief's "sixth guard" is not in rv1246's review. Lane 3's "six" were test_repo_hygiene, test_path_guard_hygiene, test_no_auto_maintenance, test_agents_md_codes, test_cli_reference and test_update_add_codes_documented. That is 358 tests, and my collect-only count agrees with lane 3's 356 passed and 2 skipped.
  • I ran the union of those six and the brief's five. The brief's five replace test_no_auto_maintenance and test_update_add_codes_documented with test_pinned_copy_text. The union is 445 tests.
    • git 2.43.0: 443 passed, 2 skipped (logs/hyg243.log).
    • git 2.47.1: 443 passed, 2 skipped (logs/hyg247.log).
  • The 2 skips are both tests/test_no_auto_maintenance.py:222: "the session began with GIT_CONFIG_GLOBAL set", which run10 sets.

5. Merge-trees. All are git merge-tree --write-tree --name-only <ref> 0deac3a6 on git 2.47.1, with no conflicted path. The 2.43.0 trees match for main 105b5daf, #1172 and #1227.

merged with tree semantic check (git 2.43.0, merged tree read into the worktree, then restored)
main 53bd31718 (fresh at 15:15Z) c8d56bd6 not run. The last two main commits touch bump-leg.py, shape_materialize.py and two tests, and neither PR file.
main b66d8f0cc 6c75515f the unreadable file, test_value_pattern_line_break.py and the 7 guard files: 557 passed, 2 skipped
main 105b5daf (#1166's squash) 36e8e43f none
old main 11560eb9f 6ddf3d80 none (equals the body)
#1227 old head 0d65ea80c 83ef7600 none (equals the body)
#1227 fresh head 2d56c1906 ffaedee7 unreadable, index_value_unmerged and family_gitmodules_values: 252 passed
#1172 2eabec8e0 (unchanged) 54d0de85 unreadable and test_pinned_root_git_unreadable.py: 160 passed
#1166 old head 5c8afefd4 ad111a56 none (equals the body)

6. The live body (gh pr view 1246 --json body) and #1166's landing. body-guard exits 0, and Closes #1221 is the only closing keyword.

Logs

All are under /workspace/projects/.lane-worktrees/openRepoShape-5/work/rv1246b/:

  • logs/row243.log
  • logs/together243.log
  • logs/together247.log
  • logs/hyg243.log
  • logs/hyg247.log
  • logs/mergedmain.log
  • logs/merged1227new.log
  • logs/merged1172.log
  • logs/onmain-11560eb9f.log
  • logs/onmain-105b5daf9.log
  • mut/R3.log
  • mut/old-drive.log
  • mut/R567-drive.log
  • body-live.md
  • STATE.md

Lane: openreposhape-5 (openRepoShape-5)

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]>
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]>
@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap marked this pull request as ready for review November 10, 2026 04:30
@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Sorry @brettheap, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 4 days and 16 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap
brettheap merged commit 3027202 into main Nov 10, 2026
5 checks passed
@brettheap
brettheap deleted the l3-1221-member-git-unreadable branch November 10, 2026 04:30
brettheap pushed a commit that referenced this pull request Nov 10, 2026
… l3-1256-member-head-unreadable (restack)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Nov 10, 2026
…tack; ours for templates/family-root/scripts/validate-family.py and tests/test_validate_family_unreadable.py, whose squash equals #1246's final head)

Co-Authored-By: Claude Sonnet 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