Skip to content

validate-pins.py: a leg git directory's HEAD this user cannot open, under .git/modules/<leg> or in a .git directory, is refused pin-submodule-unreadable by name, where it ended pin-commit-unresolvable (#1222) - #1239

Merged
brettheap merged 3 commits into
mainfrom
l3-1222-gate-head-unreadable
Nov 10, 2026

Conversation

@brettheap

@brettheap brettheap commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Goal

#1222, the gate half: a leg whose git directory's HEAD file this user cannot open is refused by name, pin-submodule-unreadable, by validate-pins.py, so the gate no longer says the pinned commit is missing. The doctor half follows in #1248, now that #1200 has landed (50869f38); see "What the doctor half will need".

What changed

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

It is RV1200's N2, from the review of #1200. One script, templates/assembly-root/scripts/validate-pins.py, and its test file: 2 files, +111 and -4 lines against e04826db.

  • _refuse_an_unreadable_git_dir asked the HEAD of a leg's git directory only by stat (validate-pins.py and repo_shape.py after #919: gh's stderr that is not UTF-8 ends in a traceback, a leg's git directory this user cannot read is called an unresolvable pin with no reason, and two gh details still name the repository raw #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 pin-commit-unresolvable under THE LOCKSTEP RULE.
  • After that stat, a HEAD that is there is now opened by _gitfile_opens, the gate's validate-pins.py and repo_shape.py: --root and gh's stderr are printed raw, a non-file in a pin's place is called absent, and a leg's .git gitfile at mode 000 passes #919 open of a gitfile, so it is opened the same way:
    • 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;
    • a refused open is pin-submodule-unreadable, <HEAD>: cannot be read (<reason>), naming the file (.git/modules/spec/HEAD or spec/.git/HEAD), with the leg checkout's remedy and the advice for the cause, as the gate refuses an unreadable git directory today.
  • Unchanged:
    • a refused stat of HEAD still names the git directory (.git/modules/spec, spec/.git);
    • a git directory with no HEAD is still left to git;
    • a gitfile that names no directory is still left to git;
    • a gitdir: line that holds a NUL is still left to git: its HEAD is nothing there, as _is_there answers it.
  • Decided here:
    • _gitfile_opens is reused rather than renamed or copied. Its docstring now says it also asks a git directory's HEAD. A rename would move lines that other lanes' PRs may call, and a copy would repeat its body.
    • The open sits behind if _is_there(head):. The NUL row pins that guard: without it, a ValueError ends the run (mutant m5).
  • The docstrings of _gitfile_opens, _refuse_an_unreadable_git_dir and _check_pin_digest say all of this, and so does the test module's docstring.
  • It is a pinned copy. Holders see an upstream-changed row for scripts/validate-pins.py on their next update-shape.py check. A grep of tests/ found no byte pin or digest pin of this file's bytes. No file holds a 64-hex digest beside its name. test_pin_source_env_collisions.py compares the copy with a blob it reads when it runs. The gate's six test files and the docs guards were run (below).

Measured before the change

Python 3.12.3, git 2.43.0, uid 1000. Every run was offline: a stub gh (exit 97) first on PATH, GH_TOKEN=bogus, an empty GH_CONFIG_DIR, GIT_SSH_COMMAND=false and GIT_CONFIG_GLOBAL=/dev/null. The projects are the test harness's real scaffolds (project), kept by one run with -o tmp_path_retention_policy=all. The gate was run as python3 scripts/validate-pins.py in the project, with the bytes at main (e04826db) and then this branch's.

Leg HEAD at 000 main e04826db this branch
gitfile leg .git/modules/spec/HEAD REFUSED pin-commit-unresolvable: spec: the pinned commit 1f482c9f... is not in that submodule's object store (... exited 128: fatal: not a git repository: .../Atlas/spec/../.git/modules/spec), then the lockstep remedy. Exit 2. REFUSED pin-submodule-unreadable: .git/modules/spec/HEAD: cannot be read (Permission denied), then the leg checkout's remedy and the permission advice. Exit 2.
.git-directory leg spec/.git/HEAD REFUSED pin-commit-unresolvable: spec: the pinned commit 1f482c9f... is not in that submodule's object store (... exited 1: ). Exit 2. Git, which cannot read that HEAD, passes over spec/.git and walks up to the root's repository: git -C spec rev-parse --show-toplevel printed the root. REFUSED pin-submodule-unreadable: spec/.git/HEAD: cannot be read (Permission denied), with the same remedy. Exit 2.

