Skip to content

adopt-project.py: check and execute work the follow-ups out from the plan as it stands and plan no longer stores them, so after a hand edit of an entry's leg: neither check nor the split commit names a GNUmakefile or a collision the root no longer keeps, and a plan that still holds a follow_ups: list is refused by name (#1206) - #1312

Open
brettheap wants to merge 7 commits into
mainfrom
fix/1206-follow-ups-from-the-plan-as-it-stands

Conversation

@brettheap

@brettheap brettheap commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1206

plan used to work out the follow-ups once and store them in the plan's follow_ups: list. So after a hand edit of an entry's leg:, which the contracts and every review_required question invite, check and the split commit (which is also this pull request's body) still named a GNUmakefile or a collision the root no longer keeps.

Now check and execute work the follow-ups out from the plan's entries as they stand, as #600 did for the read-across lines, and plan no longer stores them.

What

  • _follow_ups_as_it_stands(plan, source, names) runs follow_ups_for over the plan's entries as they stand.
    • It runs _predict_collisions over their root paths, and cross_leg_references' git grep over the source.
    • Entries that check already flags plan-unsafe-path are left out, so a NUL never reaches git grep.
    • A new _attributes_link(tree) reads whether the root .gitattributes is a link, in one way for plan, check and execute.
  • check prints the list through _print_what_will_happen.
  • execute works it out in cmd_execute, after the refusals and before any leg exists. It hands the list to _commit_the_split through a new keyword, follow_ups, which has no default.
  • plan no longer writes follow_ups:. A comment in the plan says where the follow-ups come from now. plan still prints its follow-ups (N): list, as before.
  • Removed:
    • _plan_follow_ups;
    • the follow-up items in _plan_values, since they are the tool's own text now, not plan values;
    • the unused SPLIT_MESSAGE.

A plan written before this change

Its stored follow_ups: list is refused by name, under the existing plan-bad-follow-ups. An absent key, a bare one and [] pass.

Docs

  • README's line on the read-across files now says they are in the adoption's follow-ups. The handbook's marker for README's Adopting section is hashed again, from a7154cc3 to ab85742f.
  • Two docstrings in scripts/shape_materialize.py now say the same. No code changes there.
  • No --help text changed, so docs/cli.md is untouched.

Case 1 of the issue: a kept makefile/ directory

The user-facing change, for the release notes

A plan written before this change whose follow_ups: holds items fails check once, until the key is deleted. The tool no longer carries follow-up items added by hand into the split commit or the pull request.

Proof

Measured on main 3add78e1c, before the change

Each case is a probe through lane openRepoShape-2's runner (8 passed). After each hand edit, check and the split commit's message both carried the stored list, which differed from what a fresh plan says when its rules give the edited answer directly.

Hand edit Stale text in check and the split commit What a fresh plan says
a kept GNUmakefile moved to the code leg "GNU make at the root reads the source's GNUmakefile..." "the root Makefile wires CONTRACTS_DIR..."
Makefile and GNUmakefile kept, with GNUmakefile moved to the code leg the CONTRACTS_DIR line and the Makefile collision line both still name GNUmakefile neither names it
a GNUmakefile/ question answered root "the root Makefile wires...", naming no directory GNU make stops at GNUmakefile/
a kept Makefile moved to the code leg (the issue had not measured this one) "merge shape/Makefile into Makefile" no such line, and the split's shape/ held only README.md

Rows

New file: tests/test_adopt_follow_ups_as_the_plan_stands.py, 11 rows.

  • One row per hand edit above: after the edit, check and the split commit's message each equal a fresh plan's list.
  • The plan file stores no follow-ups.
  • check refuses an old plan's list. execute refuses it before any leg exists, and the same plan adopts once the key is deleted.
  • Two controls: an empty list and a bare key both pass.
  • All 9 first rows fail on main's adopt-project.py, with the restore checked by sha256.
  • Two more, from the fix round for RV1312:
    • test_an_entry_git_cannot_be_handed_is_read_in_no_follow_up: a code file and a spec directory whose names hold a NUL give check's two plan-unsafe-path findings, exit 1, and no traceback. It fails when the filter in _follow_ups_as_it_stands is deleted (RV1312's M5), with ValueError: embedded null byte.
    • test_a_command_line_git_cannot_be_run_with_is_a_search_by_hand: one code entry of 140000 characters gives check's finding, exit 1, and no traceback. It fails on the code before the fix round with OSError: [Errno 7] Argument list too long.

Moved: about 18 test files no longer read the stored list. They read plan's printed list or check's instead, through a shared helper, printed_follow_ups, in tests/conftest.py.

Case 1:

  • tests/test_adopt_make_reads_first.py's makefile-directory row moves to the directory's form.
  • A new test_only_a_kept_file_is_merged_into, with rows a-file and a-directory, pins that only a kept file is told it waits to be merged.
  • The moved row and a-directory both fail on the old code.

Runs at this head

Every run went through lane openRepoShape-2's runner: a stub gh, a blank git identity and global config, no ssh, no LANES_* variable, and CI's git-filter-repo 2.47.0.

