Skip to content

adopt-project.py: the split commit's message and plan's report name each path, question and rule id one way only and never raw, the history scan's git-failed is one line, and the table pads a name as stdout prints it (#900) - #1030

Merged
brettheap merged 9 commits into
mainfrom
fix/900-spelled-names
Oct 20, 2026

Conversation

@brettheap

@brettheap brettheap commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

adopt-project.py now names every path, question and rule id that it prints or writes one way only, with no raw control byte. This covers the split commit's message, which is also this pull request's body, plan's report, and the git-failed refusal of the history scan (#900, from lane 3's triage of #457: A6, AS-1, AS-2, AS-3, L2-76 and L1-36).

  1. The split commit's message (A6): _split_message lists each moved, dropped and kept path as plan's report shows it (_shown). The issue's source keeps caf<0xE9>.md and cr<CR> in the root, and check and execute still run to adoption verified. Its message, through cat -A, read caf?.md$ and cr$, two names of other paths. It now reads `caf\udce9.md`$ and `cr\r`$.

  2. A backtick and a double quote (AS-1): _spelled_character is the plan's own table (repo_shape.double_quoted) for every character but the backtick. A double quote is \" and a backtick is \x60, the code point the plan's reader resolves. A spelled name, copied between the plan's double quotes, is now that entry. Before, \`` kept its backslash and named another entry, and a bare "` ended the quoting and left the plan unreadable.

  3. A name between backticks (AS-2): _shown spells a printable text that begins and ends with a backtick. The issue's four names, called directly:

    name _spelled before _spelled after _shown before _shown after
    a`b `a\`b` `a\x60b` a`b a`b
    a"b `a"b` `a\"b` a"b a"b
    `x` `\`x\ `` `\x60x\x60` `x` `\x60x\x60`
    x `x` `x` x x

    Before, `x` was shown exactly as x is spelled.

  4. A policy's question and rule id (AS-3): plan prints a path policy's question: and rule id through _shown, as check prints the question. With --path-policy, an ESC in either used to reach the terminal raw.

  5. The history scan's refusal (L2-76): _exported_gitlink's git-failed names the source folder with shown_path and what git printed with spelled, as git_out does. The code is still git-failed. A folder named Thing<LF>WARNING forged-line<ESC>[2J used to split the refusal over two lines and send the ESC raw. It is one printable line now, and after the command it reads exactly as git_out's refusal of the same failure.

  6. plan's table (L1-36): _print_entries pads a name as stdout prints it (_printed). Under LC_ALL=C PYTHONUTF8=0, a source holding caf<U+00E9>.md printed caf\xe9.md padded as 7 characters, so its leg column stood 3 columns right of leg. It is aligned now.

Beyond the issue's Direction, found while doing it. Each has rows of its own:

  • _shown also spells a name that ends in a space. git commit strips the space from the end of a message line, so trail.md was listed as trail.md, and plan's table padded trail.md and trail.md to the same row.
  • The split message, and since review round 1 plan's report too, writes each follow-up _shown, as execute already prints it. check and execute already refuse a control character there (plan-unwritable-value). What this changes is a hand-edited follow-up that ends in a space, which git commit stripped, or begins and ends with a backtick, or holds a zero-width character: each is listed as execute prints it.
  • The two questions plan writes that name the rule they replace (_asked_about, _refused_as_named) name it _spelled. For an ordinary rule id the text is byte for byte what it was.
  • _refused_by_policy no longer says the split commit's message lists a byte that is not UTF-8 with a ?. It said so before this change, and it is no longer true.

Rows changed, each because it pinned the old spelling:

  • test_adopt_spelled_unambiguous.py: test_a_backslash_and_a_backtick_are_escaped (renamed from ..._as_before) expects `a\\b\x60c`. test_python_repr_and_a_spelled_name_agree_on_every_character passes over " as well as the backtick. Two rows no longer skip the backslash, the double quote and the backtick, because adopt-project.py: a kept or dropped name reaches the split commit and the pull request body unspelled, and _spelled, _shown and plan's report print text that reads as another name, or raw #900 makes them hold:
    • test_a_character_is_spelled_as_the_plan_writes_it now skips only the backtick.
    • test_a_spelled_name_is_the_entry_the_plan_holds skips nothing. Both fail against c7a3ff16's code.
  • test_adopt_question_and_submodule_spelling.py: the backtick question row, and two [a-backtick] key rows, expect \x60.
    • say "hi" leaves UNCHANGED_NAMES, because _git_quoted keeps git's quotes only where _spelled writes nothing different. It is now the row [a-double-quote]: `submodule.say \"hi\".update`.
  • test_adopt_gitmodules_values.py: one row, `\x60x\x60`. test_adopt_submodules.py: one row, `src/ven\x60d\\or`.
  • test_adopt_entry_paths.py: NOT_UTF8_FINDING carries _refused_by_policy's corrected sentence.
  • conftest.py: spelled(), the tests' copy of the spelling, now writes \" and \x60 too.

Review round 1 (18cc6593, after lane 1's reviewer r1030's partial review, issuecomment-6281392155):

  • The read-across follow-up (cross_leg_references) names a code-leg file _shown, as the split message's listing and plan's table do. A file whose name holds a double quote, a backtick or a backslash was named two ways in one commit message and one report; it is now named one way. The new row test_the_read_across_follow_up_names_a_file_as_the_listing_does fails on 9c210eb2's adopt-project.py, and test_adopt_literal_names.py's two follow-ups now expect the backticked form.
  • plan prints its follow-ups _shown too, so all three places follow one rule.
  • A test docstring no longer says the ESC reached the commit raw on c7a3ff16: check and execute refused it there.
  • The round-1 gate, with LANES_LANE unset: 15 files, 1,225 passed, 4 skipped, 0 failed. That is the new file (27), test_adopt_spelled_unambiguous.py (145), test_adopt_literal_names.py (14), test_adopt_contracts_dir.py (34), test_adopt_printed_sentences.py (54), the doctor (445, 3 skipped) and nine more.

Tests, under a stub gh with a bogus token, GIT_CONFIG_GLOBAL=/dev/null, GIT_SSH_COMMAND=false and EMAIL set, one reused basetemp, on the branch at 9bf7f4cd (the final head 9c210eb2 changes only those two rows, which give 171 passed with the new file):

  • New file: tests/test_adopt_spelled_names.py gives 26 passed. Against c7a3ff16's adopt-project.py, all 26 fail, each at the assert it is about.
  • Every tests/test_adopt*.py file, 4248 node ids in 142 chunks of 30: 4245 passed, 3 skipped, 0 failed.
  • The doctor, in four shards: 445 passed, 3 skipped, 0 failed.
  • test_scaffold_leg_path_collisions.py and test_repo_hygiene.py: 104 and 100 passed.
  • 125 more files: every test file that names _spelled, _shown, spelled or split_message, and every other one that runs adopt-project.py, test_stdout_encoding.py and test_readme_windows_quoting_sentence.py among them: 9028 passed, 40 skipped and 1 failed, in 13 chunks of 10.
    • The failure is test_doctor_gitlink_repairs.py::test_a_hand_committed_gitlink_names_both_bump_leg_commands, and it comes from the shell, not this branch. The lane exported LANES_LANE, which the test's in-process bump_leg_command reads, while run_script blanks it for the doctor it runs.
    • With LANES_LANE unset, as in CI, it passes.
  • The merge with main: git merge-tree --write-tree of 9c210eb2 with main e076e3e8 is clean, giving tree b1402905. Main changed adopt-project.py, tests/conftest.py and tests/test_adopt_entry_paths.py, as this branch does.
    • So the adopt gate ran on that tree, in a scratch copy: the 18 adopt files this branch or main changed, or that use conftest.spelled, test_stdout_encoding.py, the scaffold collisions and the doctor in four shards.
    • Result: 1921 passed, 4 skipped, 0 failed.

Follow-up: the env_commit docstring in scripts/shape_materialize.py still says the split message names a byte that is not UTF-8 with a ?. That file is a pinned shape copy, so it is left as it is here; lane 1 files it as a follow-up.

Closes #900

Lane: openreposhape-1 (openRepoShape-1)

🤖 Generated with Claude Code

Summary by Sourcery

Make adopt-project.py use one safe, unambiguous representation for every printed or persisted path-related name and keep its reports and tables consistent with stdout output.

Bug Fixes:

  • Ensure paths, questions, rule IDs, follow-ups, and git failure details are consistently escaped and remain unambiguous and printable across plans, reports, commit messages, and refusals.
  • Preserve special and non-UTF-8 names in split commit messages without raw controls, lossy replacement, or whitespace truncation.
  • Correct plan table alignment for names whose displayed representation differs from their source text.

Enhancements:

  • Align path, question, rule ID, and cross-leg follow-up naming across plan output and adoption messages.
  • Use plan-compatible escaping for backticks and double quotes so copied names resolve to the original entries.

Tests:

  • Add comprehensive coverage for printable and escaped name representations, split-message preservation, policy output, git failures, and locale-dependent table alignment.
  • Update existing spelling and path-handling expectations for the unified escaping rules.

Brett Heap and others added 6 commits October 19, 2026 14:22
…ames, split message, plan report, gitlink refusal, padded table

Items 1-6 of #900's Direction in adopt-project.py, and the conftest
`spelled` mirror. The new test file and the updated rows follow.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…and for git keeping every line of the split message

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…te spelling, and the `?` sentence

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…CII, writing U+00E9 as an escape

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… each path, question and rule id one way only and never raw: a backtick is `\x60` and a double quote `\"`, a name between backticks or ending in a space is spelled, the history scan's `git-failed` is one line, and the table pads a name as stdout prints it (#900)

The six lines of lane 3's triage of #457 that #900 groups (A6, AS-1, AS-2,
AS-3, L2-76, L1-36), each asked by tests/test_adopt_spelled_names.py, and
four found while doing them. This commit drops the two skips that #900
makes unneeded: every spelled character, a backtick and a double quote
included, copied between the plan's double quotes, is that entry.

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

sourcery-ai Bot commented Oct 20, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR makes all paths, questions, rule IDs, and related generated text use one safe, plan-compatible spelling, then applies that spelling consistently across reports, commit messages, refusals, and terminal output while preserving table alignment and adding comprehensive regression coverage.

Sequence diagram for safe split commit message generation

sequenceDiagram
    participant Verify
    participant SplitMessage as _split_message
    participant Shown as _shown
    participant Commit as git commit

    Verify->>SplitMessage: build message from paths and follow_ups
    SplitMessage->>Shown: format each path and follow-up
    Shown-->>SplitMessage: printable text or _spelled text
    SplitMessage-->>Commit: safe path listings
    Commit-->>Verify: commit message preserves unambiguous names
Loading

Sequence diagram for aligned plan table output

