Skip to content

adopt-project.py: check asks the split's own clone of the source in the work directory, so a clone this git will not make is adopt-git-unasked before any leg, and _resolved and _answers make their repositories as check's other throwaways do (#1083) - #1119

Merged
brettheap merged 12 commits into
mainfrom
fix/1083-check-asks-the-split-clone
Oct 23, 2026

Conversation

@brettheap

@brettheap brettheap commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What

adopt-project.py check asks this machine's git what the split will make of
the source in throwaway repositories in the work directory (#910). Two
questions were still asked otherwise, and on git 2.43 both stopped short of
the answer execute meets.

Item Change
(a) the split's own clone check now makes the split's own git clone of the source first, in a throwaway directory in the work directory: git -c protocol.file.allow=always -c core.hooksPath=<empty> clone -q --no-checkout --shared <source> <throwaway>/repository (_split_clone_asked). The protocol setting is FILE_PROTOCOL, the one execute gives each of its clones, and the operator's template is copied in, as _extract_leg's clone copies it. Its environment is _split_clone_env(): _inherited_env(), plus the -c settings a parent git hands this process (GIT_CONFIG_PARAMETERS), as execute's clone takes them. Left out are the checkout (the rehearsal and _paths_git_refuses ask it), this machine's hooks, and every variable that names another repository, its objects, an index or a work tree, which the clone would write into. Where git will not make the clone, that is one adopt-git-unasked finding in git's words, the questions after it are not asked, and execute refuses it before it makes either leg. Where git makes it, nothing changes.
(b) _resolved and _answers Their repositories are now made the throwaway way, through _throwaway and _throwaway_made. That means the work directory, no hook (-c core.hooksPath=<empty> on every command), no fsmonitor program or daemon (-c core.fsmonitor=false, as the rehearsal's and #619's commands have it; r1119b's SHOULD-A), --template=<empty>, -b throwaway and the source's object format, all under _inherited_env(), read before the throwaway is made. Before, it was TMPDIR and a plain git init with the caller's whole environment. A git step that fails in one is adopt-git-unasked in git's words, through the new _throwaway_git, never "a git or gh command failed". _submodule_findings asks no url question once a throwaway in the work directory could not be made or asked. Where a url question itself cannot be asked, the url findings asked before it are kept, and that _Unasked becomes the one finding for the throwaways. _resolved takes source as a positional fourth parameter and _answers takes source=None, so the existing rows that patch or call them keep working.
(c) docstring tests/test_adopt_reencoded_files.py::test_a_link_the_checkout_writes_is_never_written_through said the throwaway is in TMPDIR. It now says the work directory; both are as deep below tmp_path, so the row still asks the same thing. (The issue's adopt-project.py:466 names _pin_row_problem at 74c1770; this docstring is the one PR #1031's body named.)
(d) main's ref-probe row tests/test_adopt_root_symlinks.py::test_check_says_where_git_would_not_make_the_ref_probe (#1091) set GIT_DEFAULT_HASH=bogus to fail the ref probe's git init. Merged with this branch, that variable stops the split's own clone first, so check said adopt-git-unasked and exited 1 where the row wants 0 (r1119b's MUST-2). The row now puts a stub git first on PATH that fails only a git init of a refs-probe-* directory, in git's words (fatal: unknown hash algorithm 'bogus', exit 128), and hands every other command to the real git. It is skipped on Windows, as the other stub rows are. It passes on main's tool and on this head.

Covers #1032, which lane 4 released into this issue: item (b) is that work.

The clone's cost. With --shared the clone copies no object of a source
that is not shallow: it borrows the source's. git ignores --shared for a
shallow source, and says nothing, so that clone is a full copy of the
source's objects. r1119 measured a shallow copy of a 100k-file source with a
115 MiB pack: 7.3 s and 10.2 s, and 117 MiB. That is a cost, not a fault:
each of execute's own clones of such a source is a full copy too. For a
source that is not shallow, r1119 measured 0.06 s and 0.1 MiB (openRepoShape)
and 0.8-1.6 s and 1.2 MiB (100k files, 20,001 refs).

Such a clone also runs the uploadpack.packObjectsHook that this machine's
global or system config names, to pack what it copies, as each of execute's
clones of that source runs it (r1119b's NIT-C). Measured on git 2.43 with a
shallow source and a counting hook:

  • in the global config: 1 run in check, and 1 in a clone made as _extract_leg makes it;
  • in the source's own config: 0 and 0;
  • handed down by a parent git -c: 0 and 0.

Measured

check --work-dir and execute --local-remote-dir against a fresh source, on
git 2.43.0, with a stub gh. Before is main 2a119f28 (its adopt-project.py
is unchanged through 16f9a0e8), after is this branch.

Case Before: check / execute After: check / execute
init.defaultBranch = a..b in the global config exit 0 plan ok / exit 2 REFUSED extracting the spec leg, fatal: invalid branch name: init.defaultBranch = a..b, after Northwind-spec.git and Northwind-code.git exist; nothing rolled back exit 1 FINDING adopt-git-unasked, "the split's git clone of the source exited 128 there: fatal: invalid branch name ..." / exit 2 REFUSED adopt-git-unasked; remotes/ absent
the same setting handed down by a parent git, GIT_CONFIG_PARAMETERS="'init.defaultbranch'='a..b'" the same as the row above (and so on bdcf9952, this branch's first head) the same as the row above
the same setting in GIT_CONFIG_COUNT the same as the first row the same as the first row
GIT_DEFAULT_HASH=bogus exit 0 plan ok / exit 2 "a git or gh command failed", fatal: unknown hash algorithm 'bogus', with Northwind-spec.git left behind exit 1 FINDING adopt-git-unasked ("unknown hash algorithm 'bogus'") / exit 2 REFUSED adopt-git-unasked; remotes/ absent
a kept submodule, init.defaultBranch = a..b exit 2 "a git or gh command failed" at git init -q <TMPDIR>/openreposhape-url-* / the same exit 1 FINDING adopt-git-unasked / exit 2 REFUSED adopt-git-unasked; remotes/ absent
a kept submodule, GIT_DEFAULT_HASH=bogus exit 2 "a git or gh command failed" at the same git init / the same exit 1 FINDING adopt-git-unasked / exit 2 REFUSED adopt-git-unasked; remotes/ absent
a kept submodule, counting hook named by core.hooksPath in the global config 2 post-index-change runs (_resolved's update-index) 0 runs; the rest of check's output is byte for byte the same
a kept submodule, counting core.fsmonitor program in the global config or in GIT_CONFIG_COUNT 8 runs, 4 in each of _resolved's two repositories: in TMPDIR over main 038dafba's tool, and in the work directory at 9b998936 0 runs; the same findings
a source with no submodule, the same hook 0 runs 0 runs
GIT_OBJECT_DIRECTORY naming the source's own objects plan ok; the source's objects/info/ stays empty the same. The clone in the whole environment (mutant M6) wrote objects/info/alternates into the source.

On git 2.55, which CI runs, git clone takes init.defaultBranch = a..b (CI
run 39404718064 on #1031). There the clone question is no finding and every
other question is asked. The rows below follow this machine's git, or a stub,
and lean on no version.

Also measured, on git 2.43, for the clone's flags and environment:

  • with protocol.file.allow = never in the config, the clone exits 128 (transport 'file' not allowed) without FILE_PROTOCOL and 0 with it, as execute's does;
  • a shallow source, and a source that is itself a --shared clone, clone with --no-checkout --shared (exit 0);
  • a parent's -c core.hooksPath=<counting hooks> runs no hook in the clone, because git reads the clone's own -c core.hooksPath after the parent's and takes a key's last value. Without the clone's own setting, the parent's ran reference-transaction 4 times;
  • an attr.tree=bogus among a parent's settings, which is why _inherited_env() leaves them out of the questions a checkout answers, still lets the clone through (exit 0);
  • GIT_ALTERNATE_OBJECT_DIRECTORIES and GIT_SHALLOW_FILE, which _inherited_env() keeps, write nothing outside the clone. A non-empty file in GIT_SHALLOW_FILE stops the clone, as it stops execute's.

Tests

  • tests/test_adopt_check_throwaway_repos.py: 70 rows at 195d9936, and 90 on the merge head e0a98f13, which holds main's 20 rows of adopt-project.py: refused_paths' update-index -z --index-info is untested with core.ignorecase and case twins (a and A) on a case-insensitive disk #1033 as well (see "The merge of main" below). 2a119f2 had 29, and one of them is split in two (below).
    • 42 new rows, the split's two among them:
      • (a) 7;
      • (b) 8, _throwaway_git's failure among them;
      • (c) 2: NIT-R2-2's missing work directory, and the case twins;
      • r1119's review, 18 rows:
        • each form a setting can reach the clone in: a global config file, GIT_CONFIG_COUNT and GIT_CONFIG_PARAMETERS. There are real-git rows under init.defaultBranch = a..b for check and execute, and stub rows for both. The stub git refuses a git clone whose config sets a test key, so they hold on every version of git;
        • _split_clone_env()'s own row: what it takes and what it leaves out;
        • git-config-parameters for the two hook rows;
        • GIT_OBJECT_DIRECTORY naming the source's objects (SHOULD-1);
        • GIT_DIR naming the source, whose own config rewrites the on-disk url. check says what it says without GIT_DIR, and the source's config is unchanged;
        • an environment read that raises leaves no throwaway, for _resolved, _answers and the clone (NIT-3).
      • r1119b's review, 7 rows:
        • a counting core.fsmonitor program runs in none of check's throwaways, from the global config or GIT_CONFIG_COUNT, with a control for each that runs it for a git add (SHOULD-A, 4 rows);
        • --work-dir inside the source, whose config rewrites the on-disk url to a directory that holds nothing or to a network. check says what it says with the work directory outside, prints no NOTE of a url it did not ask, and leaves the source's config as it was (NIT-A, 2 rows);
        • the same rewrite handed down by a parent git in GIT_CONFIG_PARAMETERS, which _answers leaves out, as its docstring says (NIT-B). Its control shows git expands the url so under it.
    • Changed assertions:
      • the work-directory row expects the clone's directory there too;
      • the unmade-work-directory NOTE names the submodule urls (NIT-2), in two rows;
      • _split_clone_env()'s row appends its two GIT_CONFIG_COUNT entries to those the environment holds, and asserts that the last entry kept is its own and that no attr.tree is kept. Built from {}, it failed tests/test_no_auto_maintenance.py::test_no_test_sets_a_git_config_count_of_its_own (r1119b's MUST-1).
    • url_plan and the GIT_DIR row now build their source and plan through two shared helpers, and ask what they asked.
    • Two docstrings changed with no assertion.
    • SonarCloud's new-code duplication read 3.8% at bba168bd (45 of 1,197 new lines; the gate is 3%), from two pairs of repeated test bodies in this file, 10 and 14 lines each. 195d9936 is test-only and factors each pair into one module-level helper in the same file, which takes the function that builds the environment:
      • check_asks_the_clone_a_default_branch, for the check rows under init.defaultBranch = a..b: test_a_default_branch_is_asked_of_the_splits_own_clone (global config) and test_a_parent_gits_default_branch_is_asked_of_the_splits_own_clone (its two parent-git forms);
      • execute_refuses_a_default_branch_its_clone_will_not_take, for the execute rows: test_execute_refuses_a_default_branch_its_clone_will_not_take and test_execute_refuses_a_parent_gits_default_branch_before_any_leg (its two parent-git forms).
      • No test id is renamed, added or removed, and no row asserts or sets up anything it did not.
      • Counted by hand over the lines this PR adds to the file, a run of 10 or more identical lines (leading space ignored) repeats in 54 new lines at bba168bd (46 with blank lines left out), and in none at 195d9936.
    • The 2a119f2 row test_a_default_branch_git_will_not_take_stops_no_question is split in two:
      • test_a_default_branch_is_asked_of_the_splits_own_clone follows this git's own clone;
      • test_a_default_branch_git_will_not_take_stops_no_throwaway_init asks the rehearsal alone, so the -b of every throwaway git init stays pinned on git 2.43.
  • tests/test_adopt_root_symlinks.py: main's ref-probe row, item (d).
  • On 195d9936: 70 passed, and the ref-probe row passes.
  • Over 195d9936, the duplication commit: test_adopt_check_throwaway_repos.py gave 70 passed, 0 skipped, the same 70 ids with the same outcomes as bba168bd (70 passed, 0 skipped), each run in a clean clone. test_path_guard_hygiene.py and test_repo_hygiene.py together: 149 passed.
  • Over d0bc40ce's tool, this round's base (9b998936 merged with main 038dafba): 2 failed, 69 passed, of the 70 rows and the ref-probe row. The 2 are the fsmonitor rows, 8 runs each.
  • Over main 038dafba's tool: 33 failed, 38 passed.
    • 30 of the 33 are the 30 that failed over 16f9a0e8's tool in the last round, row for row. Each fails for its own reason: plan ok where the finding is due, DID NOT RAISE Refusal from execute, url repositories made in TMPDIR, two hook runs, an uncaught _Unasked, or a function or parameter that main does not have.
    • The other 3 are this round's: the two fsmonitor rows (8 runs each, in TMPDIR), and the parent-rewrite row (main's _answers ran in the whole environment, read the rewrite, and found the url answering nothing).
    • This round's two controls pass there. So do the two inside-the-source rows, which pin the mutant R8 rather than a change of this PR, and the ref-probe row.
  • The rows that need git to refuse a clone or a git init use a stub git, first on PATH, and are skipped on Windows. One stub refuses every git clone; another refuses one whose config sets a test key; the ref-probe row's fails only the probe's git init.
  • The real-git execute rows under init.defaultBranch = a..b are skipped where this git's clone takes the name, as 2.55's does.
  • Case twins under core.ignorecase. No case-insensitive disk is at hand. The row is still sound: _paths_git_refuses hands paths to update-index --index-info and reads ls-files, which read no file of the disk, only the setting. So it sets core.ignorecase=true on a disk that holds both twins.
    • Its control shows the setting is live: git add of the twins under it holds at most one (git 2.43 says will not add file alias).
    • --index-info holds both, so neither twin is named.

Mutants

First round, at bdcf9952: 16 mutants of the behaviour changes, each run over the new file (and M15 over the url files too). 13 were killed and 3 survived:

  • M1-M5, M7-M13 and M16 were killed, by the rows the table of that round named. They were not re-run on this head.
  • M6 and M14 survived. They were killed in the second round.
  • M15, git submodule init without the hook setting, survives: 73 rows of the url files pass. It is equivalent, as git submodule init runs no hook.

r1119's round, at 9b998936: 11 mutants, each run over the file with -x, and the tool restored and sha-checked after each. 11 killed.

Id Mutant Killed by
M6 the clone in the whole environment the GIT_OBJECT_DIRECTORY row
M6b _split_clone_env() is the whole environment _split_clone_env()'s row
N11 the clone's environment leaves out GIT_OBJECT_DIRECTORY alone _split_clone_env()'s row
N1 the clone takes no GIT_CONFIG_PARAMETERS, as at bdcf9952 the real-git git-config-parameters row (the stub rows too, measured over bdcf9952)
N8 the clone without its own -c core.hooksPath each of the three hook rows, git-config-parameters among them
M14 _answers in the whole environment the GIT_DIR row: the source's url rewrite gave plan-submodule-url-answers-nothing
M14r _resolved in the whole environment the GIT_DIR row. Measured, it wrote [remote "origin"] and [submodule "u0"] into the source's own config, and check said plan ok
N4 _resolved reads its environment after making its throwaway the environment-read row, resolved
N5 _answers does the same the environment-read row, answers
N6 the clone does the same, outside its try the environment-read row, split-clone
N7 the unmade NOTE names no submodule url the NOTE row

r1119b's round, on this head's tool before its last docstring edit (cea25530, 0b326952): 18 mutants, each run with -x over the rows named, and the tool restored and sha-checked after each. 17 killed; S4 survives as equivalent. A5, A6, A6b, A15, A2b, R8 and A18 are r1119b's own, re-anchored on this head.

Id Mutant Killed by
A5, A6, A6b _split_clone_env() hands back GIT_ATTR_SOURCE, GIT_INDEX_FILE or GIT_WORK_TREE _split_clone_env()'s row
A15 GIT_CONFIG_PARAMETERS always set, empty where the parent sets none _split_clone_env()'s row
A2b the clone's environment drops the GIT_CONFIG_COUNT form _split_clone_env()'s row
KA1 _inherited_env() keeps attr.tree _split_clone_env()'s row
KA2 the clone alone takes the command scope back as it stands, attr.tree and all _split_clone_env()'s row
MR1 the ref probe's CommandFailed stops check the ref-probe row
MR2 the ref probe's failure is taken with no NOTE the ref-probe row
MR3 the probe's directory named otherwise, so the stub misses it and git makes it the ref-probe row: no NOTE
S1 no core.fsmonitor=false, as at 9b998936 the fsmonitor row
S2 core.fsmonitor=false for the throwaway's git init alone the fsmonitor row
S3 _resolution_of's git submodule init without hooks_off the fsmonitor row
R8 _answers' two ls-remotes run in the throwaway's own directory the inside-the-source row, a-directory-holding-nothing; and first over the whole file with -x
R8a only its ls-remote --get-url there the inside-the-source row, a-network: the NOTE of a url on a network not asked. It survived the first form of the row, and the a-network case was added for it
R8b only its other ls-remote there the inside-the-source row, a-directory-holding-nothing
A18 _answers takes _split_clone_env(), a parent's -c too the parent-rewrite row; and first over the whole file with -x
S4 _answers' ls-remotes without hooks_off survives. It is equivalent: ls-remote reads no index and writes no ref, so it runs no hook and no fsmonitor program.

Across the three rounds, 43 distinct mutants: 41 killed, and M15 and S4 survive as equivalent. Of r1119b's own list on 9b998936, R8 and A18 survived there and are killed now. R2 (no --shared, which changes only the cost), R3 (the clone after _paths_git_refuses, whose finding wins either way) and A17 (_resolved takes a parent's -c, under which the throwaway's own hook setting still wins) were judged no defect, and stay so.

Gate

On bba168bd, which merges main 038dafba (#1091, #1111), with a clean tree: 18 batches, 3,413 passed, 0 failed, 8 skipped. The head since is 195d9936, which changes one test file and nothing the tool reads; the rows it re-ran are named under Tests.

The environment was a stub gh, GH_TOKEN bogus, an empty GH_CONFIG_DIR, GIT_CONFIG_GLOBAL=/dev/null, GIT_SSH_COMMAND=false, LANES_LANE unset and EMAIL exported. Each batch had its own basetemp with retention failed, each pytest call ran under 530 s, and at most 4 ran at once.

  • test_adopt_check_throwaway_repos.py, test_adopt_relative_submodule_url.py and test_adopt_reencoded_files.py: 157.
  • test_adopt_nested_attributes.py and test_adopt_empty_symlinks.py: 132.
  • test_adopt_root_symlinks.py, in 2 shards: 205 passed, 3 skipped.
  • test_adopt_symlink_target_bytes.py: 130.
  • test_adopt_execute_refusals.py: 181.
  • test_adopt_entry_paths.py, test_adopt_literal_names.py, test_adopt_project_is_the_source.py, test_adopt_split_branch.py and test_windows_paths.py: 209.
  • test_adopt_submodules.py: 167.
  • test_adopt_history_gitlinks.py and test_adopt_submodule_url_answers.py: 67.
  • test_adopt_manifest_values.py and test_adopt_leg_path_collisions.py: 177.
  • test_adopt_plan_yaml_quoting.py: 540.
  • test_scaffold_leg_path_collisions.py, test_repo_hygiene.py, test_agents_md_codes.py, test_readme_windows_quoting_sentence.py, test_cli_reference.py, test_adopt_work_dir_refusal.py, test_adopt_clone_claimed.py, test_no_auto_maintenance.py and main's test_path_guard_hygiene.py: 520 passed, 2 skipped.
  • test_adopt_c_locale_bytes.py, test_adopt_check_plan_name.py, test_adopt_pins.py and test_pin_annotated_tag.py: 243.
  • test_adopt_shape_pin_and_work_dir.py, which names the work-dir NOTE, test_visibility_field_words.py, test_scaffold_reuse_seeded_legs.py and test_adopt_root_shape_paths.py, which the merge changed: 240.
  • test_shape_doctor.py, in 4 shards of 112: 445 passed, 3 skipped.

Before this round:

The merge of main

e0a98f13 merges main ef619c74 (#1158, which adds #1033's case-twin rows to tests/test_adopt_check_throwaway_repos.py) into this branch by a merge commit, on top of 195d9936. The merge base is main 038dafba. The push fast-forwarded the branch, and nothing was rebased or forced.

  • One conflict, in that file only: the module docstring, where both sides added a paragraph after "finding, with a NOTE." It was settled by keeping both paragraphs as their sides wrote them, adopt-project.py check: follow-ups of PR #1031 (#910): on git 2.43 an init.defaultBranch git will not take passes check and execute stops after both legs exist; _resolved and _answers still use TMPDIR, hooks and a plain git init #1083's first and adopt-project.py: refused_paths' update-index -z --index-info is untested with core.ignorecase and case twins (a and A) on a case-insensitive disk #1033's second, with a blank line between. Every other hunk of the file merged without a conflict, and no other file conflicted.
  • Both sides' rows, helpers and imports are kept, as written. No assertion was changed and no name is defined twice (an AST check of the file's top-level names: 165 names, 0 repeated).
  • Test ids of that file, collected with --collect-only -q in a clean clone at each commit: 29 at 038dafba, 49 at main ef619c74, 70 at 195d9936, 90 at the merge.
    • Main adds 20 ids and removes none. This PR adds 42 and removes 1: test_a_default_branch_git_will_not_take_stops_no_question, which it splits in two (see Tests).
    • The merge is therefore the union of the two sides (91 distinct ids) less that one id, which main left as it was and this PR replaced. Against that expected set the difference is empty.
  • Run on the merge, in a clean clone at e0a98f13, each in the probe environment (a stub gh, GH_TOKEN bogus, an empty GH_CONFIG_DIR, GIT_CONFIG_GLOBAL=/dev/null, GIT_SSH_COMMAND=false, EMAIL exported, LANES_LANE unset):
    • tests/test_adopt_check_throwaway_repos.py, one call: 89 passed, 1 skipped. The skip is main's test_on_a_disk_that_ignores_case_each_twin_is_held_or_named, which needs a disk that ignores case, as its docstring says.
    • tests/test_path_guard_hygiene.py, tests/test_no_auto_maintenance.py and tests/test_adopt_single_repository_record.py, one call: 146 passed, 2 skipped. The two are rows of test_no_auto_maintenance.py that skip when the session began with GIT_CONFIG_GLOBAL set, as the probe environment sets it.
    • These are the only runs on the merge. The gate above ran on bba168bd. The merge brings in main's changes to scaffold-project.py, scripts/family.py, the v1.2.0 release notes and tests, and leaves adopt-project.py as it was at 195d9936; it imports none of those changed files.

Known limits

It was left out of v1.2.0 by Brett Heap's ruling of 2026-10-21T10:32:04Z. Lane 3 has since put it on milestone v1.2.1, and it lands under Brett Heap's v1.2.1 merge word.

Closes #1083
Closes #1032

Lane: openreposhape-1 (openRepoShape-1)

🤖 Generated with Claude Code

Summary by Sourcery

Align adopt-project.py check with the repositories and environment that execution will use, surfacing clone and throwaway Git failures before any split work begins.

New Features:

  • Make check rehearse the split’s own source clone before evaluating paths or submodule URLs, reporting clone failures as adopt-git-unasked before any leg is created.
  • Run submodule URL resolution and answer checks in isolated work-directory throwaway repositories matching the split’s clone environment.

Bug Fixes:

  • Prevent checks from inheriting repository, object, index, work-tree, hook, or fsmonitor state that could modify the source or produce misleading results.
  • Ensure failed throwaway operations preserve earlier findings and report Git’s failure as a single unasked finding instead of a generic command failure.
  • Keep parent Git configuration parameters relevant to the split’s clone while avoiding unsafe repository-related environment variables.

Enhancements:

  • Disable hooks and filesystem monitors consistently across throwaway repositories and align clone protocol, template, object-format, and branch behavior with execution.
  • Update work-directory and unasked-question handling so URL checks are skipped when required throwaways cannot be created or queried.

Documentation:

  • Update user-facing and test documentation to describe the split clone and work-directory throwaway behavior.

Tests:

  • Add comprehensive coverage for clone failures, inherited Git configuration, repository isolation, hooks and fsmonitor suppression, URL-question ordering, work-directory behavior, and environment-read failures.
  • Adapt the ref-probe test to isolate ref-probe failures from the new initial clone check.

Brett Heap and others added 3 commits October 21, 2026 12:58
…` of the source in the work directory, and `_resolved` and `_answers` make their repositories as #910's throwaways are made (#1083)

Work in progress for #1083, stopped at a usage checkpoint.

Built: `_split_clone_asked` (asked first in `_entry_findings`; a failure is
`adopt-git-unasked`, which `execute` refuses before any leg); `_resolved`
and `_answers` made with `_throwaway`/`_throwaway_made` in the work
directory, no hooks, `--template=<empty>`, `-b`, the source's format,
under `_inherited_env()`; `_throwaway_git`; `_submodule_findings` skips the
url questions once one throwaway could not be asked. 16 rows added or
changed in tests/test_adopt_check_throwaway_repos.py (45 rows: all pass on
this head; 14 fail and 31 pass over 2a119f2's adopt-project.py).

Left: the TMPDIR docstring in tests/test_adopt_reencoded_files.py, the
gate, and the PR body.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e_checkout_writes_is_never_written_through` says the throwaway repository is made in the work directory, as #910 makes it, and no longer in `TMPDIR` (#1083)

The last item of #1083's (c): the docstring still said the throwaway
repository the link is asked in is in `TMPDIR`. Since #910 it is made in
the work directory, which is as deep below `tmp_path` as the `TMPDIR` the
row sets, so the row asks the same question and only its words change.
(The issue's `adopt-project.py:466` names `_pin_row_problem` at 74c1770;
this docstring is the one PR #1031's body named.)

Gate on the merged tree (main 6da757c): see the pull request body.

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

sourcery-ai Bot commented Oct 21, 2026

Copy link
Copy Markdown

Reviewer's Guide

check now rehearses the exact source clone that execute will make and standardizes submodule URL questions on the same work-directory throwaway repositories, reporting Git setup or query failures as actionable adopt-git-unasked findings before any split legs are created; the accompanying tests cover ordering, environment/configuration parity, hooks, cleanup, compatibility, and failure handling.

Sequence diagram for check rehearsing the source clone

sequenceDiagram
    participant Check
    participant WorkDir
    participant Git
    participant Execute
    participant Legs

    Check->>WorkDir: _throwaway()
    Check->>Git: clone --no-checkout --shared with FILE_PROTOCOL
    alt clone succeeds
        Check->>Git: _paths_git_refuses()
        Check->>Git: _submodule_findings()
        Check-->>Execute: findings and plan
        Execute->>Legs: create and extract split legs
    else clone fails
        Git-->>Check: exit status and stderr
        Check-->>Execute: adopt-git-unasked
        Execute-->>Legs: refuse before creation
    end
Loading

Sequence diagram for submodule URL questions in throwaway repositories

sequenceDiagram
    participant Check
    participant Throwaway
    participant Git
    participant Findings

    Check->>Throwaway: _resolved(source)
    Throwaway->>Git: _throwaway_git(configure origin and .gitmodules)
    Throwaway->>Git: _throwaway_git(hash-object and update-index)
    Throwaway->>Git: git submodule init
    Git-->>Throwaway: resolved URL or failure
    Check->>Throwaway: _answers(urls, source)
    Throwaway->>Git: git ls-remote --get-url
    Throwaway->>Git: git ls-remote for local URLs
    alt throwaway creation or Git query fails
        Git-->>Findings: _Unasked as adopt-git-unasked
        Findings-->>Check: stop later URL questions
    else questions succeed
        Git-->>Findings: URL findings and notes
    end
Loading

File-Level Changes

Change Details Files
Make check rehearse the split's source clone before running other Git questions, matching execute's clone behavior and refusal timing.
  • Add a work-directory throwaway git clone --no-checkout --shared using FILE_PROTOCOL, an empty hooks path, the source template, and inherited environment.
  • Convert clone failures into a single adopt-git-unasked finding so later checks are skipped and execute can refuse before creating legs.
  • Add tests for clone failures, protocol handling, environment-sensitive Git settings, work-directory cleanup, and execute refusal behavior.
adopt-project.py
tests/test_adopt_check_throwaway_repos.py
Run submodule URL resolution and local URL-answer checks in standardized throwaway repositories instead of ad hoc temporary repositories.
  • Pass the source through _resolved, _answers, and related finding functions so throwaways use the source format, work directory, fixed branch, empty template, inherited environment, and disabled hooks.
  • Add _throwaway_git to preserve Git's failure text as adopt-git-unasked findings rather than generic command failures.
  • Stop or suppress later URL questions when a throwaway cannot be made or queried, while retaining findings obtained before the failure.
  • Preserve compatibility for existing callers by making new source parameters optional.
adopt-project.py
tests/test_adopt_check_throwaway_repos.py
Expand regression coverage and update documentation for the new throwaway and clone semantics.
  • Verify throwaways are created and removed in the work directory, including previously absent or unwritable work directories.
  • Verify hooks do not run, source object formats and Git settings are respected, URL questions are ordered correctly, and case-twin behavior remains stable.
  • Update docstrings and implementation comments to describe the split clone and work-directory URL repositories.
tests/test_adopt_check_throwaway_repos.py
tests/test_adopt_reencoded_files.py
adopt-project.py

Assessment against linked issues

Issue Objective Addressed Explanation
#1083 Make check rehearse the split’s own source clone in the work directory, so a clone failure is reported as adopt-git-unasked before either leg is created. ✅
#1083 Move _resolved and _answers throwaway repositories from TMPDIR to the work directory and create them with the standard throwaway settings, reporting Git failures as adopt-git-unasked and avoiding hooks. ✅
#1083 Close the smaller documentation and regression-test gaps, including correcting the identified adopt-project.py docstring and covering a missing work directory and case twins under core.ignorecase. ❌ The PR adds tests for the missing-work-directory and case-twin cases, and updates several docstrings, but the diff does not change the specifically identified adopt-project.py:466 docstring. It therefore does not fully address this objective.

Tips and commands

Interacting with Sourcery

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

Customizing Your Experience

Access your dashboard to:

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

Getting Help

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-10-21T14:36:09Z) r1119, lane 1's independent reviewer (not the writer), reviewed #1119 at bdcf9952: READY on condition, and PARTIAL because the usage window forced a checkpoint. No MUST. The condition is SHOULD-1, a missing test that pins the clone to _inherited_env(). Measured, that is a safety property: with the whole environment, check writes objects/info/alternates into the source under GIT_OBJECT_DIRECTORY. SHOULD-2 is the GIT_CONFIG_PARAMETERS gap. The mutant runs and the gate are left to a fresh reviewer. The review follows in full.


r1119 review of PR #1119 at bdcf9952 (PARTIAL: stopped at the coordinator's checkpoint)

Verdict: READY on condition (PARTIAL). No MUST found. Every behaviour claim I measured holds. The condition is SHOULD-1, a missing test for a safety property. Mutant runs over the tests and the merged-tree gate were not finished; they are listed at the end.

Scratch state: all three copies of adopt-project.py (worktree, $S/base, $S/m6/tree) hash to b985928ed29eb465216f6fa0b308e39c1f23a196aea9ddf81f585a6a0e2d120d, and git status --short in the worktree is empty. The gate's processes were killed by PID and none is left. Nothing was written to GitHub, committed or pushed.

Findings

SHOULD-1: no test pins that the clone runs under _inherited_env(), and the body explains M6 wrongly (adopt-project.py:11184-11189)

  • The body calls M6 a fidelity limit. Measured, it is a safety property: the whole environment makes check write into the source repository.
  • I ran check with GIT_OBJECT_DIRECTORY=<source>/.git/objects:
    • head: exit 0, plan ok, and the source's objects/info/ stays empty.
    • M6 copy (env=None on the clone): exit 0, plan ok, and the source gains objects/info/alternates: …/god-m6/Thing/.git/objects. That is a write into the source, which check promises never to make.
  • Measured directly too: a plain GIT_OBJECT_DIRECTORY=<foreign> git clone --no-checkout --shared writes <foreign>/info/alternates and <foreign>/pack.
  • Fix:
    • Add a row that runs check with GIT_OBJECT_DIRECTORY naming the source's own object directory, and asserts the source's objects/info is unchanged. It kills M6.
    • Reword the body's Known limits and the M6 row of the Mutants table.

SHOULD-2: the known limit is real, and it is the failure #1083 exists to remove (adopt-project.py:11188)

  • With GIT_CONFIG_PARAMETERS="'init.defaultbranch'='a..b'":
    • head check: exit 0, plan ok;
    • execute: exit 2, REFUSED extracting the spec leg, fatal: invalid branch name: init.defaultBranch = a..b;
    • remotes: ['Northwind-code.git', 'Northwind-spec.git'], and "NOTHING has been rolled back".
  • A narrow fix is safe. A parent -c reaches the clone (measured: exit 128, invalid branch name), and the clone's own -c core.hooksPath comes after it, so it still wins.
  • Fix: give the clone _inherited_env() plus GIT_CONFIG_PARAMETERS when it is set, never the whole environment (see SHOULD-1). Attributes are irrelevant without a checkout, so the attr.tree reason for leaving it out does not apply here. This can be a follow-up issue if the lane prefers, but the body should then name that issue.

NIT-1: "--shared, so no object is copied" is false for a shallow source (docstring at adopt-project.py:11175-11176, and the body's "the object copy (--shared)")

  • git silently ignores --shared when the source is shallow.
  • Measured with a shallow copy of a 100k-file, 115 MiB-pack source: the clone took 7.3 s and 10.2 s, used 117.1 MiB, and made no alternates file.
  • Fix: say so in the docstring and the body. It is a cost, not a fault: execute's own clones copy as much.

NIT-2: the work-dir-unwritable change hides a plan finding for one round, and the NOTE does not say so (adopt-project.py:11050-11055)

  • With a read-only --work-dir and a kept relative-url submodule:
    • base: adopt-work-dir-unwritable and plan-submodule-relative-url;
    • head: adopt-work-dir-unwritable only.
  • The relative-url finding needs no work directory, so the user sees it one check later. That is acceptable under one cause, one finding.
  • But the body's "Its NOTE still says what went unasked" is only partly true. The NOTE says "It asked nothing about the source's paths and files there" and names no submodule url.
  • Fix: add "or its submodules' urls" to the NOTE, or reword the body.

NIT-3 (from reading only, unmeasured): in _resolved (:7708-7709) and _answers (:7918-7919), env = _inherited_env() runs after _throwaway(...) but outside the try. If it raised, the throwaway would be left behind. By reading, GIT_CONFIG_COUNT='²' would do it: '²'.isdigit() is true but int('²') raises. Fix: compute env before _throwaway.

Checked and found sound

Body-claim table

# Claim Measured
1 init.defaultBranch = a..b (global config): before plan ok / execute exit 2 at the spec leg with both legs made; after adopt-git-unasked / REFUSED adopt-git-unasked, remotes/ absent true. The head finding ends "the split's git clone of the source exited 128 there: fatal: invalid branch name: init.defaultBranch = a..b"
2 GIT_DEFAULT_HASH=bogus: before plan ok / "a git or gh command failed" with Northwind-spec.git left; after FINDING / REFUSED, remotes/ absent true. Base left ['Northwind-spec.git']
3 kept submodule with a..b: before exit 2 at git init -q <TMPDIR>/openreposhape-url-*; after FINDING / REFUSED true. Base said git init -q …/tmpx/openreposhape-url-vnouwe9o. On git 2.43 the head finding is the clone's, not _resolved's
4 kept submodule with GIT_DEFAULT_HASH=bogus true
5 counting hook in the global config, kept submodule: 2 runs before, 0 after; the rest of the output byte for byte the same true. Base ['post-index-change', 'post-index-change'], head []. Head's output is the same with and without the hook, and base and head differ only in the plan's path
6 no submodule, same hook: 0 / 0 true
7 protocol.file.allow = never: clone exits 128 without FILE_PROTOCOL, 0 with it true (transport 'file' not allowed)
8 a shallow source and a --shared-clone source clone with exit 0 true, but see NIT-1
9 45 rows, 45 passed on head true (45 passed in 93 s)
10 14 failed / 31 passed over the base tool true over both 16f9a0e's and 6da757c's adopt-project.py, the same 14 rows
11 2a119f2's adopt-project.py is unchanged through 16f9a0e true (empty diffstat)
12 Known limit: M6/M14, the _inherited_env() gap the gap is true (SHOULD-2). Calling M6 only a fidelity limit is false (SHOULD-1)
13 Behaviour change: an unwritable work dir asks no url question true. "Its NOTE still says what went unasked" is partly false (NIT-2)
14 Mutants: 13 of 16 killed unverified: no mutant was run over the tests
15 Gate: 3,050 passed, 5 skipped unverified: stopped before the first batch ended
16 M15 is equivalent unverified

Cost of the new clone, against base (base makes none)

Source Clone time Disk Whole check, base vs head
openRepoShape (516 commits, 179 refs) 0.06 s 0.1 MiB not timed
100k files, 115 MiB pack, 20,001 refs 0.8 s and 1.6 s 1.2 MiB 55.7–61.2 s vs 59.8–82.2 s (+4–8 s typical; 82.2 s is one noisy run)
the same, shallow 7.3 s and 10.2 s 117 MiB, a full copy 59.9 s vs 65.2 s

The load average was about 90 throughout, so the whole-check times are noisy.

Mutants: 0 run over the tests

  • I designed 16 mutants. None of them was run over the tests before the checkpoint.
  • M6 was only probed by hand (SHOULD-1); I did not run it over the test file.

Merge with main

Not finished (for a fresh reviewer)

  1. Mutant runs. Run them in $S/base, with a basetemp separate from the gate's. Run each over tests/test_adopt_check_throwaway_repos.py; the url mutants also over test_adopt_relative_submodule_url.py and test_adopt_submodule_url_answers.py, and R21 also over test_adopt_c_locale_bytes.py. Use -x, and restore and sha-check after each. R6, R7, R8, R14, R15 and R21 need count=1 replacements: patch _resolution_of, the ls-remote calls and the second _resolved(…) call by their own lines.
    • R1: no removal in _split_clone_asked.
    • R2: no --shared.
    • R3: the clone asked after _paths_git_refuses.
    • R4: _submodule_findings drops moved/notes on an _Unasked.
    • R5: _entry_findings ignores the returned unasked.
    • R6: _throwaway_git without .strip().
    • R7: _resolution_of(scratch…).
    • R8: _answers' ls-remote with cwd=scratch, which I expect survives.
    • R11 and R17: _Unasked(scratch…).
    • R12: a clone failure as unmade=True.
    • R14: the second _resolved without source.
    • R15: no ON_THIS_DISK_ONLY.
    • R21: base without _path_argument.
    • R26 and R27: no removal in _resolved / _answers.
    • Also run M6 itself over the tests, which I expect survives.
  2. The gate on $S/merged, using $S/gate.sh: the PR's file; test_shape_doctor.py in 4 shards ($S/doctor-shard{0..3}.txt, 112 ids each); test_scaffold_leg_path_collisions.py; and test_adopt_c_locale_bytes.py, test_adopt_clone_claimed.py, test_adopt_relative_submodule_url.py, test_adopt_submodule_url_answers.py, test_adopt_shape_pin_and_work_dir.py, test_adopt_work_dir_refusal.py, test_adopt_check_plan_name.py and test_adopt_reencoded_files.py.
  3. Safety probes not run:
    • core.fsmonitor (global, and in the source's config);
    • a smudge or process filter;
    • submodule.recurse=true;
    • an init.templateDir holding hooks and a config;
    • a partial-clone or promisor source, against git 2.43's CVE-2024-32004 class. That class is already reachable through the reads of the source check makes, and execute clones the source anyway.
  4. Cleanup not measured: on KeyboardInterrupt (by reading, the try/finally covers it), and two concurrent check runs in one work directory (by reading, mkdtemp names are unique).

Scratch: /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1119/ holds probe.py, cost.py, bigsource.py, timecheck.py, gate.sh and probes/.

Lane: openreposhape-1 (openRepoShape-1)

… parent git hands it, as execute's does, and no variable naming another repository; _resolved and _answers read their environment before their throwaway (#1083)

r1119's fix round on #1119.

SHOULD-2: `_split_clone_asked` makes the clone in `_split_clone_env()`:
`_inherited_env()` plus `GIT_CONFIG_PARAMETERS` where it is set. Measured on
bdcf995 with git 2.43, `GIT_CONFIG_PARAMETERS="'init.defaultbranch'='a..b'"`
gave `plan ok` from `check`, and `execute` made both legs and stopped
extracting the spec leg. Now `check` says `adopt-git-unasked` and `execute`
refuses before any leg, as for the setting in a config file or in
`GIT_CONFIG_COUNT`. A parent's `-c core.hooksPath` runs no hook: the clone's
own `-c` comes after it.

SHOULD-1: a row runs `check` under `GIT_OBJECT_DIRECTORY` naming the source's
own objects and holds the source's object directory unchanged. It kills M6:
in the whole environment the clone wrote `objects/info/alternates` into the
source. A row under `GIT_DIR` naming the source, whose own config rewrites
the on-disk url, kills M14 (`_answers` in the whole environment) and holds
the source's config unchanged.

NIT-1: the docstring says git ignores `--shared` for a shallow source, so
that clone is a full copy, a cost `execute`'s own clones pay too.
NIT-2: the unmade-work-directory NOTE says it asked nothing about the urls of
the submodules the plan keeps either.
NIT-3: `_resolved`, `_answers` and the clone read their environment before
they make their throwaway, so a raise there leaves none behind.

tests/test_adopt_check_throwaway_repos.py: 63 rows (45 before), 18 new.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brettheap brettheap changed the title adopt-project.py: check asks the split's own git clone of the source in the work directory, so a clone this git will not make is adopt-git-unasked before any leg, and _resolved and _answers make their repositories as check's other throwaways do (#1083) adopt-project.py: check asks the split's own clone of the source in the work directory, so a clone this git will not make is adopt-git-unasked before any leg, and _resolved and _answers make their repositories as check's other throwaways do (#1083) Oct 21, 2026
@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-10-21T16:52:08Z) r1119b, lane 1's independent reviewer (not the writer), re-checked #1119 at 9b998936: NOT READY, with two MUSTs, each with a proven fix. All five round-1 findings are resolved, and the safety probes found nothing written outside the throwaways.

A fix round follows. The review follows in full.


Verdict: NOT READY. Two MUSTs. Both have small fixes, and I proved each fix on a scratch copy. All five round-1 findings are resolved. Every check the brief listed was run; this report is complete, not PARTIAL.

Nothing was written to GitHub, committed or pushed. My worktree /workspace/projects/openRepoShape-worktrees/l1-r1119 is still clean at 9b998936. Every scratch clone I mutated hashes back to 4a0f5881… with a clean status, and none of my processes is still running.

Merge with main (4ed7c7bf)

  • git merge-tree --write-tree 9b998936 origin/main is textually clean (exit 0, tree 4bcc0222).
  • I built a scratch merge commit 91c0a834, checked out detached at /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1119/r2/merged.
  • Gate on the merged tree: 1,061 passed, 2 failed, 8 skipped.
Batch Result
test_adopt_check_throwaway_repos.py 63 passed
test_no_auto_maintenance.py 1 failed, 57 passed, 2 skipped (MUST-1)
test_scaffold_leg_path_collisions.py 104 passed
test_shape_doctor.py, 4 shards of 112 445 passed, 3 skipped
c_locale_bytes, clone_claimed, relative_submodule_url, shape_pin_and_work_dir, submodule_url_answers, work_dir_refusal 188 passed
test_adopt_root_symlinks.py (it names adopt-work-dir-unwritable) 1 failed, 204 passed, 3 skipped (MUST-2)

Round-1 findings

  • SHOULD-1: resolved.
    • M6 is killed by test_the_clone_writes_nothing_into_an_object_directory_around_it.
    • M14 and M14r are both killed by test_a_repository_around_check_rewrites_no_url_it_asks.
    • Each was my own run on head. The body now calls this a safety property.
  • SHOULD-2: resolved, and sound.
  • NIT-1: resolved. The docstring (:11222-11227) and the body say it. Measured: a -q --shared clone of a shallow source prints nothing and makes no alternates.
  • NIT-2: resolved. Head's NOTE now ends "nor about the urls of the submodules the plan keeps"; bdcf9952's did not.
  • NIT-3: resolved. The environment is read first at :7710, :7919 and :11231. Undoing each one (N4r, N5a, N6c) is killed by its environment-read row.

Safety probes

Trees: base 823624d9 (before the PR), head, main 4ed7c7bf, merged. "Runs" counts programs the probe's own logging scripts recorded during check.

# Probe Result Writes outside the throwaway
1 core.fsmonitor program, global config 8 runs on every tree, from _resolved's update-index. On head they run in the work dir's openreposhape-url-* (SHOULD-A) none
2 core.fsmonitor in the source's config 0 none
3 smudge and clean filter, global runs only in #910/#654's -attributes-/-reencoded- throwaways, which rehearse a checkout by design; none in the clone, -url- or -ask-. The counts (28/30/24/30) differ only in clean inside -reencoded-, code this PR does not touch; I did not re-run to prove it is timing none
4 process filter, global 2 runs on every tree, same throwaways as row 3 none
5 filter in the source's config 0 none
6 submodule.recurse=true 0, findings unchanged none
7 init.templateDir with hooks and a config (fsmonitor, hooksPath) base and main 10 runs; head and merged 0 (an improvement) none
8 template config naming remote.origin.uploadpack 0 none
9 partial clone, history blobs missing 0 none
10 partial clone, HEAD blobs missing (re-made after plan) the source's own uploadpack program runs 5 times, and a promisor pack is written into the source, identically on all four trees. It comes from check's reads of the source, not from this PR (NIT-D) the source's objects/pack (all trees)
11 shallow source, global uploadpack.packObjectsHook head and merged 1 run, base and main 0 (NIT-C) none
12 shallow source, hook and fsmonitor in the source's config 0 none
13 GIT_ALTERNATE_OBJECT_DIRECTORIES and GIT_SHALLOW_FILE naming a victim repository; GIT_NAMESPACE; GIT_REPLACE_REF_BASE plan ok none
14 a parent -c of hooksPath, fsmonitor, core.worktree=<victim>, commit-graph, reflogs, auto gc and maintenance, sharedRepository base 10 runs; bdcf9952, head and merged 0 none
15 SIGINT, to the process group and to Python alone, paused in the clone and in _resolved work dir empty in 8 of 8 (head and merged). Exit -2 with a traceback, which predates this PR none
16 two concurrent check runs, one work dir they overlapped (2 throwaways at once); both match a solo run; work dir empty after none

New findings

MUST-1: head fails a gate test (tests/test_adopt_check_throwaway_repos.py:1243)

  • test_the_clone_takes_a_parent_gits_settings_and_no_other_repository calls appended_to_command_scope({}, …).
  • That fails tests/test_no_auto_maintenance.py::test_no_test_sets_a_git_config_count_of_its_own. It failed in lane 1's G5 on head and in my run on the merged tree.
  • Fix: replace that block with:
    for name, value in appended_to_command_scope(
            os.environ, [("attr.tree", "HEAD"), ("test.heldone", "one")]).items():
        monkeypatch.setenv(name, value)
    env = adopter._split_clone_env()
    assert env["GIT_CONFIG_PARAMETERS"] == parameters
    assert [env.get(name) for name in named] == [None] * len(named)
    scoped = [(env[f"GIT_CONFIG_KEY_{n}"], env[f"GIT_CONFIG_VALUE_{n}"])
              for n in range(int(env["GIT_CONFIG_COUNT"]))]
    assert scoped[-1] == ("test.heldone", "one")
    assert "attr.tree" not in [key.lower() for key, _ in scoped]
  • Proven: with it, the row and the scan both pass.
  • It still tests what it claims: the row still fails under A5 (GIT_ATTR_SOURCE handed back), A15 (GIT_CONFIG_PARAMETERS always set) and a mutant that keeps attr.tree.

MUST-2: the merge with main fails a test that main added (main's tests/test_adopt_root_symlinks.py:2070)

SHOULD-A: a core.fsmonitor program still runs in _resolved's throwaways (adopt-project.py:11118)

NIT-A: R8 survives because no row puts --work-dir inside a repository (:7929; a row beside :1283)

  • With a work dir inside the source and the source's config rewriting the url:
    • head gives [plan-submodule-relative-url];
    • R8 adds a false plan-submodule-url-answers-nothing.
  • Fix: add that row.

NIT-B: A18 survives (docstring at :7911-7913)

  • The docstring says _answers leaves out GIT_CONFIG_PARAMETERS; no row pins it.
  • Fix: add a git-config-parameters url-rewrite variant of the :1283 row.

NIT-C: a shallow source makes the clone run uploadpack.packObjectsHook from protected config (probe 11)

  • execute's clone runs it too, and turning it off would cost fidelity.
  • Fix: one sentence in _split_clone_asked's docstring or under Known limits.

NIT-D (predates this PR; for a follow-up issue): probe 10. check's own reads of a partial source fetch from its promisor, running the source's uploadpack program and writing into the source, the same on every tree.

NIT-E: the body's Gate section is stale. It says 8 batches and 0 failed. It should now carry lane 1's G5 failure and MUST-2's merged-tree result.

Mutants: 31 killed of 36 run

  • r1119's list, 14 of 17 killed. Run: R1–R8, R11, R12, R14, R15, R17, R17b, R21, R26, R27. R9, R10, R13, R16, R18–R20 and R22–R25 are described nowhere in round 1, so I did not run them.
    • R2 (no --shared) survives: only cost changes.
    • R3 (clone after _paths_git_refuses) survives: nearly equivalent, since the clone's finding wins either way.
    • R8 survives, and is a real gap: NIT-A.
  • SHOULD-1's three, 3 of 3 killed: M6, M14, M14r.
  • My own, 14 of 16 killed: A1, A2b, A5, A6, A6b, A11, A12, A15, A22, A23, A24, N4r, N5a, N6c.
    • A17 (_resolved takes the parent's -c) survives. That is not a defect: the throwaway's own hooks setting still wins.
    • A18 survives: NIT-B.
    • An over-broad A2 was replaced by A2b and is not counted.

Body claims

Claim Measured
Closes #1083 is the only closing keyword; #1032 is "Covers", #1136 "filed as" true (regex scan; GitHub lists only #1083 as closed)
Known limits names #1136 true (#1136 is open and holds all three items)
Title within the 250 cap true, 248
63 rows; 35 new = 7+8+2+18 true
Over bdcf9952's tool: 9 failed / 54 passed, and the 9 named true, exactly those 9
Over 16f9a0e8's tool: 30 failed / 33 passed; 15 of r1119's 18 rows fail, 3 pass true
GIT_CONFIG_PARAMETERS row: before plan ok, after adopt-git-unasked true for check. execute was not run by hand; its rows pass on head and fail over bdcf9952's tool
Without its own -c, the parent's hooks ran reference-transaction 4 times true (4)
attr.tree=bogus still clones true
GIT_ALTERNATE_OBJECT_DIRECTORIES and GIT_SHALLOW_FILE write nothing true (I did not try a non-empty shallow file)
(b) "no hook" partly false: the fsmonitor program runs (SHOULD-A)
11 killed this round; 24 of 25 across both rounds the arithmetic holds. M6, M14, M14r and N4–N6 reproduced; the first round's 13 were not re-run
Gate: 1,192 passed, 0 failed the sum is true but stale: G5 has 1 failure (NIT-E)

Probe scripts and logs are in /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1119/r2/ (probe2.py, probe_s2.py, probe_intr.py, probes/). The mutant definitions and results are in mutants.py and mut/summary.txt there, and the gate logs in gate/.

Lane: openreposhape-1 (openRepoShape-1)

Brett Heap and others added 4 commits October 21, 2026 21:03
….fsmonitor=false`, and the rows r1119b named pass on main: the clone-env row appends to the environment's count, and the ref-probe row fails only the probe's `git init`

r1119b's second review of #1119, after the merge of main 038dafb (#1091, #1111):

- MUST-1: `test_the_clone_takes_a_parent_gits_settings_and_no_other_repository`
  built its `GIT_CONFIG_COUNT` from `{}`, which
  `test_no_test_sets_a_git_config_count_of_its_own` refuses. It now appends
  to `os.environ`, and asserts the last entry kept and no `attr.tree`.
- MUST-2: main's `test_check_says_where_git_would_not_make_the_ref_probe`
  set `GIT_DEFAULT_HASH=bogus`, which now stops the split's own clone
  first (`adopt-git-unasked`, exit 1). A stub `git` first on PATH fails
  only `git init` of a `refs-probe-*` directory, with git's words; skipped
  on Windows.
- SHOULD-A: `_throwaway_made` returns `-c core.fsmonitor=false` beside
  `core.hooksPath`, as the rehearsal and `_stored_as_written` give theirs.
  A counting fsmonitor program ran 8 times in `_resolved`'s two
  repositories in one `check`; now 0, in the global config and in
  `GIT_CONFIG_COUNT`. New rows: that one and its control.
- NIT-A: a row with `--work-dir` inside the source, whose config rewrites
  the url (kills R8).
- NIT-B: a row with that rewrite handed down by a parent git in
  `GIT_CONFIG_PARAMETERS`, which `_answers` leaves out (kills A18).
- NIT-C: `_split_clone_asked`'s docstring says a shallow source makes the
  clone run the `uploadpack.packObjectsHook` of protected config, as
  `execute`'s clones do.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…inside the source also rewrites the url to a network, so a `--get-url` asked around the throwaway, which names it in a NOTE as not asked, fails it

f1119c's mutant R8a, which moved only `_answers`' `git ls-remote
--get-url` out of its throwaway repository into the throwaway's own
directory, survived the row that kills r1119b's R8: the expansion there
only decides between the disk and a network, and the url itself was
still asked in the throwaway. A source config that rewrites the on-disk
url to `https://f1119c.invalid/Thing` makes R8a print the NOTE of a url
on a network it did not ask; on this head `check` prints none, inside
the source or outside it. Now killed by the row's `a-network` case.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…r system config as where the `uploadpack.packObjectsHook` a shallow source's clone runs comes from, since a parent's `-c` did not reach it

cea2553's NIT-C sentence said "protected config ... or a `-c`". f1119c
measured it on git 2.43, with a shallow source and a counting hook:

- in the global config, 1 run in `check` and 1 in a clone made as
  `_extract_leg` makes it;
- in the source's own config, 0 and 0;
- in `GIT_CONFIG_PARAMETERS`, as a parent `git -c` hands it down, 0 and 0.

So the `-c` is dropped. The commit message of cea2553 says "of
protected config" for the same sentence; this is the measured form.

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

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-10-21T22:23:41Z) r1119c, lane 1's independent re-check of round 3 at bba168bd: READY, with no MUST or SHOULD. It is not the writer f1119c.

The full re-check

Verdict: READY.

I found no MUST and no SHOULD. Every item r1119b raised is resolved. Nothing was committed, pushed or written to GitHub. My worktree /workspace/projects/openRepoShape-worktrees/l1-r1119 is still at bba168bd with a clean status. The mutant clone hashes back to b7df715b… (the sha of the head's adopt-project.py) after every mutant. None of my processes is still running.

Checks

1. Main. origin/main is still 038dafba, and git merge-base --is-ancestor origin/main HEAD says it is an ancestor of the head. I needed no merge-tree run.

2. MUST-1: resolved.

  • tests/test_no_auto_maintenance.py passes whole: 58 passed, 2 skipped. It includes test_no_test_sets_a_git_config_count_of_its_own. The 2 skips are "the session began with GIT_CONFIG_GLOBAL set", which is the probe environment.
  • The row at tests/test_adopt_check_throwaway_repos.py:1313 (it was :1243) now calls appended_to_command_scope(os.environ, [("attr.tree","HEAD"), ("test.heldone","one")]). It asserts that the last scoped entry is test.heldone and that attr.tree is absent.
  • I ran seven mutants and all were killed by that row: A5, A6, A6b, A15, A2b, KA1 and KA2.
  • The failure text shows the row now reads the session's own entries: KA1 and KA2 fail with assert 'attr.tree' not in ['gc.auto', 'maintenance.auto', 'attr.tree', 'test.heldone'].

3. MUST-2: resolved.

  • Head's ref-probe row passes on head and on main's tool (tests/test_adopt_root_symlinks.py::test_check_says_where_git_would_not_make_the_ref_probe).
  • @WINDOWS_SKIP sits directly above the def.
  • The stub (refusing_the_ref_probe, tests/test_adopt_root_symlinks.py:2070-2090) fails only an init where some argument matches */refs-probe-*. It prints UNKNOWN_HASH and exits 128. Everything else runs exec "$REAL_GIT". REAL_GIT is shutil.which("git") taken before PATH is changed, which gave /usr/bin/git here.
  • The docstring is true. I ran main's old row (GIT_DEFAULT_HASH=bogus) against head's tool and it failed with assert 1 == 0 and FINDING adopt-git-unasked.
  • MR1, MR2 and MR3 were all killed by that row. MR1 gave REFUSED … git init -q …/refs-probe-… exit 128. MR2 and MR3 gave no NOTE.

4. SHOULD-A: resolved.

  • _throwaway_made (adopt-project.py:11541) now returns ["-c", "core.hooksPath=<empty>", "-c", "core.fsmonitor=false"]. All five of its callers get both settings: _resolved, _answers, _AttributesProbe, _stored_as_written and _SplitRehearsal.
  • test_no_fsmonitor_of_this_machines_runs_where_the_urls_are_asked, both global-config and git-config-count, passes on head, and so do both controls.
  • The same row fails 2 of 2 over d0bc40ce's tool and over main's, with 8 counted runs in each of the 2 × 2 cases. The logs held 8 lines each.
  • S1, S2 and S3 were all killed. S4 survives, and it is equivalent: ls-remote reads no index.
  • The duplicate -c core.fsmonitor=false in _stored_as_written (adopt-project.py:12250) and _SplitRehearsal.git (:12533) is harmless. Measured: git -c core.fsmonitor=false -c core.hooksPath=/nonexistent -c core.fsmonitor=false config --type=bool --get core.fsmonitor printed false, exit 0.

5. NIT-A, NIT-B, NIT-C: resolved.

  • R8 was killed by the a-directory-holding-nothing case. R8b was killed by the same case. R8a was killed only by a-network, so that case is needed.
  • A18 was killed by test_a_parent_gits_url_rewrite_is_not_read_where_a_url_is_asked.
  • I re-ran probe_nitc.py from my scratch on head. The result matches logs/nitc2.log exactly: the global hook gives 1 run in check and 1 in _extract_leg's clone; the source's config gives 0 and 0; a parent's -c gives 0 and 0.
  • I ran the same probe on main's tool (038dafba) as a differential. The global hook gave 0 runs in check and 1 in the clone. So the one run on head comes from this PR's split clone.
  • The _split_clone_asked docstring (adopt-project.py:11650-11657) says the global or system config. I measured the global config, not the system one; that part rests on reading git, but the claim is correct. The docstring is true.

6. Gate on head. I ran at most 3 pytest calls at once, each under 5 minutes, in the probe environment. Result: 931 passed, 0 failed, 8 skipped.

Batch Result
tests/test_adopt_check_throwaway_repos.py 70 passed
tests/test_no_auto_maintenance.py + tests/test_path_guard_hygiene.py 107 passed, 2 skipped
tests/test_adopt_root_symlinks.py, whole 205 passed, 3 skipped
tests/test_shape_doctor.py, 4 shards (111+1, 111+1, 112, 111+1) 445 passed, 3 skipped
tests/test_scaffold_leg_path_collisions.py 104 passed
  • Base vs head. Head's test file over main's tool gives 33 failed, 37 passed. Adding the ref-probe row, which passes there, makes 33 of 71 failed, as claimed. Over d0bc40ce's tool it gives 2 failed, 69 passed: the two fsmonitor rows. Both match the body and report.
  • Row counts. 2a119f2 has 29 rows and head has 70, as the body says.
  • f1119c's batch sum. Its 18 batches add up to 3,413 passed and 8 skipped, which matches the body and report. I did not re-run all 18.

7. Body.

Findings

No MUST and no SHOULD. The NITs are optional and none blocks landing.

  • NIT-1, squash message. The cea25530 commit message still says "of protected config". The bba168bd docstring corrects it to "global or system config; a parent's -c did not reach it". Use the corrected wording in the squash message.
  • NIT-2, test file (tests/test_adopt_check_throwaway_repos.py, REWRITTEN_TO, the a-network param). The host https://f1119c.invalid/ names an agent in a committed test. Optional fix: use a neutral name such as example.invalid.
  • NIT-3, test file (test_no_fsmonitor_of_this_machines_runs_where_the_urls_are_asked and its control). They are not WINDOWS_SKIP. The existing hook rows aren't skipped either, and CI is Linux-only. Whether Git for Windows runs a #!/bin/sh fsmonitor program is unverified.
  • NIT-4, body, "Measured" section (line 38). It still says "Before is main 2a119f28", while main's adopt-project.py has since changed by 546 lines. The two newest rows name 038dafba where it matters, so this is a label only.

Scratch and logs are in /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1119/r3/. The files to look at are gate/summary.txt, mut/summary.txt, mut/mutlogs/, logs/bvh-main.log, logs/bvh-d0bc.log and body.md.

Lane: openreposhape-1 (openRepoShape-1)

@sourcery-ai

sourcery-ai Bot commented Oct 23, 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 17 hours and 2 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap
brettheap merged commit b7edd88 into main Oct 23, 2026
5 checks passed
@brettheap
brettheap deleted the fix/1083-check-asks-the-split-clone branch October 23, 2026 19:45
brettheap pushed a commit that referenced this pull request Oct 23, 2026
…o-fetch

Step 1 of the three-merge restack after #1119 squash-landed on main as b7edd88.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Oct 23, 2026
Step 2 of the three-merge restack. git diff 9b85644 b7edd88 is empty for
#1119's files, so any conflict there takes ours, the branch's version.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Oct 23, 2026
Step 3 of the three-merge restack after #1119's squash b7edd88.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Oct 23, 2026
…fig, step 1 of 3 to restack #1169 onto main after #1119's squash

One conflict, in the module docstring of tests/test_adopt_check_throwaway_repos.py: #1119 added its #1033 paragraph and #1136 added its own at the same place. Both stay, #1033 first.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Oct 23, 2026
… step 2 of 3 to restack #1169 onto main after #1119's squash

Two conflicts, adopt-project.py and tests/test_adopt_check_throwaway_repos.py, both #1119's files; both took this branch's side with git checkout --ours. git diff 9b85644 b7edd88 is empty over the whole tree, so the merge changes no file: its tree is the tree of the commit before it.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Oct 23, 2026
…ep 3 of 3 to restack #1169 onto main after #1119's squash b7edd88

No conflict.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Oct 23, 2026
#1180 restacked on main after #1119's squash b7edd88 through three merges
(c3f8a2b, ef73f75, b18d2e8), then a0e8cde fixed r1180d's NIT-1 to NIT-3.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Oct 23, 2026
…py` where GNU make at the root reads a kept `GNUmakefile` or `makefile`, and its NOTE names that file and what it takes for `make bootstrap` to run there (#1047) (#1121)

GNU make reads the first it finds of `GNUmakefile`, `makefile` and `Makefile`, and only that one. Where the source keeps `GNUmakefile` or `makefile` in the root, `make bootstrap` at the root of the clone reads the source's file, not the shape's `Makefile`, and exits 2 with "No rule to make target 'bootstrap'". `execute`'s NEXT printed it there anyway.

This PR also covers the third box of #1048 (see #1048): the `_next_steps` NOTE that said the shape's targets "arrive only once the follow-up merges the two", which is untrue where GNU make reads a kept `GNUmakefile` or `makefile`. #1105 covers that issue's other two boxes, and leaves this one to this PR.

## Measured

GNU Make 4.3 on Linux, a disk that keeps case. One directory per set of files, each file with a `which` target:

| files | `make which` reads | `make -n bootstrap` |
|---|---|---|
| `GNUmakefile` | `GNUmakefile` | exit 2, no rule |
| `makefile` | `makefile` | exit 2 |
| `Makefile` (with a `bootstrap` rule) | `Makefile` | exit 0 |
| `GNUmakefile` + `makefile` | `GNUmakefile` | exit 2 |
| `GNUmakefile` + `Makefile` | `GNUmakefile` | exit 2 |
| `makefile` + `Makefile` | `makefile` | exit 2 |
| all three | `GNUmakefile` | exit 2 |

A `GNUmakefile` that holds `include Makefile` runs the shape's rule (exit 0), and so does `make -f Makefile bootstrap`.

What NEXT printed on main, from a real `plan`, `check` and `execute --local-remote-dir`, with the printed command run in a recursive clone of the split ("S" is the source's own `scripts/bootstrap.py`, kept with `scripts/`):

| the root keeps | NEXT on main | in the clone |
|---|---|---|
| none | `make bootstrap` | exit 0 |
| `Makefile` | `python3 scripts/bootstrap.py`, #480's NOTE | exit 0 |
| `makefile`, `GNUmakefile`, or both | `make bootstrap` | **exit 2, no rule** |
| `Makefile` + `makefile`, `Makefile` + `GNUmakefile`, all three | `python3 scripts/bootstrap.py`, and a NOTE saying the targets arrive once the two `Makefile`s are merged | the command exits 0; `make bootstrap` exits 2, and still does after `cat shape/Makefile >> Makefile` |
| S + `GNUmakefile`, S + `makefile`, S + `Makefile` + `GNUmakefile` | no command; the NOTE says to merge, "and then run `make bootstrap`" | `make bootstrap` exits 2 |

## What changed

`adopt-project.py`, `_next_steps`:
- It takes `surviving=`, the paths the plan's entries send to the root (`paths_for["root"]`, passed by `cmd_execute`).
- It asks them for a kept `GNUmakefile` or `makefile` in GNU make's order, with `_root_keeps`, as `_makefile_follow_up` asks them. So NEXT names the same file as the plan's `CONTRACTS_DIR` follow-up.
- Where it finds one, the command is `python3 scripts/bootstrap.py`. The NOTE names the file in the follow-up's words, and says `make bootstrap` and the shape's other make targets run there only once that file has them, or includes a Makefile that does:
  - the shape's `Makefile` is the root's: "NOTE the shape's Makefile is the root's `Makefile`, but GNU make at the root reads the source's `GNUmakefile`, the first of `GNUmakefile`, `makefile` and `Makefile` it finds, so `make bootstrap` and the shape's other make targets run there only once `GNUmakefile` has them, or includes a Makefile that does; `python3 scripts/bootstrap.py` is what the shape's `make bootstrap` runs."
  - the source also keeps its own `Makefile`: "NOTE the root keeps its own Makefile and the shape's is shape/Makefile, and GNU make at the root reads ..." (the same clause, and the same ending).
  - the source's own script went aside too: the merges first, as before, "and then run `python3 scripts/bootstrap.py`; GNU make at the root reads ...".
- A root that keeps neither name gets the block it got before, byte for byte. That includes `MAKEFILE`, which GNU make never reads where case is kept.

## Tests

`tests/test_adopt_next_make_reads_first.py`, new, 40 tests (38, and the 2 of the fix round below):
- 13 rows word for word: none, `Makefile`, `makefile`, `GNUmakefile`, `makefile`+`GNUmakefile`, `Makefile`+`makefile`, `Makefile`+`GNUmakefile`, all three, S, S+`Makefile`, S+`GNUmakefile`, S+`makefile`, S+`Makefile`+`GNUmakefile`.
- 3 rows that keep `make bootstrap`: `MAKEFILE`; longer names (`makefile.am`, `Makefile.in`, `GNUmakefile.bak`); and the names below the root.
- 13 rows in which NEXT names the same file as `_makefile_follow_up`, for the same root paths.
- 9 end to end rows, one for each row that keeps `GNUmakefile` or `makefile`. Each is a real `execute`, and its clone is made by pasting NEXT's own clone line. In that clone:
  - NEXT's lines are the row's;
  - `make which` prints the file the NOTE names;
  - `make -n bootstrap` has no rule;
  - the printed command exits 0 and ends `bootstrap ok`. For S rows, it does so once the shape's script is merged, as the NOTE says;
  - where a `Makefile` is kept, the follow-up's merge alone still leaves no rule;
  - an `include Makefile` in the file GNU make reads makes `make -n bootstrap` run the shape's recipe.

On main's `adopt-project.py`, the first 38 all fail. The 9 end to end rows fail on what NEXT prints. The unit rows that guard the unchanged cases fail there only for want of the `surviving=` keyword. M1 below shows the same rows passing and every row that keeps `GNUmakefile` or `makefile` failing. On this head, all 40 pass.

Mutants of the change, each restored and checked by sha256. Each run is the new file plus the five `next` tests of `test_adopt_e2e.py` (43 tests). Every mutant is killed:

| mutant | failed |
|---|---|
| M1 `first` never found | 27 |
| M2 `makefile` asked before `GNUmakefile` | 6 |
| M3 the command ignores `first` | 6 |
| M4 the branch for a `Makefile` kept beside `first` dropped | 6 |
| M5 the branch for a script gone aside ignores `first` | 9 |
| M6 the lookup folds case | 7, two of them existing `test_adopt_e2e.py` rows |
| M7 `cmd_execute` passes no paths | 9, the end to end rows |

Gate on this head, named files only, one basetemp per run. Each run had `EMAIL` set, `GIT_CONFIG_GLOBAL` an empty file, `GIT_CONFIG_NOSYSTEM=1`, a stub `gh` first on PATH, `GH_TOKEN=bogus` and an empty `GH_CONFIG_DIR`:
- the new file, `test_adopt_make_reads_first`, `test_adopt_e2e`: 98 passed, with the new file at 38 tests (at `c04bb710`; the fix round's gate is below).
- `test_adopt_github_exits`, `test_adopt_printed_sentences`, `test_repo_hygiene`, `test_readme_windows_quoting_sentence`, `test_cli_reference`, `test_agents_md_codes`: 291 passed.
- `test_scaffold_leg_path_collisions`: 104 passed.
- `test_adopt_contracts_dir`, `test_adopt_verify`, `test_adopt_pins`, `test_adopt_root_manifest`, `test_adopt_ignored_shape_files`, `test_adopt_nested_attributes`, `test_adopt_shape_pin_and_work_dir`: 378 passed.
- `test_shape_doctor.py` in 4 shards: 112 + 112 + 112 + 109 = 445 passed, and 3 skipped (the PowerShell line, which is printed only on a Windows host).

## Fix round 1 (RV1121's SHOULD-1)

RV1121 found the code right and one test missing: nothing held `cmd_execute` to handing `_next_steps(surviving=)` only the root's paths. Its mutant X4, which passes `paths_for["root"] + paths_for["code"] + paths_for["drop"]`, kept all 43 tests green. The case is a real one: the `root-project-makefile` rule sends a kept `GNUmakefile` to the root, and its reason says that moving a Makefile that only builds the code to the code leg "is a one-line edit of the plan" (`contracts/path-classification.yaml`, lines 236-237).

Two end to end rows, `test_next_keeps_make_bootstrap_where_the_plan_sends_the_makefile_elsewhere[code]` and `[drop]`. Each keeps `GNUmakefile` in the source, edits the plan to send it to `leg: code` (then `leg: drop`), runs a real `execute`, and pastes NEXT's own clone line. Each asserts that NEXT's lines after the clone are `    make bootstrap` and nothing else, that the clone's root has no `GNUmakefile`, and that `make -n bootstrap` there exits 0 and runs `python3 scripts/bootstrap.py`.

The `execute`, paste and clone steps of the nine existing end to end rows moved into one helper, `executed_and_cloned`, which the two new rows share, so no block of the test is written twice. Those rows assert what they asserted. The file now holds 40 tests (38 and 2).

- **X4, on this head's `adopt-project.py` with the one line changed:** the new file and the five `next` rows of `test_adopt_e2e.py` (45 selected): 2 failed, 43 passed. Both new rows fail on NEXT's lines, which are `python3 scripts/bootstrap.py` and the NOTE "the shape's Makefile is the root's `Makefile`, but GNU make at the root reads the source's `GNUmakefile`, ...", naming a file the root does not have. The file was restored and its sha256 read `60bad59a...` again.
- **On main's `adopt-project.py`:** the two rows pass, since main printed `make bootstrap` there. They hold the unchanged case against the new lookup, and X4 is the mutant that tells them apart.
- **On this head `1c5173758`**, same environment as above: the new file 40 passed, `test_adopt_e2e.py` 27 passed, `test_repo_hygiene.py` 100 passed.
- **Merge:** `git merge-tree --write-tree` of this head with main at `823624d93`: clean (tree `73ddafb2`).

RV1121's four NITs are not in this PR; the lane files them.

## Merge

- `git merge-tree --write-tree` of this head with main at `6da757cbe`, where the branch starts: clean (tree `21955cc7`). Main has since moved to `7cd66902a`, which changes `scaffold-project.py`, its test and the docs, and none of this branch's files. The merge with it is clean too (tree `ec4e6c8e`).
- With #1105's head `5a4de7f76`: clean (tree `3394d19d`). #1105's `adopt-project.py` change is in `_predict_collisions`, apart from `_next_steps`. On that merge, built in a `git clone --shared` checkout, `test_adopt_next_make_reads_first`, #1105's `test_adopt_collision_make_reads` and `test_pinned_copy_text` gave 152 passed.
- With the other open pull requests that change `adopt-project.py` (#1120 `c55e55e3`, #1119 `bdcf9952`, #1118 `c60066cb`, #1106 `504a1dd6`, #1091 `160de118`): each clean.

## Not in this PR

- Once #1105 lands, the lookup "which of `GNUmakefile` and `makefile` the root keeps first" is written three times: in `_makefile_follow_up`, `_predict_collisions` and `_next_steps`. Each is the same two lines over `GNU_MAKE_READS` and `_root_keeps`. They are kept apart here so this PR and #1105 touch disjoint lines; one helper could serve all three after both land.
- `templates/assembly-root/AGENTS-shape.md` line 19 ("`git clone --recurse-submodules` this repository and run `make bootstrap`") has the same gap in an adopted root that keeps `GNUmakefile` or `makefile`. It is pinned, and #1105 changes that file, so it is left.
- On a disk that ignores case (#1049), a kept `makefile` is reported as a `Makefile` collision, and NEXT's NOTE says "the root keeps its own Makefile". The new clause is true there too, since GNU make reads that file and merging into it brings the targets. The spelling is #1049's.
- A kept directory named `GNUmakefile/` or `makefile/` is named as the source's file. GNU make stops on it with "Is a directory". `_makefile_follow_up` does the same.

Closes #1047

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Oct 24, 2026
…` and refuse a partial-clone source that lacks an object its branches, tags or HEAD reach as `source-partial-clone`, so neither fetches into the source any more (#1145) (#1180)

`check` promises never to write into the source, and a partial clone (`git clone --filter`) broke that through git itself. A read that needs an object the clone lacks fetches it from the promisor remote. That runs the `upload-pack` the source's config names, and writes a promisor pack into the source's `objects/`.

- `check` and `execute` now run git with `GIT_NO_LAZY_FETCH=1`. They refuse a partial-clone source that lacks an object its branches, tags or HEAD reach as `source-partial-clone`. The refusal names how many objects it lacks and the cure for each promisor remote, `git fetch --refetch --no-filter <remote>`. The walk is `git rev-list --objects --missing=print --branches --tags HEAD --`.
- Measured with git 2.43, on a `--filter=blob:none --no-checkout` clone:
  - On base, `check` ran `upload-pack` 26 times and wrote 26 promisor packs into the source. `execute` failed with `Blob not found` after both leg repositories were made.
  - On head, both exit 2 with `source-partial-clone`, run nothing, leave `objects/` unchanged and make no leg.
  - A full clone and a cured partial clone adopt as before.
- `tests/test_adopt_partial_clone_source.py` holds the rows, and `docs/cli.md` gains the help text.

Review: lane 1's independent reviewers found `2c8082a2` NOT READY for one SHOULD (#1180 issuecomment-6351633105), and `6cd96b8b` NOT READY for one SHOULD (issuecomment-6356200375). They found `b316f415` provisionally READY (issuecomment-6364551003), and `a4ec51d2` READY with 4 NITs (issuecomment-6372009946). After #1119 landed, the branch was restacked onto main by three merges, and its changed lines equal the reviewed delta. Lane 1's delta check of the NIT round `a0e8cded` found the tool's AST unchanged apart from docstrings, and the two new rows kill the surviving mutants M15 and M17 (issuecomment-6374457465).

Tests, under a stub `gh` with a bogus token: at `a0e8cded`, lane 1's gate gave 650 passed and 3 skipped over the PR's test file, the throwaway and single-repository-record files, the doc trio, the path-guard and no-auto-maintenance scans, `tests/test_scaffold_leg_path_collisions.py` and `tests/test_doctor_partial_clone.py`. The doctor's 4 shards passed on #1190's head `359a749c`, whose tree is this PR's plus #1190's change.

It lands by fast refresh (Brett Heap, 2026-10-15T22:48:35Z). Its H0 `a0e8cded` 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 58a2175, which is green on SonarCloud and Git Bash. Lane 1's gate passed on its tree: 2 pytest calls over `tests/test_adopt_partial_clone_source.py`, `tests/test_path_guard_hygiene.py`, `tests/test_no_auto_maintenance.py`, `tests/test_scaffold_leg_path_collisions.py`: 321 passed, 2 skipped.

Closes #1145

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 8, 2026
… parent's `-c` settings, `attr.tree` too, and the source's objects, `GIT_ATTR_SOURCE` is refused by name before any question, and each throwaway reads its environment first (#1136) (#1169)

`check`'s throwaways from #910 (the rehearsal, `_stored_as_written`, `_AttributesProbe`) were made with `_inherited_env()`. That leaves out a parent git's `-c` settings (`GIT_CONFIG_PARAMETERS`), `GIT_ATTR_SOURCE` and any `attr.tree` in `GIT_CONFIG_COUNT`. `_stored_as_written` held none of the source's objects, and the rehearsal chose the files it asks about with `check-attr --cached`, which reads no `attr.tree`. So `check` answered as a git with none of them would. `execute` then stopped after both legs existed, or refused a plan its own git would carry out.

- The rehearsal and `_stored_as_written` now take a parent's `-c` settings, `attr.tree` included, and the source's objects. Each throwaway reads its environment before it is made.
- `GIT_ATTR_SOURCE` is refused by name before any question is asked.
- The rehearsal's attribute reads run without `--cached` (ruling X1), so a parent's `attr.tree` reaches them as it reaches `execute`'s git.
- Measured with git 2.43, against base `bba168bd`:
  - A parent's `-c core.protectHFS=true`, or a `required` clean filter that fails, used to pass `check` and stop `execute` with both legs made. Now `check` refuses it, and `execute` refuses it before any leg.
  - A parent's `attr.tree` naming the empty tree used to refuse a plan `execute`'s own git carries out. That plan is now `plan ok` and adopts.
- Known limits: under a failing filter that two places' rules name, a misnamed second finding comes beside the right first one. `update-index -q --refresh`'s exit is not read, and the trace is on #1192. Under `attr.tree`, the copies finding asks for lines in the root `.gitattributes`, which git does not read there.

Review: lane 1's independent reviewers reviewed each round. r1169c's review of `76c9b767` stopped part-way with no MUST, and r1169d finished it NOT READY for two SHOULDs (#1169 issuecomment-6374351753). The fix round `d9224ecf` adds r1169d's own row (l), which kills mutant K3 (3 of 3), and corrects the body. r1169e found `d9224ecf` READY, with no MUST or SHOULD (issuecomment-6375188826). After #1119 landed, the branch was restacked onto main by three merges, and its changed lines equal the reviewed delta (sha256 `5c59dd53`).

Tests, under a stub `gh` with a bogus token: at `d9224ecf`, lane 1's gate gave 1,253 passed and 9 skipped over 7 calls. They covered the PR's five test files, the single-repository-record file, the no-auto-maintenance and path-guard scans, `tests/test_scaffold_leg_path_collisions.py`, `tests/test_adopt_root_symlinks.py`, and `tests/test_shape_doctor.py` in 4 shards.

It lands by fast refresh (Brett Heap, 2026-10-15T22:48:35Z). Its H0 `d9224ecf` 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 989295b, which is green on SonarCloud and Git Bash. Lane 1's gate passed on its tree: 7 pytest calls over `tests/test_adopt_check_throwaway_repos.py`, `tests/test_adopt_single_repository_record.py`, `tests/test_adopt_nested_attributes.py`, `tests/test_adopt_reencoded_files.py`, `tests/test_command_scopes_built_at_the_test.py`, `tests/test_no_auto_maintenance.py`, `tests/test_path_guard_hygiene.py`, `tests/test_scaffold_leg_path_collisions.py`, `tests/test_adopt_root_symlinks.py` and `tests/test_shape_doctor.py` in 4 shards: 1,253 passed, 9 skipped.

Closes #1136

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 8, 2026
…s message spells a path byte that is not UTF-8 as `_shown` does, an escape, and no longer says it names it with a `?` in its place, which #900 replaced (#1018) (#1104)

`env_commit`'s docstring in `scripts/shape_materialize.py` says what the split commit's message does with a `root` or `drop` path that holds a byte that is not UTF-8, as the code does since #900. It said the message names such a path "with a `?` in place of that byte, a path that does not exist". That was true before #900, and it is not true now. A reader of the docstring is told about a `caf?.md` the tool no longer writes.

Found by lane 1's writer on #900 and filed as #1018. Lane 5 took it outside v1.2.0, under Brett Heap's ruling of 2026-10-21T10:32:04Z.

Measured on main `2a119f281` and again on `16f9a0e81` (main after #1087), with a small script that calls: `adopt-project.py`'s own `_split_message` and `_shown`, then `env_commit` and a real `git commit`, read back with `cat -A`.

- The issue's claim held: the docstring (about line 2103 when filed, line 2268 on `2a119f281`, line 2349 on this branch) still said the message names the byte with a `?`.
- The code does not. `_shown("caf\udce9.md")` is `` `caf\udce9.md` ``, and the split message for a `root` and a `drop` entry named that holds no lone surrogate. Through `env_commit` and `git cat-file commit HEAD`, `cat -A`:

  ```
  DROPPED (in no leg and no longer here):$
    `caf\udce9.md`$
  STAYS IN THE ASSEMBLY ROOT:$
    README.md$
    `caf\udce9.md`$
  ```
- What stays true of `env_commit` itself: a message that holds the lone surrogate, handed to it directly, is still written as `?`. `cat -A` reads `Name: caf?.md$`. So the `errors="replace"` paragraph is kept, and what changes is who it describes.
- #1087 (main `16f9a0e81`) changed `scripts/shape_materialize.py` by 128 lines, none of them in `env_commit`, `COMMIT_COMMAND` or the message, and changed nothing in `adopt-project.py` (0 diff lines). The rebase onto it was clean and the docstring needed no other change.

One file, `env_commit`'s docstring, in two paragraphs: the `errors="replace"` paragraph (round 1, 11 lines added and 7 removed) and the sentence above it (round 2, below; 3 added and 2 removed). Together 14 added and 9 removed against main `6da757cb`. The `errors="replace"` paragraph now says:

- encoding, a character UTF-8 cannot carry is written as `?`, and nothing raises after both legs are pushed, as before;
- `adopt-project.py` refuses a lone surrogate in a path it extracts (`entry_path_problem`), and a `root` or `drop` entry that holds one is listed in the split message but never raw: the message names each path as `plan`'s report does (`_shown`, #900), so the byte 0xE9 reads as an escape with no surrogate in it, `` `caf\\udce9.md` ``, the path the source holds;
- written raw it would be a `?`, `caf?.md`, a path that does not exist, which is what `env_commit` still writes for a lone surrogate it is handed.

The backslash is doubled in the source, as the neighbouring docstrings write `\\udcc3`. A single `\u` in a non-raw docstring would be an escape that makes a lone surrogate. Measured: the docstring holds no character from U+D800 to U+DFFF and holds the six characters `\udce9`. The longest docstring line is 78 characters.

**The code is unchanged.** A script compares the AST of `scripts/shape_materialize.py` with every docstring blanked: the branch's file is identical to `origin/main`'s after the rebase onto `16f9a0e81` (round 1), and the merge of this head into `origin/main` `6da757cb` is identical to `6da757cb`'s file (round 2).

**No pin moves.** `scripts/shape_materialize.py` is not a pinned copy. `COPIED_VERBATIM`, `COPIED_FROM_SHAPE`, `FAMILY_COPIED_VERBATIM` and `FAMILY_COPIED_FROM_SHAPE` do not list it, and `templates/assembly-root/scripts/validate-pins.py` says of it "which no project carries". So no `upstream-changed` row, no digest, no assembly copy and no `tests/test_pinned_copy_text.py` entry changes.

**No other text pins these words.** Searched in `tests/`, `README.md`, `docs/`, `docs/handbook.html`, `AGENTS.md` and `templates/`: no test reads `env_commit`'s docstring (`__doc__`, `getdoc`), and none of them holds "in place of that byte" or "a path that does not exist" for this. The other places that name the `?` are about this function's behaviour or about history, and are still true: `_split_message`'s docstring says `caf\\udce9.md` "was `caf?.md`" (before #900), `_refused_by_policy` already says the message "lists it as `_shown` does (#900)", and `tests/test_adopt_spelled_names.py` quotes the message as it was on `c7a3ff16`. The `?` in `argv_text`, `trailer_line` and the commit-trailer text is about a `--trailer`, not the split message.

No rows and no mutants: the change is a docstring, the code is the same AST, and no test pins the docstring. So there is no row to fail on main and nothing to mutate.

All with `$Q/v110/run9.sh`, `[email protected]`, `GIT_SSH_COMMAND=false`, `GIT_CONFIG_GLOBAL=/dev/null`, the stub `gh`, a fake token, git 2.43.0 (`/usr/bin/git`).

Two shards, run before the rebase, at the `2a119f281` base with this one-file change in the tree. Together they are every `tests/*.py` that names `shape_materialize` or `env_commit` (86 files, including `tests/test_adopt_spelled_names.py` and `tests/test_adopt_entry_paths.py`, which run `env_commit` and the #900 message) and `tests/test_agents_md_codes.py`:

| run | files | result |
|---|---|---|
| shard A | 43 | 2873 passed, 4 skipped in 1707.51s, rc=0 |
| shard B | 44 | 4611 passed, 31 skipped in 2462.01s, rc=0 |

After the rebase onto `16f9a0e81`, on the committed head `e32b2703d733f6c60c1b2cba2d62d164d93d7b9a` (`dirty=0`): the trio, `tests/test_repo_hygiene.py`, `tests/test_agents_md_codes.py` and `tests/test_cli_reference.py`, **170 passed in 55.67s**, rc=0. The docstring-only change needed no new shards: the shards' counts are runs at the `2a119f281` base, and #1087 did not touch `env_commit`.

Round 2, on the committed head `de89aa81b1533e32f1007f991aeae05cd915b36d` (`dirty=0`): the same trio, **170 passed in 61.77s**, rc=0. The round 2 commit is one docstring sentence, so it needed no new shards either.

git 2.47.1: no run. The change adds no test file of its own, so there is none to run on it.

`git merge-tree --write-tree HEAD <other>` with HEAD at `de89aa81b1533e32f1007f991aeae05cd915b36d`, after a re-fetch of `origin main` with `-c gc.auto=0 -c maintenance.auto=false` (round 2, about 14:03Z on 2026-10-21):

| against | result |
|---|---|
| `origin/main` `6da757cbe9a4eb66d60c34f38dcc2b332d175e8b` | clean, rc 0, tree `15c11b6c959fc4c7540105d5d62e3f961c8e27fd` |
| #1105 `fix/1048-makefile-follow-up-gnu-read-order` `5a4de7f763b5a3c32adce9614a3a539508416eb4`, an open PR that touches `scripts/shape_materialize.py` | clean, rc 0, tree `db05aead67052643942e35a9689d9dd4a0873fda` |
| #1118 `fix/1089-named-link-skip-tests` `c60066cbeec18b8b6c926e254ed4bee6b9a486c2`, the other open PR that touches `scripts/shape_materialize.py` | clean, rc 0, tree `a40df3b63c32c2a3d8f4c40587b094940c8d6567` |

Read with `gh pr list --state open --json number,headRefName,headRefOid,files`: 16 open PRs, three of them (this one, #1105 and #1118) touch `scripts/shape_materialize.py`, the only file this change touches. The other 13 (#1120, #1119, #1117, #1111, #1109, #1107, #1106, #1102, #1101, #1098, #1097, #1091, #1088) touch no file this change touches.

The same command with HEAD at the reviewed head `e32b2703` gives rv1104's trees: `de31d857` against `6da757cb` and `195ffe19` against #1105. The round 1 merge against #1090 is moot: #1090 has landed in `6da757cb`.

Held as a draft until the v1.2.0 tag; it is now on the v1.2.1 milestone.

- **NIT 1, `scripts/shape_materialize.py` lines 2340-2343, a line round 1 did not change.** The paragraph above the reworded one said the adoption's split message "names each entry path as the source spells it". Since #900 that is true of a printable path alone: `_split_message` lists any other through `_shown`, as the escape the next paragraph describes. It now says "as the source spells it (a printable one; see below)". One new commit on top of `e32b2703`, `de89aa81b1533e32f1007f991aeae05cd915b36d`, 3 lines added and 2 removed, docstring only, pushed as a fast-forward (no rebase, the PR is open).
  - Measured: the AST with docstrings blanked is identical to `e32b2703`'s and, merged into `6da757cb`, to `6da757cb`'s. The docstring holds no lone surrogate, still holds the six characters `\udce9`, and its longest line is 78 characters.
  - Searched `tests/`, `README.md`, `docs/`, the handbook mirror, `AGENTS.md`, `templates/` and the scripts for "names each entry path", "as the source spells" and the new words: only `tests/test_adopt_entry_paths.py` line 233 matches, a test's docstring about `execute` handing each path on as the source spells it, which is another sentence and pins nothing here.
- **NIT 2, this body.** It named main as `16f9a0e81` and #1090 as the one open PR that touches the file. #1090 has landed. Main is `6da757cb`, and the merge-trees above are redone against it, against #1105 and against #1118, a draft that opened since and also touches the file.

Review: rv1104-1107, lane 5's independent opus reviewer, which wrote none of #1104: READY at `de89aa81`, H0 of this landing (issuecomment-6318111413), with no finding; NIT 1 and NIT 2 of the round before are fixed. CI (Brett Heap's ruling 27 and his fast-refresh ruling of 2026-10-15T22:48:35Z): H0 de89aa8 passed tests, tests-git-bash and SonarCloud; the head 92285d4 is a clean update-branch merge of main b66d8f0, with tests-git-bash and SonarCloud green; and the local gate passed on its predicted squash tree 6bd2128 over main b66d8f0: the repo_hygiene, agents_md_codes, cli_reference sets, 171 passed. Landed on Brett Heap's word of 2026-10-23T13:10:26Z, relayed to every lane by lane 3 (#473 issuecomment-6365697123): "merge v1.2.1 PRs once reviewed and green".

Closes #1018

Lane: openreposhape-5 (openRepoShape-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 8, 2026
…eeps a `GNUmakefile` or a `makefile`, which GNU make reads first, the Makefile collision follow-up no longer says the shape's make targets arrive with the merge, and the pinned file says `make` reads the first of the three and the block reaches it only once that file holds it or includes a Makefile that does (#1048) (#1105)

Two sentences said a kept `Makefile` is what holds the shape's block back. GNU make reads the first of `GNUmakefile`, `makefile` and `Makefile` it finds, and only that one, so where the root also keeps `GNUmakefile` or `makefile`, `make` reads that file, and reaches the merged `Makefile` only where that file includes it.

**Measured** (a real `execute`, then `make -n` in the clone, for each kept name; r1046's NIT-B, repeated; the include rows are RV1105's SHOULD-1):

| the source keeps | file `make` reads | after `cat shape/Makefile >> Makefile`, `make -n bootstrap` |
|---|---|---|
| `Makefile` | `Makefile` | exit 0 |
| `Makefile` + `makefile` | `makefile` | exit 2, "No rule to make target 'bootstrap'" |
| `Makefile` + `GNUmakefile` | `GNUmakefile` | exit 2, same |
| all three | `GNUmakefile` | exit 2, same |
| `Makefile` + a `makefile` or `GNUmakefile` that ends in `include Makefile` | that file | exit 0, runs `python3 scripts/bootstrap.py` (exit 2 before the merge) |
| `makefile` or `GNUmakefile` alone | that file | no merge to make: the shape's `Makefile` is the root's, and `make contracts-dir` has no rule until that file holds the block or includes `Makefile` |

**What changed**
- `scripts/shape_materialize.py`, `collision_follow_up`: takes `reads_first`, the file GNU make reads before the shape's `Makefile`. Where it is set, the Makefile's follow-up says GNU make reads that file, the first of the three it finds, and that the shape's make targets reach `make` there only once that file has them, or includes a Makefile that does; until then `python3 scripts/bootstrap.py` is what the shape's `make bootstrap` runs. Where `scripts/bootstrap.py` went aside too, it says neither command runs the shape's bootstrap until the script is merged, and then `python3 scripts/bootstrap.py` runs it. Where the root keeps only the source's `Makefile`, the sentence is what it was, byte for byte. `GNU_MAKE_READS` joins `SHAPE_MAKE_TARGETS`.
- `adopt-project.py`, `_predict_collisions`: reads the file from the plan's root paths as `_makefile_follow_up` does, so the `CONTRACTS_DIR` line and the collision line of one plan name the same file.
- `templates/assembly-root/AGENTS-shape.md`: says `make contracts-dir` prints the block wherever `make` reads the shape's Makefile, names the three files in the order the code reads them, and says that where a `GNUmakefile` or `makefile` is kept, beside a `Makefile` or instead of one, `make` reads it, and not the shape's Makefile unless that file includes it. It is one verbatim copy: the digest in every project's `contracts/shape-pin.yaml` is rendered from its bytes at adopt and scaffold time, and no digest or `tree_sha256` of it is stored in this repository, so there is no pin to move here; each project re-pins through `update-shape.py` as for any template change.
- `tests/test_pinned_copy_text.py`: `ADOPTED_SENTENCES` holds the new text.
- `tests/test_adopt_collision_make_reads.py` (new, 31 rows): the follow-up per kept set, the two lines of one plan naming one file, no collision line where no `Makefile` is kept, the two name tuples equal, the pinned file naming every file the code reads first, the script-aside tail where `make` reads another file, and, in a real adoption's clone, `make -n` held to both sentences for each kept name and for a kept `GNUmakefile` or `makefile` that ends in `include Makefile`.

**Fix round 1** (RV1105's review, `b28f40de0` on top of `5a4de7f76`)
- **SHOULD-1:** the follow-up said the targets reach `make` "only once `X` holds them, or includes a Makefile that does, and not with that merge alone". The last clause is untrue where `X` already ends in `include Makefile`: the merge alone brings them. The clause is gone, and the docstring paragraph, the `SHAPE_MAKE_TARGETS` comment and the `ADOPTED_SENTENCES` comment now say the merge alone brings the targets only where that file includes `Makefile`.
- **NIT-1 (and RV1121's NIT-3):** the follow-up now uses the words of #1121's NOTE: "has them", and "is what the shape's `make bootstrap` runs". `_next_steps` is not touched.
- **NIT-2:** the script-aside tail, where `reads_first` is set, said "neither `make bootstrap` nor `python3 scripts/bootstrap.py` runs the shape's bootstrap before both merges are made", which reads as if `make bootstrap` runs it after them. It now says neither runs it until the script is merged, and then `python3 scripts/bootstrap.py` runs it. I did not keep "before both merges": where `X` is given the targets itself, as the sentence before invites, `make bootstrap` runs the shape's bootstrap once the script is merged, with no `Makefile` merge at all.
- **NIT-3:** the template's "and never the shape's Makefile" is now ", and not the shape's Makefile unless that file includes it". `ADOPTED_SENTENCES` changes with it. No other copy or regex in `tests/` pins that sentence (`git grep` for "never the shape" and "reads the first of them").
- **NIT-4:** the `collision_follow_up` docstring no longer says `execute` reports through it. It says `plan` predicts the follow-ups and stores them in `follow_ups:`, the split commit carries those, `execute` names its collisions by path only (its `beside` lines and the "WRITTEN BESIDE" list), and `Materialized.follow_ups()` has no caller. The method stays.
- NITs 5 to 8 are left to the lane.

**Rows of this round:** `tests/test_adopt_collision_make_reads.py` and `tests/test_pinned_copy_text.py`, 118 rows. With this round's test files on `5a4de7f76`'s code, 17 fail and 101 pass; on `b28f40de0` all 118 pass. The 17 fail for the right reason:

| rows | why they fail on `5a4de7f76` |
|---|---|
| 4 collision rows (`Makefile+makefile`, `Makefile+GNUmakefile`, all three, `Makefile+GNUmakefile+scripts`) | the line holds "not with that merge alone" |
| 2 new script-tail rows (`GNUmakefile`, `makefile`) | the line holds "before both merges are made" |
| 2 new include rows in a real clone (`GNUmakefile`, `makefile`) | `make -n bootstrap` exits 2 before the merge and 0 after it alone (both asserted first, and passing), then the split message holds "not with that merge alone" |
| 7 clone rows, the pinned-file row and `test_a_scaffolded_root_is_told_its_makefile_exports_none` | the pinned file still says "and never the shape's Makefile" |

**Mutants of this round**, each run against the 118 rows on `b28f40de0`, each file restored and its sha256 checked:

| id | mutant | rows failing | result |
|---|---|---|---|
| MA | ", and not with that merge alone" put back | 6 | killed |
| MB | the script-aside tail put back ("before both merges are made") | 3 | killed |
| MC | the template's "and never the shape's Makefile" put back | 9 | killed |
| MD1 | include rows: `not in message` inverted to `in message` | 2 | killed |
| MD2 | include rows: after the merge, `returncode == 0` inverted | 2 | killed |
| ME | "holds them" put back | 6 | killed |
| MF | "the shape's `bootstrap` target runs" put back | 5 | killed |

**Gate** on `b28f40de0`:

| files | passed | failed | skipped |
|---|---|---|---|
| `test_adopt_collision_make_reads`, `test_pinned_copy_text`, `test_adopt_make_reads_first`, `test_adopt_contracts_dir`, `test_adopt_printed_sentences`, `test_adopt_e2e`, `test_repo_hygiene`, `test_scaffold_leg_path_collisions` | 470 | 0 | 0 |
| `test_shape_doctor`, 8 shards (62 + 56 + 54 + 56 + 60 + 57 + 58 + 45 collected) | 445 | 0 | 3 (PowerShell rows, Windows host only) |
| **total** | **915** | **0** | **3** |

**Merge-tree:** `b28f40de0` against main `4ed7c7bf5` is clean, and so is it against each open PR that touches these files: #1104, #1106, #1118, #1119, #1120, #1121 (`1c5173758`), #1122, #1123 and #1125.

**Round 0** (`5a4de7f76`, main `6da757cbe` merged in): on main's code (plus the constant alone), 12 of the then 27 rows failed and 15 passed; the 30 test files that run the changed code or read the template gave 2109 passed, 0 failed and 4 skipped (3 PowerShell rows in `test_shape_doctor.py`, 1 MedxEHR row in `test_adopt_plan.py` that needs a clone `SHAPE_MEDXEHR_CLONE` names); nine mutants each failed 1 to 11 of the then 114 rows.

**Not here**
- The third box of #1048, the `_next_steps` NOTE in `adopt-project.py`, is covered by the change #1047 makes to it: see #1047 and #1121.
- `templates/assembly-root/AGENTS-shape.md` line 19 and the five-commands table say `make bootstrap` without this caveat. They say nothing about a kept file, so they are outside #1048's two sentences.

Closes #1048

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 9, 2026
… offered its url only where GitHub can hold the name, so `testorg/<300 a's>` beside an unsearchable `./testorg` is offered no url, and `testorg/Thing` through a link too long keeps `https://github.com/testorg/Thing` (#1003) (#1122)

Lane 4's W1003 for #1003 (v1.2.0, #970's follow-up), with W1003b's fix round 1 for RV1122's review. Lane 3 places the issue; this is a draft, and a reviewer follows.

#1003 names two defects. Part (a) is already on main, so this PR changes only part (b).

- **(a) A `--source` or recorded clone directory this user cannot enter.** This landed in #1072 (see #918). Its `_refused_at`, `_top_level(..., refused)` and `_not_a_whole_clone` refuse it as `source-unreadable`, and `tests/test_adopt_unenterable_source_and_locale.py` holds every case #1003 measured. W1003 measured it again (first table below), and this PR does not touch it.
- **(b) A `--source` too long to name is offered a url that cannot clone.** This PR puts it right.

## What

`adopt-project.py`, `_source_there`: when the `stat` of a spelling that is also an `org/repo` is refused, the refusal names both readings and offers the url only where GitHub can hold the name. An owner over `GITHUB_OWNER_MAX` (39) or a repository over `GITHUB_NAME_MAX` (100) is refused as a path is, whatever reason the operating system gave. The file already imports both limits from `shape_materialize`.

```python
        owner, _, repo = (name or "").partition("/")
        if (name is None or len(owner) > GITHUB_OWNER_MAX
                or len(repo) > GITHUB_NAME_MAX):
```

- **Before:** `plan --source <300 a's>/Thing` was refused `source-unreadable`, "cannot be read (File name too long)" (#970). It also said "whether it names the path `./<300 a's>/Thing` here, or only the GitHub repository `<300 a's>/Thing`, cannot be told", and offered `https://github.com/<300 a's>/Thing`.
- **Why that was wrong:** a part longer than a file name may be is longer than GitHub lets an owner or a repository be named, so the url can never clone.
- **Now:** "so whether a repository is there cannot be told", which is #970's own words for a path that cannot be read. The cure follows the operating system's reason: `chmod u+rx` for a permission, "put right what it names" for anything else. No url is offered.
- **The name decides, never the reason (fix round 1, RV1122's SHOULD-1).** The first head (`e75587e7`) refused only an `ENAMETOOLONG` this way, and that went wrong both ways:
  - `testorg/<300 a's>` beside a `./testorg` at mode 000 stops at `Permission denied` before the long part. It was still offered `https://github.com/testorg/<300 a's>`. Now it is offered no url.
  - `testorg/Thing`, with `./testorg` a symlink to a name too long, is `File name too long` because of the link's destination. It lost `https://github.com/testorg/Thing`, a repository GitHub can hold, which main offered. Now it is offered again.
- **The same holds for** the `github.com/` and `www.github.com/` spellings.
- **Unchanged:** a name GitHub can hold, with its `stat` refused (a permission, an I/O error, a link too long), still names both readings and offers the url.
- No refusal code is new or changed. `--source`'s help and `docs/cli.md` already say `source-unreadable` covers this, so neither changes.

## Before and after

**Part (a), and the first head.** W1003 probed as a non-root user (uid 1000), with Python 3.12.3 and with the same Python under a `sitecustomize` that answers `Path.exists`/`is_file`/`is_dir` as 3.14 does (proved to bite). The shim's output matched 3.12's on every tree. A stub `gh` recorded and refused each call; `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR`, `GIT_SSH_COMMAND=false`, `GIT_CONFIG_GLOBAL=/dev/null`.

| case | before #1072 (`06cbd478`) | main | this PR |
|---|---|---|---|
| H: `plan --source <repo dir at 000>` | `PermissionError` traceback, exit 1 | `source-unreadable`, exit 2, 0 `gh` calls | same as main |
| C7: `check`, recorded `local_path` at 000, `cloned: false` | traceback, exit 1 | `source-unreadable`, exit 2 | same as main |
| C6: the same, `cloned: true` | "no longer whole (git finds no repository there)", `cloning testorg/Thing`, 1 `gh` call | `source-unreadable`, 0 `gh` calls, nothing made | same as main |
| C6e: `execute --yes`, the same | as C6, 1 `gh` call | `source-unreadable`, 0 `gh` calls | same as main |
| G1: `plan --source <300 a's>/Thing` | two readings, url offered | two readings, url offered | "whether a repository is there", no url; exit 2, 0 `gh` calls |
| G2b/G5b: `[www.]github.com/<300 a's>/Thing` beside `./[www.]github.com` | not measured | two readings, url offered | no url; no plan, no work directory |
| G3b: `testorg/<300 a's>` beside `./testorg` | not measured | two readings, url offered | no url; no plan, no work directory |
| G4: `./<300 a's>/Thing` (a path) | no url | no url | unchanged |

That probe ran on main `2a119f28` and on the first head's diff as first committed there (`5a8f09d8`). At this head, the tests' rows below give the same answers for G1 to G3b.

**Fix round 1.** `_source_spec` in-process, with a real `stat`, as uid 1000 on Python 3.12.3. No process is started.

| case | `stat` | main `823624d9` | first head `e75587e7` | this head |
|---|---|---|---|---|
| A: `<300 a's>/Thing` | File name too long | two readings, url | path wording, no url | path wording, no url |
| B: `testorg/<300 a's>` beside `./testorg` | File name too long | two readings, url | path wording, no url | path wording, no url |
| E: `testorg/Thing`, `./testorg` a symlink to `<300 a's>` | File name too long | two readings, `https://github.com/testorg/Thing` | path wording, **no url** | two readings, `https://github.com/testorg/Thing` |
| C: `testorg/<300 a's>` beside `./testorg` at 000 | Permission denied | two readings, url | two readings, **url** | path wording, no url |
| D: `<50 b's>/Thing` beside `./<50 b's>` at 000 | Permission denied | two readings, url | two readings, url | path wording, no url |
| K39: `<39 c's>/Thing` beside `./<39 c's>` at 000 | Permission denied | two readings, url | two readings, url | two readings, url |
| K: `testorg/Thing` beside `./testorg` at 000 | Permission denied | two readings, url | two readings, url | two readings, url |

## Tests

Every run used `/usr/bin/python3 -m pytest -p no:cacheprovider`, with the landing gate's environment:

- a stub `gh` first on PATH, `GH_TOKEN=bogus` and an empty `GH_CONFIG_DIR`;
- `GIT_CONFIG_GLOBAL` set to an empty file, and `GIT_CONFIG_NOSYSTEM=1`;
- the test author and committer variables, and `EMAIL`;
- `GIT_SSH_COMMAND` and `GIT_ALLOW_PROTOCOL` unset.

**The rows for #1003**, in `tests/test_adopt_unsearchable_source.py`, #970's file. Each was run with this head's test file against three versions of `adopt-project.py`: main's, the first head's and this head's.

| Row | What it asserts | main `823624d9` | first head `e75587e7` | this head |
|---|---|---|---|---|
| `test_a_spelling_too_long_for_the_disk_is_offered_no_url`: `[owner]`, `[repository]`, `[bare-github-url]`, `[www-github-url]` (changed) | real `stat`, `File name too long`: path wording, no url. Its control now refuses, with an I/O error, a name GitHub can hold (an owner of 39, a repository of 100), and expects that name's url | 4 fail at `detail` (two readings) | 4 pass | 4 pass |
| `test_a_name_github_cannot_hold_is_offered_no_url_whatever_the_reason`: an owner of 40 or 300, a repository of 101 or 300, and `github.com/<40>/Thing`, each refused with EIO and with EACCES (new, 10 rows) | in-process: path wording, the cure for the reason, no url. The control is the same part at GitHub's limit, refused alike, which keeps both readings and its url | 10 fail at `detail` | 10 fail at `detail` (two readings, url) | 10 pass |
| `test_a_name_github_can_hold_keeps_its_url_through_a_link_too_long` (new) | row E: real `stat`, `File name too long` through the link; two readings and `https://github.com/testorg/Thing` | passes | fails at `detail` (path wording, no url) | passes |
| `test_plan_of_a_name_github_cannot_hold_in_an_unsearchable_place` (new) | row C: a child `plan`, `./testorg` at 000, with the `stat` asserted to be `Permission denied`. Exit 2, the refusal line, the `chmod` cure, no "GitHub repository" and no `https://`; no plan, no work directory, `gh` never asked | fails at the refusal line | fails at the refusal line (url offered) | passes |
| `test_plan_of_a_spelling_too_long_for_the_disk_offers_no_url` (unchanged) | a child `plan` of `<300 a's>/Thing` | fails | passes | passes |

Totals for the 17 rows: main 16 failed and 1 passed, the first head 12 failed and 5 passed, and this head 17 passed. Each new row fails on the first head; each changed row fails on main, where the first head already passed it.

Skips follow the file's own:
- the rows that need a real `File name too long` skip on Windows (`needs_a_name_too_long`), and the symlink row needs a symlink too (`needs_a_symlink`);
- the real mode-000 row skips on Windows and as root (`needs_a_mode`);
- the in-process EIO and EACCES rows refuse `Path.stat` themselves (`refused_for`), so they run on every platform and as root, as `refused_stat`'s rows do.

**Mutants**, each applied to this head's `adopt-project.py` (sha256 `b8bdbdbe...`) by exact substitution and run against `test_adopt_unsearchable_source.py` and `test_adopt_unenterable_source_and_locale.py` (57 tests). After each one, the file was restored from its saved bytes and its sha256 checked. All seven were killed, and the file unmutated passes all 57.

| Mutant | Killed by |
|---|---|
| N1: the first head's guard, `name is None or exc.errno == errno.ENAMETOOLONG` | 12: the 10 in-process rows, row E, row C |
| N2: the owner's limit only | 6: `[repository]`, the 4 `repository-*` rows, row C |
| N3: the repository's limit only | 10: `[owner]`, `[bare-github-url]`, `[www-github-url]`, the 6 `owner-*` and `bare-github-url-*` rows, and the child `plan` of `<300 a's>/Thing` |
| N4a: the owner's limit off by one (`>=`) | 9: the 3 owner controls at 39, and the 6 `owner-*` and `bare-github-url-*` controls at 39 |
| N4b: the repository's limit off by one (`>=`) | 5: the `[repository]` control at 100, and the 4 `repository-*` controls at 100 |
| N5: the url withheld for every error | 20: 5 of #970's rows, the 4 changed rows, the 10 in-process rows, row E |
| N6: the errno, or GitHub's limits | 1: row E |

**Gate**, at this head `c01c4d73`, each file alone:

| File | Result |
|---|---|
| `tests/test_adopt_unsearchable_source.py` | 44 passed (32 before, and 12 new) |
| `tests/test_adopt_unenterable_source_and_locale.py` | 13 passed |
| `tests/test_adopt_source_clone_record.py` | 100 passed |
| `tests/test_adopt_project_is_the_source.py` | 23 passed |
| `tests/test_adopt_temp_work_roots.py` (the test file imports from it) | 9 passed |
| `tests/test_repo_hygiene.py` | 100 passed |
| `tests/test_scaffold_leg_path_collisions.py` | 104 passed |
| `tests/test_cli_reference.py` | 23 passed |
| `tests/test_agents_md_codes.py` | 47 passed |
| `tests/test_shape_doctor.py`, in 8 shards of 56 | 445 passed, 3 skipped (`:10510`, the PowerShell rows, Windows only) |

Total: 908 passed and 3 skipped, in 10 files, with no failures. Only the two `source-unreadable` files reach the changed branch: `git grep` over `tests/` finds `_source_spec`, `_source_there` and adopt's `source-unreadable` in no other file.

pyflakes on both changed files: no warning.

## Merges

`git merge-tree --write-tree`, at this head `c01c4d73`:

| Merged with | Result |
|---|---|
| main `823624d9` | clean, tree `aaed1f57`; its diff from main is byte-identical to the PR's own diff (`6da757cb..HEAD`), in the same 2 files |
| #1125 `2a53a8e6` | clean |
| #1123 `5c3908f8` | clean |
| #1121 `c04bb710` | clean |
| #1120 `c55e55e3` | clean |
| #1119 `bdcf9952` | clean |
| #1118 `c60066cb` | clean |
| #1106 `504a1dd6` | clean |
| #1105 `5a4de7f7` | clean |
| #1091 `551452be` | clean |

## Out of scope

- X1: a recorded clone whose directory can be entered, but whose `.git` is at mode 000, reads as emptied ("git finds no repository there"). With `cloned: true` it is cloned again (1 `gh` call). It is the same on main and here; lane 4 filed it as #1099 (see #1099).
- RV1122's NIT-1: an owner of 40 to 255 characters, or a repository of 101 to 255, with nothing on disk, is still handed to `gh`, which is asked for a name it cannot hold. It is the same on main and here; see #1129.

Closes #1003

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 9, 2026
… right after its three repository names, so a bad one beside an unanswered entry, a moved source, a refused name or another repository is that one refusal in both, and a `pins:` entry that is no pin is said as `_read_as` says it (#1020) (#1125)

#901 made `check` and `execute` name the same first problem among a plan's options. Outside them, the two still named different problems first (#1020, found by lane 1's writer on #901).

1. **One rule, the refusal before what `check` lists.** `check` refuses a bad `org:` or `id:` outright, exit 2, and lists none of its findings. `execute` refuses at the first of them, but it asked the two only after it had refused four things that `check` lists as findings: a plan for another repository (`plan-not-the-source`), a name the naming policy refuses (`naming-unclassified`), an unanswered entry (`plan-unresolved`) and a source that has moved on (`plan-stale`). And `check` asked the two only where the policy took the plan's names (`_manifest_values`), so an unsafe `org:` beside a refused name was a finding about the name, or about another repository. Both commands now ask the two first of the plan's values, right after the three repository names (`plan.names()`, then `_checked_org_and_id`): `execute` in `cmd_execute`, ahead of `_refuse_a_plan_for_another_repository`, and `check` at its head, after the triad advisory. Review round 1, below, moves both to right after the plan's keys, before `_work_root`. `_checked_plan_values` no longer asks them, since `cmd_execute` has.
2. **#716's L4-48, decided.** An `org:` that `checked_value` refuses, held to a repository, was `unsafe-value` to `check` and `plan-not-the-source` to `execute`. Such an `org:` names no repository, on GitHub or in the manifest, so it is not compared with the source's. It is `unsafe-value` in both commands now, held to a repository or not. Once it is mended, a plan for another repository is still `plan-not-the-source` in both. This reverses three tests in `tests/test_adopt_check_plan_name.py`, which pinned the old answers on purpose:
   - `test_an_unsafe_org_is_unsafe_in_check_and_compared_by_execute_if_held` expected `plan-not-the-source` from `execute` in its six held rows. As `test_an_unsafe_org_is_unsafe_in_check_and_in_execute_held_or_not`, all twelve expect `unsafe-value` from both, in the same words.
   - `test_check_compares_an_unsafe_org_where_no_manifest_is_built` expected `check` to compare `org: acme labs` beside the refused name `bad_name`: `plan-not-the-source` and `naming-unclassified`, exit 1. As `test_an_unsafe_org_is_asked_before_the_plans_refused_names`, it expects `unsafe-value`, exit 2, from `check` and from `execute`.
   - `test_check_asks_an_unsafe_org_first_where_a_kept_submodule_url_is_relative` expected `plan-not-the-source` from `execute`. It now expects `unsafe-value`, in `check`'s words.
3. **A `pins:` entry that is no pin** was spelled with `repr` (`` `pins:` entry 1 is 7 ``, `True`, `None`). #901 made `pins:` itself read as `_read_as` reads it, and an entry reads the same way now: "the number 7", "the boolean true", "null", "a list of 2 item(s)".

Docstrings and comments now say this: `_checked_org_and_id`, `_checked_plan_values`, `_manifest_values`, `_held_findings`, `_not_the_source`, `_refuse_a_plan_for_another_repository`, `_read_pins` and the #499 block comment. No finding is added or removed: only which problem is named first changes, and the spelling of an entry.

Measured on main at `6da757cb` and on this branch, with a stub `gh`, a bogus token, an empty `GH_CONFIG_DIR`, `GIT_SSH_COMMAND=false` and `--local-remote-dir`. No run made a leg.

| The plan has | `check` on main | `execute` on main | both, here |
|---|---|---|---|
| a bad id beside an unanswered entry | `plan-bad-id` | `plan-unresolved` | `plan-bad-id` |
| a bad id beside a source that has moved on | `plan-bad-id` | `plan-stale` | `plan-bad-id` |
| a bad id beside a name the policy refuses | `plan-bad-id` | `naming-unclassified` | `plan-bad-id` |
| a bad id beside another organisation, held to a repository | `plan-bad-id` | `plan-not-the-source` | `plan-bad-id` |
| no `id:`, and `legs.assembly: north_wind` (a derived id the policy refuses too) | `plan-bad-id` | `naming-unclassified` | `plan-bad-id` |
| an unsafe `org:` held to a repository (L4-48) | `unsafe-value` | `plan-not-the-source` | `unsafe-value` |
| an unsafe `org:` beside an unanswered entry | `unsafe-value` | `plan-unresolved` | `unsafe-value` |
| an unsafe `org:` beside a source that has moved on | `unsafe-value` | `plan-stale` | `unsafe-value` |
| an unsafe `org:` beside a refused name | finding `naming-unclassified`, exit 1 | `naming-unclassified` | `unsafe-value` |
| the same, held to a repository | finding `plan-not-the-source`, exit 1 | `plan-not-the-source` | `unsafe-value` |

Each "here" row is exit 2 from both, word for word. The last two rows agreed on main. They change because `check` now asks the two where the policy refuses the names, as `execute` now does: without that, moving `execute` alone would have made them disagree. Plans with only one of these problems (an unanswered entry, a moved source, a refused name, another repository) are named as on main by both.

**Tests.**
- `tests/test_adopt_plan_value_order.py` gains 16 rows:
  - the 10 above, through both commands, comparing the first line;
  - four `pins:` entries that are no pin: number, boolean, null and list;
  - two guard rows, `id` and `org`: a leg name `checked_value` refuses (`legs.spec: "-spec"`) beside a bad `id:` or `org:` is that name's `unsafe-value` in both, so the three names are still asked first.
- The 14 non-guard rows all fail against `6da757cb`'s `adopt-project.py` and pass here. The two guard rows pass on both, by design.
- Existing rows changed for the new behaviour:
  - `test_adopt_check_plan_name.py`: the three tests above, and its docstring's L4-48 line.
  - `test_adopt_pins.py`: `a-number`.
  - `test_adopt_execute_refusals.py`: the three entry rows of `PIN_ENTRIES`.

**Mutants**, each applied to `adopt-project.py`, run against the 16 new rows and the L4-48 tests (30 tests), and restored with its sha256 checked (`9178964d`, the same after each one):

| Mutant | Killed by |
|---|---|
| M1: `cmd_execute` does not ask `_checked_org_and_id` early | 18: the 10 new rows, the 6 held L4-48 rows, and the two other reversed tests |
| M2: `cmd_execute` asks it after `_refuse_a_plan_for_another_repository` | 11: the 3 new held rows, the 6 held L4-48 rows, and the two other reversed tests |
| M3: `cmd_check` asks `plan.names()` but not `_checked_org_and_id` at its head | 3: `org-and-refused-name`, `org-held-and-refused-name`, `test_an_unsafe_org_is_asked_before_the_plans_refused_names` |
| M4: `cmd_check` asks `_checked_org_and_id` but not `plan.names()` at its head | 2: both guard rows |
| M5: a `pins:` entry that is no pin spelled with `repr` again | 4: the four new entry rows |

**Gate**, on this branch's tree `66845bb3`, under a stub `gh`, `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR`, `GIT_CONFIG_GLOBAL` an empty file, `GIT_CONFIG_NOSYSTEM=1`, `GIT_ALLOW_PROTOCOL` and `GIT_SSH_COMMAND` unset, and `EMAIL` set. 125 files in six shards. The branch is based on `main` at `6da757cb`. `main` has since moved to `823624d9` (#1101, #1102), and its diff against `6da757cb` is empty in the five files this branch changes.
- every `tests/test_adopt_*.py` (68 files, 34 in each of s1 and s2):
  - s1: 2013 passed, 2 skipped (local run on this head).
  - s2: 2560 passed, 1 skipped (local run on this head).
- the 55 other files that name `ADOPT`, `adopt-project.py` or `adopter`, among them `test_repo_hygiene.py` and `test_agents_md_codes.py` (28 files in s3, 27 in s4):
  - s3: 1992 passed, 8 skipped (local run on this head).
  - s4: 1860 passed, 1 skipped (local run on this head).
- `tests/test_shape_doctor.py`, s5: 445 passed, 3 skipped (local run on this head).
- `tests/test_scaffold_leg_path_collisions.py`, s6: 104 passed (local run on this head).

**Merge-trees**, `git merge-tree --write-tree`, run on 2026-10-21 against `main` at `823624d9` and against each open PR's head that touches `adopt-project.py`. Every one exits 0 and is clean:
- `main` at `823624d9`: tree `728fb9e4`. At review round 1's head `9549006f`, against `main` at `038dafba` (it took #1091): clean, tree `2cf183ed`.
- #1123 (`5c3908f8`), #1122 (`e75587e7`), #1121 (`c04bb710`), #1120 (`c55e55e3`), #1119 (`bdcf9952`), #1118 (`c60066cb`), #1106 (`504a1dd6`), #1105 (`5a4de7f7`) and #1091 (`160de118`).

The merged trees were not run through the tests: the merges are clean as text only.

**Review round 1** (RV1125's review of `2a53a8e6`: one SHOULD and two NITs), head `9549006f`, one commit on top of `2a53a8e6`:
- **SHOULD-1.** A bad `id:` or `org:` beside a `--work-dir` this user cannot write in was `plan-bad-id` (or `unsafe-value`) to `check` and `adopt-work-dir-unwritable` to `execute`: `check` lists the directory as a finding (#524), and `execute` refuses it before it opens the source, ahead of the two asks. Both commands now ask `plan.names()` and `_checked_org_and_id(plan)` right after the mistyped-plan question, before `_work_root`, as RV1125 sketched. They read only the plan. The comments in `cmd_execute`, `cmd_check`, `_checked_org_and_id` and `_checked_plan_values` say so, and the "A REFUSAL OF `check`'S IS ASKED BEFORE WHAT IT LISTS" paragraph names the work directory among what is asked after. A `--work-dir` that is a file or cannot be made agrees as well: both ask `_work_root` after the two now.
- **Two side effects, said here.** (1) `check` printed the Triad advisory, on stdout, once it had opened the source and before it refused a bad `org:` or `id:`; the refusal now comes before the source is opened, so it prints nothing on stdout. (2) `execute` asks the two before `_require_filter_repo()`, so a bad `id:` is the refusal even where `git filter-repo` is missing; `check` asks no such question.
- **Two more reorders, said here (RV1125b's NIT-B).** Besides the `--work-dir` that is a file, a bad `id:` or `org:` is now asked, in `check` and in `execute`, before `_work_root` refuses a `--work-dir` every user can write in, without the sticky bit (`adopt-work-dir-shared`), and before a source that has moved on is refused (`plan-source-gone`). On main at `6da757cb` both commands said `adopt-work-dir-shared` or `plan-source-gone` of such a plan; here both say `plan-bad-id` or `unsafe-value`, so only which refusal comes first changes: the two commands agreed before and agree now. The same plan with no bad `id:` or `org:` is refused as before, in both. Measured at `6da757cb` and at `9549006f`, for a bad `id:` and for a bad `org:` beside each. No row pins either yet: see #1179.
- **Rows** in `tests/test_adopt_plan_value_order.py`: `both_on` takes a `--work-dir` for both commands; `test_the_org_or_the_id_is_named_before_an_unwritable_work_dir` has a row for a bad `id:` and one for a bad `org:`, each beside a `--work-dir` that is `chmod 500`, asserting exit 2 from both, the same first problem, and no `adopt-work-dir-unwritable`. It skips where `chmod` cannot keep this user from writing (root, Windows), by `test_adopt_root_symlinks.unwritable_work`.
- **NIT-1.** The docstring of `test_check_asks_an_unsafe_org_first_where_a_kept_submodule_url_is_relative` says it is a regression row: since #1020 `check` asks `org:` at its head, so the relative url decides nothing.
- **NIT-2.** `check` prints its findings only at its end, so no finding tells a late ask from one at its head. Its stdout does: the Triad advisory comes after `_work_root` and the source are opened. `test_check_asks_the_org_and_the_id_before_it_says_anything_else` (a row for a bad `id:` and one for a bad `org:`) asserts that `check` prints nothing on stdout and refuses first on stderr, and its control, the unedited plan, says the advisory first.
- **Rows against `2a53a8e6`'s `adopt-project.py`:** the 4 new rows fail (the work-dir rows: `execute` says `adopt-work-dir-unwritable` where `check` says the id or the org; the NIT-2 rows: stdout holds the advisory), and the 2 guard rows pass.
- **Mutants** of this round, each applied to the new `adopt-project.py`, run against `test_adopt_plan_value_order.py` and `test_adopt_check_plan_name.py` (85 tests), restored with sha256 checked (`412edbda`, the same after each one):

| Mutant | Killed by |
|---|---|
| N1: `check` asks the two after the advisory (this PR's place before the round) | 2: both NIT-2 rows |
| N2: `check` asks them only before `_print_what_will_happen` (RV1125's K3) | 2: both NIT-2 rows |
| N3: `check` asks them only before `_not_the_source` (K9) | 2: both NIT-2 rows |
| N4: `execute` asks them after the work-dir refusal, before the source is opened | 2: both work-dir rows |
| N5: `execute` asks them where it did before the round, after `_require_filter_repo()` | 2: both work-dir rows |

- **Gate** on a scratch merge commit `8bd1e05f` of `main` at `038dafba` and `9549006f` (tree `2cf183ed`, clean, not pushed), in the landing gate's environment, six shards: the PR's four test files, 416 passed; `test_adopt_work_dir_refusal.py` and `test_adopt_shape_pin_and_work_dir.py`, 73 passed; `test_cli_reference.py`, `test_agents_md_codes.py`, `test_repo_hygiene.py`, `test_path_guard_hygiene.py` and `test_scaffold_leg_path_collisions.py`, 323 passed; `test_shape_doctor.py` in three shards of 150, 150 and 148 ids (448 in all): 150 passed, 150 passed, 145 passed and 3 skipped. 0 failures. `test_path_guard_hygiene.py` passes on the merge: its three guards from #1091 are on `main` now, and the test is green there.
- Not done: RV1125's list of other open PRs was not re-run through the merge; a PR whose tests assume `check` printed the advisory before a refusal would fail, and none was found in this repository's tests.

**Left for follow-up issues, not taken here (see #1113 and #1114):**
- #1113: `check` and `execute` still name different first problems for four pairs that have no bad id or `org:`:
  - a source that has moved on beside an unanswered entry;
  - a plan for another repository beside an unanswered entry;
  - a plan for another repository beside a moved source;
  - a refused name beside an unanswered entry.

  Each is `check`'s finding order against `execute`'s refusal order, and is the same on `main` and here.
- #1114: `_pin_row_problem` spells a pin field that is not text with Python's `repr` (`` `commit: 7` ``, `True`).

Closes #1020

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 9, 2026
…d is refused `source-unreadable`, naming that `.git`, so `check` and `execute` no longer call a clone `plan` made with its `.git` at mode 000 no longer whole and clone it again (#1099) (#1141)

A recorded source whose `.git` this user cannot read is now refused as `source-unreadable`, naming that `.git`. `check` and `execute` no longer call a clone `plan` made with its `.git` at mode 000 "no longer whole", and no longer clone it again from GitHub. This uses the code and wording #1072 gave a recorded directory this user cannot enter (#918). No refusal code is new.

## Reproduced on main `4ed7c7bf5`

Measured as uid 1000, with git 2.43.0 and Python 3.12.3. The run had a stub `gh` first on PATH that records and refuses every call, `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR`, `GIT_SSH_COMMAND=false` and an empty global git config. Remotes were local, under `--local-remote-dir`.

The source was a clone with `origin` at `https://github.com/testorg/Thing.git`, so `plan` recorded `source.repository: testorg/Thing`. `plan --source <it>` wrote the plan, and `cloned:` was set by hand where the row needs it. Then `chmod 000 <it>/.git`.

| Row | `check` on main | `execute --yes` on main |
|---|---|---|
| `.git` a directory at 000, `cloned: true` | exit 2: NOTE "... is a clone `plan` made that is no longer whole (git finds no repository there), so its `source.repository`, testorg/Thing, is cloned again from GitHub", then `cloning testorg/Thing`, then `source-unclonable`; **1 `gh repo clone`** | the same, 1 `gh` call |
| `.git` a directory at 000, `cloned: false` | exit 2: `REFUSED git-failed: git rev-parse --is-inside-git-dir in <it> exited 128: fatal: not a git repository (or any of the parent directories): .git`; 0 `gh` | the same |
| `.git` a file (`gitdir:`) at 000, `cloned: true` | as the directory row: NOTE, cloning, **1 `gh` call** | the same |
| `.git` a file at 000, `cloned: false` | exit 2: `git-failed`, `fatal: error opening '<it>/.git': Permission denied`; 0 `gh` | the same |
| readable `.git`, `cloned: true` and `false` | exit 0, `plan ok`; 0 `gh` | exit 0, `adoption verified`; 0 `gh` |

## On this branch

Each of the four unreadable rows now exits 2 before anything is cloned or made, and `gh` is never asked:

```text
REFUSED source-unreadable: the `.git` in the plan's `source.local_path`, `<it>/.git`: cannot be read (Permission denied), so whether `plan`'s clone is still whole, to be read, or no longer whole, to be cloned again, cannot be told
Remediation: a path this user cannot reach is never read as one that is not there, and nothing was cloned. Make it readable by this user: `chmod u+rx` on the directory and on every directory above it, or fix who owns them. Then run the same command again; or pass the source again with --source, which is held to the plan's `commit:`.
```

- With `cloned: false`, what cannot be told is "whether a repository is there".
- A `.git` that is a file is given `chmod u+r` on the file and `chmod u+rx` on every directory above it.
- The readable rows are unchanged: `plan ok`, `adoption verified`, 0 `gh` calls.

## What changed

All in `adopt-project.py`, plus the regenerated `docs/cli.md` and one new test file.

- **`_git_refused(path)`** (new, after `_not_a_whole_clone`) asks the `.git` before git runs, through `_is_a` and `_is_there` (#430):
  - A directory is asked whether its `HEAD` is there. That `stat` needs only the directory searched, and nothing of `HEAD` itself.
  - A regular file is opened, as git reads it.
  - Git's own answer cannot be used: it says "not a git repository" of a `.git` it cannot read, as it does of an emptied clone. With a directory `.git`, it also climbs to the parent, which may be another repository.
  - It returns `(the OSError, whether the .git is a file)`, or None. None is returned where nothing is there, where the `.git` holds no `HEAD` (git's "no repository", as before), or where the `.git` is neither a directory nor a file.
  - None is also returned where the `.git`'s own `stat` is refused. Then the directory itself cannot be searched, and #918's `cwd=` guards name it, as before.
- **`Plan._recorded_source`** asks `_git_refused` right after asking whether the path is there, before it branches on `source.cloned`. That covers `cloned: true` and `false` alike. The new `Plan._git_unreadable` words the refusal. The insertion sits clear of #1106's change to the `there` line.
- **`_source_unreadable`** takes the cure for a `PermissionError` as a keyword, `permission=`. It defaults to the directory's `SOURCE_UNREADABLE_PERMISSION`, so every other caller is unchanged. A `.git` file is given the new `SOURCE_UNREADABLE_FILE_PERMISSION`.
- **`SOURCE_OVERRIDE_HELP`** (the `--source` help of `check` and `execute`) now says "one this user cannot reach, or one whose `.git` this user cannot read, a clone `plan` made included, as `source-unreadable`, never cloned again".
  - It is worded so that argparse does not wrap inside `source-unreadable`.
  - `docs/cli.md` was regenerated with `scripts/render-cli-reference.py`.
  - No README, handbook, `AGENTS.md` or template sentence names this case. `AGENTS.md`'s codes table is untouched, since no code is added.
- **`--source` itself is unchanged.** The issue names the recorded clone (see Out of scope).

## Rows: `tests/test_adopt_unreadable_clone_git.py` (new, 18)

| Row | main `4ed7c7bf5` | this head |
|---|---|---|
| `test_a_recorded_git_this_user_cannot_read_is_refused_by_name[check,execute x given,cloned x directory,file]` (8, real mode 000, `needs_a_mode`) | 8 failed: the refusal line is missing (`git-failed`, or `source-unclonable` after `gh` was asked) | 8 passed |
| `test_a_recorded_clone_whose_git_is_refused_is_not_cloned_again` (in-process, the `stat` of `.git/HEAD` refused, so it runs as root and on Windows too) | failed: `check` read the clone, exit 0 | passed |
| `test_a_git_that_can_be_read_or_is_not_there_is_gits_question[5]` (the helper) | 5 failed: no `_git_refused` on main | 5 passed |
| `test_a_recorded_git_this_user_can_read_is_read_as_before[given,cloned x directory,file]` (4 controls) | 4 passed | 4 passed |

In total: **14 failed and 4 passed on main; 18 passed on this head.** The permission rows skip as root and on Windows, as the repository's other permission rows do. The rows' `at_mode_000` asserts that the mode bites (`os.access(R_OK)` is False), and gives the mode back in a `finally`.

## Mutants

Each was applied alone to the committed `adopt-project.py` (sha256 `b2b41532c3a5...`) and its rows run. The file was then restored, and its sha256 checked equal to the commit's every time. `git status` was clean after all of them. **All 8 were killed.**

| Mutant | Killed by |
|---|---|
| M1 the new guard removed (`refused = None`) | 9 failed / 18: the 8 refused-by-name rows and the in-process row |
| M2 the guard applied to a readable `.git` (a `PermissionError` returned where the `.git` reads) | 9 failed / 18: the 4 read-as-before rows and the 5 helper rows |
| M3 `gh` asked anyway (`Source.clone` of the record asked, then the same refusal raised) | 9 failed / 18: the 8 refused-by-name rows (the `gh` log is not empty) and the in-process row (2 `gh` calls) |
| M4 a `.git` whose own `stat` is refused taken as the `.git`'s | 3 failed / 31: #1072's `test_a_recorded_source_this_user_cannot_enter_is_refused_by_name[check-False]`, `[check-True]` and `[execute-True]` (the directory must still be named by itself) |
| M5 a `.git` file given the directory's cure | 4 failed / 18: the 4 file rows |
| M6 a `.git` file never opened | 4 failed / 18: the 4 file rows |
| M7 a `.git` with no `HEAD` refused | 1 failed / 18: `..._is_gits_question[a-git-directory-with-no-head]` |
| M8 what cannot be told swapped between `cloned` and `given` | 9 failed / 18 |

## Gate

Run at this head `7a2711d0`, 16:35:44Z to 16:46:37Z, with `/usr/bin/python3 -m pytest -p no:cacheprovider -o tmp_path_retention_policy=failed`. The environment had `EMAIL` set; `GIT_ALLOW_PROTOCOL`, `GIT_SSH_COMMAND` and the `LANES_*` variables unset; an empty `GIT_CONFIG_GLOBAL` and `GIT_CONFIG_NOSYSTEM=1`; test author and committer identities; and a stub `gh` first on PATH, with `GH_TOKEN=bogus` and an empty `GH_CONFIG_DIR`.

| Set | Result |
|---|---|
| `test_adopt_unreadable_clone_git.py`, `test_adopt_source_clone_record.py`, `test_adopt_unenterable_source_and_locale.py`, `test_adopt_unsearchable_source.py`, #1091's `test_adopt_root_shape_paths.py` and `test_adopt_root_symlinks.py`, `test_pin_source_unreadable.py`, `test_cli_reference.py`, `test_agents_md_codes.py`, `test_repo_hygiene.py`, `test_scaffold_leg_path_collisions.py` | 839 passed, 3 skipped, rc=0 |
| `test_shape_doctor.py`, 8 shards (62, 56, 54, 56, 60, 57, 58, 45 of 448) | 62, 56, 54, 56, 60, 57, 55 + 3 skipped, 45 passed; every shard rc=0 |

`test_pin_source_unreadable.py` was added from a grep of `tests/` for `source-unreadable`, `_source_unreadable`, `SOURCE_UNREADABLE_`, `_recorded_source` and `SOURCE_OVERRIDE_HELP`. pyflakes on `adopt-project.py` and the new test file reports nothing.

## #1111's path-guard hygiene test (lane 1's rule, #473 16:26Z)

The guard asks the `.git` and its `HEAD` through `adopt-project.py`'s own `_is_a` and `_is_there`. It adds no bare `is_file`, `is_dir`, `exists`, `is_symlink` or `os.path` test. `tests/test_path_guard_hygiene.py` from #1111's head `b4484647` was run on a scratch merge of main `4ed7c7bf5`, #1111 and this head:

- **main + #1111 + this head:** 1 failed, 48 passed. The one failure is `test_no_bare_guard_outside_a_stat_helper_or_the_allowlist[adopt-project.py]`, for three sites:
  - `_PlannedRoot._no_directory`: `self._git().is_dir(here)`
  - `_PlannedRoot._into_git`: `self._git().is_dir(here.rpartition("/")[0])`
  - `_clone_ref_store`: `(probe / CLONE_GIT_DIR / "reftable").is_dir()`
- **main + #1111 alone, without this head:** the same three sites, the same 1 failed and 48 passed. They come from #1091 (`4ed7c7bf5`, #904), which landed after #1111's head was cut. #1111 needs them allowlisted or fixed before it lands. This PR does not touch them.
- **main + #1111 + this head, with only those three sites allowlisted in a scratch copy of the test:** 49 passed. This head adds no site.

## Merge-trees

Each was run as `git merge-tree --write-tree` of this head against:

| Against | Head | Result |
|---|---|---|
| `origin/main` | `4ed7c7bf5` | clean, tree `5e784b0f` |
| #1125 `fix/1020-bad-id-first-problem` | `2a53a8e6` | clean, tree `76af7e33` |
| #1123 `fix/1061-makefile-follow-ups` | `5c3908f8` | clean, tree `12859bc5` |
| #1122 `fix/1003-adopt-unenterable-source` (`_source_there`) | `c01c4d73` | clean, tree `6222542f` |
| #1121 `fix/1047-next-make-bootstrap` | `1c517375` | clean, tree `e294504f` |
| #1120 `fix/1035-source-branch-shown` | `c55e55e3` | clean, tree `46bcc762` |
| #1119 `fix/1083-check-asks-the-split-clone` | `9b998936` | clean, tree `dcc12164` |
| #1118 `fix/1089-named-link-skip-tests` | `c60066cb` | conflict in `tests/test_adopt_root_shape_paths.py` only, which this head does not touch; #1118 conflicts there with `origin/main` alone too |
| #1106 `l3-1078-one-byte-locale` (`_recorded_source`'s `there` line) | `504a1dd6` | clean, tree `e59c5cf4` |
| #1105 `fix/1048-makefile-follow-up-gnu-read-order` | `b28f40de` | clean, tree `67d4fec4` |

These are every open pull request that changes `adopt-project.py`, `docs/cli.md` or the new test file, as listed at 16:33Z.

## Out of scope

Each was measured on this head, and none is changed here:

- **`plan --source <a repository whose .git is at 000>`**, and so `check --source` and `execute --source`: `REFUSED git-failed: ... fatal: not a git repository`, exit 2. No `gh` is asked and nothing is cloned, but the refusal does not name the `.git`. The issue names the recorded clone only. A follow-up could give `_top_level` the same guard.
- **A readable `.git` directory whose `HEAD` is at 000** (`cloned: true`): still "no longer whole (git finds no repository there)", cloned again, 1 `gh` call.
- **A readable `.git` file whose git directory is at 000** (`cloned: true`): the same, 1 `gh` call.
- Both of those are other files git reads, not the `.git` the issue measured. Naming every file git might be refused is a wider question, left for a ruling.
- **#1111 against main:** see above (#1091's three bare guards).
- **#1118 against main:** `git merge-tree` of #1118's head `c60066cb` with main alone conflicts in `tests/test_adopt_root_shape_paths.py`. This head does not touch that file.

Closes #1099

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 9, 2026
…nly) into` name the caller's `--out` and `--work-dir` with `_shown`, as the other lines of the report name a path, so a bidi control, a line feed or a tab in either no longer reaches the terminal as it was typed (#1115) (#1154)

## What changes

`adopt-project.py` named two caller-typed paths in its output as they were typed. A path holding U+202E or U+2066 turned the line round, a line feed split it and a tab padded it. Both now go through the existing `_shown`, the helper the `source` line, the table and the follow-ups already use (#199, #900):

- `cmd_plan` printed `plan written to {out}` with the `--out` path raw. This is the line #1115 names.
- `Source.clone` printed `cloning {repository} (read only) into {path}` with the `--work-dir` path raw, for an `org/repo` source only (`plan`, `check` and `execute` all say it). RV1120's review of #1120 found this one (its N4, see #1120), and the comment on #1115 asked for it to be fixed with `--out`.

A path whose every character is printable prints exactly as before, unless `_shown` spells it by #900's rule: a path that ends in a space, or one that begins and ends with a backtick. The diff in `adopt-project.py` is 13 lines.

## Behaviour change

A path that is not UTF-8 now prints as `\udcff` between backticks on the `plan written to` line, as `_shown` spells it in every other line, where it was written back as the raw 0xff byte before. `tests/test_stdout_encoding.py` pinned the raw byte for that one line, so its two `surrogateescape` rows now hold the spelled form, and one test is renamed to `test_a_name_that_is_not_utf8_is_spelled_and_the_report_still_comes_out`. `tests/test_non_utf8_name_callers.py` calls that test by name and is changed to match.

## Rows

`tests/test_adopt_plan_paths_spelled.py` is new: 18 rows, ASCII only (every non-ASCII character is an escape in the source), POSIX only. It runs `plan` as a child with U+202E, U+2066, a line feed, a tab and all four together in `--out` (5 rows) and in `--work-dir` (5 rows), a raw-bidi-control check for each flag (2 rows each), a plain path for each flag that must print unchanged (1 row each), a `./` dot-segment `--out` that must print as it always did, and one run that clones and writes its plan with both flags at once. The `--work-dir` rows use a `gh` that refuses, because the line is said before `gh` runs.

- On main's code (038dafb, with only this file added): 15 of the 18 rows fail. The 2 plain-path controls and the `./` row pass there, as they must.
- On this head: 18 of 18 pass.

## Mutants

7 of 7 are killed, each restored with its sha256 checked: the `--out` path raw again (M1), the `--work-dir` path raw again (M2), either path spelled with `_spelled` so a plain path gets backticks (M3, M4), `--out` spelled with `_line_shown`, the wrong helper (M5), the spelling put on the repository with the path left raw (M6), and `--out` spelled from `args.out` where the printed value is `out` (M7).

## Gate

- Gate run AB, in the landing gate's own environment (stub `gh`, empty global git config): 2098 passed, 4 skipped.
- On a scratch merge of this head and main `038dafba9`, which has #1111's `tests/test_path_guard_hygiene.py`:
  - `test_path_guard_hygiene.py`, the new file, `test_stdout_encoding.py` and `test_non_utf8_name_callers.py`: 150 passed, 1 skipped.
  - `test_shape_doctor.py`, 448 rows in 8 shards of 56: all 8 shards pass, 445 passed and 3 skipped (the PowerShell rows, which need a Windows host).
- `git merge-tree --write-tree` against `origin/main` exits 0, and the merged tree differs from main in exactly the four files of this diff. Against every open PR that changes `adopt-project.py` (#1143, #1141, #1125, #1123, #1122, #1121, #1120, #1119, #1118, #1106, #1105) it exits 0 each time.

## Not in this PR

The `--plan` path and `--local-remote-dir` are still printed raw. That is the follow-up #1152.

Closes #1115

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 9, 2026
… `--local-remote-dir` path in `execute`'s `bare`, leg and `split` lines, are named with `_shown`, as #1154 names `--out` and `--work-dir`, so a bidi control, an escape, a line feed or a byte that is not UTF-8 in either no longer reaches the terminal as it was typed (#1152) (#1177)

## What

#1154 (#1115) names `--out` and `--work-dir` in `plan`'s and `check`'s report with `_shown`. #1152 lists the two groups of paths it leaves raw: the `--plan` path in `check` and `execute`, and the `--local-remote-dir` path in `execute`. A bidi control (U+202E), an ESC or a line break in either reached the terminal as it was typed, where the other plan lines name a path with `_shown`.

This change spells each of the 21 sites with `_shown(str(...))`, in `adopt-project.py` only. A path with a character that is not printable is named as `_spelled` names it, between backticks. Every other path prints byte for byte as it did, and no refusal code is new.

The `--plan` path, 16 sites:
- the five `N finding(s) in <plan>` lines: `_refuse_a_mistyped_plan`, `_refuse_what_check_finds`, the `plan-split-branch-taken` refusal, and `cmd_check`'s two branches;
- the `<plan>: ...` refusals: `plan-wrong-kind`, `plan-unsupported-mode`, `plan-unreadable`, `plan-no-source`, the three `plan-bad-id` ones, `plan-not-the-source`, `adopt-topic-too-long`, and the `legs.assembly` and `org:` ones.

The `--local-remote-dir` path, 5 sites:
- the `<bare> already exists` refusal;
- the `  bare  <bare>` line;
- the two leg lines, in `_extract_leg` and `_seed_leg`, which end `-> <url>`;
- the `split <commit> on <branch> -> <url>` line. It names the source's directory under `--local-remote-dir`.

The `NEXT:` clone command is not touched. It already quotes the url with `shlex.quote`, and a row pins that it still does.

## Behaviour change

A path that is not UTF-8 now prints `\udcff` between backticks, as #1154's paths do, where it printed raw before. A plain path prints as it did.

## Names

#1152 calls the wrong-kind refusal `plan-bad-kind`. The code's name for it is `plan-wrong-kind`, and that is the code this change spells. No refusal was renamed.

## Not in this PR

`repo_shape.load_yaml`'s own refusals, `yaml-unreadable`, still print a path raw. They live in `scripts/repo_shape.py`, and they are a separate follow-up: see #1168.

## Proof

`tests/test_adopt_plan_and_remote_paths_spelled.py` is new, ASCII only and POSIX only, with every non-ASCII character written as an escape.

- **Rows: 148.**
  - 135 plan rows: 14 refusal families (27 family and command pairs) by 5 path forms (U+202E, ESC, a line feed, the byte `\xff` through `surrogateescape`, and a plain control).
  - 5 `--local-remote-dir` rows for the `bare` and leg lines (the code leg is extracted, the spec leg seeded).
  - 3 `split` rows. `execute` refuses a source path that holds U+202E, ESC, a line feed or `\xff` as `adopt-unwritable-value` before any leg exists, so these rows use U+200B in the parent directory and a name that ends in a space, and a plain control.
  - 5 in-process rows for `{bare} already exists`, which call `_create_leg_remote`.
- **On main's `adopt-project.py`: 118 failed, 30 passed.** Each failure is the raw path where the spelled one was expected. The 30 that pass are exactly the 30 plain controls.
- **On this head: 148 passed.**
- **Mutants: 23, all killed.** 21 put one spelling back to raw, one at a time, and 2 swap `_shown` for `_spelled` at one site. Each was restored with its sha256 checked.
- **Gate:** a scratch merge of this head with main `961640c68` (tree `61063bb76`, which is the tree of this PR merged into that main). Targeted files only: the new file, `test_stdout_encoding.py`, `test_non_utf8_name_callers.py`, `test_adopt_plan_escapes.py`, `test_path_guard_hygiene.py`, `test_repo_hygiene.py`, `test_scaffold_leg_path_collisions.py`, and every test file that greps for `finding(s) in` or `already exists` (47 files), in 6 shards, and `test_shape_doctor.py` (448 ids) in 8 shards. Every shard exited 0, with 0 failed.

  | Shard | Result |
  | --- | --- |
  | g0 | 617 passed |
  | g1 | 344 passed |
  | g2 | 439 passed |
  | g3 | 605 passed |
  | g4 | 902 passed |
  | g5 | 764 passed, 1 skipped |
  | d0 | 56 passed |
  | d1 | 56 passed |
  | d2 | 56 passed |
  | d3 | 55 passed, 1 skipped |
  | d4 | 55 passed, 1 skipped |
  | d5 | 55 passed, 1 skipped |
  | d6 | 56 passed |
  | d7 | 56 passed |

  That is 3671 passed and 1 skipped in the file shards, and 445 passed and 3 skipped in the doctor shards. The skips are Windows-only rows.
- **Merge-trees** (`git merge-tree --write-tree`, this head against each), all clean:
  - `origin/main` `961640c68`;
  - #1154's head `8a782733`: clean, so this PR is based on main and not stacked on it;
  - the other 15 open PRs that touch `adopt-project.py`, at their heads: #1171 `159815d75`, #1170 `4df784ac4`, #1169 `b8e63bcf0`, #1153 `ff33ba12a`, #1143 `7af5fabc3`, #1141 `7a2711d03`, #1125 `9549006fe`, #1123 `5c3908f8d`, #1122 `c01c4d73d`, #1121 `1c5173758`, #1120 `c55e55e33`, #1119 `bba168bdd`, #1118 `2307036ab`, #1106 `504a1dd65`, #1105 `b28f40de0`.

  The other open PRs do not touch `adopt-project.py`. None of the 16 that do adds a line that names `plan.path`, `{bare}`, `finding(s) in` or `already exists`, apart from a tuple in #1121 that is not printed.

Closes #1152

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 10, 2026
…not text as `_read_as` says what the plan's reader read, "records `commit:` as the number 7", where it spelled it as Python does, `commit: 7` and `True`, so `check` and `execute` name it in the words the plan's other refusals use under the same `plan-pin-malformed` (#1114) (#1198)

This PR lands only after the v1.2.0 tag, on Brett's word.

## What

`_pin_row_problem` holds each of a pin's five fields (`product`, `repository`, `commit`, `tree_sha256`, `digest_source`) to text. A value that is not text it spelled with Python's `repr`: a number as `commit: 7`, a boolean as `True`, a list as `['a', 'b']` and a mapping as `{'k': 'v'}`. Every other refusal of a plan's value says what the reader read, with `_read_as`: "the number 7", "the boolean true", "a list of 2 item(s)", "a mapping of 1 key(s)". W1020 found the gap while working on #1020.

It says it that way now, field by field, in `adopt-project.py`'s `_pin_row_problem`, in the `not_text` branch only:

- one field: ``records `commit:` as the number 7, which is not text``
- two or more: ``records `commit:` as the number 7, `tree_sha256:` as the boolean true, which are not text``

What stays as it was:

- the code, `plan-pin-malformed`, the remedy, and the sentence's ending, `which is not text`;
- every text value's spelling, byte for byte (`commit: '7'`, which is not 40 hex);
- a null or a blank: it is "records no `commit:`" under the code it has always had, and no value is spelled there.

Every field takes the one site (`PIN_FIELDS`). The docstring and a comment say so. The change is 13 lines added and 4 removed in `adopt-project.py`.

## Behaviour change

A pin field that is a number, a boolean, a list or a mapping is named by what it was read as, where it was named as Python spells it. A text value, a null and a blank print as they did.

## Rows

`tests/test_adopt_pin_row_values.py` is new, ASCII only, with 45 rows. Each runs `check` and then `execute --yes`, with a stub `gh` first on PATH and `--local-remote-dir`, and asserts one finding, `execute` refusing with that same finding, an empty `gh` log, no remotes directory made and no Traceback.

| Group | Rows | On main's code | On this head |
| --- | --- | --- | --- |
| The matrix: 5 fields by number, boolean, list, mapping | 20 | 20 failed | 20 passed |
| The whole sentence: `commit: 7`, and a boolean `digest_source` | 2 | 2 failed | 2 passed |
| Edge forms: 0, false, 7.5, -3, 007, `[]`, `{}`, `[a]` | 8 | 8 failed | 8 passed |
| Two fields at once, a non-text commit beside bad text, entry 2 | 3 | 3 failed | 3 passed |
| Null and blank controls | 6 | 6 passed | 6 passed |
| Text controls (`commit: "7"` and `"true"`, another product, no owner, short digest, source by hand) | 6 | 6 passed | 6 passed |
| **All** | **45** | **33 failed, 12 passed** | **45 passed** |

Every one of the 33 failures is the finding text holding the repr spelling (``records `commit: 7` ``, `True`, `['a', 'b']`, `{'k': 'v'}`, `{}`, `[]`). There is no crash or other cause. The 12 that pass on main are the controls, which pin what must not change.

Two existing rows pinned the old spelling, and no others did. Each now expects the new one, and both pass on this head (2 passed):

- `tests/test_adopt_pins.py`, the `a-number-commit` row: `` `commit:` as the number 1234567 ``;
- `tests/test_adopt_plan_value_order.py`, the `not-text` row: `` `digest_source:` as the number 7 ``.

## Mutants

19 mutants of this head's `adopt-project.py`, all killed. Each was run against the new file (first failure with `-x`, or a whole run where the table says so), and each run was restored with its sha256 checked.

| Mutant | Result |
| --- | --- |
| M1: main's repr form put back | killed, 33 failed and 12 passed |
| M2: `!r` inside the new "as" form | killed, 33 failed and 12 passed |
| M3: `str()` in place of `_read_as` | killed |
| F-repr-product, F-repr-repository, F-repr-commit, F-repr-tree_sha256, F-repr-digest_source: repr put back for one field only | 5 of 5 killed, each by that field's own rows |
| M4: "is" in place of "as" | killed |
| M5: singular and plural swapped | killed |
| M6: only the first field named | killed |
| M7: `missing` takes any falsy value (an existing guard; the zero, false and empty rows pin it) | killed |
| M8: only a list and a mapping counted as not text | killed |
| M9: the ending without "how it was read" | killed |
| M10: the code `plan-pin-unrecorded` | killed |
| T1 to T4: the text branches unquoted (commit, product and repository, digest, source) | 4 of 4 killed |

## Gate

A scratch merge of this head `d38e4e36d` with main `961640c68`: commit `1ef3f0783`, tree `b12197610`, which is this head's own tree. Targeted files only, in the landing gate's environment (a stub `gh` first on PATH, `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR`, an empty global git config). The set is 47 test files: every one that names `plan-pin-malformed`, `plan-pin-unrecorded`, `_pin_row_problem`, `_read_pins` or `pins:`, the new file, and `test_path_guard_hygiene.py`, `test_repo_hygiene.py` and `test_scaffold_leg_path_collisions.py`; and `test_shape_doctor.py` (448 ids, each in exactly one shard, run from a script that reads each list into an array because 25 ids hold spaces). Every chunk exited 0, with 0 failed.

| Chunk | Files | Result |
| --- | --- | --- |
| f01 | `test_adopt_pins.py` | 150 passed |
| f02 | `test_adopt_plan_yaml_quoting.py`, `test_adopt_plan.py` | 606 passed, 1 skipped |
| f03 | `test_adopt_execute_refusals.py`, `test_adopt_pin_row_values.py`, `test_adopt_plan_escapes.py`, `test_adopt_plan_value_order.py`, `test_adopt_reencoded_files.py`, `test_adopt_root_symlinks.py`, `test_adopt_shape_pin_and_work_dir.py`, `test_adopt_template_values.py` | 661 passed, 3 skipped |
| f04 | `test_bump_remedies_family_root.py`, `test_chain_link_fold.py`, `test_chain_pin_sources.py`, `test_chain_remedy_callers.py`, `test_doctor_gitlink_repairs.py`, `test_doctor_recorded_answers.py`, `test_family_add_member_id.py`, `test_family_makefile_siblings.py` | 255 passed |
| f05 | `test_family_tracking_branch.py`, `test_legs_not_a_list.py`, `test_link_source_chain_defaults.py`, `test_manifest_validator.py`, `test_naming_policy.py`, `test_neutral_pin_entry_one_spelling.py`, `test_neutral_pin_validator.py`, `test_non_list_project_fields.py` | 757 passed |
| f06 | `test_path_guard_hygiene.py`, `test_pin_annotated_tag.py`, `test_pin_source_env_collisions.py`, `test_pinned_copy_text.py`, `test_reader_refusals_named.py`, `test_repo_hygiene.py`, `test_scaffold_e2e.py`, `test_scaffold_leg_path_collisions.py` | 599 passed |
| f07 | `test_scaffold_pin_and_reuse.py`, `test_scaffold_pin_collisions.py`, `test_scaffold_referent_chain_links.py`, `test_setup_project_py.py`, `test_template_text_placeholders.py`, `test_update_shape_add_ignored.py`, `test_update_shape_landing.py`, `test_validate_pins_named_and_spelled.py` | 1078 passed |
| f08 | `test_yaml_flow_brackets.py`, `test_yaml_flow_quotes.py`, `test_yaml_indicator_openers.py`, `test_yaml_reader_spaces.py` | 813 passed |
| d01 | `test_shape_doctor.py`, 56 ids | 56 passed |
| d02 | the same, 56 ids | 56 passed |
| d03 | the same, 56 ids | 56 passed |
| d04 | the same, 56 ids | 56 passed |
| d05 | the same, 56 ids | 56 passed |
| d06 | the same, 56 ids | 56 passed |
| d07 | the same, 56 ids | 56 passed |
| d08 | the same, 56 ids | 53 passed, 3 skipped |

The file chunks hold 4919 passed and 4 skipped (f02: `SHAPE_MEDXEHR_CLONE` is unset; f03: the reftable backend needs git 2.45). The doctor shards hold 445 passed and 3 skipped (d08: the PowerShell line is printed only on a Windows host). In all, **5364 passed, 7 skipped, 0 failed.**

**Run on the merge with #1125's head.** A scratch merge of this head with #1125's head `9549006fe`: commit `8a291d8b2`, tree `88530bb7`. The new file (45), `test_adopt_pins.py` (150), `test_adopt_plan_value_order.py` (40), `test_adopt_execute_refusals.py` (181) and `test_adopt_check_plan_name.py` (45): **461 passed.**

## Merge-trees

`git merge-tree --write-tree`, this head against each, all clean (exit 0), at the heads of 2026-10-23T08:20Z:

- `origin/main` `961640c68`;
- the 23 open PRs that touch `adopt-project.py`: #1194 `900f77af9`, #1190 `00f959c61`, #1189 `4d40ce9fd`, #1186 `07486a498`, #1180 `b316f4157`, #1178 `c4beba193`, #1177 `5208e874e`, #1171 `8162b874e`, #1170 `24ee133aa`, #1169 `258051022`, #1154 `8a7828332`, #1153 `ff33ba12a`, #1143 `7af5fabc3`, #1141 `7a2711d03`, #1125 `9549006fe`, #1123 `5c3908f8d`, #1122 `c01c4d73d`, #1121 `1c5173758`, #1120 `c55e55e33`, #1119 `bba168bdd`, #1118 `2307036ab`, #1106 `504a1dd65`, #1105 `b28f40de0`;
- #1126 `4c1f80cf4`, which touches `tests/test_adopt_pins.py`.

## This PR needs no #1125

#1125 (for #1020) makes `_read_pins` say an entry that is not a pin as `_read_as` says it. Its `adopt-project.py` hunks are at the `_read_pins` docstring and at the non-dict entry's `{row!r}` (about line 625 on main), and they do not touch `_pin_row_problem`. Its test hunks do not overlap the lines this change edits. The two are textually independent: this PR is based on main, not stacked, the merge-tree with #1125's head is clean, and the run above on the merge with its head passed.

An entry that is neither a name nor a mapping stays #1020's, in #1125.

## Not in this PR

The other `repr` in the pin rows are on a value that is text by then: the later branches of `_pin_row_problem` (spelled as before), a text product in an entry's name, and an entry that is a name. They are not gaps.

`docs/release-notes/v1.2.0.md` is left alone. Its lines 297 to 299 mention #901's pins wording, and the release owner may want a line there.

## Out of scope

Four other places in `adopt-project.py` put a plan value of any type into a refusal with `!r`, as the pin rows did: `plan-wrong-kind`, `plan-unsupported-mode`, `plan-bad-leg` and `plan-bad-id`. They are not pin rows, so this change leaves them. They were found by reading the code, not by running it. They are filed as #1199, with each site's line and what it would print.

Closes #1114

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 10, 2026
…blems against its source, in the order a person mends them (another repository, a refused name, a moved source, an unanswered entry), so `check`'s first finding is `execute`'s refusal for each pair (#1113) (#1210)

**Stacked on #1125.** This PR's base is `fix/1020-bad-id-first-problem` (#1125's branch, head `9549006f`). It lands after #1125 and stays a draft until then. #1125 makes `check`'s first finding `execute`'s first refusal for a bad `id:` or `org:`. This PR extends that rule to the four pairs #1113 measured, which have neither.

**Fix round.** The first gate failed six rows of `tests/test_adopt_relative_submodule_url.py` that pinned `check`'s old order on a plan hand-edited into another organisation, the relative url before `plan-not-the-source`, a plan `execute` already refused `plan-not-the-source` first on #1125's head; they now expect `plan-not-the-source` first, and a new row asserts that both commands name it first.

## The rule and the order

One generator, `_against_its_source`, asks a plan's four problems against its source in one order, and both commands read it. `execute` refuses its first problem. `check` lists each one, in that order and in its own words, before the split branch and the entries.

The order is the one a person mends them in:
1. a plan for another repository (`plan-not-the-source`);
2. a name the naming policy refuses (`naming-unclassified`, or `naming-role-mismatch`);
3. a source that has moved on since `plan` (`plan-stale`);
4. an unanswered entry (`plan-unresolved`).

Why this order:
- **An unanswered entry last.** Each of the first three is mended by running `plan` again, as its remediation says, and a fresh plan takes back every answer given before. An answer given first would be lost.
- **Another repository first.** Nothing in such a plan is this source's own: it is mended by `plan` under the source's own name, or from the source it is about. And `execute` must ask the naming policy nothing about the plan's names, and no remote anything, before it refuses it (#499). `_against_its_source` is a generator, so `execute` asks nothing after the first problem, and that still holds.
- **A refused name before a moved source.** The name is mended by `plan` given another `--project`, or after the source is renamed on GitHub. That run reads the source as it is now, so it mends the moved source too. `plan` run again as it was, for the moved source, would leave the name to mend.
- **The least change to each command.** The order keeps `execute`'s order for the plan's names (#499, #716) and `check`'s order of a moved source before its entries. Only the pairs that disagreed change.

## Before and after

Measured on #1125's head `9549006f` and on this head, with a stub `gh` (exit 97), `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR`, `GIT_SSH_COMMAND=false`, a proxy that goes nowhere, an empty global git config and `--local-remote-dir`. No run made a leg. `check` exits 1 and `execute` exits 2 in every row.

| The plan holds | `check` before | `execute` before | both, here |
|---|---|---|---|
| a moved source and an unanswered entry (#1113) | `plan-stale` | `plan-unresolved` | `plan-stale` |
| another repository and an unanswered entry (#1113) | `plan-unresolved` | `plan-not-the-source` | `plan-not-the-source` |
| another repository and a moved source (#1113) | `plan-stale` | `plan-not-the-source` | `plan-not-the-source` |
| a refused name and an unanswered entry (#1113) | `plan-unresolved` | `naming-unclassified` | `naming-unclassified` |
| a refused name and a moved source (not in #1113's table) | `plan-stale` | `naming-unclassified` | `naming-unclassified` |
| all four | `plan-stale` | `plan-not-the-source` | `plan-not-the-source` |
| another repository and a refused name | `plan-not-the-source` | `plan-not-the-source` | `plan-not-the-source` (unchanged) |

The fifth row is not in #1113's table, but the two commands disagreed there too, and the same rule decides it.

The same probe, comparing each command's output before and after, with paths and hashes masked:
- A plan with one of the four problems: both commands print the same stderr and stdout before and after.
- Both commands' stdout is the same before and after in every row.
- `check`'s stderr in each pair row holds the same lines as before, reordered: the same findings and the same remediation lines.
- `execute`'s stderr changes in one row only, a moved source beside an unanswered entry: `REFUSED plan-stale`, in its own words, where it said `REFUSED plan-unresolved`.

No refusal's code or wording changes, and no code is added. Re-run on this head after the fix round, the probe gives the same: the 24 plans (these 11, and the 13 of the next section) each get one first problem from both commands, no run makes a leg, and the comparison with #1125's head is the one above, line for line.

## #1113's suspected case: a `--work-dir` that cannot be written

Measured on #1125's head and on this head, the two commands agree in every row, and nothing here changes it:
- **A bad `id:` or `org:` beside a `--work-dir` this user cannot write in** (`chmod 500`): `plan-bad-id` or `unsafe-value` to both. #1125's review round 1 (RV1125's SHOULD-1) made both commands ask the two before `_work_root`, which settled this case.
- **Each of the 11 plans above beside the same `--work-dir`:** `adopt-work-dir-unwritable` first to both.

## What changed, in `adopt-project.py`

- **`_against_its_source` and `_Unmended` (new).** `_against_its_source` is the rule. It asks:
  - `_refuse_a_plan_for_another_repository`;
  - `_check_names`, given the source only where the plan names no other repository, as `check` gave it (#716);
  - `_refuse_an_unrunnable_plan`.

  It yields each problem as an `_Unmended`: the `Refusal` `execute` refuses it with, and `check`'s FINDING lines and remediation for it, in `check`'s words as they were. `check` lists an unanswered entry with the entries, each by its path (`_leg_findings`), after the rule's problems.
- **`cmd_execute`.** It refuses the first problem, `next(_against_its_source(...))`. Before, it called `_refuse_a_plan_for_another_repository`, `_check_names` and `_refuse_an_unrunnable_plan` in turn.
- **`cmd_check`.** It lists the rule's findings right after the Triad advisory, where it listed a moved source. Another repository and the names are no longer listed after the entries. Three things are still asked where they were, and only where no name was refused:
  - the names' classification lines on stdout;
  - the findings about what the disk or GitHub will not hold (#863);
  - the leg question (#798).

  The remediation lines it prints after its findings follow the findings' order, so the rule's come first.
- **`_refuse_an_unrunnable_plan`.** It asks a moved source before an unanswered entry. Its docstring says why.
- **`_refuse_a_plan_for_another_repository`.** Unchanged. The rule calls it.

## Tests

`tests/test_adopt_plan_against_its_source.py` (new, ASCII only), 11 rows. Each runs `check` and then `execute --yes` on one hand-edited plan, both with the same `--local-remote-dir`, and asserts that no leg is made.
- **7 pair rows** (the six pairs and all four). Each asserts:
  - `check` exits 1 and `execute` exits 2;
  - both name first the same code, the rule's first;
  - `check` lists every problem the plan holds, in the rule's order.
- **4 controls**, one per code: the plan holds that problem alone, and both commands name it.
- **Against #1125's head `9549006f`:**
  - the 6 pair rows that disagreed fail, each because the two commands named different codes, for example `('plan-stale', 'plan-unresolved') != ('plan-stale', 'plan-stale')`;
  - the `another-and-name` guard row and the 4 controls pass.
- **Here:** 11 passed.

`tests/test_adopt_relative_submodule_url.py`, 6 rows changed and 1 new (the fix round):
- **The 6 rows** are `test_check_keeps_a_relative_url_its_github_leg_resolves_alike` for `[https]`, `[scp]`, `[scp-other-case]`, `[ssh-port]` and `[ssh-github-443]`, and `test_a_credential_in_the_source_remote_is_never_printed`.
  - Each hand-edits the plan's `org:` to `otherorg`, so the plan names `otherorg/Thing` and the source is `testorg/Thing`: a plan for another repository.
  - Each expected `check` to list the relative url first and `plan-not-the-source` after it, `check`'s old order. They now expect `plan-not-the-source` first. Their other assertions are unchanged; the credential is still printed nowhere.
- **The new row,** `test_check_names_another_repository_first_as_execute_refuses_it`, runs one such plan. It asserts that `check`, with and without `--local-remote-dir`, lists `plan-not-the-source` and then the url, that `execute` refuses `plan-not-the-source`, and that no leg is made.
- **Measured on #1125's head** for the six source remotes: `execute` already refused each such plan `plan-not-the-source`, and its output is the same on both heads. Only `check`'s order changed. No spelling of the source's `origin` reads as another repository: with `org:` left as the source's, `check` passes on both heads, as the rows assert.

Both files together, 46 rows:
- **Against #1125's head:** 13 failed, 33 passed. The 13 are the 6 pair rows above and the 7 relative-url rows, each on the order: `plan-not-the-source` where the url was expected first, or the url first in the new row.
- **Here:** 46 passed.

## Mutants

Each was applied to `adopt-project.py`, run against both files (46 rows), and restored, with its sha256 checked (`4c8c1c9e`, the same after each one). Unmutated, the 46 pass. M1-M6 are the first round's; M7 and M8 are the fix round's.

| Mutant | Killed by |
|---|---|
| M1, `execute`: `_refuse_an_unrunnable_plan` asks an unanswered entry before a moved source (pair 1) | 2: `moved-and-unanswered`, `all-four` |
| M2, `check`: lists another repository after the entries (pair 2) | 11: `another-and-unanswered`, `another-and-moved`, `another-and-name`, `all-four`, and the 7 relative-url rows |
| M3, `check`: lists a moved source before another repository (pair 3) | 3: `another-and-moved`, `name-and-moved`, `all-four` |
| M4, `check`: lists a refused name after the entries (pair 4) | 3: `name-and-unanswered`, `name-and-moved`, `all-four` |
| M5, `check`: lists a moved source before a refused name (pair 5) | 2: `name-and-moved`, `all-four` |
| M6, the rule: asks a refused name before another repository (both commands) | 2: `another-and-name`, `all-four` |
| M7, `execute`: asks `_refuse_what_check_finds` before the rule | 8: the pair rows but `another-and-name`, the `plan-stale` control, and the new relative-url row |
| M8, `check`: lists all the rule's problems after the entries | 14: the pair rows but `another-and-name`, the `plan-stale` control, and the 7 relative-url rows |

## Gate

Run on the scratch merge `743ebe176`: `origin/main` `961640c68` plus this head `90eca4144` (tree `d71d6f00a`, never pushed). It ran in the landing gate's own environment (a stub `gh`, `GH_TOKEN=bogus`, an empty global git config, `EMAIL` set, the `LANES_*` and `GIT_SSH_COMMAND` variables unset), one shard at a time, each started with at least 19G free. The ids were collected from that tree, 4405 + 448 = 4853, and each is in exactly one shard. The file list is the 46 test files W1113's gate named and four more, added in the fix round (50 in all): `test_adopt_c_locale_bytes.py` and `test_adopt_submodule_url_answers.py` (they import helpers and the module-scoped `adopter` fixture from the changed test file, so they sit in its shard, r03), `test_reader_refusals_named.py` (it hand-edits a plan's `org:` and checks `check`'s exact findings) and `test_github_name_limits.py`. Every shard exited 0.

| Shard | Result |
|---|---|
| r01 | 600 passed |
| r02 | 613 passed |
| r03 | 464 passed, 1 skipped (`test_adopt_plan.py::test_plan_on_medxehr_matches_the_rulings`) |
| r04 | 547 passed |
| r05 | 599 passed, 19 skipped (all in `test_family_init_values.py`) |
| r06 | 542 passed |
| r07 | 489 passed |
| r08 | 531 passed |
| d01 to d07 | 56 passed each (`test_shape_doctor.py`) |
| d08 | 53 passed, 3 skipped (`test_shape_doctor.py`) |

- **r01 to r08:** 4385 passed, 20 skipped (4405 ids).
- **d01 to d08:** 445 passed, 3 skipped (448 ids).
- **Total:** 4830 passed, 23 skipped, none failed, none errored.

Main has moved since this gate: `origin/main` is `ac5f28d2a` (#1188, #1130 and #1098 landed). They change `scaffold-project.py`, `scripts/family.py` and four test files. None of them is a file this PR changes, a module `adopt-project.py` imports, or one of the 50 gated test files, so the gate was not run again on that tip. The merge-trees below were.

## Merge-trees

`git merge-tree --write-tree`, run again on 2026-10-23 at 15:31Z against the current `origin/main`, every one clean:
- **`origin/main` `ac5f28d2a`:** clean, tree `1a65ab9bd`.
- **#1125 `9549006fe`:** clean. This branch is on it.
- **#1177 `5208e874e`** (`fix/1152-plan-and-remote-paths-spelled`, which edits a line of `_refuse_a_plan_for_another_repository`): clean, with this head and three-way on the scratch merge.
- **Every open PR that touches `adopt-project.py` or either test file, 25 of them, #1125 and #1177 among them:** clean, both with this head and three-way on the scratch merge of `ac5f28d2a` and this head, `98afb128a` (`git merge-tree --write-tree <that merge> <its head>`). Since the first run, #1207 is new, and #1119, #1189 and #1190 have moved; all four are clean. No open PR touches either test file. The list is in a code block, so that it does not mention each PR:

```
PR     head       with this head              on the scratch merge
#1105  b28f40d  clean (tree 32fce74c6)   clean (tree 490f555f9)
#1106  504a1dd  clean (tree 3abfa1b6a)   clean (tree db57682e9)
#1118  2307036  clean (tree 79a3888bf)   clean (tree 629f167ca)
#1119  195d993  clean (tree a2926127e)   clean (tree 6aec4c863)
#1120  c55e55e  clean (tree 6171a52f8)   clean (tree 0cb310664)
#1121  1c51737  clean (tree 3acb80467)   clean (tree 2771fbfd0)
#1122  c01c4d7  clean (tree af9a4c414)   clean (tree ef00f52f7)
#1123  5c3908f  clean (tree eb7cb34b3)   clean (tree 4c311748b)
#1125  9549006  clean (tree 239df6d)   clean (tree 1a65ab9bd)
#1141  7a2711d  clean (tree e1c8f7169)   clean (tree 3afeda790)
#1143  7af5fab  clean (tree 35cd165de)   clean (tree aae00cfc7)
#1153  ff33ba1  clean (tree 57da668e8)   clean (tree f91ce3d8d)
#1154  8a78283  clean (tree 28699ba0c)   clean (tree 3e6b1ae98)
#1169  1e958ca  clean (tree e3ef802be)   clean (tree f4566b2c4)
#1170  24ee133  clean (tree 94b9291c8)   clean (tree 848bb0ed0)
#1171  8162b87  clean (tree 65ca8196d)   clean (tree f15571ef3)
#1177  5208e87  clean (tree 08e3d6a62)   clean (tree 111f3c238)
#1178  c4beba1  clean (tree 646f02266)   clean (tree eae3b5996)
#1180  b316f41  clean (tree 25b3d4b6f)   clean (tree 85a559171)
#1186  07486a4  clean (tree d0fe77836)   clean (tree 849f0ef41)
#1189  a131fc2  clean (tree 5b1ab0620)   clean (tree 9851d22b7)
#1190  91a937e  clean (tree aa83fae05)   clean (tree 18101f50b)
#1194  900f77a  clean (tree 9d74efa35)   clean (tree 46317beae)
#1198  d38e4e3  clean (tree 87ca21b8c)   clean (tree 7fc45a875)
#1207  1c7ca5c  clean (tree 1dbab659d)   clean (tree 1e44c98f0)
```

## Left for a follow-up (outside #1113)

- **An unanswered entry beside an uncovered path still gives two first problems,** filed as #1197. `check` lists `plan-uncovered` first and `execute` refuses `plan-unresolved` first. Measured the same on #1125's head and on this head. `execute` refuses an unanswered entry before `_refuse_what_check_finds`, while `check` lists it in `_leg_findings`, after the paths and the coverage. Other entry findings ahead of it in `_entry_findings` are likely the same (`plan-unsafe-path` among them), and so is the taken split branch, but those were not measured.

Closes #1113

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 10, 2026
…`--work-dir` that is a file or a shared one, or beside a gone source, is the value's refusal in both `check` and `execute`, so the head ask is pinned against `_work_root`'s other refusals and the source (#1179) (#1226)

Test only: six rows in `tests/test_adopt_plan_value_order.py` that kill four surviving mutants (L1, L2, L4 and L11) of #1125's head ask. No change to `adopt-project.py` (its sha256 is `412edbda` on #1125's head and on this one).

**It was stacked on #1125,** which landed as `f5bb4b4`. RS1226 then restacked it onto `main` with three merges (#1125's final head, its squash, then `main`), which carry exactly the reviewed change (#1226 issuecomment-6752188531).


## What the rows pin

RV1125b's NIT-A on #1125 (for #1020): `check` and `execute` ask `plan.names()` and `_checked_org_and_id(plan)` right after the plan's keys and before `_work_root`. One row pinned that position against the work directory, and it used a directory made unwritable with `chmod`. `_work_root` refuses two more things before it makes anything, and both commands refuse a gone source, and no row put a bad `id:` or `org:` beside any of them.

Three tests, each run for `id` and for `org`, so six rows. Each is `check` and then `execute --yes` on one plan, in the shape of `test_the_org_or_the_id_is_named_before_an_unwritable_work_dir`:

| Test | The control: the plan unedited, beside the same file, directory or path | With a bad `id:` or `org:` added |
|---|---|---|
| `test_the_org_or_the_id_is_named_before_a_work_dir_that_is_a_file` | a `--work-dir` that is a file: both commands exit 2 on `REFUSED adopt-work-dir-unwritable` | both exit 2 on the value's refusal, the same first line in each, and none of the three work-directory or source codes on either stderr |
| `test_the_org_or_the_id_is_named_before_a_shared_work_dir` (`WINDOWS_SKIP`) | a `--work-dir` every user can write in, no sticky bit: `adopt-work-dir-shared` | the same |
| `test_the_org_or_the_id_is_named_before_a_source_that_is_gone` | a `source.local_path` that names nothing: `plan-source-gone` | the same |

The shared row is in because RV1125b's NIT-A names "a `--work-dir` that is a file or a shared one", and #1179 asked for it unless the lane ruled otherwise.

## Mutants

Each mutant was made from #1179's text in the writer's own clone, run against the 85 old rows (the two order files of #1125, `tests/test_adopt_plan_value_order.py` and `tests/test_adopt_check_plan_name.py`) and against the six new ones, and `adopt-project.py` was restored after each with its sha256 checked (`412edbda`, the same after each one).

| Mutant | The 85 old rows | The six new rows |
|---|---|---|
| L1: `check` asks `plan.names()` and `_checked_org_and_id` after `_work_root` | 85 passed (survives) | 4 failed: the file and shared rows, for `id` and for `org` |
| L2: `check` asks them after the source is opened | 85 passed (survives) | 6 failed: all of them |
| L4: `execute` asks them after `_work_root` | 85 passed (survives) | 4 failed: the file and shared rows |
| L11: `check` asks `plan.names()` at its head and `_checked_org_and_id` after `_work_root` | 85 passed (survives) | 4 failed: the file and shared rows |

The `plan-source-gone` rows fail only on L2, as #1179's table says. On the head the six pass alone (6 passed, 40 deselected in 8.49s), the two order files together give 91 passed, and `tests/test_adopt_plan_value_order.py` alone is 46 rows, the 40 it had and the six.

## Gates

One pytest run over 39 files each time: every file that greps for the codes and functions #1125 touches, the files this test file imports from, `tests/test_repo_hygiene.py`, `tests/test_cli_reference.py` and `tests/test_agents_md_codes.py`. The environment is the landing gate's own: a stub `gh` first on PATH, `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR` and an empty gitconfig, `GIT_CONFIG_NOSYSTEM=1` and `EMAIL` set, and a wait for at least 17G free before each run.

| Tree | Result |
|---|---|
| The head, `f61be9f59` | 3130 passed, 1 skipped in 41:00, exit 0 |
| The scratch merge `1c1e6653c` of `961640c68` (`origin/main` when it was gated) and the head, not pushed | 3180 passed, 4 skipped in 40:15, exit 0 |

- The one skip on the head is `tests/test_adopt_plan.py:567`, which needs `SHAPE_MEDXEHR_CLONE`, a read-only clone of MedxSoft/MedxEHR.
- The 3 extra skips on the merge are main's new reftable rows in `tests/test_adopt_root_symlinks.py`, at lines 1926, 1981 and 2532. They need git 2.45 or later, and the bench has git 2.43.0.
- The 50 extra passes are main's new rows.

`origin/main` has moved since: it is now `50ce8ab15`, and #1119 (`b7edd8816`) changed `adopt-project.py` in `check`. Since `961640c68` main has changed `adopt-project.py` and `tests/test_adopt_pins.py`, two of the five files #1125 changes, and it has not changed this PR's file. The 39-file gate was not run again on it. The two order files, the 91 rows, were run on a scratch merge of `50ce8ab15` and the head (`b0e2e0461`, not pushed): 91 passed in 172.19s, exit 0.

## Merge-trees (all clean, exit 0)

| Against | Tree |
|---|---|
| `origin/main` (`50ce8ab15`) and this head | `bede214aa0d551c1c0c2ce81ff4ce1452983d45c` |
| #1125's head `9549006fe` and this head | `8c604453d4766e3eed40e34874f4a6acaaf0039d` |
| #1198's head `d38e4e36d` and this head | `a1504e06d18f07f1f3c02d081ee6067159459180` |
| `origin/main` and #1125's head (context) | `ad61940f1a55897592a519dee59b5f31f53c7a9a` |
| #1198's head and #1125's head (context) | `88530bb7b3d29bfb11c5bb8e1f28e0ab194261ae` |

Of the 45 open PRs, only #1125 and #1198 touch `tests/test_adopt_plan_value_order.py`.

See #1020, #1113 and #1125.

Closes #1179

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 10, 2026
…cter a terminal acts on in the command, its directory and what it printed, as `_first_said` spells gh's, so `--local-remote-dir` no longer reaches the terminal raw there; a NOTE before `NEXT:` says when the source's path in its clone command holds a character a terminal does not show as itself; and rows pin six sites #1177's 148 left to chance (#1195) (#1225)

This PR was stacked on #1177, which landed as `8bcdb2c`. RS1225 then restacked it onto `main` with three merges (#1177's final head, its squash, then `main`), which carry exactly the reviewed change (#1225 issuecomment-6752574422).

## What

#1195 follows RV1177's review of #1177 (for #1152). It names two raw routes, N3 and N4, and six mutants, K1, K2, K4, K5, K6 and K7, that all 148 rows of #1177's `tests/test_adopt_plan_and_remote_paths_spelled.py` let through.

Three files change: `adopt-project.py`, that test file, and `tests/test_adopt_github_exits.py`.

### N3: a refused command no longer names `--local-remote-dir` raw

`CommandFailed.loudly` belongs to `scripts/shape_materialize.py`, and every tool shares it. It printed the command, its `(in <cwd>)` line and its output as they were. So when a `pre-receive` hook refused a leg push under `--local-remote-dir <D>/re<U+202E>mote`, the raw U+202E was printed three times: in the command, and in git's own `To` and `error:` lines.

The change is in `adopt-project.py` only. `shape_materialize.py` is unchanged.
- `_unacted(text, kept="")` writes each character that `str.isprintable` refuses, other than those in `kept`, as `_spelled_character` spells it, with no backticks. That is what `_first_said` does to the line gh said.
- `_loudly(exc, step)` builds the same REFUSED block from the command's arguments, its directory and its output, each passed through `_unacted`.
  - The output keeps its line breaks (`kept="\n"`), so it still reads one line per line.
  - This settles the point the issue left open: `loudly` prints the whole output, while `_first_said` keeps one line.
- The leg push (`_push_the_leg`), `_failed_loudly` and `main`'s catch-all now print a refused command through `_loudly`, not `exc.loudly`.
- A printable character prints as it is, so a command with plain paths prints the same block as before.

I measured it with a real `execute --allow-empty-leg spec` and a global `pre-receive` hook that refuses every push:
- **U+202E.** On `5208e874e`, U+202E in `--local-remote-dir` reaches stderr raw 3 times. On this head it reaches stderr 0 times. The command, the `(in ...)` line and git's `To` line each name it as `\u202e`, six ASCII characters.
- **ESC.** ESC behaves the same way. git itself writes ESC as `?` in its `error:` line.
- **Byte 0xff.** It was already printed as `\udcff` before this change, because stderr is `backslashreplace`. git's own lines hold U+FFFD for it, the character `run` decodes that byte to.

### N4: a NOTE says when `NEXT:`'s clone command holds a character a terminal does not show

#1195 asks for a ruling: refuse such a source, as the README's clone line does, or add a note under `NEXT:`. The code settles it in favour of the note:
- **Such a source is writable.** `_refuse_an_unwritable_clone_url` asks `unwritable_reason`. Since #255, that lets through a `Cf` character other than the nine bidi controls. Its docstring in `scripts/shape_materialize.py` says such a character "is invisible, not unwritable", and that a Persian name joins its parts with U+200C.
- **The tests pin it.** `tests/test_adopt_template_values.py` lists `Ali<U+200C>Reza`, `a<U+200E>b`, `a<U+200F>b` and `a<U+061C>b` as `WRITABLE`. Refusing the source would reverse #255.
- **Spelling breaks pasting.** Spelling the command instead would break `_branch_deletion`'s rule that a printed command pastes as it is. `sh` reads a quoted path, not a spelled one.

I measured the old behaviour on `5208e874e`, with a full `execute --local-remote-dir` of a source under `<D>/so<c>urce/Thing`. U+200B, U+200F, U+200C and U+00A0 each pass, and the `split` line spells them. `NEXT:` prints each one raw, once, inside `shlex.quote`'s single quotes.

On this head, the clone command is unchanged. When the url is not `str.isprintable`, this line prints just before the `NEXT:` block:

```
NOTE the path in the clone command below holds a character a terminal does not show as itself, so it can read as another path: it is `<D>/so\u200burce/Thing`, as the `split` line names it.
```

A url whose every character is printable gets no NOTE. A source name that ends in a space shows between the quotes, so it gets none either.

**Where the NOTE goes differs from the issue's wording; please weigh it.**
- The issue says a note *under* `NEXT:`.
- #1121 and #1207 each add lines right after the `print` of the `NEXT:` block. With the NOTE printed under the block, this branch conflicted with #1121 (`git merge-tree` exit 1).
- Printed just before the block, the NOTE merges cleanly with both. It is also read before the command a person would paste.
- Mutant M14 (the NOTE after the block) fails 2 rows, so the placement is pinned.
- Moving it under the block means moving one `print` and flipping the row's order check. It would then need a rebase over whichever of #1121 and #1207 lands first.

### The new rows

The new file goes from 148 to 188 rows, 40 of them new. `tests/test_adopt_github_exits.py` keeps its 23 rows, with one assertion tightened.
- **K1, K2.** `test_a_printable_plan_is_named_as_typed_unless_900_spells_it` runs `check` on the uncovered plan, in the plan's own directory, four ways. `run_adopt` now takes `cwd=` and `over=`.

  | `--plan` given | Named as |
  |---|---|
  | absolute, ending in a space | `` `<D>/plan.yaml ` `` |
  | `` `plan.yaml` ``, relative, between backticks | `` `\x60plan.yaml\x60` `` |
  | `plan.yaml`, relative | `plan.yaml` |
  | `./plan.yaml` | `plan.yaml` |

- **K4, K5.** Two new `ROWS` entries. Each runs under `check` and `execute`, with the plan at each of the five path forms.
  - `plan-wrong-kind-a-placement-plan` expects `kind is 'placement-plan', expected 'adoption-plan'`.
  - `org-too-long`, with an `org:` of 40 `o`, expects `` `org:` is oooooooooooo...oooooooooooo, 40 characters ``.
  - The issue read both expected lines from the code. Both rows pass on `5208e874e`, which confirms them.
- **K6.** `printable-U+00E9` is added to the remote-dir test. `re<U+00E9>mote` prints as typed, with no backticks.
- **K7.** In `tests/test_adopt_github_exits.py`, the GitHub-mode `split` line must now match in full: `  split <12 hex> on adopt/three-repo-shape -> https://github.com/testorg/Northwind.git`.
- **N4.** `SPLIT_SOURCES` gains `right-to-left-mark` (U+200F). Every split row checks either that the NOTE comes before `NEXT:`, or that there is no NOTE.
- **N3.** Three tests:
  - `test_a_refused_command_names_the_remote_and_work_dirs_spelled` is the probe above as a test. The character goes in both `--local-remote-dir` and `--work-dir`, for U+202E, ESC, byte 0xff and a plain control. The line feed is left out, because git's own output names the path and the output's line breaks are kept.
  - `test_a_late_refused_command_is_said_spelled` checks `_failed_loudly`, in process, for all five `CHARACTERS`.
  - `test_a_refused_command_no_step_said_is_said_spelled` checks `main`'s own block, in process, with `cmd_check` replaced, for all five.

## Proof

### Before and after

| Code | The new file (188 rows) and `tests/test_adopt_github_exits.py` (23 rows) |
|---|---|
| #1177's head `5208e874e` | 12 failed, 199 passed |
| This head `73c9f57e8` | 211 passed |

- **What fails on `5208e874e`.** The 12 failures are all N3 and N4 rows:
  - 2 split rows (U+200B and U+200F);
  - 2 refused-push rows (U+202E and ESC);
  - 4 `_failed_loudly` rows;
  - 4 `main` rows.
- **The K rows** pass on `5208e874e`, because its code is right there. Each one fails on its mutant (below).
- **Two N3 controls** pass on both heads: byte 0xff, because stderr already wrote `\udcff`, and the plain control.

### Mutants

All 20 were killed. Each was applied to `adopt-project.py` on this head and restored with `git checkout`. After every restore, the file's sha256 was `163c692aff5b076410bde27740439070f2b9a4c62b4a7dc9510199cb0a7f890a`.
- For K1 to K6, the whole new file was run (188 rows). For K7, `tests/test_adopt_github_exits.py` was run too (211 rows).
- Under every K mutant, only new rows failed, so the old 148 stayed green.
- M1 to M14 ran the N3 or N4 rows.

| Mutant | What it does | Rows failed |
|---|---|---|
| K1 | `check`'s last count line names `--plan` by `isprintable()` alone | 2 of 188 |
| K2 | that line names `plan.path.absolute()` | 3 of 188 |
| K4 | the PLACEMENT plan's `plan-wrong-kind` names the plan raw | 8 of 188 |
| K5 | `adopt-org-too-long` names the plan raw | 8 of 188 |
| K6 | the extracted leg line spells every url outside ASCII | 1 of 188 |
| K7 | the `split` line names the source's own path | 2 of 211 |
| M1 | `_loudly` leaves the arguments raw | 10 of 14 |
| M2 | `_loudly` leaves the working directory raw | 10 of 14 |
| M3 | `_loudly` leaves the output raw | 8 of 14 |
| M4 | the output's line breaks are spelled too | 14 of 14 |
| M5 | the arguments are wrapped in backticks | 14 of 14 |
| M6 | the leg push goes back to `exc.loudly` | 2 of 14 |
| M7 | `_failed_loudly` goes back to `exc.loudly` | 4 of 14 |
| M8 | `main` goes back to `exc.loudly` | 4 of 14 |
| M9 | `_unacted` keeps every whitespace character | 2 of 14 |
| M10 | no NOTE | 2 of 4 |
| M11 | a NOTE wherever the `split` line spells the path | 1 of 4 |
| M12 | the NOTE names the path raw | 2 of 4 |
| M13 | the clone command is spelled, not quoted | 4 of 4 |
| M14 | the NOTE prints after the block, not before it | 2 of 4 |

### Gate

The gate ran on the scratch merge `37c65a609` of `origin/main` `961640c68` and this head `73c9f57e8`, in the landing gate's environment:

| Shards | Tests | Result |
|---|---|---|
| g0 to g5: the 52 files listed below | 3,250 | 3,246 passed, 4 skipped |
| d0 to d7: `tests/test_shape_doctor.py` | 448 | 445 passed, 3 skipped |

- The shard lists hold each collected id exactly once. Every shard exited 0.
- **The 7 skips are environment skips.** Three `tests/test_adopt_root_symlinks.py` rows need git 2.45 for the reftable backend. One `tests/test_stdout_encoding.py` row and the three doctor rows run only on Windows.
- **g1 ran twice.** A host reboot killed its first run part way. It was re-run whole: 542 passed.

<details><summary>The 52 files in g0 to g5</summary>

`tests/test_adopt_attributes_eol_block.py`, `tests/test_adopt_c_locale_bytes.py`, `tests/test_adopt_clone_template.py`, `tests/test_adopt_contracts_dir.py`, `tests/test_adopt_e2e.py`, `tests/test_adopt_entry_paths.py`, `tests/test_adopt_execute_refusals.py`, `tests/test_adopt_filter_repo_failure.py`, `tests/test_adopt_git_reads.py`, `tests/test_adopt_git_rm_bytes.py`, `tests/test_adopt_github_exits.py`, `tests/test_adopt_late_failure.py`, `tests/test_adopt_leg_keys.py`, `tests/test_adopt_mount_ignored.py`, `tests/test_adopt_pins.py`, `tests/test_adopt_plan_and_remote_paths_spelled.py`, `tests/test_adopt_plan_escapes.py`, `tests/test_adopt_reencoded_files.py`, `tests/test_adopt_relative_submodule_url.py`, `tests/test_adopt_root_manifest.py`, `tests/test_adopt_root_shape_paths.py`, `tests/test_adopt_root_symlinks.py`, `tests/test_adopt_spec_only.py`, `tests/test_adopt_spelled_names.py`, `tests/test_adopt_split_branch.py`, `tests/test_adopt_submodule_url_answers.py`, `tests/test_adopt_submodules.py`, `tests/test_adopt_temp_work_roots.py`, `tests/test_adopt_template_values.py`, `tests/test_adopt_tracking_branch.py`, `tests/test_adopt_unsearchable_source.py`, `tests/test_adopt_values_as_typed.py`, `tests/test_adopt_verify.py`, `tests/test_doctor_next_is_a_command.py`, `tests/test_dry_run_asks_remotes.py`, `tests/test_family_add_refusals.py`, `tests/test_git_output_decoding.py`, `tests/test_github_limits_init_check_org.py`, `tests/test_github_name_limits.py`, `tests/test_non_utf8_name_callers.py`, `tests/test_path_guard_hygiene.py`, `tests/test_refusal_default_remediation.py`, `tests/test_repo_hygiene.py`, `tests/test_ruleset_hint_tracking_branch.py`, `tests/test_scaffold_leg_path_collisions.py`, `tests/test_scaffold_manifest_values.py`, `tests/test_scaffold_reuse_seeded_legs.py`, `tests/test_stdout_encoding.py`, `tests/test_template_values_single_pass.py`, `tests/test_update_shape.py`, `tests/test_update_shape_add.py`, `tests/test_update_shape_merged_away.py`

</details>

**`main` has moved since the gate's base, and it touched `adopt-project.py`.**
- `origin/main` is now `50ce8ab15`. Of the 15 commits since `961640c68`, one touches `adopt-project.py`: `b7edd8816` (#1119, for #1083), with 279 lines added and 78 removed. None touches either test file.
- `git merge-tree` of this head with `50ce8ab15` is clean. In the merged `adopt-project.py`:
  - the file parses;
  - `_unacted` and `_loudly` are each defined once;
  - `.loudly(` is called only inside `_loudly`, so #1119 adds no new `exc.loudly(` call.
- The gate above did not run on `50ce8ab15`. The landing gate re-tests this head on its own merge.

### Merge-trees (2026-10-23T20:14Z)

`git merge-tree --write-tree <X> 73c9f57` exits 0 (clean) for every `<X>` below:
- `origin/main` at `50ce8ab15`;
- #1177's head, `5208e874e`;
- each of the 24 open PRs that touch `adopt-project.py`: #1210, #1207, #1198, #1194, #1190, #1189, #1186, #1180, #1178, #1171, #1170, #1169, #1154, #1153, #1143, #1141, #1125, #1123, #1122, #1121, #1120, #1118, #1106 and #1105.

No other open PR touches either test file. #1121, which adds lines after `NEXT:`, has not landed, and it merges cleanly.

Each of the 24 was also merged against a scratch merge of `origin/main` and this head:
- 21 merge cleanly.
- #1169, #1180 and #1190 conflict in `tests/test_adopt_check_throwaway_repos.py`, and #1169 also conflicts in `adopt-project.py`.
- Those three conflict with `origin/main` alone, in the same hunks byte for byte: 6 in `adopt-project.py` for #1169, and 13, 8 and 8 in the test file. So this head adds no conflict.

## Not in this PR

These are outside #1195, which covers `adopt-project.py`'s `--local-remote-dir`:
- `scaffold-project.py`, `update-shape.py`, `scripts/family.py` and `scripts/bump-leg.py` still print `CommandFailed.loudly` as it is.
- `_init_refused` prints `git init`'s argument list raw, and those arguments hold the `--work-dir` path.
- The `adopt-remote-unreadable` and `source-unclonable` refusals print git's or gh's output raw.
- `_unacted` and the NOTE test `str.isprintable`, as `_first_said` does. So the default-ignorable characters that #1171 (#1128) adds to `_shown` get no NOTE, and are not spelled in a REFUSED block. They belong with `_first_said` under #1165.

Closes #1195

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 10, 2026
… repository over 100, so `plan --source <50 b's>/Thing` never asks `gh` for a name GitHub cannot hold, no remedy offers `--org <50 b's>`, and `check` and `execute` never clone such a record again (#1129) (#1194)

Lane 4's W1129 for #1129, RV1122's NIT-1 on #1122 (#1122 issuecomment-6319493639). RV1194 reviewed it READY at `900f77af` (#1194 issuecomment-6365280794).

**It was stacked on #1122,** which landed as `ebb8716`. RS1194 then restacked it onto `main` with three merges (#1122's final head, its squash, then `main`), which carry exactly the reviewed change (#1194 issuecomment-6751617746). "Why stacked" below says why it was stacked.

**A fix round followed #1268.** Since #1268, `Source.clone` hands `gh repo clone` `-- --quiet --origin origin`. So FX1194 merged `main` (`106f92ff`) and changed only the rows' helper `cloned_by_gh` to expect that line (+4 -2, #1194 issuecomment-6769522297). RVD1194b reviewed the round READY at `ddc21fb5`: the reviewed change's lines are byte-equal, and the 14 rows fail before the fix and pass after it (#1194 issuecomment-6772772773).

## What

`adopt-project.py`, `_github_name`: an owner of more than `GITHUB_OWNER_MAX` (39) characters, or a repository of more than `GITHUB_NAME_MAX` (100), counted once the trailing `.git` is dropped, names no `owner/repo`. The file already imports both limits from `shape_materialize`.

```python
    if len(owner) > GITHUB_OWNER_MAX or len(repo) > GITHUB_NAME_MAX:
        return None
```

Every reader of `_github_name` now gives the same answer for such a spelling:

| Reader | Used by | Before | Now |
|---|---|---|---|
| `_source_spec` | `plan`, `check` and `execute` `--source` | taken as GitHub's name: `gh repo clone` asked, or `source-ambiguous` beside a directory of that spelling | a path: read in place where it is one, `source-unresolvable` ("neither a path that exists nor an `org/repo` name") where it is not |
| `_repository_in_url` | a url `--source`, `github.com/...` too | `gh repo clone` asked | `source-unresolvable`, "names no `owner/repo` on github.com", before any `stat` |
| `_recorded_repository` | `check` and `execute`, a plan's clone gone (`cloned: true`) | "is cloned again from GitHub", `gh repo clone` asked | `source-unresolvable`, "the plan's `source.repository`, ..., names no `owner/repo` on github.com" |
| `_held_repository` | `check` and `execute`, a source with no `origin` | held to the record: `plan-not-the-source`, remedy `--org <40 c's>` | holds the plan to nothing, as a record that names no `owner/repo` does |
| `_source_there` | beside a directory this user cannot search | #1122: no url | unchanged: no url (the name is None now) |

`_refuse_another_repository`'s remedy (`adopt-not-the-source`) is reached only after `_source_spec`, so it never offers `--org <a name GitHub cannot hold>` for an `org/repo` `--source` now.

**#1122's guard in `_source_there` is redundant, and is folded in.** `_source_there` is called only by `_source_spec` and `_repository_in_url`, and both take `name` from `_github_name`. So a name past the limits now arrives as None, and the `name is None` branch gives the same refusal #1122's guard gave. The guard is gone, `if name is None:` is back, and the docstring says the limits are asked in `_github_name`. The merge with `main` and with #1122 is clean (see "Merges").

**Why stacked.** The textual merge with #1122 is clean, but the two do not hold together as they stand. A `github.com/` spelling past the limits is now refused by `_repository_in_url` before any `stat`, so four of #1122's rows, which expected `source-unreadable` from `_source_there`, fail on the combination:
- `[bare-github-url]`;
- `[www-github-url]`;
- `[bare-github-url-owner-one-over-EIO]`;
- `[bare-github-url-owner-one-over-EACCES]`.

This PR moves those three params out of #1122's `_source_there` tests, with a comment pointing to the new file. There they assert the new answer (`source-unresolvable`, no url), with the control at the limit kept: two readings and the url.

No refusal code is new or changed, and no help text or `docs/cli.md` sentence changes: `--source`'s help already says `source-unresolvable` refuses "one that is neither a path that exists nor an `org/repo`".

## Behaviour that changes besides the refusal

- **A directory here spelled `<40 c's>/Thing`** (or `testorg/<101 r's>`) is read in place, and the plan is written, recording that directory and no repository. Before, it was `source-ambiguous`, which named a GitHub repository that cannot exist. At the limit, it is still `source-ambiguous`.
- **A plan whose source has no `origin`, and whose `source.repository` records `<40 c's>/Thing`,** is held to nothing. `check` says `plan ok`, and `execute` goes on. Before, it was held to that record, and the remedy said `--org <40 c's>`, which `execute` then refuses as `adopt-org-too-long`. A record at the limit still holds the plan.
- **`github.com/<300 a's>/Thing` beside a `./github.com`** is `source-unresolvable`, "names no `owner/repo` on github.com". #1122 made it `source-unreadable`, "whether a repository is there cannot be told". Both offer no url.

## Before and after

Probed with a `gh` first on PATH that logs each call and refuses it (exit 4), and with:
- `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR`;
- `GIT_SSH_COMMAND=false`, `GIT_CONFIG_GLOBAL` an empty file, `GIT_CONFIG_NOSYSTEM=1`;
- uid 1000, Python 3.12.3, run in an empty directory.

Each row is `plan --source <it> --project <repo> --org <owner>`, except where `--org` is said. `main` `961640c6` gave the same answers as #1122's head on every row.

| `--source` | #1122 head `c01c4d73` | this head |
|---|---|---|
| `<50 b's>/Thing`, `--org <50 b's>` (the issue's) | `gh repo clone <50 b's>/Thing` (1 call), `source-unclonable` | `source-unresolvable`, 0 calls |
| `<50 b's>/Thing`, `--org testorg` (the issue's) | `adopt-not-the-source`, remedy `--project Thing --org <50 b's>`, 0 calls | `source-unresolvable`, no `--org` offered, 0 calls |
| `<40 c's>/Thing` | 1 call | `source-unresolvable`, 0 calls |
| `testorg/<101 r's>`, and with `.git` | 1 call each | `source-unresolvable`, 0 calls |
| `<40 c's>/<101 r's>` | 1 call | `source-unresolvable`, 0 calls |
| `https://github.com/<40 c's>/Thing`, `github.com/<40 c's>/Thing` | 1 call each | `source-unresolvable` ("names no `owner/repo` on github.com"), 0 calls |
| `<39 c's>/Thing`, `testorg/<100 r's>`, `testorg/<100 r's>.git` (controls) | 1 call each (`.git` dropped) | the same |
| `<39 c's>/Thing`, `--org testorg` (control) | `adopt-not-the-source`, remedy `--org <39 c's>` | the same |

## Tests

The landing gate's environment throughout:
- `/usr/bin/python3 -m pytest -p no:cacheprovider`, Python 3.12.3;
- a stub `gh` first on PATH, `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR`;
- `GIT_CONFIG_GLOBAL` set to an empty file, `GIT_CONFIG_NOSYSTEM=1`;
- the test author and committer variables, and `EMAIL`;
- `GIT_SSH_COMMAND`, `GIT_ALLOW_PROTOCOL` and the `LANES_*` variables unset.

**New file `tests/test_adopt_source_github_limits.py`, 48 rows,** ASCII only. It skips on Windows: the logging `gh` is a `/bin/sh` script, and the moved rows need a POSIX `File name too long`. Each child puts the logging `gh` ahead of the suite's guard, and every `execute` gets `--local-remote-dir`.

| Test | Rows | What it asserts | #1122 head | main | this head |
|---|---|---|---|---|---|
| `test_plan_asks_gh_for_a_name_github_can_hold` (control) | 6 | owner 39, repository 100, 100 + `.git`, both at, a url and a bare url: `gh` logged exactly `repo clone <name> <work>/source-readonly/<repo> -- --quiet --origin origin`, once | 6 pass | 6 pass | 6 pass |
| `test_plan_never_asks_gh_for_a_name_github_cannot_hold` | 9 | owner 40 and 50, repository 101 and 101 + `.git`, both over, and four url spellings: the `gh` log empty, exit 2, the `source-unresolvable` line, no plan, no work directory | 9 fail at the `gh` log (`cloning ...`) | 9 fail, the same | 9 pass |
| `test_a_github_url_past_the_limits_is_refused_before_any_stat` (moved from #1122) | 4 | `[www.]github.com/<300 a's>/Thing` with a real `File name too long`; `github.com/<40 a's>/Thing` with `stat` refused (EIO, EACCES): `source-unresolvable`, no url; control at 39, both readings and the url | 4 fail at the code (`source-unreadable`, "cannot be told") | 4 fail, the same | 4 pass |
| `test_no_remedy_offers_an_org_github_cannot_hold` | 3 | `--org testorg` with owner 40, 50, both over: no `--org <owner>`, no `adopt-not-the-source`; control at 39 offers `--org <39 c's>` | 3 fail at `--org <owner>` offered | 3 fail, the same | 3 pass |
| `test_a_directory_github_cannot_name_is_read_in_place` | 2 | `./<40 c's>/Thing`, `./testorg/<101 r's>` repositories here: exit 0, recorded in place, no repository, 0 `gh` calls; control at the limit is `source-ambiguous` | 2 fail at the exit (`source-ambiguous`) | 2 fail, the same | 2 pass |
| `test_a_recorded_name_github_can_hold_is_cloned_again` (control) | 4 | `check`, `execute`: the NOTE and 1 `gh` call | 4 pass | 4 pass | 4 pass |
| `test_a_recorded_name_github_cannot_hold_is_never_cloned_again` | 6 | `check`, `execute`; owner 40, repository 101, both: the `gh` log empty, the `source-unresolvable` line, no "cloned again" | 6 fail at the `gh` log (the NOTE, "cloned again") | 6 fail, the same | 6 pass |
| `test_check_and_execute_read_a_source_name_as_plan_reads_it` | 10 | `check`, `execute` with `--source`: 4 controls at the limits (1 `gh` call), 6 past them (0 calls, `source-unresolvable`) | 6 fail at the `gh` log; 4 pass | the same | 10 pass |
| `test_a_record_github_cannot_hold_offers_no_org` | 4 | `check`, `execute` (no `--yes`); a source with no `origin`, record owner 40 and 50: no `--org <owner>`, no `plan-not-the-source`; `plan ok` / `adopt-unconfirmed`; control at 39 keeps `plan-not-the-source` and `--org <39 c's>` | 4 fail at `--org <owner>` offered | 4 fail, the same | 4 pass |

Totals for the 48 rows:
- **#1122's head:** 34 failed, 14 passed;
- **main:** 34 failed, 14 passed;
- **this head:** 48 passed.

Every row that is not a control fails on both bases, at the assertion that names the defect, not at a setup step. The 14 controls pass on all three.

**#1122's file** `tests/test_adopt_unsearchable_source.py`: 40 rows at this head, from 44. Three params moved out: the two url rows, and the url row's EIO and EACCES variants. Before the move, those four rows failed at this head (`source-unresolvable` against `source-unreadable`), and the other 40 passed.

## Mutants

Each was applied to this head's `adopt-project.py` (sha256 `d494ba0e...`) by exact substitution of the new guard line, and run against this file, `test_adopt_unsearchable_source.py` and `test_adopt_unenterable_source_and_locale.py` (101 tests). After each one the file was restored from its saved bytes and its sha256 checked. Unmutated, all 101 pass. All 8 were killed.

| Mutant | Killed by |
|---|---|
| M1: owner limit one lower (`> GITHUB_OWNER_MAX - 1`) | 24: the owner-39 controls (plan, `--source`, the recorded clone, the remedy, the directory, the held record, the moved rows' controls), and #1122's 5 owner controls at 39 |
| M2: owner limit one higher (`+ 1`) | 15: every owner-40 row (plan, url, `--source`, the recorded clone, the remedy, the directory, the held record, the 2 moved EIO/EACCES rows), and #1122's 2 `owner-one-over` rows |
| M3: repository limit one lower (`- 1`) | 15: the repository-100 controls, and #1122's 5 repository controls at 100 |
| M4: repository limit one higher (`+ 1`) | 11: every repository-101 row, and #1122's 2 `repository-one-over` rows |
| M5: owner limit removed | 25 |
| M6: repository limit removed | 15 |
| M7: both limits removed (no guard anywhere, since #1122's is folded in) | 46: every refused row here, and 12 of #1122's |
| M8: the repository counted with its `.git` (`len(segments[1])`) | 1: `test_plan_asks_gh_for_a_name_github_can_hold[repository-100-dot-git]` |

## Gate

Run on the scratch merge `w1129-gate` at `ca06ad25a`: a merge of `main` `961640c6` and this head `900f77af`. Its tree, `90fbea0e`, is the one `git merge-tree --write-tree origin/main HEAD` gives, and `main` has not moved since. The environment is the one under "Tests"; targeted files only, never the full suite. Every run ended with rc=0.

**Test files, 23:**

| File | Passed | Skipped |
|---|---|---|
| `test_adopt_source_github_limits` (new) | 48 | 0 |
| `test_adopt_unsearchable_source` | 40 | 0 |
| `test_adopt_unenterable_source_and_locale` | 13 | 0 |
| `test_adopt_check_plan_name` | 45 | 0 |
| `test_adopt_source_clone_record` | 100 | 0 |
| `test_adopt_template_values` | 78 | 0 |
| `test_adopt_work_dir_refusal` | 53 | 0 |
| `test_windows_paths` | 46 | 0 |
| `test_adopt_clone_claimed` | 42 | 0 |
| `test_adopt_late_failure` | 88 | 0 |
| `test_adopt_plan_flag_refusals_first` | 89 | 0 |
| `test_adopt_temp_work_roots` | 9 | 0 |
| `test_adopt_origin_repository` | 30 | 0 |
| `test_adopt_plan` | 66 | 1 |
| `test_adopt_project_is_the_source` | 23 | 0 |
| `test_adopt_relative_submodule_url` | 34 | 0 |
| `test_adopt_split_branch` | 47 | 0 |
| `test_adopt_values_as_typed` | 40 | 0 |
| `test_adopt_plan_escapes` | 59 | 0 |
| `test_path_guard_hygiene` | 49 | 0 |
| `test_repo_hygiene` | 101 | 0 |
| `test_scaffold_leg_path_collisions` | 104 | 0 |
| `test_github_name_limits` | 64 | 0 |
| **Total** | **1268** | **1** |

**`tests/test_shape_doctor.py`, all 448 collected ids, in 8 shards of 56** (the shard lists together hold every collected id exactly once; every `adopt-project.py` change is gated with it):

| Shard | Ids | Passed | Skipped |
|---|---|---|---|
| d01 | 56 | 56 | 0 |
| d02 | 56 | 56 | 0 |
| d03 | 56 | 55 | 1 |
| d04 | 56 | 55 | 1 |
| d05 | 56 | 55 | 1 |
| d06 | 56 | 56 | 0 |
| d07 | 56 | 56 | 0 |
| d08 | 56 | 56 | 0 |
| **Total** | **448** | **445** | **3** |

**Totals: 1713 passed, 4 skipped, 0 failed, 0 errors.** The skips are the host's: three `test_shape_doctor.py` rows that print the PowerShell line and need `powershell.exe` on a Windows host, and one `test_adopt_plan.py` row that needs `SHAPE_MEDXEHR_CLONE`, a read-only clone of MedxSoft/MedxEHR.

The gate paused after d02 for disk space and ran d03 to d08 later, on the same scratch merge, whose head did not change.

## Merges

`git merge-tree --write-tree`, this head `900f77af` against each of these; all are clean (rc=0, no conflict):

| Against | Head | Tree |
|---|---|---|
| `main` | `961640c6` | `90fbea0e` |
| #1122, the base | `c01c4d73` | `e2cea9b3` (this head's own tree) |
| #1186 | `07486a49` | `78702414` |
| #1180 | `6cd96b8b` | `eff9e4db` |
| #1178 | `c4beba19` | `b79abc31` |
| #1177 | `5208e874` | `91156ae6` |
| #1171 | `8162b874` | `87e2ce31` |
| #1170 | `24ee133a` | `f001382d` |
| #1169 | `25805102` | `b58ed451` |
| #1154 | `8a782833` | `2e67c977` |
| #1153 | `ff33ba12` | `070c39b2` |
| #1143 | `7af5fabc` | `7237b405` |
| #1141 | `7a2711d0` | `c0bcaf88` |
| #1125 | `9549006f` | `c16ff99a` |
| #1123 | `5c3908f8` | `aba16ad4` |
| #1121 | `1c517375` | `6e1f5cb9` |
| #1120 | `c55e55e3` | `845f0ab5` |
| #1119 | `bba168bd` | `ab6af7c8` |
| #1118 | `2307036a` | `1d53a9d9` |
| #1106 | `504a1dd6` | `60cd4c67` |
| #1105 | `b28f40de` | `b5f065ec` |
| #1189 | `8684af86` | `352b9e86` |
| #1190 | `00f959c6` | `6335ed44` |

These are the open PRs that touch `adopt-project.py`, and #1122 also touches `tests/test_adopt_unsearchable_source.py`. #1189 and #1190 opened, and #1169 and #1171 moved, after the first run of these; the four were merged again at the heads shown, just before the push, and the other heads were read again and had not moved. The merge with #1122 is clean as text, and see "Why stacked" for what it does not settle.

## Out of scope

- **The origin url has its own reader.** A local source whose `origin` is `https://github.com/<40 c's>/Thing` is read by `url_repository` in `scripts/repo_shape.py`, a pinned script that shares the reading with `shape-doctor.py`, and not by `_github_name`. It still records that name, and `--org testorg` would be told `--org <40 c's>`. I read this in the code and did not measure it.
- **Owner characters.** `_github_name` takes owner characters GitHub gives no owner: `.`, a trailing `-`, and `--`. `_` is let by on purpose, for GitHub Enterprise Managed Users (#863's `GITHUB_OWNER_CHARACTERS`). The brief limited this change to the two lengths.
- **The refusal's wording.** `source-unresolvable` for a spelling past the limits says "neither a path that exists nor an `org/repo` name", which is true now, but does not say which limit it broke.

Closes #1129

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 10, 2026
…able character, which a terminal draws as nothing, is spelled by its code point in `plan`'s lines and in the `unsafe-value` refusal, so a branch `ma<U+034F>in` no longer prints as `main` (#1128) (#1171)

**It was stacked on #1120,** which landed as `6740776`. RS1171 then restacked it onto `main`: it merged #1120's final head, then its squash, then `main` as `main` moved, and the result carries exactly the reviewed change (#1171 issuecomment-6752897940).

## What was wrong

`_shown` printed a name as it is wherever `str.isprintable()` passed it, and `_spelled_character` wrote such a character as it is. `str.isprintable()` passes 267 of Unicode's Default_Ignorable_Code_Point characters, which a terminal draws as nothing: 263 combining marks, among them U+034F and the variation selectors, and the four Hangul fillers, among them U+3164. Git takes each in a branch or a path, so a source on `ma<U+034F>in` printed in `plan`'s `source` line (#1120's) as `(main)`. `checked_value`'s `unsafe-value` refusal names the value with `repr`, which printed U+3164 raw on stderr the same way. RV1120 found both (#1120 issuecomment-6319321596).

## What changed

- `scripts/repo_shape.py`:
  - `DEFAULT_IGNORABLE_RANGES`: the property's 27 lines of `DerivedCoreProperties.txt`, joined into 17 ranges, 4174 code points. The table is the same in Unicode 14.0.0, 16.0.0 and 17.0.0, and is written into the code with a citation, not asked of `unicodedata`. CI runs Python 3.14 and the bench 3.12, and their `unicodedata` differ.
  - `DEFAULT_IGNORABLE`, one character of the table as a pattern.
  - `code_point_escaped`, taken out of `_escaped`, which writes exactly what it wrote before.
  - `visible_repr`: `repr` with each default-ignorable character written as its code-point escape.
  - `checked_value`'s `unsafe-value` refusal names the value with `visible_repr`: `'ma\u3164in'`, where it said `'ma<U+3164>in'`.
- `adopt-project.py`:
  - `_shown` spells a name that holds a default-ignorable character, whatever `str.isprintable()` says of it: `` `ma\u034fin` ``.
  - `_spelled_character` writes one as its code-point escape, which the plan's reader reads back as the character.
  - `_shown`'s signature, and its output for every other character, are unchanged, so #1120's and #1154's rows still pass.

`scripts/repo_shape.py` is a shape copy that every root digest-pins, so this change shows every project an `upstream-changed` row, as every change to it does. The new names are used inside the file itself: `checked_value` calls `visible_repr`. No pinned copy calls `checked_value` (`validate-family.py` only names it in a comment); the change is in `scripts/repo_shape.py` because `checked_value` lives there, so its refusal cannot change without the `upstream-changed` row. No pinned script imports a new name, so the skew rule in `test_pinned_copy_text.py` holds, and its list of names a kept `repo_shape.py` may lack, `NEWER_THAN_A_KEPT_LIBRARY`, now holds the four, so it refuses a pinned script that imports one. No sentence in README.md, AGENTS.md or the handbook describes these helpers.

## Tests

`tests/test_adopt_shown_default_ignorables.py` (new, 48 rows, ASCII only; every character outside ASCII is written as an escape):

- The table against `DerivedCoreProperties.txt`, listed again line by line in the test, so no row depends on the Python's Unicode data.
- The compiled `DEFAULT_IGNORABLE` against the table, over all 0x110000 code points: not one more, not one fewer (RV1171's N1).
- All 4174 code points through `_shown`, `_spelled_character` and `checked_value`'s refusal.
- A value that holds three, `m` U+034F `a` U+3164 `in` U+FE0F, through `checked_value`'s refusal and `_shown`: each is written as its escape and none is raw (RV1171's S1).
- The issue's characters (U+034F, U+3164, U+FE0F, and the controls U+200B, U+2060 and U+180E, which were spelled already) through `_shown`, through a read back of the plan, and end to end through `plan`. In `plan`, they appear in the `source` line, the tracking-branch NOTE, a path in the table, and the `unsafe-value` refusal on stderr.
- The rows RV1120 asked for on #1120's `source` line (#1128 items 2 and 3):
  - `feat/caf\u00e9` prints as it is;
  - a branch named `` `main` ``, backticks included, is spelled `` `\x60main\x60` ``;
  - the branch that is not UTF-8 is spelled `` `caf\udce9` `` under a `utf-8:surrogateescape` stdout, where main wrote the byte 0xE9 itself.

`tests/test_adopt_spelled_unambiguous.py`: its two sweeps of every character take the default-ignorables apart and hold each to its escape.

`tests/test_pinned_copy_text.py`: `NEWER_THAN_A_KEPT_LIBRARY` holds the four new names, so the skew rule refuses a pinned script that imports one (RV1171's N3).

Counts for the new file:

| Code | Result |
|---|---|
| main `961640c68` | 28 failed, 20 passed |
| #1120 alone `c55e55e3` (the 10 `source`-line and item 2-3 rows) | 3 failed, 7 passed |
| this head | 48 passed |

- On main, every failure is for the right reason:
  - the table is missing;
  - 267 characters come back raw from `_shown`, `_spelled_character` and the refusal, and the three in one value are raw in both;
  - the compiled pattern is missing too;
  - the raw bytes are in the `source` line, the NOTE, the table and stderr;
  - `` (`main`) `` is printed as it is;
  - `caf\xe9` is on stdout.
- The 20 rows that pass on main are the controls: the three format characters, the printable names and `feat/caf\u00e9`.
- On #1120 alone, the 3 failures are U+034F, U+3164 and U+FE0F in the `source` line. **Items 2 and 3's three rows pass on #1120 alone: they pin #1120's code**, which is right in each case. They kill RV1120's mutants E (`_spelled` for every branch outside ASCII) and N (`str.isprintable()` alone, with no backtick rule).

## Sweep

Run with `/usr/bin/python3` 3.12.3 (Unicode 15.0.0), against #1120's head `c55e55e3`, whose helpers are main's:
- Of the 4174 default-ignorable code points, 267 pass `str.isprintable()` (263 Mn, 4 Lo). Raw on the base: 267. Raw on this head: 0.
- Of the 148731 printable code points that are not default-ignorable, none is spelled on this head.
- For every code point that is not default-ignorable, `_shown`, `_spelled_character` and `visible_repr` give the same output as the base's `_shown`, `_spelled_character` and `repr`: 0 differ.

## Mutants

Each ran against the new file, `test_adopt_spelled_unambiguous.py` and #1120's `test_adopt_plan_source_branch_shown.py` (212 rows). Each file was restored afterwards and its sha256 checked.

| Mutant | Result |
|---|---|
| The table empty | killed: the pattern no longer compiles, so every row errors |
| The table's pattern matches nothing | killed, 20 rows fail |
| The range U+115F-U+1160 dropped | killed, 3 rows fail |
| The range U+1D173-U+1D17A dropped | killed, 1 row fails (the table row) |
| The escape removed from `_spelled_character` | killed, 18 rows fail |
| `checked_value` back on `repr` | killed, 4 rows fail |
| The compiled pattern runs one past each range, the table unchanged | killed, 1 row fails (the compiled-pattern row) |
| `visible_repr` escapes only the first match (`count=1`) | killed, 1 row fails (the three-in-one row) |
| A pinned script (`validate-family.py`) imports `visible_repr` | killed, 1 row fails (the skew rule's `validate-family` row); passes on the old list |

## Gate

On a scratch merge commit of `origin/main` `038dafba9`, #1120's `c55e55e3` and this head (`39cb15180`), in the landing gate's environment with a stub `gh`:
- 94 test files, 9806 ids, in 6 shards: every test file that mentions `_shown`, `_spelled` or `unsafe-value`, with `test_tracking_branch_ref.py`, `test_pinned_copy_text.py`, `test_adopt_plan_escapes.py`, `test_stdout_encoding.py`, `test_non_utf8_name_callers.py`, `test_path_guard_hygiene.py`, `test_repo_hygiene.py` and `test_scaffold_leg_path_collisions.py`. 9777 passed, 29 skipped, 0 failed.
- `test_shape_doctor.py`, 448 ids in 8 shards from `mapfile` lists: 445 passed, 3 skipped, 0 failed.
- On a merge of main, #1120, this head and #1154, the rows of #1154, of #1120 and of this PR: 166 passed, 1 skipped.
- Fix round 1 (RV1171's S1, N1 and N3), test-only, so no doctor shards: on a scratch merge `331dc93c7` of `origin/main` `961640c68` and `8162b874e`, `test_adopt_shown_default_ignorables.py`, `test_adopt_spelled_unambiguous.py`, `test_pinned_copy_text.py`, `test_adopt_plan_source_branch_shown.py`, `test_stdout_encoding.py`, `test_path_guard_hygiene.py` and `test_repo_hygiene.py`: 496 passed, 1 skipped, 0 failed.

## Merge-trees

`git merge-tree` of this head with `origin/main` is clean. So is each of the 13 other open PRs that touch `adopt-project.py` or `scripts/repo_shape.py`, against both this head and the scratch merge: #1154, #1153, #1143, #1141, #1126, #1125, #1123, #1122, #1121, #1119, #1118, #1106 and #1105.

Fix round 1: `git merge-tree` of `8162b874e` with `origin/main` and with #1105 (the one other open PR that touches `tests/test_pinned_copy_text.py`) is clean, and so is the scratch merge with #1105.

## Out of scope: filed separately by the lane

The other helpers that test only `str.isprintable()`, or use `repr`, let the same characters through. They are:
- the `repr`-based `_shown` copies in `validate-repository-naming.py`, `validate-manifest.py` and `validate-pins.py`, and `repo_shape.shown_path`;
- `shape_materialize.py`'s `-`-leading `unsafe-value` refusal;
- `repo_shape.double_quoted`, which writes them raw into the plan file;
- `adopt-project.py`'s `_worded`, `_line_shown`, `unwritable_values` and `_refuse_an_unwritable_clone_url`.

They are filed separately by the lane as #1165 (see #1165), and are untouched here.

Closes #1128

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