Files Result
the new file 9 passed
14 adopt files that cover follow-ups 594 passed, and 2 skipped; the 6 failures were fixed, then 88 passed for test_adopt_late_failure.py
the execute refusals, submodules, the end-to-end rows, and update-shape merged-away 398 passed
11 docs and hygiene files, test_cli_reference.py and test_readme_sections.py among them 733 passed
tests/test_shape_doctor.py and tests/test_scaffold_leg_path_collisions.py 550 passed, and 3 skipped (Windows-only rows), at 19bfae3f and again at 55955d6a
case 1's files: test_adopt_make_reads_first.py, test_adopt_make_bootstrap_followups.py, test_adopt_collision_make_reads.py and the new file 108 passed
13 other adopt files that mention follow-ups 1082 passed; the 2 failures were fixed, then 54 passed for their 2 files
the 27 in-process execute rows changed, with LANES_LANE set 27 passed

After the fix round, at 5235870f1:

Files Result
the new file 11 passed
test_adopt_make_bootstrap_followups.py, test_adopt_make_reads_first.py, test_adopt_collision_make_reads.py and test_adopt_contracts_dir.py 133 passed
test_adopt_entry_paths.py, and test_adopt_execute_refusals.py -k "unsafe or git_option or path" 79 passed, and 18 passed
test_repo_hygiene.py 101 passed
test_adopt_c_locale_bytes.py and test_adopt_printed_sentences.py 71 passed
tests/test_shape_doctor.py and tests/test_scaffold_leg_path_collisions.py 550 passed, and 3 skipped (Windows-only rows)

Lane 3's rulings on cases 2 and 3 (#1312 issuecomment-6769103751)

Both stay out of this PR.

Not in this PR

Notes

  • This branch hashes the handbook's marker for README's Adopting section again, so it conflicts there with any other README PR that touches that section. Land one at a time.
  • The branch was brought up to date with main f2a6527e9 by update-branch on 2026-11-10 at 16:13Z (e5012593a). RV1312 found that the merge changed none of this PR's lines: every file's patch-id is equal.

Review

  • RV1312, an independent Opus review at e5012593a by an agent that wrote none of this: READY AFTER FIXES (issuecomment-6773370489), with one SHOULD and six NITs.
  • The fix round, 83f9a16d0 and 5235870f1:
    • SHOULD-1: the NUL row above.
    • NIT-1: cross_leg_references catches an OSError from git grep, and says the spec directory is for the person to look for by hand, as a grep that exits 128 already does. Its row is the 140000-character one above.
    • NIT-2, NIT-3 and NIT-4: comments and docstrings only. With docstrings blanked, the AST of each source file equals its parent's.
  • RV1312b, the delta review of the fix round: READY, with no MUST and no SHOULD (issuecomment-6774526006). Its four NITs change nothing the tool does and are listed under "Not in this PR".

Lane 3 places this PR in v1.2.2's order by its READY time.

Lane: openreposhape-2 (openRepoShape-2)

🤖 Generated with Claude Code

Summary by Sourcery

Keep adoption follow-ups synchronized with edited plans by deriving them at validation and execution time instead of persisting them.

New Features:

  • Compute adoption follow-ups from the plan’s current entries during check and execute, keeping them consistent with hand-edited leg assignments.
  • Retain follow-up reporting in plan output without storing a follow_ups: list in the plan file.
  • Refuse non-empty legacy follow_ups: entries with clear remediation while allowing empty or bare keys.
  • Handle oversized search arguments without crashing and clarify Makefile follow-ups for kept directories.

Bug Fixes:

  • Prevent stale follow-ups from naming files, collisions, or merges that no longer apply after editing a plan.
  • Prevent unsafe or unexecutable paths from reaching follow-up searches.

Enhancements:

  • Pass computed follow-ups explicitly into split commit generation and centralize .gitattributes link detection.

Documentation:

  • Update README, handbook metadata, and shape materialization documentation to describe follow-ups as adoption output rather than stored plan data.

Tests:

  • Add coverage for recomputing follow-ups after plan edits, legacy-plan refusals, unsafe paths, search failures, and directory-versus-file Makefile wording.
  • Update adoption tests to validate printed and committed follow-ups instead of reading them from the plan.

Brett Heap and others added 3 commits November 10, 2026 13:06
…the plan as it stands, so after a hand edit of an entry's `leg:` neither `check` nor the split commit names a `GNUmakefile` or a `shape/Makefile` the root no longer keeps; `plan` stores no `follow_ups:`, and a plan that still holds a list is `plan-bad-follow-ups` (#1206)

`plan` wrote its follow-ups once, into `follow_ups:`, and `check` and the
split commit's message (the pull request's body) read that list back. Measured
on main 3add78e, after each hand edit below both carried what `plan`
wrote, not what a fresh `plan` of a source whose rules give the edited answer
says:

- a kept `GNUmakefile` moved to the code leg: the `CONTRACTS_DIR` line still
  said GNU make at the root reads it;
- `Makefile` and `GNUmakefile` kept, `GNUmakefile` moved: that line and the
  Makefile's collision line both did;
- a `GNUmakefile/` question answered `root`: "the root Makefile wires
  `CONTRACTS_DIR`", where GNU make stops at the directory;
- a kept `Makefile` moved to the code leg: "merge shape/Makefile into
  Makefile", over a split that wrote no `shape/Makefile`.

Now:

- `_follow_ups_as_it_stands(plan, source, names)`: `follow_ups_for` over the
  plan's entries as they stand, with `_predict_collisions` over the paths they
  send to the root (`_attributes_link`, read from the source tree as `plan`
  reads it) and `cross_leg_references`' `git grep`. `check` asks it in
  `_print_what_will_happen`; `cmd_execute` asks it before any leg exists and
  hands it to `_commit_the_split` (new keyword `follow_ups`).
- `plan` writes no `follow_ups:` (a comment says where they are) and still
  prints its list, from what the rules imply as before (#166's NEW-1).
- `_plan_follow_ups` is gone, and `_plan_values` no longer lists follow-up
  items: they are the tool's own text.
- An old plan's list is REFUSED BY NAME, not read as nothing: it is the one
  list a person was told they may write items into, and an item of theirs
  must not vanish from the pull request unsaid. `_follow_ups_findings` gives
  one `plan-bad-follow-ups` for any `follow_ups:` holding something (#293's
  per-type findings fold into it, since nothing iterates the key), and
  `FOLLOW_UPS_REMEDIATION` says the follow-ups are no longer stored, to delete
  the key, and to copy an own item out first for the pull request. Absent,
  bare and `[]` pass. No format version bump: the key was always optional.

Tests: new `tests/test_adopt_follow_ups_as_the_plan_stands.py` (9 rows, all
fail on main's code); `tests/conftest.py`'s `printed_follow_ups`; the readers
of the stored list moved to `plan`'s printed list or `check`'s; the #293 rows
of `tests/test_adopt_execute_refusals.py` and two rows of
`tests/test_adopt_template_values.py` follow the refusal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane: openreposhape-2 (openRepoShape-2)
…ead-across files and the collision lines are in the adoption's follow-ups, which the plan no longer stores, and not in its `follow_ups:` (#1206)

README.md's worked example said `plan` lists the files that read across the
root "in `follow_ups:`"; it now says "in its follow-ups", on the same line
count. The handbook's marker for README § Adopting an existing repository
records the section's new blob (a7154cc3 -> ab85742f). Two docstrings of
`scripts/shape_materialize.py` said the plan stores each collision
follow-up in `follow_ups:`; they say `check` and `execute` predict them again
from the plan as it stands. No code changes there, and no `--help` text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane: openreposhape-2 (openRepoShape-2)
…_files.py: the read-across lines and the linked `.gitattributes` follow-up are read from what `plan` and `check` print, since the plan stores no follow-ups (#1206)

Both rows read a follow-up out of the plan file's text, which holds none
since the previous commit. `test_plan_greps_for_a_spec_directory_outside_ascii`
still holds the plan's bytes equal under the C locale and UTF-8 mode, and now
counts two read-across lines in `plan`'s printed list under each, UTF-8
mode's naming both code paths (the C locale's stdout escapes a name outside
ASCII). `test_a_linked_attributes_file_checked_out_as_a_plain_file_adopts`
reads the symlink follow-up from `check`, under the same `core.symlinks=false`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Lane: openreposhape-2 (openRepoShape-2)
@brettheap brettheap added this to the v1.2.2 milestone Nov 10, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Recompute follow-ups from the plan as it stands, pass them into the split commit, refuse non-empty legacy lists, and correct Makefile guidance for a kept directory.

  • adopt-project.py L4218-4234, L7343-7407, L9534-9550 (+28 small edits)
  • scripts/shape_materialize.py L24-25, L1017-1026

Documentation

Update the adoption guide and handbook reference to describe follow-ups as output rather than stored plan data.

  • README.md L819
  • docs/handbook.html L1291

Tests

Update adoption tests to consume printed follow-ups and cover recomputation after plan edits, legacy-list refusals, unsafe paths, and directory-specific Makefile wording.

  • tests/conftest.py L961-973
  • tests/test_adopt_c_locale_bytes.py L50-51, L213-220, L229-240
  • tests/test_adopt_contracts_dir.py L46-47, L206
  • tests/test_adopt_e2e.py L58-66, L314, L471
  • tests/test_adopt_execute_refusals.py L445-504, L548-553, L575-582 (+4 small edits)
  • tests/test_adopt_follow_ups_as_the_plan_stands.py L1-356
  • tests/test_adopt_ignored_shape_files.py L916-918, L930-936
  • tests/test_adopt_late_failure.py L251-253, L271, L494
  • tests/test_adopt_leg_keys.py L44-45, L185-186, L215
  • tests/test_adopt_literal_names.py L43-44, L82-83
  • tests/test_adopt_make_bootstrap_followups.py L472-477, L493-498 (+4 small edits)
  • tests/test_adopt_make_reads_first.py L90-103, L185-188, L236-258 (+4 small edits)
  • tests/test_adopt_plan.py L19-20, L172-174, L616
  • tests/test_adopt_printed_sentences.py L52, L138, L270
  • tests/test_adopt_submodules.py L23-24, L809-810, L816-818
  • tests/test_adopt_template_values.py L363-366, L382-385 (+4 small edits)
  • tests/test_adopt_tracking_branch.py L61-62, L130-133, L144-147
  • tests/test_update_shape_merged_away.py L43-750 (5 small edits)

Tips and commands

Interacting with Sourcery

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

Customizing Your Experience

Access your dashboard to:

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

Getting Help

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-3, 2026-11-10T13:52:09Z) Lane 3's rulings on "Asked of lane 3" (cases 2 and 3 of #1206): both stay out of #1312. This answers lane 2's #473 issuecomment-6769085418.

… the Makefile follow-up names "the source's directory `makefile/`" as the path a disk that ignores case takes, and no longer says the two are merged, which a directory cannot be (#1206)

`_makefile_follow_up`'s `folded` branch read a kept `makefile/` as the twin
`makefile` and said the shape's Makefile is written "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". Nothing merges a Makefile
into a directory. The branch now asks whether the twin is kept as a directory
(`makefile/` kept, `makefile` not), names it "the source's directory
`makefile/`" through `_spelled`, and drops ", until the two are merged" for
it. The clause that follows already says GNU make stops at that directory and
what it takes (`_make_reads_first_clause`). A kept `makefile` FILE reads as it
did.

tests/test_adopt_make_reads_first.py: `written_as` has a `directory` form; the
`makefile-directory` row of `ANSWERED` expects it, with its comment and the
test's docstring moved; `test_only_a_kept_file_is_merged_into` asks a kept
`makefile` and a kept `makefile/` side by side. Both fail on the old code.

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

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-2, 2026-11-10T16:47:36Z) RV1312, the independent review of this PR at e5012593a: READY AFTER FIXES. It found no MUST, one SHOULD and six NITs. The reviewer is an Opus agent that wrote none of this PR. Its review follows as it wrote it.

Next: lane 2's fix round runs now, on this branch. It adds the row for SHOULD-1 and fixes the text of NIT-2, NIT-3 and NIT-4, and NIT-1 if time allows. NIT-5 and NIT-6 go into the body's "Not in this PR". A delta review follows the fix round.


Lane openRepoShape-2's independent reviewer, 2026-11-10. I wrote none of this PR. I reviewed what would land, git diff f2a6527e9 e5012593a.

Verdict: READY AFTER FIXES

The change does what #1206 asks, and I measured that rather than taking the body's word for it. check and execute now work the follow-ups out from the plan as it stands. They match a fresh plan after every hand edit the issue names, after the one the body adds, and after two more edits of my own. An old plan's stored list is refused by name, before any leg exists. Case 1 reads as the body says. The merge with main changed nothing, and every run I made passes.

One SHOULD remains. The guard that keeps a NUL out of the new git grep in check works, and it matters: without it, check ends in a traceback. But no row pins it. The rest are NITs.

Findings

SHOULD-1: no row pins the guard that keeps an unsafe entry path out of git grep

  • Where: adopt-project.py:7368-7376 (_follow_ups_as_it_stands).
  • What the code says: the comment and the PR body say that entries check flags plan-unsafe-path are left out, "so git grep is never handed it (a NUL in an argument is a ValueError before git runs)".
  • Measured (mutant M5): I deleted the if entry_path_problem(path) is None filter.
    • The PR's new file plus tests/test_adopt_entry_paths.py: 88 passed.
    • tests/test_adopt_execute_refusals.py -k "unsafe or git_option or path": 18 passed, 166 deselected.
    • No row of the PR kills the mutant.
    • My probe P3 kills it. That is a plan with a spec entry "a\x00b/" and a code entry "c\x00d". Under the mutant, check ends in a traceback, ValueError: embedded null byte, raised at cmd_check 14731 -> _print_what_will_happen 11323 -> _follow_ups_as_it_stands 7378 -> follow_ups_for 4570 -> cross_leg_references 4218, before any finding is printed.
    • At this head the same plan is two plan-unsafe-path findings, exit 1, and no traceback.
  • Why it matters: main's check ran no git grep, so this is a regression path the PR opens and then closes with an unpinned guard.
  • Fix: add a row. For example, in tests/test_adopt_follow_ups_as_the_plan_stands.py, hand-edit one code entry and one spec directory to hold \x00, and assert that check exits 1 with FINDING plan-unsafe-path for each and no Traceback.

NIT-1: check can still end in a traceback where main's did not

  • Where: adopt-project.py:4214-4219 (cross_leg_references), now reached from check (11324) and execute (17521).
  • Measured (probe P4): one hand-edited code entry of 140000 characters ends check in OSError: [Errno 7] Argument list too long: 'git', exit 1, before any finding is printed.
    • main's check ran no git grep, so it gave findings, exit 1.
    • execute refuses that plan first (REFUSED plan-empty-entry, no traceback).
  • Not measured: many real code entries, whose arguments add up past the kernel's limit. The command line would be the same in check and execute.
  • Why a NIT: the input is absurd.
  • Fix: catch OSError around the subprocess.run and return _search_by_hand(named, ...), as a grep that exits 128 already does.

NIT-2: text the PR leaves stale

NIT-3: the filter leaves out more entries than its comment says

  • Where: adopt-project.py:7368-7376.
  • What differs: the filter leaves out every entry with an entry_path_problem, root and drop entries included. _unsafe_path_findings (10333-10345) judges only entries that are not root or drop. So a kept root entry with such a name is in no finding and in no follow-up.
  • Effect: none on the output, by reading. No such name can be a shape path, a GNU make name or CODEOWNERS.
  • Fix: say so in the comment, or apply the filter only to entries that are not root or drop.

NIT-4: case 1's comment holds only for makefile/ exactly

NIT-5: duplicated test helpers

  • printed_by_plan (tests/test_adopt_follow_ups_as_the_plan_stands.py:83-90) copies conftest's new printed_follow_ups without its count check.
  • The parse of check's follow-up: lines is written out five times: the new file, test_adopt_e2e.py:60, test_adopt_execute_refusals.py:549, test_adopt_make_bootstrap_followups.py:493 and test_adopt_ignored_shape_files.py:933.
  • Fix: use one helper in conftest for each.

NIT-6: the C-locale git grep row is weaker now

  • Where: tests/test_adopt_c_locale_bytes.py:229-240.
  • What changed: the plan bytes no longer hold the follow-ups, so text == in_utf8 says nothing about git grep. Under the C locale only the count (2) of read-across lines is asserted. The two paths are checked only in UTF-8 mode.
  • Fix: decode the C-locale lines' escapes, or compare them with check's.

What I measured

Every pytest run below went through lane 2's runner, one at a time:

  • the runner stubs gh, blanks git's identity and global config, makes ssh impossible, unsets every LANES_* variable and puts git-filter-repo 2.47.0 on PATH;
  • the bench has git 2.43.0 and /usr/bin/python3 3.12;
  • the head is e501259, and the tree was clean (dirty=0) for runs 1-3, the probes and run 4.
Run What Result
1 tests/test_adopt_follow_ups_as_the_plan_stands.py 9 passed in 47.17s
2 test_adopt_make_bootstrap_followups.py, test_adopt_make_reads_first.py, test_adopt_collision_make_reads.py, test_adopt_contracts_dir.py 133 passed in 119.31s
3 test_adopt_plan_against_its_source.py, test_adopt_relative_submodule_url.py, test_adopt_plan_value_order.py, test_adopt_partial_clone_source.py 161 passed in 299.74s
4 test_adopt_execute_refusals.py and test_adopt_make_reads_first.py, -k on the follow-up and case-1 rows, with L2_KEEP_LANE=1 (LANES_LANE set) 47 passed, 173 deselected in 117.98s (lane=openRepoShape-2)
probes my own pytest file, kept outside the worktree, P1-P6 7 passed in 23.28s

Facts

  • The merge: what would land equals the PR's own change (git diff 3add78e1c 55955d6ae). All 22 files have the same git patch-id --stable, so the merge with main needed no resolution.
  • The handbook marker: readme_fingerprint (tests/test_repo_hygiene.py's own function) of README's "Adopting an existing repository" segment is ab85742fcd7d8c18d1f5ea7aa438d9aec0882668. That is the marker's new hash.
  • Case 1 (probe A): I ran _makefile_follow_up of f2a6527 and of this head, in-process, over 176 root sets built from Makefile, makefile, MAKEFILE, MakeFile, GNUmakefile and each one's directory form.
    • 139 sets read the same; 37 differ.
    • Every set that differs keeps a directory twin. Every set of files only reads exactly as before, so a kept makefile file is unchanged.
    • 15 of the 37 keep a file twin as well (for example MAKEFILE/ beside makefile). There the directory wins twins[0] and the merge clause goes. Such a root is case twins, which check refuses anyway (plan-case-twins).
  • P1, an unedited plan with many follow-ups: a source with contracts/, specs/, 10 code files naming specs/, Makefile, AGENTS.md, CODEOWNERS and .gitignore.
    • It gives 17 follow-ups, among them "... and 2 more", the CONTRACTS_DIR line, CODEOWNERS, four collisions and the review line.
    • plan's printed list, check's list and the split commit's list are equal, in the same order and words.
  • P2, two more hand edits:
    • contracts/ spec -> root: 19 follow-ups, now with the four contracts/*-pin.yaml and repository-naming.yaml collisions, and without the CONTRACTS_DIR line or the contracts/ read-across.
    • src/ code -> spec: 7 follow-ups.
    • Each list equals a fresh plan of a source whose rules give the edited answer (policy_sending), and each differs from the list before the edit.
  • P3, odd hand-edited entries: path: null, no path, path: 5, NUL paths, ../x, ../outside/, /etc/, -e/, and leg: [code].
    • check exits 1 with findings and no traceback.
    • One bad code entry, ../x, turns every read-across line into "git could not search ... git grep exited 128". That is acceptable beside the finding.
    • git grep reads the commit, never the disk.
  • P4: see NIT-1.
  • P5, a moved source: check's first finding is plan-stale, and the follow-ups print with no traceback. execute says REFUSED plan-stale.
  • P6, a moved source and an old follow_ups: list:
    • check lists plan-stale first and plan-bad-follow-ups exactly once, and never prints the stored item.
    • execute says REFUSED plan-stale. Once the source is put back, it says REFUSED plan-bad-follow-ups.
    • So the refusal sits after 106f92f's ordered list in both commands, and nothing is reported twice.

Mutants

Each mutant was applied in my worktree and restored with git checkout -- adopt-project.py. After every one the sha256 was 47f0dfcd...632c6 again, and the tree was clean after the batch.

Mutant What it changes Result
M0 main's adopt-project.py under this head's rows 11 failed, 3 passed: all 9 rows of the new file, plus make_reads_first's a-directory and makefile-directory. The body's "all 9 fail on main" and "the moved row and a-directory fail on the old code" hold.
M1 check prints a stored list where one is there KILLED, 8 failed
M2 the refusal accepts any list KILLED, 7 failed
M3 execute hands follow_ups=[] KILLED, 5 failed (the 4 edit rows and the old-plan execute row)
M4 case 1's directory test inverted KILLED, 10 failed
M5 no entry_path_problem filter SURVIVES the PR's rows (see SHOULD-1)
M6 the recomputed collisions get attributes_link=False KILLED, 1 failed (test_a_linked_attributes_file_checked_out_as_a_plain_file_adopts)
M7 a bare key and [] are refused too KILLED, 4 failed
M8 the recomputed list is sorted KILLED, 5 failed

What I only read

  • Who reads and writes follow_ups:: nothing still reads a stored list but _follow_ups_findings, and nothing writes one. I grepped adopt-project.py, shape-doctor.py, scripts/, docs/, templates/ and tests/. The removed _plan_follow_ups and SPLIT_MESSAGE have no users left.
  • The order in check and execute: _follow_ups_as_it_stands runs after open_source, _refuse_a_partial_clone_short and all the findings in check (inside _print_what_will_happen). In execute it runs after every refusal and after _confirm, before any leg. Both commands run under _lazy_fetch_off. So a source that is gone, unreadable or a partial clone is refused before it.
  • No format version bump: right. adopt-project.py writes schema_version: 1 (4637) and never reads it. Without follow_ups:, a plan is the same schema 1 it always was.
  • The finding and its remediation are accurate. Absent, bare and [] pass; anything else is one finding.
  • An unedited plan: check equals plan for a source with no submodule. For an unedited plan, the only gap between plan's implied and the stored entries is the defaults with_defaults writes (drop only), and those change no follow-up. Submodule questions read leg: null until they are answered, as the docstring says.
  • The rows: they assert no wording that depends on the Python version (_read_as uses the repr of a number or a text, which is stable). They are not tied to the git version. The follow-ups are now read from stdout rather than from the UTF-8 plan file, which assumes a UTF-8 stdout; CI's Linux runners have one.
  • The docs: README.md:819 is accurate.

Checks not done

  • tests/test_shape_doctor.py and tests/test_scaffold_leg_path_collisions.py (the body reports 550 passed, 3 skipped).
  • The rest of the suite.
  • CI's state on this head.
  • SonarCloud: the MCP server did not connect.

Lane: openreposhape-2 (openRepoShape-2)

…and a spec directory whose names hold a NUL is `check`'s two `plan-unsafe-path` findings, exit 1, and no traceback, pinning the guard `_follow_ups_as_it_stands` keeps so `git grep` is never handed one (#1206); adopt-project.py and scripts/shape_materialize.py: comments and docstrings only, five stale texts and two comments corrected (RV1312's NIT-2, NIT-3, NIT-4)

RV1312's SHOULD-1: deleting the `if entry_path_problem(path) is None` filter passed every row of the PR, yet `check` then ended in `ValueError: embedded null byte` (cross_leg_references, `git grep`). The new row fails under that mutant, and under each half of it (the filter for code entries only, for spec entries only).

No code line changes: with docstrings blanked, the AST of adopt-project.py and of scripts/shape_materialize.py equals the parent's, and no message a tool prints changes.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Lane: openreposhape-2 (openRepoShape-2)
… the person to look for by hand when `git grep` cannot be run at all, an `OSError` such as one code entry too long for the kernel's one-argument limit, as it does for a grep that exits 128, so `check` prints its findings and exits 1 and no longer ends in a traceback; test_adopt_follow_ups_as_the_plan_stands.py: a row with one hand-edited code entry of 140000 characters (#1206, RV1312's NIT-1)

On main `check` ran no `git grep` and printed findings for such a plan; at e501259 it ended in `OSError: [Errno 7] Argument list too long: 'git'` before any finding. `execute` already refuses the plan first (`plan-empty-entry`). The new row fails on the parent's adopt-project.py with that OSError and passes with this change.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Lane: openreposhape-2 (openRepoShape-2)
@sonarqubecloud

Copy link
Copy Markdown

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-2, 2026-11-10T17:35:55Z) RV1312b, the delta review of the fix round (83f9a16d0 and 5235870f1), reads READY, with no MUST and no SHOULD.

  • The round (for RV1312's SHOULD-1, NIT-1, NIT-2, NIT-3 and NIT-4): the NUL row pins the filter that keeps an unsafe entry path out of git grep, and cross_leg_references says an OSError from git grep as a search by hand, as it says a grep that exits 128. 83f9a16 changes comments and docstrings only.
  • The writer's runs at 5235870f1: the new file 11 passed, the four follow-up files 133, test_adopt_entry_paths.py 79, the execute refusals 18, test_repo_hygiene.py 101, the C-locale and printed-sentences files 71, and the doctor pair 550 passed and 3 skipped.
  • CI at 5235870f1: SonarCloud, package and tests-git-bash passed; tests is running. Lane 2 marks this PR ready when it passes, and then asks lane 3 for its place in v1.2.2's order.
  • RV1312b's four NITs change nothing the tool does. The body lists them under "Not in this PR", with RV1312's NIT-5 and NIT-6.

RV1312b's review follows as the reviewer wrote it. The reviewer is an Opus agent that wrote none of this PR.


RV1312b: delta review of PR #1312 (#1206), fix round e501259..5235870, by rv1312b

Lane openRepoShape-2's independent delta reviewer, 2026-11-10. I wrote none of this PR. I reviewed git diff e5012593a 5235870f1: 83f9a16 (SHOULD-1's row, NIT-2/3/4 texts) and 5235870 (NIT-1). The worktree was detached at 5235870, clean, adopt-project.py sha256 82e9452e...3032891 before and after every mutant.

Verdict: READY

The round does what it says. SHOULD-1's row kills RV1312's M5 at the head. NIT-1's catch turns the E2BIG traceback into a by-hand line that reads as the exit-128 one does, and its row fails on 83f9a16's code and passes at the head. 83f9a16 changes no code, and 5235870's only code change is the one new except OSError handler, both measured on the AST. Every run passes. The four findings below are NITs; none blocks landing.

Findings

NIT-A: the SHOULD-1 row's read-across assertion also matches a by-hand line

  • Where: tests/test_adopt_follow_ups_as_the_plan_stands.py:323-324 (test_an_entry_git_cannot_be_handed_is_read_in_no_follow_up).
  • Measured (mutant MB6): I deleted the entry_path_problem filter AND widened the new catch to except (OSError, ValueError). The row passes (2 passed, 9 deselected). Under MB6 the NUL code entry reaches every git grep, so every read-across line becomes _search_by_hand's line, and that line says "each must read across the assembly root once ...", which the row's filter "must read across the assembly root" in item accepts.
  • So: the row pins "no traceback", which is what SHOULD-1 asked, but not what its docstring says: "the code file that names contracts/ still gets its read-across line".
  • Fix: match the real line, for example item.endswith(...) on the reader's name, or add and not item.startswith("git could not search").

NIT-B: NIT-1's row overflows the argument limit only on a 4 KiB-page Linux

  • Where: tests/test_adopt_follow_ups_as_the_plan_stands.py:342 ("a" * 140000).
  • Measured here: page size 4096; a subprocess with one argument of 131071 characters runs, and 131072 and 140000 raise OSError errno 7. Linux's per-argument limit is 32 pages.
  • Read, not measured: on a 16 KiB or 64 KiB page kernel (some arm64 hosts) the limit is 512 KiB or 2 MiB, and macOS has no per-argument limit (1 MiB in all). There git grep would run, and the row would fail at line 355 (len(by_hand) == 2). CI is Linux x86_64 only (ci: run the test suite on Linux only #597), so it passes there.
  • Fix: take the length from the host, for example max(140000, os.sysconf("SC_ARG_MAX") + 1) where os.sysconf exists, or say in the docstring that the row assumes 4 KiB pages.

NIT-C: two texts name a failing grep but not one that cannot be run

  • adopt-project.py:17546-17549 (cmd_execute, written in 83f9a16, before NIT-1): "A git grep that exits other than 0 or 1 stops nothing: it is a follow-up line that says to look by hand". True, but since 5235870 a grep that cannot be run at all is such a line too.
  • adopt-project.py:4195-4197 (cross_leg_references' docstring): "A grep that FAILS is said ..., and so is one that cannot be asked". The third case, one the kernel will not run, is only in the new inline comment.
  • Fix: add "or cannot be run (OSError)" to each.

NIT-D: NIT-4's comments say "no clause" where another make name gives one

  • Where: adopt-project.py:4494-4498 (docstring) and 4519-4522 (comment).
  • Read: "MakeFile/ and MAKEFILE/ get no clause". first comes from _make_reads_first, which walks GNU_MAKE_READS without folding case. So a root that also keeps GNUmakefile or makefile does get a clause, about that name. RV1312's NIT-4 said "a root that keeps only MakeFile/ or MAKEFILE/".
  • Fix: "get no clause of their own", or put "only" back.

The checks of the brief

  1. SHOULD-1: done, measured. The new row passes at the head (run 1). MB5 (RV1312's M5 at the head: the filter deleted) fails it: ValueError: embedded null byte, a traceback from main (log rb/mut-MB5.log). The new except OSError does not hide it: ValueError is not an OSError.
  2. NIT-1: done.
    • Catch (read): except OSError wraps only the subprocess.run, whose argument list is built inside the try; _path_argument raises UnicodeEncodeError, a ValueError, never an OSError. Nothing else is caught.
    • Wording (measured): the line is _search_by_hand(named, ...), as the exit-128 branch's: "git could not search the files moving to the code leg for contracts/ (git grep could not be run: [Errno 7] Argument list too long: 'git'); find the ones that name it by hand: ..." (rb/mut-MB3.log). The exit-128 one says "(git grep exited 128: <git's words>)". Both hold READ_ACROSS, so holds_a_read_across and the mounts sentence treat them alike.
    • Row on 83f9a16 (measured, M83): git show 83f9a16d0:adopt-project.py over the worktree's file: the row fails with OSError: [Errno 7] Argument list too long: 'git' at cross_leg_references line 4218; the NUL row passes. At the head it passes (run 1).
    • Anything that now passes silently (read): no. Every OSError becomes a visible line, naming the error, in check's output and in the split message. Its other kinds (FileNotFoundError for git missing or the source gone, PermissionError, a fork's BlockingIOError) are now lines too where they were a traceback. Git missing or the source gone is refused earlier by open_source. A source deleted between open_source and this call is a race, and execute then stops at its next git call on the source. I did not measure that. str(error) names only 'git' for E2BIG. For a missing cwd it would name the source's path raw, but that case is the same race.
  3. NIT-2, NIT-3, NIT-4: done.
    • No code line changes in 83f9a16 (measured): rb/astcmp.py parses each file from git show, blanks every docstring, and compares ast.dump. adopt-project.py and scripts/shape_materialize.py are equal at e501259 and 83f9a16.
    • Texts (read):
      • holds_a_read_across (4303-4308) is right. Its one caller, contracts_from_code_leg, is called at 11352 (check) and 17909 (execute's split message), both with _follow_ups_as_it_stands' list. plan (7139) does not call it.
      • _predict_collisions (7297-7299) is right.
      • _not_a (9713-9714) is right: _plan_key_findings (9719) is its only caller (9741-9771), and the words match its f-string.
      • The cmd_execute comment is right but incomplete (NIT-C).
      • shape_materialize.py:1020-1022 is right.
      • NIT-3's comment (7391-7397) is right. I read _misread and _refused_by_policy: they refuse the empty path, LF, a trailing CR, NUL, a lone surrogate, whitespace alone, control and line-separator characters, bytes that are not UTF-8, and a leading -. None can be a shape path or a directory above one, GNUmakefile, makefile, Makefile, or CODEOWNERS.
      • NIT-4's text is right apart from NIT-D.
  4. New risks: done, measured. I unwrapped every try/except OSError on both sides (rb/astcmp2.py). Then 5235870 and 83f9a16 are equal ASTs for both files, and the count of such handlers goes 45 -> 46 in adopt-project.py. So the git grep command line is unchanged, and where no OSError happens the output is byte for byte the code it was. Runs 1 and 2 pass.
  5. Mutants: done, measured. Each was applied in my worktree, run with -k "an_entry_git_cannot or command_line_git_cannot", restored with git checkout -- adopt-project.py, and followed by a sha256 check (OK every time) and a clean git status.
Mutant What it changes Result
M83 83f9a16's adopt-project.py (no NIT-1) KILLED: 1 failed (the E2BIG row), OSError traceback
MB1 except FileNotFoundError (too narrow) KILLED: 1 failed (the E2BIG row), OSError traceback
MB2 the handler returns out (drops every spec directory silently) KILLED: 1 failed, assert 0 == 2 at line 355
MB3 the handler breaks (stops after the first spec directory) KILLED: 1 failed, assert 1 == 2 at line 355
MB5 RV1312's M5 at the head (no entry_path_problem filter) KILLED: 1 failed (the NUL row), ValueError traceback
MB6 MB5 plus except (OSError, ValueError) SURVIVES: 2 passed (NIT-A)
  1. Runs: done, measured. All went through W/tools/run-l2.sh, one at a time, at head 5235870 with dirty=0 and lane=unset.
Run What Result
1 rv1312b-run1: tests/test_adopt_follow_ups_as_the_plan_stands.py 11 passed in 45.35s (END 17:31:36Z, rc 0)
2 rv1312b-run2: tests/test_adopt_c_locale_bytes.py, tests/test_adopt_printed_sentences.py 71 passed in 80.01s (END 17:32:57Z, rc 0)
muts rv1312b-mut, six runs of the two new rows, as in the table above see the table

The writer's counts agree with mine where we ran the same thing: run 1 11 passed (theirs run 5), run 2 71 passed (theirs run 7).

Checks not done

  • The doctor pair (tests/test_shape_doctor.py, tests/test_scaffold_leg_path_collisions.py): skipped as the brief says. The writer reports 550 passed, 3 skipped at 5235870. I did not see that run.
  • An L2_KEEP_LANE=1 run: not needed. Both new rows run the tool through run_script (a subprocess), not main() in-process.
  • The rest of the suite, CI's state on 5235870, and SonarCloud (the MCP server did not connect).
  • NIT-B on a non-4 KiB-page kernel or macOS: read only.
  • NIT-5 and NIT-6: out of this round, as the brief says.

Lane: openreposhape-2 (openRepoShape-2)

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

sourcery-ai Bot commented Nov 10, 2026

Copy link
Copy Markdown

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

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

This was referenced Nov 10, 2026

This branch has not been deployed

No deployments
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