With HEAD readable, this branch's gate exits 0 on both projects. Main's bytes exit 1 there, with one finding, shape-copy-drift for scripts/validate-pins.py. That finding comes from the probe, not from main: the projects were scaffolded from this branch's template, and the probe swapped main's bytes in.

The new rows were also run at main's gate before the change: 6 failed and 4 passed. The 2 mode rows got pin-commit-unresolvable, and the 4 in-process rows ended DID NOT RAISE Refusal. The 4 rows that passed are the controls.

Tests

tests/test_validate_pins_spelled_and_named.py, +91 lines: 5 functions and 10 rows (116 collected at this head, 106 at main), beside #968's rows.

  • test_a_leg_git_directory_head_this_user_cannot_open_is_refused ([gitfile-leg], [git-directory-leg]): the issue's two shapes, at mode 000, run as a project runs the gate. The control comes first: readable, the same leg passes, exit 0. Then exactly one pin-submodule-unreadable naming the HEAD, with the remedy and the permission advice, exit 2, and nothing written. Skipped as root and on Windows (CANNOT_RUN_AS_ROOT).
  • test_a_leg_git_directory_head_whose_open_is_refused_is_refused_everywhere: the in-process stand-in for those hosts. Both shapes, with the open of HEAD refused for permission and for an I/O error, each with its own advice.
  • test_a_head_gone_when_it_is_opened_is_left_to_git: an open that finds nothing is no refusal, and the run finds nothing.
  • test_a_head_that_is_no_regular_file_is_not_opened ([directory], [fifo]): an open of either fails the row rather than hanging it.
  • test_a_head_no_system_call_can_name_is_left_to_git: a gitdir: line that holds a NUL (built with chr(0)).
  • validate-pins.py and repo_shape.py after #919: gh's stderr that is not UTF-8 ends in a traceback, a leg's git directory this user cannot read is called an unresolvable pin with no reason, and two gh details still name the repository raw #968's test_a_leg_git_directory_with_no_head_is_left_to_git passes unchanged.

Every pytest ran under the stub gh above, with [email protected], /usr/bin/python3 -m pytest -q -p no:cacheprovider --basetemp=<scratch>/bt-<name> -o tmp_path_retention_policy=failed, one at a time:

shape-doctor.py is not changed, so tests/test_shape_doctor.py was not run.

Mutants

Each mutant was applied to the template, then the gate's leg rows were run (-k "head or no_head or git_directory or gitfile or no_system_call"). The file was then restored, and cmp with the saved good copy was clean each time.

Mutant Result
m1 the open dropped (_gitfile_opens(head) deleted) KILLED: both mode rows and all 4 in-process rows fail
m2 the refusal names the git directory, not its HEAD KILLED: the same 6 rows fail
m3 HEAD opened whatever it is, with head.open("rb") in place of _gitfile_opens KILLED: the gone-at-open row and both no-regular-file rows fail
m4 the open asked with no _is_there guard, as a direct open KILLED: the same 3 rows fail
m5 the if _is_there(head): guard made a bare statement, with the open kept KILLED: the NUL row fails with ValueError: embedded null byte

Merges

git merge-tree --write-tree of this head (fff42145) with:

What the doctor half will need (it follows in #1248, now that #1200 has landed)

At #1200's head, mount_read asks is_a(gitdir / "HEAD", lambda _mode: True), which is a stat and the gate's old check. To mirror this gate:

  • Where that HEAD is there, name it as the gate does, after its mount, with git_dir_named(root, rel, gitdir / "HEAD"): spec: .git/modules/spec/HEAD, or spec/.git/HEAD.
  • Open it only where it is a regular file, as _gitfile_opens does. An open that finds nothing stays git's. A refused open is cannot_be_read(<that name>, exc).
  • The doctor has no open helper of that shape yet, so it needs one. git_dir=False (leg shape files) still asks nothing.
  • tests/test_doctor_unreadable_paths.py then needs:
    • two GIT_DIR_CELLS: .git/modules/spec/HEAD at 000, named spec: .git/modules/spec/HEAD, and spec/.git/HEAD at 000 on the own-directory leg, named spec/.git/HEAD. The legs and members rows read INVALID with the gate's line and not DRIFTED, and placement does not say "not a git repository";
    • an in-process row with the open of HEAD refused;
    • the parity row, which runs the gate's _refuse_an_unreadable_git_dir and the doctor's mount_read over the same HEAD-open-refused shape and asserts that the doctor's line ends with the gate's detail, as the directory's parity row does now;
    • the no-regular-file and gone-at-open controls.

Out of scope

Part of #1222

Lane: openreposhape-3 (openRepoShape-3)

🤖 Generated with Claude Code

Summary by Sourcery

Distinguish unreadable submodule git-directory HEAD files from genuinely unresolved pinned commits during pin validation.

New Features:

  • Report unreadable submodule git-directory HEAD files as pin-submodule-unreadable with the specific HEAD path and applicable remediation.

Bug Fixes:

  • Prevent permission-denied HEAD files from being misreported as unresolved pinned commits.

Enhancements:

  • Handle missing, non-regular, and unnameable HEAD paths by preserving Git's existing responsibility for those cases.

Tests:

  • Add coverage for unreadable HEAD files in both submodule git-directory layouts, filesystem and in-process failures, disappearing files, non-regular files, and NUL-containing gitfiles.

… under `.git/modules/<leg>` or in a `.git` directory, is refused `pin-submodule-unreadable` by name, where it ended `pin-commit-unresolvable` (#1222)

`_refuse_an_unreadable_git_dir` asked the `HEAD` of a leg's git directory
only by `stat`, which a `HEAD` at mode 000 passes, so git, which could not
read it, ended the run in `pin-commit-unresolvable` under THE LOCKSTEP
RULE. A `HEAD` that is there is now opened as `_gitfile_opens` opens a
gitfile: only where it is a regular file, and an open that finds nothing
is a git directory with no `HEAD`, left to git. One this user cannot open
is named, `.git/modules/spec/HEAD` or `spec/.git/HEAD`, with the leg
checkout's remedy.

The gate half of #1222; the doctor half waits for #1200.

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

sourcery-ai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Reuse the gitfile readability check for a leg git directory’s regular HEAD, reporting an unreadable file by its HEAD path while leaving missing or unnameable paths to Git; document the behavior at the helper and call site.

  • templates/assembly-root/scripts/validate-pins.py L408-411, L464-473, L479-482 (+1 small edits)

Tests

Document the regression and cover unreadable HEAD files in both git-directory layouts, plus missing-at-open, non-regular, and unnameable-path controls.

  • tests/test_validate_pins_spelled_and_named.py L46-53, L922-1004

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-3, 2026-10-24T14:41:31Z) RV1239, independent review of #1239 at fff4214 (Claude Opus 5.5): READY for the code. Two body edits are needed before landing; they are not commits.

Measured with my own probe. Each tree's gate ran in a project scaffolded by that tree, 45 s timeout. Main 50869f3 against this head:

  • HEAD at 000, gitfile leg and .git-directory leg: main pin-commit-unresolvable, exit 2. Head: pin-submodule-unreadable, ".git/modules/spec/HEAD: cannot be read (Permission denied)" or "spec/.git/HEAD: ...", exit 2.
  • A symlink HEAD to a file at 000 is now refused by name too.
  • Unchanged from main: a HEAD that is a directory, a dangling symlink (exit 0 when it points into refs/), no HEAD, a git directory at 000, and a readable leg (exit 0).
  • A FIFO HEAD hangs at main AND at this head (exit 124 at 45 s). The hang is git's own open of HEAD; git_out has no timeout. Not a regression and not this PR, but it wants a follow-up issue.
  • As root (sudo, a scratch safe.directory config), HEAD at 000 exits 0 at main and here: root keeps its old answer. The new rows as root: 11 passed, 2 skipped (the mode rows, CANNOT_RUN_AS_ROOT).

Tests at the head: the 27 leg rows passed; test_path_guard_hygiene, test_repo_hygiene and test_no_auto_maintenance gave 280 passed, 2 skipped (test_no_auto_maintenance.py:222, GIT_CONFIG_GLOBAL set). The full six gate files were not re-run (window).
Mutants, my own script, each restored and cmp-clean: k1 open dropped, k2 the directory named not its HEAD, k3 HEAD named before its stat, k4 a gone HEAD treated as refused, k5 no regular-file guard. All KILLED.
Pinned copy: no byte or digest pin of validate-pins.py in tests/ or anywhere in the merged tree.
Merge-tree clean against main 50869f3 (77d9529a) and #1147 569ea05, #1172, #1159, #1144, #1109, each against the head and against main+head.
Sonar: gate OK, 0.0% duplication, 0 issues. CI: 4/4 green on fff4214 (from before #1200 landed).

Doctor parity: on main+head, tests/test_doctor_unreadable_paths.py gave 68 passed. Yet with HEAD at 000 the gate refuses .git/modules/spec/HEAD while the doctor's mount_read answers (True, True, None). The parity rows do not catch that split. The doctor half must:

Body:
B1 strip the "Summary by Sourcery" block after the robot line.
B2 #1200 has landed (50869f3): update "waits for #1200", "(after #1200 lands)", main 0ed3e57 -> 50869f3, and #1147 b75babe -> 569ea05.
N1 the new rows are 10, not 11 (116 at the head, 106 at main).
N2 the 2 hygiene skips are test_no_auto_maintenance.py:222.

Lane: openreposhape-3 (openRepoShape-3)

brettheap pushed a commit that referenced this pull request Nov 8, 2026
…e its `stat` passes, as the gate does, so a root `HEAD` at mode 000 is `.git/HEAD: cannot be read (<reason>)` and `INVALID (pins)`, never `no gitlink recorded` and DRIFTED (rv1248's S1, N3, N4) (#1222)

S1 (rv1248's SHOULD, a MUST on a main that holds #1147). #1147's
`root_git_read` asked the root's `HEAD` by `stat` alone. A `HEAD` at mode
000 stats, so git could not read the root, the `legs` row said `no gitlink
recorded` of each leg and the verdict was `DRIFTED (1 leg(s) not at the
pin)`, while `validate-pins.py` (`_refuse_an_unreadable_root`, through
`_refuse_an_unreadable_git_dir` with #1239's open) refused
`git-repo-unreadable: .git/HEAD: cannot be read (Permission denied)`: the
#1146 defect again. `root_git_read` now names `HEAD` once its `stat` finds
it and opens it through `regular_file_opens`, only where it is a regular
file. A refused open is the root's line, so no gitlink is read and no leg is
compared with its pin, and the verdict is `INVALID (pins)`. A refused
`stat` still names the git directory; an absent `HEAD`, one gone at the
open, a directory and a FIFO are left to git as before. `named` starts from
the root's `.git` path, so `.git/HEAD` is spelled relative to the root, in
POSIX, on every platform, as the gate's `_named` spells it.

N3. `regular_file_opens` keeps its False/True answer, and its docstring now
says why: its two callers (`mount_read`, `root_git_read`) ask it only for
its raise, but it is the gate's `_gitfile_opens`, whose answer the gate
reads of a leg's gitfile (`initialized`, #919), so one question keeps one
answer in both files for any later caller here. A new parity row holds the
two to the same answer for each shape, so rv1248's m11 is no longer an
equivalent mutant.

N4. The leg parity row's `HEAD_SHAPES` gains a `HEAD` that links to a file
at mode 000, and a new row asks #1239's NUL `gitdir: ` line of both parity
pairs (a leg's gitfile, the root's gitfile): neither tool refuses it.

Rows: in `tests/test_root_git_unreadable.py`, the root `HEAD` at 000 (a mode
row, doctor and gate, COMPLIANT once put back), its open refused in process
for a permission and an I/O error (doctor and gate, each with its advice),
three open rows in the doctor-and-gate sentence row (the git directory, and
a gitfile naming one inside and outside the root), a `HEAD` gone at the
open, and a directory `HEAD` among the absent controls. In
`tests/test_doctor_unreadable_paths.py`, the parity row of `root_git_read`
against `_refuse_an_unreadable_root` over three root layouts and nine `HEAD`
shapes, the NUL row, and the `regular_file_opens` parity row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 9, 2026
…ose `.git` this user cannot read is refused `git-repo-unreadable`, exit 2, not a traceback or `not-a-git-repo`, and the doctor's `members` row names it once, never drift (#1148) (#1172)

The root's own `.git` is read by `find_repo_root` in four pinned tools: the assembly root's `scripts/bootstrap.py`, and the family holder's `validate-family.py`, `bootstrap.py` and `siblings.py`. When this user cannot read that `.git`, as a link into a folder at mode 000 or a `.git` directory at mode 000, they answered with a `PermissionError` traceback (3.12), or `not-a-git-repo` (from 3.14, where `is_file` and `exists` answer False to any `OSError`), or git's own answer about something else: `no gitlink recorded`, `gitlinks-unreadable` over `not a git repository`, or `FETCH INCOMPLETE` with the advice to set a credential. The doctor's `members` row over such a holder said `INVALID (family)` over a `crashed ... PermissionError`, or `DRIFTED (a member is not at its pin)`.

- Each pinned copy carries its own `_refuse_an_unreadable_root(start)`, which its loader calls right before `find_repo_root(start)`. It asks each `.git` that `find_repo_root` would ask, in the same order, with the file's own `_is_a`. A `.git` that answers absent is passed over, and the walk stops at the first `.git` that is there, so a `.git` above the root is never asked. A pinned copy may not rely on a newer `repo_shape.py` (#370, #610), which is why #1146 put the walk in each validator and why it is in each copy here.
- The refusal is `git-repo-unreadable`, exit 2, the code `validate-pins.py` and `validate-manifest.py` give the same root (#1146): `.git: cannot be read (Permission denied)` and the `chmod` cure, in each tool's own words. `siblings.py` keeps its "(and on every directory above it)" without "inside the root", since its clones sit outside the holder.
- The two bootstraps and `validate-family.py`, which read the root's repository through git, also ask what `validate-pins.py` asks of the first `.git` that is there: a gitfile they cannot open, and a git directory whose `HEAD` they cannot reach. `siblings.py` asks the `stat` alone, as `validate-manifest.py` does, so a `.git` directory at 000 still lets it place every member.
- The doctor's `check_members` calls `root_git_read(ctx.root)` after its empty-members return and gives one FINDING in the `members` row, with the gate's line once, NEXT this doctor again and WHY the cure for the cause. Each member's entry carries every key a member's entry has, null, plus `gitlink_cannot_be_read`, so a `--json` reader gets no `KeyError`. `drifted_reasons` counts no entry that carries it, and still counts a member beside it that it could read and is off its pin.
- `tests/test_pinned_root_git_unreadable.py` holds 76 rows. The `gate()` fixture in `tests/test_validate_family_unreadable.py` now gives the holder as the whole root. The gate had found 6 of that file's 53 rows failing at `05e6ab0f`, where base passes all 53: the new check met the holder's refused `.git` that `refused_stat(monkeypatch, ".git")` also refuses, and named it by its own name. The tool was right and the stub was stale, and no assertion changed.
- Measured in a scaffold's recursive clone and a family holder, on Python 3.12.3 and a 3.14-like `sitecustomize`, base `b75babee` against head, with each tool run from the root as `make` runs it (git 2.43). Was stacked on #1147, which landed as its squash `51a9c5f1`: `b75babee` was #1147's head then, and these numbers were measured against it and not measured again after the restack.
  - Over a `.git` linked into a folder at 000, all four tools went from a traceback (3.12) or `not-a-git-repo` (shim) to `REFUSED git-repo-unreadable`, exit 2, with no traceback and nothing on stdout, on both Pythons.
  - Over a `.git` directory at 000, the assembly bootstrap went from "no gitlink recorded; leaving as is" and a refusal by `pins`, `validate-family.py` from `gitlinks-unreadable` over git's `not a git repository`, and the family bootstrap from `FETCH INCOMPLETE (git exit 128)`, exit 1, or from `family bootstrap ok` over a run that read nothing under `--no-fetch --skip-members`, to the same `git-repo-unreadable` refusal. `siblings.py` is unchanged there, by design: it places every member, exit 0.
  - The doctor over a holder whose `.git` is a link went from `INVALID (family)` with a crashed `family` row (3.12), or `DRIFTED (a member is not at its pin)` with `members` at `checked out at ?` (shim), to `INVALID (family)` on both. Its `members` row names `.git: cannot be read (Permission denied)` once, with the cure, and the `family` row shows the holder's `validate-family.py` refusing `git-repo-unreadable`. A readable holder is `COMPLIANT`.
  - The new file at base fails 74 rows and passes 2, on 3.12.3 and on the shim alike. The 2 are controls. Of the 74, 38 fail on base's own answers and 36 only on the name `_refuse_an_unreadable_root`. At head all 76 pass on both.
  - Mutants: 58 of 58 killed, the 55 first run and the 3 review r1 added, each in a scratch clone of the head with the file put back in a `finally`.
  - Against a standard one commit past the pin, `update-shape.py check` names `scripts/bootstrap.py` alone as `upstream-changed` for a project (10 unchanged), and `scripts/validate-family.py`, `scripts/bootstrap.py` and `scripts/siblings.py` for a holder (7 unchanged). No digest of these files is recorded in the tree, so there is no pin-record edit, as in #1147.
- Lane 1's ruling: the family bootstrap's new refusal under `--no-fetch --skip-members` over a `.git` directory at 000 is accepted. Base said `family bootstrap ok` there, over a run that read nothing.
- Known limits:
  - #1164 (`fix/1110-family-unsearchable-gitmodules`) also changes `templates/family-root/scripts/siblings.py`. Lane 1's merge-tree shows a content conflict in the docstring's exit-2 paragraph and in `member_unreadable`, still there at `ba81fd7d` against #1164's head `74096eb4`. Whichever lands second keeps one form of each. #1164 has not landed, so this PR lands first.
  - The `chmod` cure says "every directory above it". In the issue's case the line names `.git`, a link, and the folder to mend is the one it leads into, so `chmod u+rx .git` follows the link and is refused. These are each tool's existing words.
  - `siblings.py` over a `.git` directory at 000 still places every member, by design. `validate-family.py` and `make bootstrap` refuse that holder.
  - A `.git` this user can search whose `HEAD` is at mode 000 is not asked by this PR's four tools, since the question is the `stat` of `HEAD` and a searchable directory answers it. Base and head give the same answers, each about something else, so this PR leaves that case as it was. That holds whether or not #1239 lands. Only what #968 asks of a leg is asked, so a git directory whose index cannot be read is still git's answer.
    - #1239 (lane 3's, for #1222) changes the assembly root's answer there, and this PR does not. It is not on main at `51a9c5f1`. It makes `validate-pins.py`'s `_refuse_an_unreadable_git_dir` open a git directory's `HEAD`, and `_refuse_an_unreadable_root` in that file calls it for the root's own `.git`. Once #1239 lands, the pins validator opens the root's `HEAD` first, so the assembly bootstrap's `pin-gitlink-absent` answer there becomes a `git-repo-unreadable` refusal by name (lane 5's note, #473 issuecomment-6724142443, read from the code, not run). #1239 changes only `validate-pins.py` and its tests. The family gate, `validate-family.py`, and the holder's `bootstrap.py` and `siblings.py` carry their own walk, so for the family holder the sentence above holds either way.
  - Not in this PR: `scripts/repo_shape.py`'s `find_repo_root`, and #1110 slice B (siblings' `submodule_urls`). The doctor's `members` row for an unread holder `.git` has `without_working_clone: []` beside entries whose `working_clone` is null, which tells a `--json` reader no member lacks a working clone about a question the row did not ask (r1172's NIT 3).

Review: lane 1's independent reviewers reviewed each round. r1172 reviewed `3a389565`, stopped at the shared window's STOP, and found it NOT READY as far as it got, for one SHOULD and no MUST (#1172 issuecomment-6351621763). The SHOULD was that no row held the line that stops the walk at a gitfile naming no directory, in three tools. r1172b found `5aa0f116` READY, with no MUST or SHOULD and two NITs, neither blocking (issuecomment-6360478153). The new row kills the three mutants that survived, 3 of 3. NIT-B, two stale phrases in the body's Tests section, is applied to the body. NIT-A, a contrived `pass` mutant of that line that the row does not kill, is not applied at this head. Lane 1 then checked the merge of #1147's then-head `a2fc1da8`, which is `2eabec8e` (issuecomment-6722268492): it had no conflict, it added to the 7 files exactly the lines `a2fc1da8` brought and kept exactly the lines this PR added (+902/-26), and the `members` row agrees with #1200's per-member line, since the root's line returns first. r1172b's READY is about this PR's own lines, which that merge left unchanged. After #1147 landed as `51a9c5f1`, the branch was restacked onto main by 2 merges (`81bc91f8` and `ba81fd7d`). There was no third, because main still equalled the squash. Its changed lines equal the reviewed delta, 928 `+`/`-` lines with sha256 `9eef7395` (issuecomment-6725567957), and the READY stands. Lane 1's first landing HOLD (2026-11-08T20:14:13Z) refreshed the branch with update-branch's clean merge of main `40cb8086`, `bbe5b414`, whose tree `84ebd14f` is the one lane 1's gate passed before that HOLD (`p1172-40cb808`, 0 failed). #1245 then merged into main under that HOLD, so lane 1 withdrew it (20:18:55Z), and `bbe5b414` became H0 once its `tests` passed.

Tests, under a stub `gh` with a bogus token, on Python 3.12.3 and git 2.43.0: lane 1's gate at the restacked head `ba81fd7d` gave 129 passed for `tests/test_pinned_root_git_unreadable.py` and `tests/test_validate_family_unreadable.py`, 171 passed for `tests/test_root_git_unreadable.py`, `tests/test_doctor_unreadable_paths.py` and `tests/test_doctor_unreadable_pin.py`, 283 passed and 2 skipped for `tests/test_scaffold_leg_path_collisions.py`, `tests/test_path_guard_hygiene.py` and `tests/test_no_auto_maintenance.py` (the 2 skips are `tests/test_no_auto_maintenance.py:222`, where the session began with `GIT_CONFIG_GLOBAL` set), 171 passed for `tests/test_agents_md_codes.py`, `tests/test_cli_reference.py` and `tests/test_repo_hygiene.py`, and for `tests/test_shape_doctor.py` in 4 shards (449 ids) 112 passed and 1 skipped, 111 passed and 1 skipped, 112 passed, and 111 passed and 1 skipped (the 3 skips are `tests/test_shape_doctor.py:10516`, the PowerShell line that only a Windows host prints). That is 1,205 ids over 5 calls: 1,200 passed, 5 skipped, 0 failed. The PR body's earlier gate, at `05e6ab0f` (and at `3a389565` for the one shard that holds `tests/test_validate_family_unreadable.py`), also gave 945 run for the pin call (0 failed) and 8037 passed and 39 skipped for the 116 other files that name `validate-family.py`, `siblings.py` or `bootstrap.py` and 6 that read the `members` row; those two calls were not run again on the restack.

It lands by fast refresh (Brett Heap, 2026-10-15T22:48:35Z). Its H0 `bbe5b414` is green on Linux and SonarCloud. The branch was never rebased. After H0, the only commit is update-branch's clean merge of main, giving ff423ed, which is green on SonarCloud and Git Bash. Lane 1's gate passed on its tree: 10 pytest calls over `tests/test_pinned_root_git_unreadable.py`, `tests/test_validate_family_unreadable.py`, `tests/test_root_git_unreadable.py`, `tests/test_doctor_unreadable_paths.py`, `tests/test_doctor_unreadable_pin.py`, `tests/test_scaffold_leg_path_collisions.py`, `tests/test_path_guard_hygiene.py`, `tests/test_no_auto_maintenance.py`, `tests/test_agents_md_codes.py`, `tests/test_cli_reference.py`, `tests/test_repo_hygiene.py`, `tests/test_adopt_work_dir_refusal.py`, `tests/test_adopt_filter_repo_origin_url.py`, `tests/test_adopt_one_byte_locale.py` and `tests/test_shape_doctor.py` in 4 shards: 1,300 passed, 5 skipped.

Closes #1148

Lane: openreposhape-1 (openRepoShape-1)
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 03:40
@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 15 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap
brettheap merged commit a20d4bd into main Nov 10, 2026
5 checks passed
@brettheap
brettheap deleted the l3-1222-gate-head-unreadable branch November 10, 2026 03:40
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 added a commit that referenced this pull request Nov 10, 2026
…er cannot open is named in the gate's words, `spec: .git/modules/spec/HEAD: cannot be read (<reason>)` or `spec/.git/HEAD: ...`, so the `legs` and `members` rows read INVALID with the gate's line and never DRIFTED, and `placement` never calls the leg "not a git repository" (#1222) (#1248)

`scripts/shape-doctor.py`'s `mount_read`, the one question the `legs`,
`leg shape files`, `placement` and `members` rows share, asked a mount's
git directory's `HEAD` by `stat` alone (#1174). A `HEAD` at mode 000
stats, so git, run in the mount, could not read it. A gitfile leg's
`legs` row said `spec: populated, but git cannot read a HEAD in it` and
`placement` said `spec: it is not a git repository`. A `.git`-directory
leg went further: git passed over the leg's `.git` to the root's
repository, so `legs` quoted the root's HEAD as the leg's, with a
`submodule update --checkout` as the NEXT. A member read
`members/IRRS: checked out at ?, pinned at <pin>`. The verdict was
DRIFTED each time, while the gate refuses `pin-submodule-unreadable`
(#1239).

`regular_file_opens(path)` is the doctor's copy of the gate's
`_gitfile_opens` (as `git_dir_of` is of `_leg_git_dir`, #1174): it opens
`path` only where it is a regular file, since the open of a FIFO waits
for a writer, answers False for an open that finds nothing, and raises a
refused open. In `mount_read`, after `git_dir_of`, a `HEAD` that is
there is named as the gate names it and opened with it. A refused open
is the mount's `mount_cannot_be_read` line,
`spec: .git/modules/spec/HEAD: cannot be read (Permission denied)` or
`spec/.git/HEAD: ...`, and for a member
`members/IRRS: .git/modules/members/IRRS/HEAD: ...`. The rows then read
INVALID (the `pins` row's, or the `family` row's for a holder), with
this doctor again as the NEXT and the gate's advice as the WHY, and
never DRIFTED. The name comes before the open, behind the `stat` of
`HEAD`, as the gate's does, so a refused `stat` still names the git
directory.

`root_git_read`, which asks the root's own `.git/HEAD` (#1147), gets the
same open, as the gate's `_refuse_an_unreadable_root` does through
#1239's. A refused open is the root's line,
`.git/HEAD: cannot be read (<reason>)`, spelled relative to the root in
POSIX on every platform, and the verdict is `INVALID (pins)`, where it
was DRIFTED with `no gitlink recorded`. The helper is copied and not
imported because the gate is a pinned copy the doctor does not load
(#430's rule); a row holds the two to one answer for each shape.

Not changed: a git directory with no `HEAD`, a gitfile that names none,
and a `HEAD` that is gone at the open or is no regular file are left to
git, and `leg shape files` asks nothing of the git directory. A FIFO
`HEAD` still hangs the doctor and the gate, in git's own open. Git's
other reads of a git directory (`config`, `objects`, `refs`,
`commondir`) are a separate ruling, and `validate-family.py`'s member
check is #1221's, with its `HEAD` case #1256's. Known limit: with the
root's `.git/HEAD` and a leg's own `HEAD` both at 000, `placement` names
the root's line, and mending it shows the leg's refusal on the next run;
the verdict is `INVALID (pins)` either way.

`tests/test_doctor_unreadable_paths.py` gains 24 rows for the leg and
member `HEAD` and 40 for the root, and
`tests/test_root_git_unreadable.py` 9: the mode-000 cells, the open
refused in process for a permission and for an I/O error, a git
directory with no `HEAD`, and parity rows that hold the doctor to the
gate over eight `HEAD` shapes on both leg layouts and over nine shapes
on three root layouts. Against main's `shape-doctor.py` the first 52
`HEAD` rows give 13 failed, 39 passed, and without the root's open the
192 rows of the two files give 18 failed, 174 passed, the failures being
exactly the new refusal rows. `tests/test_root_git_unreadable.py` and
`tests/test_doctor_unreadable_paths.py` in one pytest, since the second
imports from the first, give 192 passed;
`tests/test_validate_pins_spelled_and_named.py` 116 passed,
`tests/test_shape_doctor.py` 446 passed, 3 skipped, and the guards 343
passed, 3 skipped. All 11 mutants run are killed.

Closes #1222

Lane: openreposhape-3 (openRepoShape-3)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 10, 2026
…ame the file as `shown_path` does, and validate-pins.py, family.py and shape-doctor.py read either spelling (#1168) (#1274)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Closes #1168

Lane: openreposhape-5 (openRepoShape-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 10, 2026
…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

Development

Successfully merging this pull request may close these issues.

1 participant