Skip to content

update-shape.py: prepare asks the shape pin's source_repository: once, with --upstream passed too, and refuses a path or a value that is no owner/repo in the pin's name; shape-doctor.py answers as it did (#1203) - #1269

Merged
brettheap merged 6 commits into
mainfrom
fix/1203-pin-source-asked-once
Nov 10, 2026

Conversation

@brettheap

@brettheap brettheap commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Goal

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

What held on main

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

What changed

  • update-shape.py: a new pin_source(pin, pin_path). prepare asks it once, after reading the pin and before opening the upstream, with or without --upstream. It asks three questions, under the codes these values already had:
    • Something is at the value where the command runs, and it holds no git repository: update-upstream-not-a-repo. The value is looked up the way open_upstream looks up --upstream: expanduser, relative to the working directory.
    • REPOSITORY_RE does not take the whole value (fullmatch): update-upstream-unresolvable.
    • checked_value refuses it: unsafe-value.
  • What each refusal says. Each names the pin and its field, <root>/contracts/shape-pin.yaml: `source_repository:` .
  • open_upstream(spec) asks only about --upstream again. validate-manifest.py, validate-family.py, family.py and update-shape.py: an id:, a date or a repository: ending in a line feed is refused by name, and a pin's source_repository: that is no path or owner/repo name is named as the pin's (#1139) #1166's pin_path and its two pin-named branches moved into pin_source. Both functions use _holds_a_repository as their one repository question.
  • prepare(args, *, ask_source=True). shape-doctor.py's check_shape_currency call passes ask_source=False. Its refusals_ahead call asks the field (S2 of the review round, below).
    • Why: the doctor reads any Refusal out of prepare as its own checkout being unable to answer. update-shape.py's comment above _ABSENT_ERRNOS documents this.
    • Measured with the field asked there: a hand-edited source_repository: turned the shape currency row from exit 1 (behind) into CANNOT ANSWER, exit 3. Its NEXT was git -C <standard> fetch --all, and its why was "this checkout of the standard does not carry the commit the pin names".
    • With the opt-out at check_shape_currency the doctor answers as it does on main. Where the root is behind, the doctor's NEXT is update-shape.py check, which refuses the field in the pin's name.
  • Codes: none added, renamed or removed.
  • Tests:

Review round (rv1269: two SHOULDs)

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

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

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

Second review round (rv1269b: three NITs)

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

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

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

The decision: a pin that names a path, with --upstream passed

Refused.

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

Rows failing on main

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

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

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

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

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

Mutants

Setup:

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

This round's mutants:

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

The review round's mutants, run again:

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

The first round's mutants, run again:

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

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

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

Runs

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

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

Merges

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

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

Limits

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

Closes #1203

Lane: openreposhape-5 (openRepoShape-5)

🤖 Generated with Claude Code

Summary by Sourcery

Validate shape pin source repositories consistently before upstream operations and preserve accurate shape-doctor findings when validation cannot be performed.

Bug Fixes:

  • Ensure update-shape validates the pinned source repository consistently whether or not --upstream is supplied, refusing paths and malformed or unsafe values before opening the upstream.
  • Prevent shape-doctor from misreporting or crashing when the pin source cannot be validated, while preserving its existing shape-currency response.

Enhancements:

  • Centralize source-repository validation and improve diagnostics for inaccessible, malformed, non-repository, and unusual path values.
  • Keep source-related refusals associated with the pin and field, and prevent apply from making changes when validation fails.

Tests:

  • Add comprehensive coverage for source validation across update-shape routes, edge-case paths, apply behavior, and shape-doctor refusal handling.

Brett Heap and others added 2 commits November 8, 2026 16:36
…once, before the upstream opens and with `--upstream` passed too, refusing a path or a value that is no `owner/repo` in the pin's name; shape-doctor.py answers as it did (#1203)

`prepare` read the pin's `source_repository:` and used it two ways. With
no `--upstream` it was the upstream `open_upstream` opened, and a value
naming something in the working directory that is no repository
(`contracts`, `scripts/repo_shape.py`) was `update-upstream-not-a-repo:
--upstream contracts exists but is not a git repository`, a flag nobody
passed. With `--upstream` passed it was never asked: a value ending in a
line feed went into `apply`'s commit subject and the `gh pr create` line
it prints, both broken by it, exit 0 (#1166's review, findings 3 and 9).

`pin_source` now asks it once, in `prepare`, before the upstream is
opened, whichever way the run reaches the upstream, under the codes these
values had: something there that holds no repository is
`update-upstream-not-a-repo`, a value `REPOSITORY_RE` does not take whole
is `update-upstream-unresolvable`, and `checked_value`'s is
`unsafe-value`, each naming the pin and its field. A path is refused with
`--upstream` passed too, and a clone kept at a path that is not spelled
`owner/repo` is refused with no `--upstream` (main opened it in place):
the pin records the name `apply` commits and opens its pull request with.
The remedy no longer offers `--upstream` a path, which asks the field too.
An `owner/repo` spelling that is a repository where the command runs is
taken, as it was. `open_upstream` asks `--upstream` alone again.

`shape-doctor.py` passes `prepare(..., ask_source=False)` at its two
calls: it reads a refusal out of `prepare` as its own checkout unable to
answer, so asking there turned a hand-edited field into CANNOT ANSWER,
exit 3, with a `git fetch --all` NEXT (measured). Its rows are main's.

Closes #1203

Lane: openreposhape-5 (openRepoShape-5)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… the `ask_source` keyword the doctor now passes, so the rows that raise an `OSError` out of the comparison raise it again (#1203)

`shape-doctor.py` calls `prepare(args, ask_source=False)` since the
commit before this one, and the stand-in took one argument, so its three
rows ended in a `TypeError` instead of the error they raise.

Lane: openreposhape-5 (openRepoShape-5)

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

Uses of the API

Have the doctor ask the pin source when evaluating the pins gate, but skip that question for shape currency so its existing answer is preserved; treat refusals and OS read errors as inability to ask.

  • shape-doctor.py L3345-3347, L3358-3375, L6440-6447

Implementation

Centralize validation of the pin’s source repository in pin_source, ask it before opening the upstream, and handle path, malformed-name, and unreadable-path cases consistently.

  • update-shape.py L649-662, L730-826, L2515-2527 (+7 small edits)

Tests

Exercise pin-source validation across both upstream routes, including path handling, malformed and unsafe values, filesystem edge cases, and refusal before upstream processing.

  • tests/test_update_shape_pin_source.py L1-455

Verify the doctor retains its gate finding when source validation refuses or cannot read the pin value, and that currency counts remain unchanged.

  • tests/test_update_shape_merged_away.py L65-71, L516-529, L546-630 (+1 small edits)

Update doctor test doubles and upstream stand-ins to match the changed prepare and open_upstream call signatures.

  • tests/test_doctor_unreadable_pin.py L504
  • tests/test_update_shape_unreadable.py L228-229

Align existing line-break validation tests and refusal remediation expectations with pin-source validation occurring even when --upstream is supplied.

  • tests/test_value_pattern_line_break.py L392-400, L438-444 (+3 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-08T18:42Z) Independent review of #1269 (#1203) by rv1269, lane 5's opus reviewer, which wrote none of it: NOT READY at 86c1e6ea, on two SHOULDs with measured fixes. A fix round follows. The report follows as the reviewer wrote it.

Independent review of #1269 (#1203) for lane openRepoShape-5, by rv1269 (opus), at 86c1e6e: NOT READY

The fix itself holds: the rows, mutants, gates, merge-trees and the writer's three choices all check out. Two SHOULD findings block it. Each is a small defect the PR introduces, with a fix of one to three lines that I measured. There are no MUST findings.

The three choices

  1. ask_source=False in the doctor's check_shape_currency: right, and the narrowest fix.
    • With the field asked there (mutant M9, my probe), every hand-edited value turned the row into CANNOT ANSWER, exit 3. Its NEXT was git -C <standard> fetch --all and its reason "this checkout of the standard does not carry the commit the pin names". That held for a current root too, so the body's claim is confirmed.
    • With the opt-out, the doctor gives main's answer in all 6 probe cases (3 values x a current or a behind root): same exit, verdict, row status and reason.
    • Where the root is behind, the row's NEXT (update-shape.py check) now refuses in the pin's name. On main it exited 1.
    • The doctor loads update-shape.py from its own directory, so the new keyword cannot meet an older copy.
    • The doctor's second call is a different matter: see S2.
  2. A path in the pin with no --upstream is now refused: within update-shape.py: a shape pin's source_repository: that names a path is refused as --upstream, and with --upstream passed one that ends in a line feed is never asked and reaches the commit subject and the pull request title (#1166 follow-up) #1203.
    • The Suggested fix's first bullet asks REPOSITORY_RE.fullmatch in both routes, which refuses ~/shape and /srv/shape.
    • Nothing documents a path in that field:
      • README and the handbook say --upstream "defaults to the repository the pin names".
      • docs/cli.md says "default: the pin's source_repository".
      • AGENTS-shape.md and bootstrap's notice document update-shape.py check --root .; README gives --upstream <path> as the offline route.
      • Both templates write {{SHAPE_REPOSITORY}}, which is the constant opensoft/openRepoShape.
      • No test writes a path there.
    • The body discloses the change.
  3. validate-manifest.py, validate-family.py, family.py and update-shape.py: an id:, a date or a repository: ending in a line feed is refused by name, and a pin's source_repository: that is no path or owner/repo name is named as the pin's (#1139) #1166's words: no stale copy anywhere.
    • I grepped tests/, README, docs/, the handbook and AGENTS.md for "or pass --upstream a path to a clone of openRepoShape" and for the pin-named "neither a path on this machine".
    • The remaining "neither a path on this machine" strings belong to the argv --upstream refusal, where a path is still valid.

SHOULD

S1. A pin value ~<unknown user>/... is a Python traceback; with --upstream passed this is new.

  • pin_source calls Path(declared).expanduser(), which raises RuntimeError: Could not determine home directory. (Python 3.12; 3.13 and 3.14 raise the same).
  • Measured with source_repository: "~rv1269nosuchuser/shape" and check --upstream <clone>:
    • at the head: traceback, exit 1;
    • on main: exit 1 with a report.
  • With no --upstream both versions crash; that was already true on main.
  • The PR's Goal is "refuses a value that is no owner/repo in the pin's name". Exit 1 is also check's "behind" code, so a script can misread the crash.
  • Realistic case: a pin hand-edited to ~alice/... and committed crashes on every machine without a user alice.
  • Fix, shown in-process on a copy in work/rv1269/fixcheck/ (no tree touched): wrap the expanduser in try/except RuntimeError and keep the bare path. The value is then update-upstream-unresolvable in the pin's name, and the scaffolded value is unchanged. Add a row in each route.

S2. The doctor's second opt-out, in refusals_ahead, makes a pins row sentence false (the #676 class).

  • Setup (my probe 2): two collision copies merged away plus source_repository: "has space/x".
  • At the head:
    • the pins row says "update-shape.py check reports them merged-away, and the apply it prints drops their pin rows";
    • that check, run as the row's NEXT, exits 2 with update-upstream-unresolvable.
  • On main the same sentence is true: check exits 1 and lists both copies as merged-away.
  • Under R1 (refusals_ahead calls prepare(args) and asks the field):
    • prepare refuses, so refusals_ahead returns None, as its docstring says it should when prepare refuses;
    • the pins row keeps the validator's plain finding and says nothing false about check;
    • the scaffolded case is identical at the head and under R1.
  • R1 passes the 40 rows, plus test_update_shape_merged_away, test_update_shape_hardlink, test_update_shape_rewrite_symlink and test_doctor_partial_clone: 141 passed.
  • Fix: drop ask_source=False at shape-doctor.py:3358 only, and add a row for this setup.

NIT

Measured

  • Rows (Python 3.12.3, git 2.43.0):

  • Mutants: each alone on the writer's 40-test set, each restored with a sha256 check (17 of 17 restored=yes).

    • The writer's M1-M10 and M3b match the body's table in count and killing rows: 11, 12, survives, 7, 8, 3, 2, 2, 12, 1, 11.

    • M3 is equivalent, by construction and checked: match and fullmatch of REPOSITORY_RE disagree on 0 of 66,430 strings (every string up to length 5 over a, /, LF, CR, space, -, ., ~).

    • My own:

      Mutant Result
      R1 refusals_ahead asks survives (see S2)
      R2 or not args.upstream dropped survives; unreachable, since no caller passes ask_source=False without upstream=
      R3 name question before path question killed, 4
      R4 bare HEAD question dropped killed, 1 (test_open_upstream_raises_a_refused_stat[a-bare-repositorys-head])
      R5 checked_value first killed, 10
      R6 pin named relative killed, 22
  • Probes: real check and apply --yes runs, gh stub first on PATH, an unreachable proxy.

    • The issue's 6 values in both routes at the head: exit 2 in the pin's name. apply writes nothing: no branch, HEAD unchanged, the pin's commit: unchanged, clean tree.
    • On main with --upstream: check exit 1, and apply exit 0 committing "Re-sync the shape copies to contracts @ ..." and the like. The line-feed value broke the subject, and the gh pr create line split inside its --title quotes.
    • The scaffolded pin with --upstream: the same answer at the head and on main.
  • Gates at the head (Python 3.12.3, git-filter-repo 2.47.0, gh stub, bogus token, GIT_CONFIG_GLOBAL=/dev/null):

    Gate git 2.43.0 (/usr/bin/git) git 2.47.1 (L/tools/git247/bin/git)
    A (27 files) 1339 passed, 5 skipped, one run 1339 passed, 5 skipped, 15 parts of at most 90
    B (8 doctor files) 824 passed, 3 skipped, one run 824 passed, 3 skipped, 10 parts
    • Gate A's skips: 3 test_update_shape_add_symlink.py:832 "junctions are NTFS's", and 2 test_no_auto_maintenance.py:222 "the session began with GIT_CONFIG_GLOBAL set".
    • Gate B's skips: 3 test_shape_doctor.py:10516, the PowerShell line (Windows only).
    • These match the body's counts.
  • CI at 18:41Z: SonarCloud, package and tests-git-bash pass; tests is still pending.

Merge-trees

git merge-tree --write-tree <other> 86c1e6ea2, git 2.43.0, heads read fresh. All rc=0 with 0 conflicts.

Other Head Tree
main (18:40Z) 51a9c5f10 be211791
main (17:57Z) 9729315f1 d88ff40d
#1231 aca00dfd 7abe1a3b
#1241 ab137eb5 9c02c2ba
#1248 2dd144f5 b1655305
#1172 (18:41Z) ba81fd7d2 6c0616c5
#1172 (earlier) 2eabec8e d0401e70
#1159 (merged) 9e4aab8c 7d77b481
#1147 (merged since) 4d299dd3 3d1efda2
  • The six PR trees at the heads the body names equal the body's trees.
  • No added or removed line in main's diff since be21751c3 (including +270/-20 in shape-doctor.py) or in the open PRs' diffs mentions prepare(, open_upstream, pin_path, source_repository, WRITE_THE_PIN or REPOSITORY_RE.
  • Not done: the rows on the merged tree with current main. That is left to the landing gate.

Files

Everything is in /workspace/projects/.lane-worktrees/openRepoShape-5/work/rv1269/:

  • STATE.md (with the final CHECKPOINT)
  • logs/, mutants.summary, mutate.py, merge-trees.log
  • probe-*.jsonl and probe/ (the two probe files)
  • chunks-gate*-2471.summary
  • fixcheck/ (the S1 fix check)

Both of my worktrees are clean and left in place (no rm):

  • /workspace/projects/openRepoShape-worktrees/rv1269-review
  • /workspace/projects/openRepoShape-worktrees/rv1269-mut

I made no commits, pushes or GitHub writes, and touched neither of the writer's trees.

Lane: openreposhape-5 (openRepoShape-5)

Brett Heap and others added 2 commits November 8, 2026 18:50
…`~<unknown user>/...` or over 255 bytes is nothing there and is refused in the pin's name, the doctor's `pins` row asks the field, a folder-named value is told where to run (#1203)

Review of PR #1269 (rv1269), two SHOULDs and the NITs it asked for:

- S1: `Path(declared).expanduser()` raised `RuntimeError` for `~<user>/...`
  with no such user, a traceback with exit 1, the code `check` uses for
  "behind". `_named_here` keeps the bare path, so the name question
  refuses it `update-upstream-unresolvable` in the pin's name, with or
  without `--upstream`.
- N1: a first part over 255 bytes made `stat` raise `ENAMETOOLONG`, which
  was `update-unreadable` naming neither the pin nor the field. That errno
  is nothing there; every other refused `stat` is raised as it was.
- S2: `refusals_ahead` no longer passes `ask_source=False`. Where `check`
  refuses the pin's field, the `pins` row said `check` reports the copies
  `merged-away` and the `apply` it prints drops their rows; it exits 2 and
  does neither. `check_shape_currency` keeps the opt-out.
- N2: the `update-upstream-not-a-repo` remedy of a pin's value says to run
  from a directory where nothing is at that path.
- N3: `REPOSITORY_RE`'s comment no longer says it is for the pin "where no
  `--upstream` is passed".
- N4: the doctor guard row holds the `shape currency` row to main's `ok`.

Lane: openreposhape-5 (openRepoShape-5)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…user` cannot expand is looked up as the bare path, so a folder of that name where the command runs is `update-upstream-not-a-repo` in both routes (#1203)

S1 of the review of PR #1269 asks the guard to "keep the bare path". The
row holds that half: a guard that returned "nothing there" instead gave
the same answer for every value but this one.

Lane: openreposhape-5 (openRepoShape-5)

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

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-5, 2026-11-08T20:40Z) Delta check of #1269's fix round, 86c1e6ea..c792615f, by rv1269b, lane 5's sonnet reviewer, which wrote none of it: READY, with three NITs. A short round for NITs A and B (two one-line fixes, each with a row) and C follows. The report follows as the reviewer wrote it.

Delta check of #1269 (#1203) for lane openRepoShape-5, by rv1269b (sonnet), 86c1e6e..c792615: READY

All findings are NITs. S1, S2 and N1 to N4 hold, with a measured one-line fix for each of the two new NITs. No MUST or SHOULD. I made no commits, pushes or GitHub writes, and no subagents.

Findings

1. The delta is what the body says. git diff 86c1e6ea2 c792615f4 is four files:

  • update-shape.py and shape-doctor.py;
  • tests/test_update_shape_pin_source.py (+171) and tests/test_update_shape_merged_away.py (+44).

The two stand-in files (test_update_shape_unreadable.py, test_doctor_unreadable_pin.py) and test_value_pattern_line_break.py are byte-identical between 86c1e6e and the head. The test file has 34 rows: 22 from the first round and 12 new, which is S1 4, N1 5, N2 3. Both commits carry the Lane and Co-Authored-By lines, and their subjects are 249 and 222 characters.

2. S1 holds. I ran real check and apply --yes with a stub gh and an unreachable proxy.

  • source_repository: "~rv1269bnosuchuser/shape" gives REFUSED update-upstream-unresolvable, exit 2, in the pin's name, in both routes, with no traceback.
  • apply writes nothing: HEAD unmoved, no branch, the pin's commit: unchanged, clean tree.
  • At 86c1e6e both routes are tracebacks, exit 1. On main, no --upstream is a traceback; with --upstream, check exits 1 and apply exits 0 and commits.
  • The scaffolded value with --upstream is identical at the head, at 86c1e6e and on main: check exit 1, apply commits.

3. N1 holds.

  • "r"*300 + "/x" is unsafe-value in both routes at the head (the writer's finding is right). "r"*300 + "/has space" and a 5000-character path are update-upstream-unresolvable.
  • The control is a real run with a mode-000 folder locked and the value locked/x. It gives REFUSED update-unreadable: locked/x: cannot be read (Permission denied), exit 2, at the head and at 86c1e6e. Only ENAMETOOLONG is taken as nothing there.
  • Mutants Y1 (wrong errno), Y2 (EACCES also nothing) and N1-any-oserror are each killed.

4. S2 holds. I ran rv1269's probe-2 setup: two collision copies merged away, plus a hand-edited value.

  • For has space/x, a line feed, ~nosuchuser/shape and "r"*300+"/x", the doctor's pins row falls back to the gate's finding and no longer claims check reports merged-away. check exits 2 in the pin's name.
  • At 86c1e6e the same rows still carried the false sentence.
  • The scaffolded case with the two copies is unchanged on all three versions: the pins row names merged-away and check exits 1.
  • The shape currency row is identical to main for all six values, current and behind, with no traceback: same exit, verdict and status, and no environment key.

5. N2 holds.

  • The added sentence ends "run this from a directory where nothing is at that path." It appears only in the update-upstream-not-a-repo remedy.
  • The scaffolded pin run from a folder holding a non-repository opensoft/openRepoShape shows it at the head in both routes. The line-feed and contracts refusals read the name remedy.
  • No README, docs/cli.md, handbook or AGENTS.md text names these codes or this remedy. The old remedy words live only in update-shape.py, test_update_shape_pin_source.py and test_value_pattern_line_break.py, and test_value_pattern_line_break.py is unchanged.
  • The Limits claim that --upstream ~<unknown user>/x is still a RuntimeError traceback, and that a long argv first part is still update-unreadable, both measured true.

6. N3 and N4. I checked N3 by reading. N4's assert is what kills the doctor-asks mutant D1 (below). On main, shape currency is ok for a current root, so the asserted status is main's.

7. Rows and mutants (Python 3.12.3, git 2.43.0). Every mutant ran alone on the writer's 53-test selection, restored with a sha256 check of the four files (restored=yes for all 31).

  • At 86c1e6e's production: 19 failed, 34 passed. The 19 are the S2 row, 4 S1, 4 N1, 2 N2, and 8 remedy-sentence rows, which is the body's list.

  • On main's (be21751c3) production: 33 failed, 33 passed. This is the body's 21 plus 12 (S1 4, N1 4, N2 2, S2 1, the PermissionError row).

  • Writer's undos, all killed:

    Undo Killing rows
    S1 guard removed 4
    S1 bare path not kept 2
    N1 errno removed 4
    N1 any OSError 1
    S2 opt-out back 1
    N2 sentence removed 12
    N2 sentence everywhere 15
    D1, doctor asks and calls a refusal a plain finding 1
  • D1 with N4's assert undone survives, so that assert alone kills D1. N4's assert undone, with the production code as committed, passes (53), which makes it a control.

  • First-round M1 to M10 give 17, 18, survives, 7, 12, 3, 4, 2, 18, 2, 17 killing rows. These are M1, M2, M3 (equivalent), M3b, M4, M5, M6, M7, M8, M9, M10, in order. M3 (match for fullmatch) is equivalent: rv1269 checked 66,430 strings.

  • My own mutants, with their results:

    Mutant Result
    Y1 wrong errno killed, 4
    Y2 EACCES also nothing killed, 1
    Y4 remedy words changed killed, 12
    Y7 nothing-there kept as a path killed, 23
    Y3 except (RuntimeError, ValueError) survives (see NIT A)
    Y5 or not args.upstream dropped survives; unreachable, since the only ask_source=False caller passes upstream=; this is rv1269's R2
    Y6 .resolve() dropped survives; equivalent
  • rv1269's R1 is the code now, and its inverse S2-optout-back is killed.

NIT A. A raw NUL byte after ~ in the pin value is still a traceback, exit 1.

  • Setup: source_repository: ~a<NUL>b/x, plain or quoted, in either route. Path.expanduser() raises ValueError: embedded null byte, which S1's except RuntimeError does not catch.
  • On main with --upstream, check exited 1 with a report, so this is new in that route; with no --upstream main crashed too.
  • It is contrived, since the file would be binary.
  • Fix: except (RuntimeError, ValueError). Mutant Y3 turns all four tracebacks into update-upstream-unresolvable, exit 2. No row covers it, which is why Y3 survives.

NIT B. The doctor's pins row can read "could not be run" in one narrow case.

  • Setup: merged-away copies, a pin value like locked/x, and an unsearchable locked in the doctor's cwd.
  • S2's new asking in refusals_ahead lets the OSError from pin_source's stat escape, because only Refusal is caught. The row reads could not be run: [Errno 13] Permission denied: 'locked/x' instead of the gate's finding.
  • On main and at 86c1e6e it said the merged-away sentence, and check, the row's NEXT, now exits 2 update-unreadable.
  • Verdict, exit and the shape currency row are unchanged.
  • Fix: except (Refusal, OSError): return None. Mutant Z1 restores the gate finding.

NIT C. The Merges section is stale again. The body names main 9252ef208; main is now 77c56dde6. #1172 moved to bbe5b414e, and the trees below are re-read fresh. That is for the landing refresh.

Not changed: the live body is the writer's text plus Sourcery's regenerated summary after the footer. Body-guard exits 0 and closingIssuesReferences is #1203 only.

Gates

Head c792615f4, dirty=0, Python 3.12.3, git-filter-repo 2.47.0 (L/tools/venv247), stub gh, bogus token, GIT_CONFIG_GLOBAL=/dev/null. I used n1203's lists (27 files for A, 8 for B). One run of more than 100 tests at a time.

Gate git 2.43.0 (/usr/bin/git) git 2.47.1 (L/tools/git247/bin/git)
A 1352 passed, 5 skipped, one run, 799.7s 1352 passed, 5 skipped, 16 parts of at most 90 ids
B 824 passed, 3 skipped, one run, 1254.5s 824 passed, 3 skipped, 10 parts of at most 90 ids

Skips, the same on both gits and the same as the body:

  • A: 3 at test_update_shape_add_symlink.py:832 ("junctions are NTFS's") and 2 at test_no_auto_maintenance.py:222 (the session began with GIT_CONFIG_GLOBAL set).
  • B: 3 at test_shape_doctor.py:10516 (the PowerShell line, Windows only).

The live PR's tests check was still IN_PROGRESS at the last read. tests-git-bash, package and SonarCloud passed.

Merge-trees

git merge-tree --write-tree <other> c792615f4, git 2.43.0, heads read fresh at 20:39Z. All exit 0, no conflict lines.

Other Head Tree
main 77c56dde6 b4f709c6
#1231 aca00dfd9 487cf667
#1241 ab137eb5f 1fbe57e7
#1248 1b747f7ab 36531a9b
#1172 bbe5b414e 435cfd98

Disclosures

  • One bash line of mine ended in a fallback || rm -f /dev/null. It ran once and was denied (Permission denied); nothing was removed.
  • I once ran my probe script with mutant Y3 in the review tree by mistake. It restored production to the head's bytes, which I checked by sha256 and git status.
  • At the end both worktrees were clean at c792615f4, with the four files at their commit sha256.

Files

Everything is in /workspace/projects/.lane-worktrees/openRepoShape-5/work/rv1269b/:

  • STATE.md
  • mutants.summary, mutants-rf.summary, mutate2.py, mut2.sh
  • probe-*.jsonl and probe/
  • gates.summary, gateA-2471.summary, gateB-2471.summary, logs/
  • merge-trees.log, merge-trees-final.log

Worktrees /workspace/projects/openRepoShape-worktrees/rv1269-review and rv1269-mut are clean at c792615f4.

Lane: openreposhape-5 (openRepoShape-5)

…h a NUL byte after the `~` is nothing there and is refused in the pin's name, and the `pins` row keeps the gate's finding where `prepare` raises an `OSError`, a row for each (#1203)

Second review of PR #1269 (rv1269b), NITs A and B:

- A: `Path(declared).expanduser()` raises `ValueError: embedded null byte`
  for a raw NUL byte after the `~`, which `_named_here` did not catch (it
  caught `RuntimeError` only): a traceback, exit 1, in both routes. It now
  catches `(RuntimeError, ValueError)` and keeps the bare path, which no
  file has the name of, so the name question refuses the value
  `update-upstream-unresolvable` in the pin's name. A row in each route.
- B: `refusals_ahead` caught `Refusal` only from `prepare`, since the
  doctor began to ask the pin's field. A value `locked/x` with an
  unsearchable `locked` in the doctor's directory raises the `OSError` of
  `pin_source`'s `stat` out of `prepare`, and the `pins` row read `could not
  be run: [Errno 13] ...` where it had kept the gate's finding. It now
  catches `(Refusal, OSError)` and returns None. A row, with real modes.
- The pin-edit lines of the existing S2 doctor row move into
  `source_written_as`, which the new row uses too.

Lane: openreposhape-5 (openRepoShape-5)

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

Copy link
Copy Markdown
Contributor Author

Re-check of #1269 (#1203) for lane openRepoShape-5, by rv1269c (sonnet), at 52e5c18: READY

There is no MUST and no SHOULD. I found two NITs, and neither blocks landing. I made no commits, pushes or GitHub writes, and used no subagents. My gh calls were reads only.

The head is 52e5c18830c3a617367466b5104117b4a4865d0f. It is the live PR head, the fix/1203-pin-source-asked-once branch on origin, and the -wip branch. At the 16:10Z read, the checks tests, tests-git-bash, package and SonarCloud Code Analysis were all SUCCESS.

Findings

NIT 1. The Merges section of the body is stale again. This is the same class as rv1269b's NIT C. It matters only at the landing refresh.

NIT 2 (observation, not a defect). The surviving mutant B-permissionerror-plus-refusal is named honestly, and its reason holds.

  • OSError is wider than PermissionError, but the code does not need a row for the wider case.
  • The reason: the only errno a real mode can make stat raise that _mode_of does not read as absent is EACCES. _ABSENT_ERRNOS is (ENOENT, ENOTDIR, EBADF, ELOOP), and ENAMETOOLONG is taken earlier in _named_here.

What I checked

1. NIT A (update-shape.py, NUL after ~): holds.

  • The rows are test_a_nul_byte_after_a_tilde_is_refused_in_the_pins_name[no-upstream] and [upstream-a-clone].

  • At the head: 3 passed in 10.35s for the two NIT A rows plus the NIT B row, with no skip.

  • On c792615f4's update-shape.py and shape-doctor.py: 3 failed, 66 passed on the 69-test selection. The NUL rows fail with the real traceback, ValueError: embedded null byte out of Path(declared).expanduser() in _named_here, assert 1 == 2.

  • rv1269b's Y3, except (RuntimeError, ValueError), is the code now. Its inverse (RuntimeError alone) gives 2 failed, killed by the 2 NUL rows.

  • Other mutants on the same selection:

    Mutant Result
    ValueError alone 4 failed (the S1 rows)
    no guard 6 failed
    bare path not kept (return None) 2 failed
  • In-process probe at the head (Python 3.12.3, _named_here): NUL after the ~, NUL right after the ~, a lone surrogate after the ~, a NUL with no ~, an unknown user and a 300-character name all return None. None raises.

2. NIT B (shape-doctor.py, refusals_ahead): holds.

  • The row is test_the_pins_row_keeps_the_gate_where_the_pins_source_cannot_be_read. It ran as uid 1000 with a real mode-000 locked folder, and was not skipped.

  • On c792615f4's production it fails with "could not be run: [Errno 13] Permission denied: 'locked/x'". At the head it passes.

  • The mode was back at 755 in the kept basetemps of both failing runs, so the finally restores it.

  • rv1269b's Z1, except (Refusal, OSError): return None, is the code now.

    Mutant Result
    Refusal alone (the inverse of Z1) 1 failed (the locked row)
    OSError alone 1 failed (the S2 row ..._check_refuses_the_pins_source)
    (Refusal, PermissionError) survives, 69 passed. The body names it; see NIT 2.
    asks no more (prepare(args, ask_source=False)) 2 failed (the S2 row and the locked row)
  • The control (head, no mutant) passed 69. Every mutant ran alone, restored, with a sha256 check of five files (restored=yes), and rv1269-mut is clean at 52e5c1883.

3. Nothing else changed: holds. The measurements:

  • git diff --stat c792615f4..52e5c1883 lists 4 files, +122/-19. They are shape-doctor.py (12/4), tests/test_update_shape_merged_away.py (72/10), tests/test_update_shape_pin_source.py (31/1) and update-shape.py (7/4).
  • An AST comparison with docstrings stripped (work/rv1269c/astdiff.py) shows production differing only in _named_here and refusals_ahead.
  • In the tests, the differing units are the new rows and constants, the DOCTOR import, needs_a_mode, the source_written_as helper, and the S2 row whose inline pin-edit lines moved into that helper.
  • The commit has one parent and no Closes line. Its subject is exactly 250 characters, and the Lane and Co-Authored-By lines are last. The added lines are ASCII, and the identity is Brett Heap [email protected].

4. Gates (head 52e5c1883, dirty=0, Python 3.12.3, git-filter-repo a40bce548d2c, which is the 2.47.0 pin in L/tools/venv247). I ran tests/test_update_shape_pin_source.py (36 ids), tests/test_update_shape_merged_away.py (20) and tests/test_shape_doctor.py (449): 505 ids in 6 parts of at most 90, through run10.sh, whose -rs is the only -r option.

git Result Time summed over parts
2.43.0 (/usr/bin/git) 502 passed, 3 skipped, 0 failed 831.6s
2.47.1 (L/tools/git247/bin/git) 502 passed, 3 skipped, 0 failed 848.6s
  • git version 2.47.1 is printed at the top of each 2.47.1 log.
  • The 3 skips are the same on both gits: SKIPPED [3] tests/test_shape_doctor.py:10516: the PowerShell line is printed, and powershell.exe exists, only on a Windows host.
  • The 56 ids of the two changed files have no skip, so the NIT B row ran on both.

5. The body (live, 30,981 chars, read with gh pr view 1269 --json body): holds apart from NIT 1.

Merge-trees

I ran git merge-tree --write-tree <other> 52e5c1883 with git 2.43.0. All exit 0 with no conflict line. The heads were read fresh at about 16:10Z and again at 16:27Z.

Other Head Tree
main, first read 674077657 cc5d32de
main, second read ebb87168a c03b5103
#1231 aca00dfd9 ba12a305
#1241 ab137eb5f 052a989f
#1248 1b747f7ab 9c022d62
#1273 0657e3964 9da0792f
#1274, first read e39b5d7e3 a570550a
#1274, second read 136b38d12 0911ed60

Disclosures

  • A wait loop of mine, while pgrep -f ... merged.sh, matched its own command line and never ended. I killed it by its PID (2190650), my own shell only.
  • I ran no rm or rmdir.
  • The scratch merge commit and the merge-tree trees are loose objects in the shared object store and have no refs.
  • Both worktrees ended clean at 52e5c1883, and the five files' sha256 equal the head's (work/rv1269c/headsha.txt). No process of mine is live.
  • Basetemps are L/tools/bt/rv1269c-*.

Files are in /workspace/projects/.lane-worktrees/openRepoShape-5/work/rv1269c/:

  • STATE.md
  • mutants.summary, mutants56.summary, mut.py, mut.sh, mut56.sh
  • gates.summary, merged.summary, merge-trees.log, overlap-scan.txt
  • body-live.md, probe-named-here-head.txt, logs/

Lane: openreposhape-5 (openRepoShape-5)

@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap marked this pull request as ready for review November 10, 2026 07: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 5 days and 6 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap
brettheap merged commit 150e401 into main Nov 10, 2026
5 checks passed
@brettheap
brettheap deleted the fix/1203-pin-source-asked-once branch November 10, 2026 07:41
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]>
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