sequenceDiagram
    participant Plan
    participant PrintEntries as _print_entries
    participant Shown as _shown
    participant Printed as _printed
    participant Stdout

    Plan->>PrintEntries: render entries
    PrintEntries->>Shown: format path and rule id
    Shown-->>PrintEntries: safe display text
    PrintEntries->>Printed: measure text for stdout encoding
    Printed-->>PrintEntries: encoded display width
    PrintEntries->>Stdout: print padded path, leg, confidence, files, rule
Loading

Sequence diagram for safe history scan refusal

sequenceDiagram
    participant HistoryScan as _exported_gitlink
    participant Git
    participant ShownPath as shown_path
    participant Spelled as spelled_as_git_out
    participant Refusal

    HistoryScan->>Git: scan exported history
    Git-->>HistoryScan: failure output and return code
    HistoryScan->>ShownPath: format source folder
    ShownPath-->>HistoryScan: safe folder text
    HistoryScan->>Spelled: format git output
    Spelled-->>HistoryScan: printable single-line text
    HistoryScan->>Refusal: raise git-failed with safe names
Loading

Flow diagram for safe path spelling and output

flowchart LR
    Input[Path question or rule id] --> Shown[_shown]
    Shown --> Spelled[_spelled]
    Spelled --> Plan[Plan report or split commit message]
    Shown --> Printed[_printed]
    Printed --> Table[Aligned terminal table]
    Spelled --> GitOut[git-failed refusal]
    GitOut --> Safe[One printable line with no raw controls]
Loading

File-Level Changes

Change Details Files
Centralize safe, round-trippable spelling for paths, questions, rule IDs, and follow-up text.
  • Reuse the plan's double-quoted escape table for printable and control characters.
  • Encode backticks as \x60 and double quotes as \" so copied spellings resolve to the original value.
  • Expand _shown to protect names ending in spaces or enclosed by backticks.
  • Use the same display spelling in plan reports, policy messages, split commit messages, and history-scan refusals.
adopt-project.py
tests/conftest.py
tests/test_adopt_spelled_unambiguous.py
tests/test_adopt_question_and_submodule_spelling.py
tests/test_adopt_gitmodules_values.py
tests/test_adopt_submodules.py
tests/test_adopt_entry_paths.py
Make generated output safe for terminals, commit storage, and fixed-width tables.
  • Spell both source paths and Git output in git-failed as a single printable line.
  • Escape follow-up text before placing it in the split commit message.
  • Pad table paths after applying stdout encoding, keeping columns aligned under ASCII-compatible output.
  • Correct the policy refusal text to describe the new split-message behavior.
adopt-project.py
Add focused regression coverage for spelling uniqueness and every affected output surface.
  • Add direct tests for backticks, double quotes, trailing spaces, control bytes, and YAML round trips.
  • Cover split messages, Git commit preservation, policy questions and rule IDs, git-failed refusals, and table alignment.
  • Update existing expected spellings and test helpers to match the shared escape rules.
tests/test_adopt_spelled_names.py
tests/test_adopt_spelled_unambiguous.py
tests/test_adopt_question_and_submodule_spelling.py
tests/test_adopt_gitmodules_values.py
tests/test_adopt_submodules.py
tests/test_adopt_entry_paths.py
tests/conftest.py

Assessment against linked issues

Issue Objective Addressed Explanation
#900 Spell every path listed in the split commit message consistently with plan/check, so the commit message and pull request body preserve names without raw control bytes or lossy substitutions. ✅
#900 Make _spelled and _shown unambiguous and compatible with the plan’s quoting rules, including backticks, double quotes, and printable names that could otherwise collide with a spelling. ✅
#900 Escape path-policy questions and rule IDs in plan output, safely format _exported_gitlink’s git-failed refusal, and pad table paths according to how stdout actually prints them. ✅

Possibly linked issues


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-20T01:43:42Z)

r1030 partial review of PR #1030 (#900) at 9c210eb2. Stopped at the usage checkpoint.

No verdict yet. The two MUSTs below will make it NOT READY unless they are fixed. Several checks are still to run (see "Resume steps").

State at the stop:

  • The worktree /workspace/projects/openRepoShape-worktrees/r1030-spelled-names is at 9c210eb2 and git status --short is clean. Every mutant was restored.
  • None of my processes is running.

Findings so far

MUST-1: the split message and plan's report name a code-leg file two ways, and the PR adds this for "

  • Where: adopt-project.py:3257, in cross_leg_references: shown = "".join(map(_spelled_character, hit)).

  • What goes wrong: the read-across follow-up names the file in the plan's escape form, with no backticks. The listing in the split message and plan's table name the same file _shown.

  • Evidence:

    • Source: tools/mksource2.py builds code files q"uote.py, t`ick.py and b\ack.py, each holding docs/. plan, check and execute then run to exit 0 with --local-remote-dir.

    • The split message at head (probe/e2/message.txt):

      10:  q"uote.py
      23:  - q\"uote.py in the code leg names `docs/`, which moves to the spec leg: it
      
    • plan's report at head, table row and follow-up:

      q"uote.py                          code       medium ...
        - q\"uote.py in the code leg names `docs/` ...
      
    • The same source at c7a3ff16's adopt-project.py (probe/b2/plan.out):

        - b\\ack.py in the code leg names `doc
        - q"uote.py in the code leg names `doc
        - t\`ick.py in the code leg names `doc
      

      At head:

        - b\\ack.py ...
        - q\"uote.py ...
        - t\x60ick.py ...
      
  • Exact fix:

    • adopt-project.py:3257: shown = _shown(hit).
    • Keep named at :3225 as it is. It sits between backticks, so it is already _spelled without its wrap.
    • Docstring :3211-3213: "each hit is named as plan's table and the split message's listing name it (_shown, adopt-project.py: a kept or dropped name reaches the split commit and the pull request body unspelled, and _spelled, _shown and plan's report print text that reads as another name, or raw #900), and the spec directory as a sentence names a path, between backticks: one line of UTF-8 whatever its bytes".
    • tests/test_adopt_literal_names.py:290-291: expect follow_up("`src/caf\\udce9.py`", "notes/") and follow_up("`src/line\\nbreak.py`", "notes/").
    • Add a row to tests/test_adopt_spelled_names.py: the mksource2 source, asserting each follow-up begins with _shown(name) + " in the code leg names ".
    • A candidate with only the :3257 change is applied, uncommitted, in my scratch clone /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1030/head-9c21. It is NOT yet tested (resume step 4).
  • Alternative: if lane 1 rules the hit spelling out of adopt-project.py: a kept or dropped name reaches the split commit and the pull request body unspelled, and _spelled, _shown and plan's report print text that reads as another name, or raw #900's scope, at least revert the " change for hits (write " raw there), and narrow the title and the body's first sentence to "each path the split message lists". The backtick and backslash case then goes to a follow-up issue.

MUST-2: a false sentence in the PR body (extra 2), and in a test docstring

  • The claims:

    • The body says: "The split message writes each follow-up _shown ..., so an ESC that a hand edit puts in follow_ups: no longer reaches the commit raw."
    • tests/test_adopt_spelled_names.py:252 says: "On c7a3ff1 the ESC went into the commit raw."
  • Why both are false: at c7a3ff16, check and execute already refuse such an item as plan-unwritable-value, before any leg exists. The _plan_values follow-up row and the _value_findings call are both present at base, at :13909 and :8584.

  • Evidence: base adopt-project.py in place, a plan whose follow_ups: gained "merge a\x1b[2J into b" (probe/b2/exec.out). execute exits 2:

    REFUSED plan-unwritable-value: 1 finding(s) in .../probe/b2/plan.yaml, as `check` prints them:
      FINDING plan-unwritable-value: a `follow_ups:` item is 'merge a\x1b[2J into b', which `execute` writes into the split commit's message, and it holds a control character
    

    The same happens at head (probe/e3/exec1.out, exit 2).

  • What the extra really changes end to end: a follow-up that a hand edit leaves ending in a space, between backticks, or holding a zero-width character. Measured at head (probe/e3, exit 0, adoption verified), the commit lists:

      - `ends in a space `
      - `\x60wrapped\x60`
      - `zw\u200bj`
    
  • Exact fix:

    • Body: replace the sentence with "check and execute already refuse a control character there (plan-unwritable-value); what this changes is a hand-edited follow-up that ends in a space, which git commit stripped, or begins and ends with a backtick, or holds a zero-width character: each is listed as execute prints it."
    • Docstring :250-252: "On c7a3ff1 _split_message wrote the ESC raw; check and execute refuse such an item (plan-unwritable-value), so this row asks the message itself."
    • Optionally add an end-to-end row for a follow-up ending in a space.

NIT-1 (pre-existing, not claimed by the PR): the table pads by code points, not display width

  • Where: adopt-project.py:5726.
  • Evidence: on a UTF-8 stdout (probe/e1/plan.out), measured with east_asian_width and combining:
    • 名前.md displays 37 columns where leg begins at 35, so its leg stands 2 columns right.
    • e\u0301.md displays 34, so its leg stands 1 column left.
    • Every escaped name lines up.
  • The PR's sentence still holds: "Under LC_ALL=C ... aligned now" is true.
  • Fix (follow-up issue): pad by display width, counting W/F as 2 and combining marks as 0.

NIT-2: plan's report prints the follow-ups raw

  • Where: adopt-project.py:5343-5344, print(f" - {item}").
  • Why it is a NIT: execute and now the split message print them _shown. No follow-up plan writes today begins and ends with a backtick or ends in a space, so the output is the same.
  • Fix: print(f" - {_shown(item)}"), for one rule.

NIT-3 (outside #900's path, question and rule id): plan's source line prints the default branch raw

  • Where: adopt-project.py:5326, ({source.branch}).

  • Evidence: a source on branch ma<U+202E>in, planned with --tracking-branch main (probe/br/plan2.out):

    source     .../probe/br/Thing @ e1874364018e (maM-bM-^@M-.in), 2 files, 1 commits$
    

    The RLO reaches the terminal raw.

  • Fix (follow-up issue): {_shown(source.branch)}.

Verified so far (no finding)

  1. One spelling, never raw (end to end). I adopted 23 entries named with:

    • a backtick, a double quote and a backslash, and all three at once;
    • a leading space and a trailing space;
    • a TAB, an LF and a CR;
    • é, a bidi control (U+202E), U+0085, U+2028 and ESC;
    • a byte that is not UTF-8;
    • a wide name and a combining name;
    • `wrapped`, `w`.md and `a\x60b.md`.

    check and execute both exit 0. For every entry, plan's table row and the split message's line are the same _shown text, and each spelled form read back through parse_yaml is the entry. No raw Cc, Cs, Cf, Zl, Zp or bidi character is in the report, the message or execute's stdout. Problems: 0 (tools/e2e.py, probe/e1).

  2. Fuzz. 200,000 random names from 39 awkward characters (137,064 distinct): 0 read-backs wrong, 0 backticks inside a spelling, 0 _shown collisions, and every raw _shown is printable, ends in no space and is not wrapped in backticks (tools/fuzz.py).

  3. Rule ids and questions through --path-policy. Rule ids tested:

    • `asked`, q"uote, back\slash, trail ;
    • a TAB, U+202E, a wide name, an LF;
    • `r`1"<ESC>.

    The table's rule column is _shown(rule). Each question prints the same in plan and in check's plan-unresolved. A question naming its rule (_refused_as_named) spells it `\x60r\x601\"\x1b`, the same as the table. No output byte is non-printable (tools/policy.py, probe/pol2). Verdict folds whitespace in a question before printing (prior behaviour).

  4. git-failed is one line. I broke the history scan's git six ways, each in a folder named Thing<LF>WARNING forged-line<ESC>[2J<U+0085><U+202E>:

    • a bad gitfile;
    • repositoryformatversion=99;
    • a missing tree object;
    • .git/objects mode 000;
    • a ref zz<U+0085>x to a missing object;
    • a missing commit.

    Every one gives git-failed, exactly 1 line, isprintable() True. Each names its cause: invalid gitfile format: ..., Expected git repo version <= 1, found 99, unable to read tree ..., not a git repository ...\nStopping at ... spelled, bad object zz\x85x, and bad object <sha>. Where git_out also fails, its tail after the command is identical (tools/gitfail.py).

  5. Scope of the four extras: all within adopt-project.py: a kept or dropped name reaches the split commit and the pull request body unspelled, and _spelled, _shown and plan's report print text that reads as another name, or raw #900, none needs its own issue.

    • The trailing space is the A6 defect itself: git commit strips it just as it strips the CR the issue measured.
    • Follow-ups _shown fit A6's goal and agree with execute's print, but see MUST-2 for the false sentence.
    • The rule id in the two questions is AS-3's goal.
    • The _refused_by_policy sentence keeps a printed sentence true.
  6. Style.

    • git diff --check c7a3ff16 9c210eb2 is clean.
    • The added lines hold no non-ASCII character and no TAB, none is over 79 columns, and there is no compound assert a and b.
  7. PR body checks.

    • Items 1-6 and their before/after table match my base and head runs.
    • The rows-changed list and counts match the diff: 3 rows [a-backtick] and the line-feed backtick question, plus [a-double-quote].
    • The writer's merge tree b1402905 matches mine.
    • Main changed adopt-project.py, tests/conftest.py and tests/test_adopt_entry_paths.py since c7a3ff16, as the body says.
  8. CI at the head (gh pr checks, read-only): SonarCloud pass, package pass, tests-git-bash pass, tests pending.

Test counts

All runs at head 9c210eb2, under the stub gh, GH_TOKEN=bogus-r1030, an empty GH_CONFIG_DIR, GIT_CONFIG_GLOBAL=/dev/null, GIT_SSH_COMMAND=false, EMAIL exported, LANES_LANE unset, one basetemp and retention=failed.

Run Result
New file, test_adopt_spelled_unambiguous, test_adopt_entry_paths, test_adopt_gitmodules_values, test_adopt_question_and_submodule_spelling 539 passed
test_adopt_submodules, test_agents_md_codes, test_repo_hygiene, test_readme_windows_quoting_sentence 358 passed
tests/test_shape_doctor.py, 4 shards (118, 110, 117, 103 ids) 445 passed, 3 skipped, 0 failed
The new file and the two tightened rows, with c7a3ff16's adopt-project.py in place 28 failed of 28, then restored

On the base run: 25 of the 28 fail at their assert. Three fail with the plan reader's YamlError: quoted scalar with text after its closing quote, which is the defect itself. These are [double-quote], [quoted-word] and test_a_spelled_name_is_the_entry_the_plan_holds.

Mutants

17 run, each restored with git checkout -- adopt-project.py. 0 survive. The row set is the new file, test_adopt_spelled_unambiguous, test_adopt_question_and_submodule_spelling, and the single rows in entry_paths, gitmodules_values and submodules: 281 tests, all passing unmutated.

Mutant Killed by (failed / 281)
M1 backtick written \` (old) 17
M2 " written raw 8
M3 _shown prints a backtick-wrapped name raw 6
M4 _shown prints a trailing-space name raw (extra 1 reverted) 3
M5 table padded by raw width 2
M6 git-failed keeps git's stderr raw (second line) 1
M7 git-failed names the folder raw 1
M8 split listing raw 8
M9 split follow-ups raw (extra 2 reverted) 1
M10 unresolved question raw 1
M11 defaulted question raw 1
M12 table rule id raw 1
M13 _asked_about rule raw (extra 3 reverted) 1
M14 _refused_as_named rule raw (extra 3 reverted) 1
M15 _refused_by_policy old ? sentence (extra 4 reverted) 1 (test_adopt_entry_paths only)
M16 _printed the identity 2
M17 _shown prints a non-printable raw 35

The logs are /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1030/logs/mutant-*.log.

Merges

All three git merge-tree --write-tree 9c210eb2 <other> runs exit 0 with no conflict:

Merged with Tree
main e076e3e8 b1402905933f978fcf693b2c3d371a4926d19b28
fix/901-plan-value-order c9652c9e 7a7e875411408cf98a03ff424e115accbb306c4f
fix/910-check-throwaway-repos 5425d73b (the remote head) 6765a21da36538e9ed2472f3104db571934f0f16

Not yet done: resume steps, in order

All runs use the env above: source .../_lane1-scratch/r1030/env.sh, plus export EMAIL=... on the command line, and the basetemp .../_lane1-scratch/r1030/bt.

  1. tests/test_scaffold_leg_path_collisions.py at head, in the worktree.

  2. In merged-main: the new file, test_adopt_spelled_unambiguous, test_adopt_entry_paths, test_adopt_gitmodules_values, test_adopt_question_and_submodule_spelling and test_adopt_submodules. Add test_adopt_literal_names.py too, since its follow-ups are affected by the _spelled_character change.

  3. The LANES_LANE note. In the shared clone .../_lane1-scratch/r1030/main-e076 (detached at e076e3e8), run tests/test_doctor_gitlink_repairs.py::test_a_hand_committed_gitlink_names_both_bump_leg_commands twice: with LANES_LANE=openRepoShape-1 exported, and with env -u LANES_LANE.

  4. Optional, to hand the writer a tested fix for MUST-1: in .../_lane1-scratch/r1030/head-9c21, which carries the uncommitted one-line candidate at :3257, run:

    • tests/test_adopt_literal_names.py, where 1 row is expected to need the new expectation;
    • tests/test_adopt_contracts_dir.py;
    • tests/test_adopt_printed_sentences.py;
    • tests/test_adopt_spelled_names.py.

    Then re-run tools/mksource2.py and the e2e checker with that clone's adopt-project.py.

  5. Fetch main again with the no-maintenance flags, and repeat the main merge-tree if main has moved.

  6. Write the final report to c1030-r1030.md. As it stands it would be NOT READY at 9c210eb2 on MUST-1 and MUST-2.

Scratch and tools

Everything is under /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1030/.

  • Tools: tools/mksource.py, mksource2.py, e2e.py, policy.py, gitfail.py, fuzz.py and mutants.py.
  • Probes:
    • probe/e1: all names, head.
    • probe/e2: follow-ups, head.
    • probe/b2: follow-ups and ESC, base.
    • probe/e3: hand-edited follow-ups, head.
    • probe/pol2: policy.
    • probe/br: bidi branch.
    • probe/gf1, probe/gf2: git-failed.
  • Logs: logs/.

…mes a code-leg file as the listing and the table do, `plan` prints its follow-ups `_shown`, and a test docstring no longer says the ESC reached the commit raw

r1030's partial review of #1030 (issuecomment-6281392155):

- MUST-1: `cross_leg_references` names each file it found `_shown`, as
  `plan`'s table and the split message's listing name it, where it wrote
  the plan's escape form with no backticks: `q"uote.py` was `q\"uote.py`
  in its follow-up. The spec directory between backticks is unchanged.
  tests/test_adopt_literal_names.py expects the backticks `_shown` gives a
  name with a line break or a byte that is not UTF-8, and a new row in
  tests/test_adopt_spelled_names.py adopts `q"uote.py`, `t`ick.py` and
  `b\ack.py` that each name `docs/`, and fails on 9c210eb's code.
- MUST-2: the follow-up row's docstring says `_split_message` wrote the
  ESC raw on c7a3ff1, which `check` and `execute` refuse before
  (`plan-unwritable-value`), so the row asks the message itself.
- NIT-2: `plan`'s report prints each follow-up `_shown`, as `execute` and
  the split message do.

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-20T05:35:00Z)

r1030 independent review of PR #1030 (closes #900)

Verdict: READY at 18cc65939e58cab994442049ee17e2926cc2ca59

The round-1 head fixes both MUSTs from my partial review (r1030-review-r1-partial.md, made at 9c210eb2), and NIT-2 as well. No MUST or SHOULD is left. Two NITs remain, and neither blocks.

Separately, CI's tests job was still pending at 05:34Z. SonarCloud, package and tests-git-bash pass. Landing still needs a green H0 on the head that lands.

The worktree /workspace/projects/openRepoShape-worktrees/r1030-spelled-names is detached at 18cc6593, and git status --short is clean. No mutant is applied and none of my processes is running.

Findings

Round-1 resolutions

  • MUST-1 (a code-leg file named two ways): RESOLVED.
    • The fix: adopt-project.py:3258 is now shown = _shown(hit), and the docstring at :3211-3214 says so. The spec directory, between backticks, is unchanged.

    • Evidence, end to end: I ran plan, check and execute on tools/mksource2.py's source (probe/r1e2). It holds code files q"uote.py, t<backtick>ick.py and b<backslash>ack.py, each naming docs/. Every report line and message line names each file one way:

      plan table:      q"uote.py   ...   t`ick.py   ...   b\ack.py
      plan follow-ups: - q"uote.py in the code leg names `docs/` ...
                       - t`ick.py in the code leg names `docs/` ...
                       - b\ack.py in the code leg names `docs/` ...
      MOVED TO THE CODE LEG:  b\ack.py / q"uote.py / src/ / t`ick.py
      FOLLOW-UPS:      - b\ack.py ... / - q"uote.py ... / - t`ick.py ...
      

      e2e.py gives entries 7 problems 0, and no raw control or format character is in the report, the message or execute's stdout.

    • The new row and the changed row fail on the old code: test_the_read_across_follow_up_names_a_file_as_the_listing_does and the changed row in test_adopt_literal_names.py both fail with 9c210eb2's adopt-project.py in place. The result is 2 failed in 1.33s, and the new row fails at its first assert, on the report's follow-ups. The file was then restored with git checkout.

  • MUST-2 (false sentences): RESOLVED.
    • The test docstring at tests/test_adopt_spelled_names.py:250-254 now reads: "On c7a3ff1 _split_message wrote the ESC raw; check and execute refuse such an item (plan-unwritable-value), so this row asks the message itself." That is true. My base run gave execute exit 2, REFUSED plan-unwritable-value.
    • The PR body's sentence is replaced and is true. "check and execute already refuse a control character there ... What this changes is a hand-edited follow-up that ends in a space ..., or begins and ends with a backtick, or holds a zero-width character" matches my probe/e3 run.
  • NIT-2 (plan printed its follow-ups raw): RESOLVED. :5345 is now print(f" - {_shown(item)}").
  • NIT-1 and NIT-3: filed as adopt-project.py: plan's table pads a name by code points, not by display width, so a wide or combining name's leg column stands out of line #1034 and adopt-project.py: plan's source line prints the source's branch raw, so a bidi control in a branch name reaches the terminal #1035, outside this PR.

NITs left (do not block)

  • NIT-A: the change at :5345 (NIT-2's fix) has no row that tells it apart.
    • Mutant M19 puts back print(f" - {item}"), and it survives: 296 passed.
    • It is an equivalent mutant today. No follow-up plan writes can begin and end with a backtick, end in a space, or hold a character that is not printable:
      • cross_leg_references' lines end in "environment";
      • the "... and N more" line begins with U+2026;
      • _search_by_hand's line ends in "spec leg";
      • every name inside them is _shown or _spelled.
    • The body's "Each has rows of its own" therefore covers the split-message half of that extra, not the plan-report half.
    • Fix if wanted: one direct row that calls _print_plan_report, or print through _shown, with the follow-up `x` and expects - `\x60x\x60`. Not required.
  • NIT-B: the body's "Tests" section is historical. It is labelled "on the branch at 9bf7f4cd" and says the new file has 26 rows. At 18cc6593 it has 27, and the round-1 paragraph gives the new counts. The 27th row also fails on c7a3ff16's code, through the backtick and backslash files. No edit is needed, but the squash message should carry the round-1 counts.

Checks 1-9 at the round-1 head

  1. One spelling, never raw.

    • probe/r1e1 held 23 entries, among them names with:

      • a backtick, a double quote, a backslash, and all three at once;
      • a leading space and a trailing space;
      • a TAB, an LF and a CR;
      • e-acute, U+202E, U+0085, U+2028 and ESC;
      • a byte that is not UTF-8;
      • a wide name and a combining name;
      • `wrapped`, `w`.md, and the literal text `a\x60b.md`.

      Plan, check and execute all exit 0, with problems 0. Every table row and every split-message line is the entry's _shown, and every spelled form reads back through parse_yaml as the entry. No raw Cc, Cs, Cf, Zl, Zp or bidi character appears.

    • The fuzz of 200,000 random names (137,064 distinct) at 18cc6593 gives 0 wrong read-backs and 0 _shown clashes.

    • The policy probe (probe/pol2, at 9c210eb2; the round-1 delta does not touch that code) covered rule ids and questions with a backtick wrap, ", a backslash, a trailing space, a TAB, U+202E, a wide character, an LF and ESC. Each prints the same in plan's table, plan's questions and check's plan-unresolved.

    • Not a finding: inside a follow-up sentence, the spec directory stays between backticks, _spelled. A sentence names a path that way everywhere, as check's findings do, and a _shown text never begins and ends with a backtick. The two forms cannot be mistaken for each other.

  2. git-failed is one line. I broke the history scan six ways, in a folder named Thing<LF>WARNING forged-line<ESC>[2J<U+0085><U+202E>:

    • a bad gitfile;
    • repositoryformatversion=99;
    • a missing tree;
    • objects mode 000;
    • a ref zz<U+0085>x to a missing object;
    • a missing commit.

    Each gives git-failed as exactly 1 line, printable, naming its cause. Where git_out also fails, the tail after the command is identical. The round-1 delta does not touch this code.

  3. Table padding. Escaped names line up. Padding is by code point after stdout's escaping, so a wide name (2 columns right) and a combining name (1 column left) do not line up on a UTF-8 terminal. That was the same before this PR, the PR does not claim otherwise, and it is filed as adopt-project.py: plan's table pads a name by code points, not by display width, so a wide or combining name's leg column stands out of line #1034.

  4. Scope. All four extras are within adopt-project.py: a kept or dropped name reaches the split commit and the pull request body unspelled, and _spelled, _shown and plan's report print text that reads as another name, or raw #900:

    • the trailing space is the A6 defect, which git commit strips like the CR;
    • the follow-ups _shown serve A6's goal and agree with execute's print;
    • the rule id in the two questions is AS-3;
    • the _refused_by_policy sentence keeps a printed sentence true.

    The round-1 change to cross_leg_references is the fix for MUST-1, which this PR introduced for ".

  5. Tests and mutants: see the next two sections.

  6. The LANES_LANE note is pre-existing and not this PR's. On main 5b41d44f, tests/test_doctor_gitlink_repairs.py::test_a_hand_committed_gitlink_names_both_bump_leg_commands:

    • with LANES_LANE=openRepoShape-1: 1 failed, at the repairs == [...] compare of the in-process module.bump_leg_command;
    • with env -u LANES_LANE: 1 passed.

    The mechanism, read from the code: run_script blanks LANES_LANE for the doctor (tests/conftest.py:767-768), while the in-process call reads it. This is a test-isolation follow-up.

  7. Merges: see below.

  8. The live PR body and title (gh pr view 1030 --json body, head 18cc6593) are true sentence by sentence:

    • Items 1-6 and the four-name table: they match my base and head runs.
    • Extra 2: it now reads true.
    • The round-1 paragraph:
      • "named two ways ... now named one way": verified at probe/r1e2.
      • "The new row ... fails on 9c210eb2's": verified.
      • "two follow-ups now expect the backticked form": verified.
      • "all three places follow one rule": verified.
      • "check and execute refused it there": verified.
      • "15 files, 1,225 passed, 4 skipped": consistent with the collected counts: new file 27, unambiguous 145, literal 14, contracts_dir 34, printed_sentences 54, doctor 448 ids. I did not re-run all 15 files.
    • The LANES_LANE explanation: confirmed on main.
    • The title: true at 18cc6593.
    • The NIT-B caveat applies to the historical "Tests" section.
  9. Style.

    • git diff --check c7a3ff16 18cc6593 is clean.
    • The added lines of the delta hold no non-ASCII character and no TAB, none is over 79 columns, and there is no compound assert a and b. The same holds for the round-0 diff, checked earlier.

Mutant table

Each mutant was applied to adopt-project.py and then restored with git checkout -- adopt-project.py.

Mutant Head Failed
M1 backtick written as backslash-backtick (old) 9c210eb 17/281
M2 " written raw 9c210eb 8/281
M3 _shown prints a backtick-wrapped name raw 9c210eb 6/281
M4 _shown prints a trailing-space name raw (extra 1 reverted) 9c210eb 3/281
M5 table padded by raw width 9c210eb 2/281
M6 git-failed keeps git's stderr raw (second line) 9c210eb 1/281
M7 git-failed names the folder raw 9c210eb 1/281
M8 split listing raw 9c210eb 8/281
M8 split listing raw (re-run) 18cc659 8/296
M9 split follow-ups raw (extra 2 reverted) 9c210eb 1/281
M9 split follow-ups raw (re-run) 18cc659 1/296
M10 unresolved question raw 9c210eb 1/281
M11 defaulted question raw 9c210eb 1/281
M12 table rule id raw 9c210eb 1/281
M13 _asked_about rule raw (extra 3 reverted) 9c210eb 1/281
M14 _refused_as_named rule raw (extra 3 reverted) 9c210eb 1/281
M15 _refused_by_policy old ? sentence (extra 4 reverted) 9c210eb 1/281
M16 _printed is the identity 9c210eb 2/281
M17 _shown prints a non-printable raw 9c210eb 35/281
M18 _spelled_character back in cross_leg_references 18cc659 2/296
M19 plan prints follow-ups raw (NIT-2's fix reverted) 18cc659 0/296, SURVIVES (equivalent; NIT-A)
  • M18 is killed by the new row and by test_adopt_literal_names's line-break and byte row.
  • The row set at 9c210eb2 (281 rows):
    • the new file;
    • test_adopt_spelled_unambiguous;
    • test_adopt_question_and_submodule_spelling;
    • one row each of entry_paths, gitmodules_values and submodules.
  • At 18cc6593 (296 rows): the same, plus test_adopt_literal_names. The control at that head is 296 passed.

Test counts

All runs used the brief's environment:

  • a stub gh first on PATH, GH_TOKEN=bogus-r1030, and an empty GH_CONFIG_DIR;
  • GIT_CONFIG_GLOBAL=/dev/null, GIT_SSH_COMMAND=false, EMAIL exported, and LANES_LANE unset;
  • one reused basetemp, with retention=failed.

Head 9c210eb2 (round 0)

Files Result
New file, spelled_unambiguous, entry_paths, gitmodules_values, question_and_submodule_spelling 539 passed
submodules, agents_md_codes, repo_hygiene, readme_windows_quoting_sentence 358 passed
test_shape_doctor.py, 4 shards 445 passed, 3 skipped
New file and the two tightened rows, on c7a3ff16's code 28 of 28 failed, then restored

Head 18cc6593 (round 1)

Files Result
test_scaffold_leg_path_collisions.py (104), test_adopt_contracts_dir.py (34), test_adopt_printed_sentences.py (54) 192 passed
The mutant control set 296 passed
The two round-1 rows, on 9c210eb2's code 2 of 2 failed, then restored

The merge of 18cc6593 with main 5b41d44f

Built as a detached commit 66906f0d with tree 2942cfcc, in the shared clone .../_lane1-scratch/r1030/merged-main. The files run were:

  • the new file;
  • spelled_unambiguous, entry_paths, gitmodules_values, question_and_submodule_spelling;
  • submodules and literal_names.

Result: 721 passed, 0 failed.

Merges

Merge Tree Exit
9c210eb2 + main e076e3e8 b1402905 0
9c210eb2 + fix/901-plan-value-order c9652c9e 7a7e8754 0
9c210eb2 + fix/910-check-throwaway-repos 5425d73b 6765a21d 0
18cc6593 + main 5b41d44f (contains e2f9fc42) 2942cfcc 0, tested above: 721 passed
18cc6593 + fix/910-check-throwaway-repos abd1b984 0ac6fd0d 0

fix/977-lower-case-makefile is not on origin: git ls-remote printed no ref, so there was no merge to run.

What I could not verify

  • I did not re-run w900's own round-1 gate of 15 files and 1,225 tests, or its all-test_adopt* sweep of 4,248 ids. I ran only the files above.
  • I did not re-run the doctor at 18cc6593. The round-1 delta touches only cross_leg_references, one print in _print_plan_report and two test files, and the doctor passed at 9c210eb2.
  • The policy probe (probe/pol2) was not re-run at 18cc6593, for the same reason.
  • CI's tests job at 18cc6593 was pending when I checked at 05:34Z.
  • I have no Windows or macOS runs. The new row and several others are marked POSIX_ONLY and needs_filter_repo.

Scratch

Everything is under /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1030/:

  • tools: tools/;
  • probes: probe/ (round 1 in r1e1 and r1e2);
  • logs: logs/;
  • shared clones: merged-main, main-e076 (now at 5b41d44f) and head-9c21, all with clean trees.

@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap marked this pull request as ready for review October 20, 2026 07:17
@sourcery-ai

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

@brettheap
brettheap merged commit e656199 into main Oct 20, 2026
5 checks passed
@brettheap
brettheap deleted the fix/900-spelled-names branch October 20, 2026 07:17
brettheap added a commit that referenced this pull request Oct 20, 2026
… holding U+202E or another character the launcher refuses, by code point and in the launcher's words, before it prints the value or runs `git clone` (#953) (#1043)

`setup-project.py`'s self-bootstrap refuses an `$OPENREPOSHAPE_REPO` holding a character the launcher refuses (U+202E and the rest of `MISDRAWN_CHARACTERS`). It refuses by code point, in the launcher's words, before it prints the value or hands it to git.

Head `c42afa30`, one commit on origin/main `5b41d44f`. Only `setup-project.py` and a new `tests/test_setup_project_repo_misdrawn.py` change. No flag, no `--help` line and no doc changes.

**`setup-project.py`** (section 0, just above `self_bootstrap`):
- `MISDRAWN_CHARACTERS` is the launcher's list (`openRepoShape:502` at `5b41d44f`), entry for entry, in the package's tuple form. It is a copy, for `checked_value`'s reason: self-bootstrap mode runs before there is a checkout to read the launcher from.
- `misdrawn_characters(value)` names the characters a value holds as `U+XXXX`, in code point order. It is the package's `standard.misdrawn_characters`, and it looks for characters, as `CONTROL_RE` does.
- `checked_repo(value)` asks that first. It refuses with the launcher's `checked_repo` sentence, which names the code points and nothing else of the value. Then it calls `checked_value(..., PATH_RE)`, unchanged, for a leading `-` and a control character.
- `self_bootstrap` reads a non-empty `$OPENREPOSHAPE_REPO` through `checked_repo`. Unset or empty still means the default. The check stays where `--org` is asked, so the order is the same: `--org` first, then the repository, then `openRepoShape setup` is printed, then `mkdtemp` and `git clone`.
- The value's raw bytes are never printed. The refusal goes through `die`, so it is `REFUSED: ...` on stderr with exit 2.

**`tests/test_setup_project_repo_misdrawn.py`**, 22 tests:
- **Parity:** `test_the_misdrawn_table_is_the_launchers_list` reads `MISDRAWN_CHARACTERS=(...)` out of `openRepoShape` and compares the tuple. It also checks that `misdrawn_characters` names all of the launcher tests' `MISDRAWN`, each once and in order. `test_misdrawn_characters_names_the_launchers_and_nothing_else` runs the launcher's `SHARING_ITS_BYTES`. These follow #947's two tests for the package.
- **Direct path, 12 tests:** two runs (`Atlas --org acme`, which is the issue's run, and `--org acme` alone) times six values: U+202E, U+00AD, U+200B, U+E0001 (two, three and four UTF-8 bytes), two characters at once, and a tab before U+202E (the launcher asks for the code point before the control character).
  - Each test runs a lone copy of the file under `call_loggers`' logging git, gh and curl.
  - Each checks the launcher tests' `assert_refused_saying`: exit 2, the launcher's sentence, an empty stdout, and no listed character, escape or `forged` in either stream. So no `E2 80 AE` gets out.
  - The git log must hold exactly one call: the checkout probe.
- **Values that still go on, 7 tests:** the launcher's `NOT_CONTROLS` after `acme/`: e-acute, a no-break space, U+200C and U+200D where a script or an emoji needs them, U+2026, U+FF21 and a subdivision flag. Each is printed in the clone line and handed to `git clone` as before.
- **Package path, 1 test:** a tree with no `.git` (the package's modules under `src/openreposhape/`, plus `setup-project.py`, `scaffold-project.py`, `shape-doctor.py` and `contracts/repository-naming.yaml`). `openRepoShape Atlas --org acme` is run from that tree's `src` with the issue's value. The package prints its one line (`the standard is the checkout this package sits in, <tree>.`) and hands over. The tree's `setup-project.py` refuses: exit 2, the launcher's sentence, no U+202E and no `forged` in either stream, and only the checkout probe in the git log.
- Tests that use the logging stub are skipped on Windows. There `subprocess` starts `git.exe` and never the stub's `.cmd`, so the stub would log nothing. CI is Linux only (#597).
- `setup.sh` has no twin of these tests. Its guard covers control characters and the two separators and no other listed character, by #940's design: the launcher refuses the rest first where it is the way in.

**"No git call", stated exactly.** The refused run makes one git call, `git -C <dir> rev-parse --show-toplevel`. That is `is_shape_checkout`, which runs before `self_bootstrap` on every run past `--help` and `--preflight`. It asks whether the file stands in a checkout, which is how the run knows it is self-bootstrapping at all, and it names nothing of the value. No git call names the value, and there is no clone. Moving the check above the probe would also refuse the value on the developer path, which never reads it. It would also leave `setup-project.py` ordered differently from `setup.sh`, which probes first and guards only on its self-bootstrap path.

These run `$Q/v118/w953/probe.py`. Each case uses a fresh scratch folder, a logging git stub that then runs the real git, a gh that fails, `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR`, `GIT_SSH_COMMAND=false` and `GIT_CONFIG_GLOBAL=/dev/null`. "Before" is `git archive 5b41d44`; "after" is the worktree. Results are the same under git 2.43.0 and 2.47.1.

| Case | Before (`5b41d44f`) | After |
|---|---|---|
| package, ZIP tree, `Atlas --org acme`, `acme/r[U+202E]forged` | exit 128; `E2 80 AE` on stdout and stderr; git: probe, then `clone --quiet -- acme/r[U+202E]forged /tmp/openreposhape-shape-...` | exit 2; no `E2 80 AE`; git: probe only; stdout is the package's one line |
| direct, `Atlas --org acme`, same value | exit 128; raw bytes in the clone line; probe + clone | exit 2; refusal names `U+202E`; probe only |
| direct, `--org acme`, same value | exit 128; probe + clone | exit 2; probe only |
| direct, `acme/r[U+200B]forged` | exit 128; probe + clone | exit 2; names `U+200B` |
| direct, `acme/r[U+E0001]forged` | exit 128; probe + clone | exit 2; names `U+E0001` |
| direct, `acme/r[U+2026]b` (not listed) | exit 128; probe + clone | the same: probe + clone, exit 128 |

The "after" refusal, from the probe:

```
REFUSED: OPENREPOSHAPE_REPO holds a character a terminal draws as something other than itself (U+202E): one that is invisible, is drawn as another character, ends a line or reorders the text around it. This tool will not put it on a `git clone` command line. Set it to a URL or a path.
```

The new file was run on main's `setup-project.py` (`git show 5b41d44:setup-project.py`, put back byte for byte afterwards): **15 failed, 7 passed**.
- Failed: both parity tests (`AttributeError`: no `MISDRAWN_CHARACTERS`, no `misdrawn_characters`), all 12 direct tests, and the package test.
- Passed: the 7 `NOT_CONTROLS` tests. They pass at main by design, because they guard against a check that is too broad.

Each mutant was applied alone (`$Q/v118/w953/mutate.py`), the new file was run (22 tests), and both files were put back. **All 18 are killed.**

| Mutant | Failed |
|---|---|
| m01 check removed (main's read) | 13 |
| m02a check moved after the `(0) self-bootstrap` line | 13 |
| m02b check moved after the clone line | 13 |
| m03a only the value's first character checked | 15 |
| m03b only the table's first entry checked | 13 |
| m04 only U+202E checked | 8 (U+00AD, U+200B, U+E0001, two-at-once) |
| m05 refusal exits 1 | 13 |
| m06a table drops `E0001` | 4 |
| m06b parity compares the first five entries + table drops `E0001` | 4 (parity's second assert, `SHARING_ITS_BYTES`, both U+E0001 tests) |
| m06c parity compares the first five + table adds `200C` | 2 (`SHARING_ITS_BYTES`, the Persian/U+200C test) |
| m06d parity compares the first five + `2060-206F` narrowed to `206E` | 2 |
| m06e parity uses set inclusion + table drops `E0001` | 4 |
| m07 a range read without its last code point | 15 |
| m08 control check asked before the code points | 2 (both tab-then-U+202E tests) |
| m09 characters named in the value's order | 3 |
| m10 every character past ASCII refused | 7 (every `NOT_CONTROLS` test) |
| m11 refusal quotes the value back | 13 |
| m12 check skipped on a hand-over (`OPENREPOSHAPE_SELF_BOOTSTRAP=1`) | 1 (the package test alone) |

All at `c42afa30`, one pytest process at a time: `/usr/bin/python3 -m pytest -q -p no:cacheprovider -o tmp_path_retention_policy=failed`, one reused basetemp, `[email protected]`, a stub gh first on PATH, `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR`, `GIT_SSH_COMMAND=false`, `GIT_CONFIG_GLOBAL=/dev/null`.

| Run | git | Files | Result |
|---|---|---|---|
| h1 | 2.43.0 | `test_setup_project_repo_misdrawn.py` (22), `test_setup_project_ref_parts.py` (27), `test_openreposhape_package.py` (213), `test_readme_windows_quoting_sentence.py` (44), `test_release_install_check_children.py` (30), `test_repo_hygiene.py` (100), `test_agents_md_codes.py` (47), `test_cli_reference.py` (23) | 506 passed in 94.06s |
| h2 | 2.43.0 | `test_setup_project_py.py` | 340 passed in 122.68s |
| h3 | 2.43.0 | `test_setup_sh.py` | 191 passed in 96.62s |
| h4 | 2.47.1 | `test_setup_project_repo_misdrawn.py`, `test_setup_project_ref_parts.py`, `test_setup_project_py.py` | 389 passed in 128.13s |
| h5 | 2.43.0 | `test_no_auto_maintenance.py`, `test_setup_project_dry_run_offers.py`, `test_validator_child_encoding.py`, `test_setup_project_name_edges.py`, `test_setup_project_typed_name.py` | 353 passed, 2 skipped in 73.92s (the two skips: `GIT_CONFIG_GLOBAL` was set) |

No `shell_quoted` call was added (count 0), so the README's and the handbook's Windows-quoting sentences and `NAMED` are unchanged. `setup-project.py` is not a pinned copy. The wheel takes it at build time (`pyproject.toml` `force-include`), and the tests that read its source (`test_setup_project_py.py`, `test_release_install_check_children.py`, `test_repo_hygiene.py`) pass.

- `git merge-tree --write-tree` of `c42afa30` with origin/main `5b41d44f` (fetched with `-c gc.auto=0 -c maintenance.auto=false`) is clean, tree `59de4c261c228274a5cff18aff953211de7002e3`.
- No open PR touches `setup-project.py` or the new test file. Every open PR's head was still merged in, and all ten are clean: #1041 `4a23c6e2`, #1039 `5f924500`, #1038 `fd1de5ab`, #1031 `eea70be1`, #1030 `9b4845bb`, #1028 `0c9eac6c`, #1027 `052f1e24`, #1025 `f83ca618`, #1023 `4d0aa1cf`, #954 `dc7fd7ea`.

- **RV947's companion is left out.** That companion is the package's scaffold run asking the repository even beside a checkout.
  - Once this lands, no package run prints the value or hands it to git. Beside a git checkout, the hand-over takes `setup-project.py`'s developer path, which never reads `$OPENREPOSHAPE_REPO`. `self_bootstrap` and `standard.py` are the only shipped Python that read it. Beside a tree with no `.git`, this check refuses it.
  - The companion would change `standard.prepare`, which `--doctor` and the four tools share. They would then refuse a value they never use. That is the launcher's "checked once, before every run but `--help`" policy, and it is a decision about the package of its own.
  - `src/openreposhape/standard.py` is also open in #1038.
- **Found while measuring, not changed here:** `CONTROL_RE` and `PATH_RE` hold `\x00-\x1f\x7f` only, so a C1 control passes `checked_value`. The launcher and the package refuse C1 (U+0080 to U+009F) in a repository. With `acme/r[U+009B]31mforged`, the clone line prints the raw `C2 9B`, before and after this change. `--into` and `--local-remote-dir` go through the same `PATH_RE` (read in the code, not measured). That would be a follow-up for `checked_value`, which every flag shares.

Review: rv953, lane 5's independent reviewer, not the writer (w953): READY at `c42afa30`, the head that lands (issuecomment-6284626889), with no MUST. It rules #953's Verify met in substance: the refused run's only git call is the checkout probe every run makes, which names nothing of the value, and there is no clone. Its SHOULD is #459's documented C1 known limit (U031, L4-24), left with its test NIT for a follow-up on a ruling. CI (Brett Heap's ruling 27): H0 is the head c42afa3 itself, which passed tests, tests-git-bash and SonarCloud; main has touched none of its files since its base 5b41d44; and the local gate passed on its predicted squash tree e146bb5 over main e656199: the setup_project_repo_misdrawn, repo_hygiene, agents_md_codes, cli_reference sets, 192 passed. Landed on Brett Heap's word of 2026-10-18T14:45:28Z, relayed to every lane by lane 3 (#473 issuecomment-6251255596): "merge v1.2.0 PRs once reviewed and green".

Closes #953.

Lane: openreposhape-5 (openRepoShape-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Oct 20, 2026
…hain link before an `=` that leaves a path after it, so the offer the gate prints for a link holding `=` verifies that link when typed as printed (#980) (#1044)

For a declared-unverified chain link whose name holds `=`, the naming gate offers only sources that verify that link's tree when typed as printed. The gate offered `open=y` the source `--link-source open=y=<path>`, and read every `--link-source` key at the value's first `=`: the key was `open`, which no chain names, so the value was a bare PATH for the first link, `open=y` stayed declared-unverified under the same offer, exit 0.

**The issue's direction (a)**, in `scripts/validate-repository-naming.py`. `LinkSources._read_source` reads a `--link-source` key the way `_read_remedy` reads a `--link-remedy` link since #949: the longest text before an `=` that names a link of a chain this run reads, by `pin_product_key`, and leaves a path after it. `__init__` and `no_path` both take the key and the path from it, so the path refused as empty is the one after the key's own `=`. For a chain whose links hold no `=`, every value is read exactly as before: a text holding `=` can only name a link that holds one.

**What (a) keeps from the documented rules, and how each case was checked** (probes below, and one test row or more each):
- A link holding `=`: `open=y=<tree>` verifies `open=y`, as printed and in capitals (`OPEN=Y=<tree>`, by `pin_product_key` as every key is).
- Two links where one is a prefix of the other (`open` and `open=y` in one chain): `open=y=<tree>` is `open=y`'s and `open=<tree>` is `open`'s, in either order. On main both were `open`'s and the later replaced the earlier, so `open=y` read none.
- A path that itself holds `=`: `open=y=<dir>/a=b/tree` is `open=y`'s with that whole path. A text holding `/` names no link, since a link's name is `repo_basename`'d, so an `=` after a `/` never ends the key. A path that begins like a longer link's name is given after `./`: `open=./y=dir` is `open`'s in a chain naming `open=y` too.
- A key that names a link but leaves an empty path: `open=y=` is `PRODUCT=` for `open=y`, refused as `link-source-no-path`, exit 2, as `openXdox=` is (#442). On main it was a bare PATH asked for `openXdox`, a link the person did not name. Where a shorter link leaves a path (`open=y=` with `open` in the chain too), that link is the key, `open` with the path `y=`, as `--link-remedy openXdox=y=` gives `openXdox` the words `y=` where a chain names `openXdox=y`: the longest link that leaves a path wins, and `open=y` leaves none.
- A value that is a real directory spelled like the whole value: `open=y=x` beside a directory `open=y=x` is still `open=y`'s, decided by the chain and not the disk, with `_also_a_directory`'s line; `./open=y=x` asks for the directory, as a bare PATH for the first link.
- The key is read whole, where a remedy's link is stripped and cut at its last `/`: ` open=y=<tree>` and `opensoft/open=y=<tree>` name no link and stay bare PATHs, as on main.

**One difference from `--link-remedy`, deliberately.** `--link-remedy open=y=` is a NOTE (its link falls back to the first `=`, `open`). `--link-source open=y=` is refused, because the #442 rule refuses `PRODUCT=` for every link, and `--link-remedy`'s own `openXdox=` refusal is made by argparse before the chains are known, which is why it cannot catch `open=y=`. `_read_source`'s docstring says so.

**Not (b).** (a) makes the offer the gate already prints true, so the person who types it gets the verification; (b) would only stop offering it. Setup's step (4) is unchanged: it passes the gate its `--pin-source` as an absolute path, with a separator before every `=`, so no text before one names a link.

**Docs.** The module docstring (a new paragraph, "A KEY IS THE LONGEST LINK A VALUE NAMES"), the `LinkSources`, `_link_remedy` and `_read_remedy` docstrings, the `--link-source` help, and `docs/cli.md` regenerated from it. `setup-project.py`'s `as_the_plan_reads_it` docstring stated the first-`=` rule, and now states this one. README, the handbook and AGENTS.md state no rule for how a `--link-source` key is read (README names `--link-source PRODUCT=<path>` only), so they are unchanged. The class docstring records that `validate-pins.py` still ends a `--pin-source` key at the first `=`; no scaffold writes a pin holding one (`--pin` names are `[A-Za-z0-9_.-]`), and it is left as its own change.

Measured from a root scaffolded at main `5b41d44f` (local remotes, no network):
- `update-shape.py check --upstream <this checkout> --at c64e85f` lists `upstream-changed scripts/validate-repository-naming.py`, with `upstream-changed 1  unchanged 10`.
- `update-shape.py apply --yes --branch ...` exits 0, commits `contracts/shape-pin.yaml`, `project.yaml` and the copy, and the project's validators print `pins ok` and `manifest ok`. A fresh `check` prints `unchanged 11`, and the root's own naming gate exits 0.
- The new sha256 of `scripts/validate-repository-naming.py`: `ec167fb0e259f90705db895a1a37f4adebd4cbf03ca2d5ae18f6d9a8df896548` (78664 bytes). No other pinned copy and no template changes.

Run from empty folders, `<D>` a fresh folder, trees as named (`trees/y` declares `openInk`, `trees/x` declares `open=y`; for the chain with `open`, `trees/x2` declares `open` and `trees/o` declares `open=y`). The gate prints an arrow between links; it is written `->` here.

| Probe | At main `5b41d44f` | At head `c64e85fe` |
|---|---|---|
| P1, the issue's row: `--referent-chain openXdox,open=y,openInk --link-source open=y=<D>/trees/y` | `link-source-unreadable ... could not answer for openXdox`, "It was read as a PATH: `open` is not a link", and `open=y` declared-unverified with the same offer; exit 0 | only `openXdox` declared-unverified (no source named it); no `link-source-unreadable`; exit 0 |
| P2, P1 plus `openXdox=<D>/trees/x`, `--explain` | NOTE: the value not used, read as a PATH; `CHAIN openXdox -> open=y -> openInk [declared-unverified]` | `[verified]`, nothing warned or noted |
| P3, chain `openXdox,open,open=y,openInk`, `open=<o>` then `open=y=<y>` | `link-source-unreadable: y=<D>/trees/y (--link-source open=...)`, NOTE `open=<o>` replaced; 2 links declared-unverified | `[verified]`, nothing warned or noted |
| P4, `open=y=` (chain without `open`) | bare PATH `open=y=` asked for `openXdox`; exit 0 | `REFUSED link-source-no-path: --link-source open=y= names no path for open=y`; exit 2 |
| P5, `open=y=` (chain with `open`) | `y= (--link-source open=...) could not answer for open` | the same |
| P6, `open=y=<D>/trees/a=b/y` | read as a PATH, `[declared-unverified]` | `[verified]` |
| P7, `open=y=x` beside a directory `open=y=x` | bare PATH, read as the directory for `openXdox` | `link-source-unreadable: x (--link-source open=y=...) could not answer for open=y`, then "`open=y=x` is also a directory; `--link-source ./open=y=x` reads it as one." |
| P7b, `./open=y=x` | the directory, for `openXdox` | the same |
| P8, chain with `open`: `open=./y=dir`, `open=y=<y>` | `open=y=<y>` read for `open`, replacing `open=./y=dir` | `[verified]` |

Eleven new rows in `tests/test_chain_remedy_callers.py`, section "#980", reusing its helpers (`naming`, `tree`, `gate_warnings`, `UNREACHED`, `GATE_OFFER`, `EQUALS`), with no assert that joins conditions with `and`:
- `test_the_offer_for_a_link_holding_an_equals_verifies_it[as-printed, in-capitals, a-path-holding-an-equals]`: reads the offer the gate prints for `open=y`, types it with a tree, and asserts the one WARNING left is `openXdox`'s, with no `link-source-unreadable` and no NOTE.
- `test_each_link_reads_its_own_source_where_one_name_begins_another[open-first, open=y-first, a-path-that-begins-like-the-longer-link]`
- `test_a_value_that_ends_at_a_link_holding_an_equals_names_no_path`
- `test_a_shorter_link_that_leaves_a_path_is_the_key`
- `test_a_link_holding_an_equals_wins_over_a_directory_spelled_like_it`
- `test_a_key_is_read_whole[a-blank, an-owner]`

**Failing at main.** The test file copied onto a `git archive` of `5b41d44f`: 8 of the 11 fail, each on the defect (the offer row's `open=y` WARNING and `link-source-unreadable`, the prefix rows' `[declared-unverified]`, `open=y=` exiting 0, the keyed reading not winning over the directory). The other 3 pass at main by design: they pin behaviour main already had (`test_a_shorter_link_that_leaves_a_path_is_the_key`, `test_a_key_is_read_whole[a-blank]` and `[an-owner]`), and each kills a mutant below.

**Mutants**, each applied alone to the fixed gate in a scratch repository, then `test_chain_remedy_callers.py`, `test_link_source_chain_defaults.py`, `test_naming_policy.py`, `test_chain_link_fold.py` and `test_chain_pin_sources.py` (400 passed, 4 skipped with no mutant). All 11 killed:

| Mutant | Failed | Killed by (new rows unless named) |
|---|---|---|
| M1 back to `typed.partition("=")` | 8 | the offer rows, the prefix rows, `open=y=`, the directory row |
| M2 the shortest match instead of the longest | 3 | the prefix rows |
| M3 the "leaves a path after it" check dropped | 1 | `test_a_shorter_link_that_leaves_a_path_is_the_key` |
| M4a the `./PATH` rule dropped (`./` stripped from the key) | 3 | the directory row; `test_a_labelled_source_holding_an_equals_is_not_said_to_be_a_path`; `test_naming_policy.py::test_a_link_named_before_the_equals_is_the_key_even_over_a_directory` |
| M4b the key cut at its last `/`, as a remedy's link is | 4 | as M4a, and `test_a_key_is_read_whole[an-owner]` |
| M5 the empty-path fallback dropped | 6 | `open=y=`; `test_a_value_that_names_no_path_is_spelled`; 4 rows of `test_link_source_chain_defaults.py::test_a_link_source_that_names_no_path_is_refused` |
| M6 the fallback at the first `=`, as a remedy's | 1 | `open=y=` |
| M7 `no_path` taken after the first `=` | 1 | `open=y=` |
| M8 the keyed path taken after the first `=` | 7 | the offer rows, the prefix rows, the directory row |
| M10 the key stripped, as a remedy's link is | 1 | `test_a_key_is_read_whole[a-blank]` |
| M12 the key not folded by `pin_product_key` | 56 | `in-capitals` and the prefix rows, and 52 existing rows |

**Runs**, all on head `c64e85fe`, `/usr/bin/python3 -m pytest -q -p no:cacheprovider -o tmp_path_retention_policy=failed`, one reused basetemp per run, with `[email protected]`, a stub `gh` first on PATH, `GH_TOKEN=bogus`, an empty `GH_CONFIG_DIR`, `GIT_SSH_COMMAND=false` and `GIT_CONFIG_GLOBAL=/dev/null`:
- git 2.43.0 (`/usr/bin/git`), 31 files: the 25 that run the naming gate (`grep -l validate-repository-naming tests/`, the pinned-copy files `test_pinned_copy_text.py`, `test_update_shape_kept_helper.py`, `test_update_shape_unreadable.py` and `test_adopt_reencoded_files.py` among them, and `test_repo_hygiene.py`), the files that scan every script's source (`test_git_output_decoding.py`, `test_shape_advisory.py`, `test_no_auto_maintenance.py`, `test_non_utf8_git_failures.py`), and the trio's other two, `test_agents_md_codes.py` and `test_cli_reference.py`: **2964 passed, 5 skipped** in 1749 s, exit 0.
- git 2.47.1 first on PATH, the 25 naming-gate files: **2680 passed, 3 skipped** in 1181 s, exit 0.

No template changes. `grep` of `tests/` found no fixed digest or `^id:`-style pattern over the gate: the tests that read a root's copy of it (`test_shape_doctor.py`, `test_doctor_validator_verdicts.py`) compare it at run time, and both are in the first run, as are the source scanners above and `test_cli_reference.py`, which holds `docs/cli.md` to the help.

- `git merge-tree --write-tree origin/main HEAD`, origin/main `5b41d44f` (fetched with `-c gc.auto=0 -c maintenance.auto=false`, and `git ls-remote` agrees): clean, tree `82780dc63d7f`, the head's own tree.
- Open pull requests: none of the 9 open (#954, #1023, #1025, #1027, #1028, #1030, #1031, #1038, #1039) touches `scripts/validate-repository-naming.py`, `tests/test_chain_remedy_callers.py`, `setup-project.py` or `docs/cli.md`, so there is no merge-tree to run against them.

Review: rv980, lane 5's independent reviewer, not the writer (w980): READY at `c64e85fe` (issuecomment-6288391970), with no MUST or SHOULD; the landing head only merges main over it. Its NIT-1 (three test rows for the corners of the old first-`=` split) and NIT-2 (a sentence in `validate-pins.py`) go to a follow-up. CI (Brett Heap's ruling 27 and his fast-refresh ruling of 2026-10-15T22:48:35Z): H0 c64e85f passed tests, tests-git-bash and SonarCloud; the head 0f5845b is a clean update-branch merge of main b0babe1, with tests-git-bash and SonarCloud green; and the local gate passed on its predicted squash tree ac9c882 over main b0babe1: the chain_remedy_callers, repo_hygiene, agents_md_codes, cli_reference sets, 233 passed. Landed on Brett Heap's word of 2026-10-18T14:45:28Z, relayed to every lane by lane 3 (#473 issuecomment-6251255596): "merge v1.2.0 PRs once reviewed and green".

Closes #980.

Lane: openreposhape-5 (openRepoShape-5)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Oct 20, 2026
…makefile` or `GNUmakefile` GNU make reads first, and where a case-blind disk writes the shape's; README says which Makefile exports `CONTRACTS_DIR` (#977) (#1046)

## What

Two follow-ups to #906 that lane 1's review of #964 (r906) found and
ruled out of that pull request. Neither is a regression: both were as
untrue on `main` before #906 as after it.

**(a) The Makefile follow-up names the root file GNU make reads first.**
The line is in `plan`'s `follow_ups:`, in `check`'s output and in the
split commit's message, which is also the pull request's body. GNU make
reads the first file it finds of `GNUmakefile`, `makefile` and
`Makefile`, and only that one. #906 asked only whether the source keeps
`Makefile`, comparing names byte for byte (`_root_keeps`). So a source
that keeps `makefile` or `GNUmakefile` got "the root Makefile wires
`CONTRACTS_DIR` ...". But the clone's root then holds the shape's
`Makefile`, with the block, and the source's file, which `make` reads
instead, so `make contracts-dir` answered `No rule to make target
'contracts-dir'` (r906's probe, both names).

`_makefile_follow_up` now writes the line:

- It names the source's file that GNU make reads at the root, wherever
  that file is not the `Makefile` #906's words already name. It also
  says what it takes for `make` there to export `CONTRACTS_DIR`.
- On a disk that ignores case, a kept `makefile` IS `Makefile`.
  `place` (`Path.exists()`) finds the name taken and writes the shape's
  Makefile as `shape/Makefile`. The line says so in `CASE_ASIDE`'s
  words. `_root_keeps` gains `fold`, which asks the question the way
  `_KeptTree` asks it for `check`'s disk that ignores case.
- A source that keeps only `Makefile`, or none of the three names and no
  other case of `Makefile` that a rule keeps, gets the line it got before,
  byte for byte.
- Each kept name is printed with `_spelled`, and the three names GNU make
  looks for with `_and_listed`. No `shell_quoted` call is added.

| The root keeps | Before | After |
| --- | --- | --- |
| none | "the root Makefile wires `CONTRACTS_DIR` ..." | unchanged |
| `Makefile` | #906's line: "the shape's Makefile wires ...; but the source keeps a Makefile of its own at the root, so that block waits in `shape/Makefile` until the two are merged, and the run adds none of it to the root's Makefile" | unchanged |
| `makefile` | "the root Makefile wires ..." | "the shape's Makefile wires ...; it is written as the root's `Makefile`, or as `shape/Makefile` once case is ignored, as a macOS or Windows disk does, where the source's `makefile` is that path, until the two are merged; and GNU make at the root reads the source's `makefile`, ..." |
| `GNUmakefile` | "the root Makefile wires ..." | "the shape's Makefile wires ...; it is written as the root's `Makefile`, but GNU make at the root reads the source's `GNUmakefile`, ..." |
| `makefile` and `GNUmakefile` | "the root Makefile wires ..." | as for `makefile`, and GNU make reads the source's `GNUmakefile` |
| `Makefile` and `makefile` | #906's line | #906's line, then "; and GNU make at the root reads the source's `makefile`, ..." |
| `Makefile` and `GNUmakefile`, or all three | #906's line | #906's line, then "; and GNU make at the root reads the source's `GNUmakefile`, ..." |
| `MAKEFILE`, kept in the root by a `--path-policy` rule (with the shipped rules `plan` asks about it, and a person's `root` answer keeps the line `plan` wrote: "the root Makefile wires ...") | "the root Makefile wires ..." | "the shape's Makefile wires ...; it is written as the root's `Makefile`, or as `shape/Makefile` once case is ignored, ..., where the source's `MAKEFILE` is that path, until the two are merged" |

The clause that names the file, in full:

```text
GNU make at the root reads the source's `makefile`, the first of
`GNUmakefile`, `makefile` and `Makefile` it finds, so `make` there exports
`CONTRACTS_DIR` only once `makefile` does, or includes a Makefile that does
```

**(b) README.md, section "Adopting an existing repository".**

- Before: "the root Makefile it materializes exports `CONTRACTS_DIR`,
  pointing at the `contracts/` of the spec leg where the plan mounts it
  (`$(CURDIR)/spec/contracts` by default)."
- After: "the shape's Makefile exports `CONTRACTS_DIR`, pointing at the
  `contracts/` of the spec leg where the plan mounts it
  (`$(CURDIR)/spec/contracts` by default); it is the root's Makefile, or,
  where the source keeps a `Makefile` of its own, `shape/Makefile`, which
  holds the export until a person merges the two."

This is r906's wording, as its re-check corrected it, with one change:
`Makefile` is in backticks in "a `Makefile` of its own". A source that
keeps `makefile` has the shape's Makefile written as the root's
`Makefile` on a disk that keeps case, so the plain word would have
claimed `shape/Makefile` for it.

The section is bound to the handbook's `adopt` section. The handbook
says nothing of `CONTRACTS_DIR`, and its sentence that a shape file
whose name the source already holds, `Makefile` among them, is written
under `shape/` stays true. So only the section's marker moves, to the
section's new blob, computed with `readme_segments` and
`readme_fingerprint`.

The tail of the paragraph is reflowed, and README.md grows by one line,
to 1479, which is the cap. No `tests/readme-cap.d/` file is needed while
no other README pull request lands first.

## Measured

On a disk that keeps case (Linux, GNU Make 4.3, git 2.43), each row ran
a real `execute --local-remote-dir` and made a recursive clone of the
split. Each file the source keeps has its own `which` target, so `make
which` at the clone's root prints the name of the file GNU make read.

| The root keeps | `make which` prints | the split message names | `make contracts-dir` at the root | the block is in (`make -f <it> contracts-dir` prints the spec leg's `contracts/`) |
| --- | --- | --- | --- | --- |
| `makefile` | `makefile` | `makefile` | no rule | `Makefile` |
| `GNUmakefile` | `GNUmakefile` | `GNUmakefile` | no rule | `Makefile` |
| `makefile` and `GNUmakefile` | `GNUmakefile` | `GNUmakefile` | no rule | `Makefile` |
| `Makefile` | `Makefile` | #906's line, the source's own `Makefile` | no rule | `shape/Makefile` |
| `Makefile` and `makefile` | `makefile` | `makefile` | no rule | `shape/Makefile` |
| `Makefile` and `GNUmakefile` | `GNUmakefile` | `GNUmakefile` | no rule | `shape/Makefile` |
| all three | `GNUmakefile` | `GNUmakefile` | no rule | `shape/Makefile` |

The disk that ignores case is not measured: there is none here. What
the line says of it rests on `place`'s `Path.exists()`, and is tested
against `_KeptTree(..., fold=True)`, `check`'s model of that disk.

## Tests

- `tests/test_adopt_make_reads_first.py`, new: 33 tests.
  - The line word for word, for every row above, and for `makefile`
    and `GNUmakefile` sent to legs.
  - The line against `_KeptTree` on both disks.
  - `plan` and `check` for each row but none and `Makefile`, which
    `test_adopt_contracts_dir` and `test_adopt_printed_sentences` already
    plan and check.
  - A real `execute` for each row except none, with the `make`
    measurements above.
  - README's sentence, and the handbook marker matching the section as
    it now stands.
- Fail on base: on `e2f9fc42` (main when the branch was made), 23 fail
  and 10 pass. The 10 are the handbook marker test, which was current
  on base, and rows whose line does not change: none and `Makefile`
  alone; `makefile` and `GNUmakefile` sent to legs; and the
  `Makefile`-plus-another rows of the disk test, which asks only where
  the copy goes.
- Gate on this head, named files only, one basetemp, a stub `gh` first
  on PATH, `GH_TOKEN=bogus`, `GIT_SSH_COMMAND=false`,
  `GIT_CONFIG_GLOBAL=/dev/null`:
  - The new file, `test_adopt_contracts_dir`, `test_adopt_printed_sentences`,
    `test_adopt_leg_keys`, `test_adopt_plan`, `test_adopt_e2e`,
    `test_repo_hygiene`, `test_readme_sections`, `test_agents_md_codes`,
    `test_cli_reference`, `test_readme_windows_quoting_sentence` and
    `test_scaffold_leg_path_collisions`: 652 passed, 1 skipped (the
    MedxEHR test, no clone here).
  - Every other adopt test file that names `Makefile`, `makefile` or
    `CONTRACTS_DIR`: `attributes_eol_block`, `verify`,
    `ignored_shape_files`, `leg_path_collisions`, `submodules`: 368
    passed. `root_manifest`, `root_symlinks`, `symlink_target_bytes`,
    `root_shape_paths`: 403 passed.
  - `test_shape_doctor.py` in 4 shards: 445 passed, 3 skipped (the
    PowerShell line, Windows only).
  - After the last test-only edit (helpers imported from
    `test_adopt_printed_sentences`): the new file and
    `test_adopt_printed_sentences`, 87 passed (33 and 54).

Mutants of the change, each restored. Each one is killed:

| Mutant | Failed |
| --- | --- |
| GNU make's order with `makefile` before `GNUmakefile` | 18 of 33. The end-to-end rows `makefile`+`GNUmakefile` and all three fail on `make which` against the split message itself. |
| the case-folding check off | 9 |
| the joining word always "; and" | 3 |
| "the shape's" not chosen when only `GNUmakefile` or `makefile` is kept | 4 |
| GNU make's first file never found | 19 |
| `_root_keeps` folds case by default | 13, #906's `the-root-keeps-it` row among them |
| README's old sentence | 3, `test_the_handbook_follows_the_readmes_outline` among them |
| the handbook marker left stale | 2 |

## Merge with main

`git merge-tree --write-tree` of this head with `main` at `dc7cd49b` is
clean (tree `ae9abfcb`). Of this branch's files, only
`adopt-project.py` moved on main: #1030 (#900) changed `_spelled`, and
#1038 (#994) changed a hint and a docstring. `_spelled` changes only a
backslash, a double quote or a backtick inside a name. The names this
line spells are plain letters, so its words do not change. README.md,
`docs/handbook.html` and `tests/readme-cap.d/` did not move on main, so
the marker stays current and the cap still holds.

On the merge, built in a `git clone --shared` checkout: the new file,
`test_adopt_printed_sentences`, `test_repo_hygiene` and
`test_readme_sections`, 263 passed.

## Not in this PR (follow-ups for lane 1 to file)

- **NEXT's `make bootstrap`, measured.** For a source that keeps
  `makefile` or `GNUmakefile`, `execute`'s NEXT block prints `make
  bootstrap`. `make -n bootstrap` in the clone exits 2 with `No rule to
  make target 'bootstrap'`. For `Makefile` and `GNUmakefile`, its NOTE
  says the shape's make targets "arrive only once the follow-up merges
  the two". But GNU make at the root reads `GNUmakefile`, not the merged
  `Makefile` (inferred; before the merge, `make -n bootstrap` there
  exits 2, as the NOTE says).
- **`collision_follow_up`'s sentence.** In `shape_materialize.py`,
  "The shape's make targets ... arrive only with that merge" is likely
  untrue where the source also keeps `GNUmakefile` or `makefile`, which
  GNU make reads before the merged `Makefile`. Inferred, not measured.
- **`AGENTS-shape.md` in the pinned template.** "Where the source kept a
  Makefile of its own, that block waits in `shape/Makefile`" has the
  same gap for a kept `makefile`. It is pinned bytes, so it is left.
- **Disks that ignore case.**
  - `_predict_collisions` stays byte for byte, so on such a disk a plan
    for a kept `makefile` lists no "merge shape/Makefile into Makefile"
    follow-up. `execute`'s own collision report lists it.
  - A split made on a disk that keeps case commits both `Makefile` and
    `makefile`, two names that collide in a clone on a disk that
    ignores case.
  - Spellings such as `gnumakefile` are not asked about.
  - None of this is measured.

**Review round 0, body only** (lane 1's reviewer r1046's partial review, issuecomment-6288714370): the `MAKEFILE` row and the byte-for-byte sentence now say that a `--path-policy` rule, not a person's answer, is what keeps `MAKEFILE` in the root. Follow-ups are built from the rules' answers alone, so a `MAKEFILE` a person answers `root` keeps "the root Makefile wires ...", which a disk that ignores case makes untrue, as on base.

**Review round 1** (`c121ed90`, test file only): the comment above `ANSWERED` says a `--path-policy` rule, not a person's answer, reaches the follow-ups (r1046's SHOULD-1). The new test file is ASCII: its section signs and em dashes are written as escapes, with two lines rewrapped: the assert's string is unchanged, the `re` pattern matches the same text (its raw string now holds the escape), and one docstring changes only where its lines break (NIT-2). `tests/test_adopt_make_reads_first.py` 33, `tests/test_adopt_printed_sentences.py` 54 and `tests/test_repo_hygiene.py` 100 passed.

It lands by fast refresh (Brett Heap, 2026-10-15T22:48:35Z). Its reviewed head `c121ed90` is green on Linux and SonarCloud. The branch merged main once and was never rebased; the last merge is update-branch's, clean, giving db92198, which is green on SonarCloud and Git Bash. Lane 1's gate passed on its tree: the 13 test files that run `adopt-project.py`'s Makefile follow-ups and `make`, read README and the handbook, the doctor and the docs, 1,097 passed and 4 skipped.

Closes #977

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
brettheap added a commit that referenced this pull request Nov 9, 2026
…inal gives it, not the code points it holds, so a wide or combining name's `leg` column lines up under `leg` with every other row's (#1034) (#1178)

`plan`'s table padded each name with `:<34`, which counts code points,
not the columns a terminal gives them. On a UTF-8 stdout the name U+540D
U+524D `.md` (two wide ideographs) takes 7 columns and was padded as 5,
so its `leg` began at column 37, 2 right of the heading's 35. The name
`e` U+0301 `.md` (a combining acute) takes 4 columns and was padded as
5, so its `leg` began at 34. Names that stdout escapes have lined up
since #900's PR (#1030).

In `adopt-project.py`, `_columns(text)` now counts the columns a
terminal gives a text: none for a character whose general category is in
`ZERO_COLUMN_CATEGORIES` (Mn, Me and Cf) or that is a Hangul medial
vowel or final consonant (`MEDIAL_AND_FINAL_JAMO` and
`MEDIAL_AND_FINAL_JAMO_EXTENDED_B`), two for one
`unicodedata.east_asian_width` calls wide or fullwidth
(`TWO_COLUMN_WIDTHS`), and one for any other. The category is asked
before the width, since the voiced sound mark U+3099 is Mn and East
Asian wide, and a terminal draws it over the kana before it.
`_padded(text, columns)` pads a text to that many columns, and leaves a
wider one as it is, as `:<34` does. `_print_entries` pads
`_printed(_shown(entry.path))` with `_padded(..., 34)`, so the text
measured is the one printed, and an ASCII stdout's escapes still count
one column each (#900).

`tests/test_adopt_spelled_names.py` has 44 passed.
`test_a_name_takes_the_columns_a_terminal_gives_it` holds 14 names whose
columns are counted by hand, and glibc's `wcswidth` gives each new name
the count the row holds.
`test_a_name_wider_than_its_column_is_padded_by_no_space` holds a
43-column name as it is, and
`test_the_table_pads_a_wide_and_a_combining_name_by_their_columns` runs
`_print_entries` on a UTF-8 stdout, with every row's `leg` at column 35.
`test_plan_on_a_utf_8_stdout_keeps_each_column_under_its_heading` runs
`plan` end to end over a source holding the two wide names, the
combining one and a decomposed Hangul one. With main's
`adopt-project.py`, 17 of the 18 rows selected fail, and each of the 17
mutants run is killed.

Closes #1034

Lane: openreposhape-3 (openRepoShape-3)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant