Skip to content

tests/test_adopt_plan_and_remote_paths_spelled.py: the seven execute rows that reach _require_filter_repo skip without git filter-repo, as each row's reaches_filter_repo says, and a check with the tool hidden holds the guard to them (#1286) - #1323

Open
brettheap wants to merge 2 commits into
mainfrom
fix/1286-filter-repo-guard-plan-rows

Conversation

@brettheap

@brettheap brettheap commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1286

Milestone v1.2.2: v1.2.1 is frozen, and lane 3 places this PR by its READY time.

Base: f39c6707a (f39c670), origin/main when the branch was made (lane 1 saw the same commit there at 18:55Z). Head: 1cf7a37a2 (1cf7a37), two commits on it: 3bec11599 (the change) and 1cf7a37a2 (the fix round for r1286a's review, below). The PR changes one test file and nothing else: tests/test_adopt_plan_and_remote_paths_spelled.py, blob 536b5a5cd to c33740e09, +127 -20. No tool, no template, no tests/conftest.py, no doc. This body is ASCII, apart from the footer's emoji.

What

On a machine without git filter-repo, test_the_plan_is_named_as_a_path_is failed every character of seven execute rows: 35 ids on f39c6707a, each with stderr beginning REFUSED filter-repo-missing: . The issue measured 30 (six rows) at 4552efa6a; #1225 (dc9a0bcc7) added the row org-too-long, whose execute reaches the tool too, which makes the seventh. The seven rows: uncovered-plan, split-branch-taken, assembly-a-windows-device-name, org-with-two-hyphens, org-too-long, topic-too-long and plan-not-the-source. No other test of the file failed without the tool: its 14 other filter-repo ids already carry @needs_filter_repo and skip.

Now those 35 ids skip with the guard's own reason, git filter-repo is not installed: `pip install git-filter-repo`, and every other id keeps its outcome. The 80 check ids and the 40 ids of the eight execute rows refused before the tool still run without it, and pass.

The issue's three boxes:

  1. Without the tool the file gives 0 failed: 170 passed, 49 skipped (main: 35 failed, 139 passed, 14 skipped).
  2. With the tool the file keeps every id's outcome: 219 passed (main: 188 passed). The 31 new ids are the check's.
  3. A mutant that guards every execute row, with needs_filter_repo on CASES or on the test function, fails ids of the new check, with the tool hidden and with it present: 8 for a guard on every execute row in CASES (M2 below), 24 for @needs_filter_repo above the test function (K6 below).

Why

Where execute asks for the tool. cmd_execute (adopt-project.py, line 17395 on base) calls _require_filter_repo() at line 17414. Before it come Plan.load, _refuse_a_mistyped_plan, plan.names(), _checked_org_and_id, _work_root, _refuse_an_unwritable_work_dir, plan.open_source, _refuse_a_partial_clone_short and NamingPolicy.load. After it come _against_its_source (plan-not-the-source), _checked_plan_values, _repository_urls with _what_cannot_be_held (adopt-bad-project-name, adopt-org-too-long, adopt-bad-org, adopt-topic-too-long), _refuse_what_check_finds (plan-uncovered) and _refuse_a_branch_in_the_split_branchs_way (plan-split-branch-taken). cmd_check never calls it: _require_filter_repo() has one caller. So the property is whether execute refuses the row's plan only after line 17414. That is exactly the seven rows that failed, and no check row.

How the guard is chosen.

  • Row gets a field, reaches_filter_repo: bool = False, set True on the seven rows. A comment above ROWS names the functions that refuse them, each after _require_filter_repo.
  • guarded(row, command) gives (needs_filter_repo,) for an execute row that reaches the tool, and () otherwise.
  • CASES passes that as each pytest.param's marks. There is no list of ids: a new row states the field, and the check below holds it to the tool.

Rejected.

  • row.local (under --local-remote-dir): it holds 2 of the 7.
  • "check lists it as a finding" (check exits 1): it holds the 7 and mistyped-plan too, whose execute is refused by _refuse_a_mistyped_plan before the tool. One row too wide.
  • A guard on every execute row: it skips the 40 ids of the eight rows that must run without the tool. That is the issue's third box, and M2 below.
  • A run-time skip when stderr says filter-repo-missing, the issue's other option: it would also skip a row that execute wrongly started to refuse filter-repo-missing after a reorder of cmd_execute, so a regression would read as a skip. It also spends the child before it decides.
  • Reading the order out of cmd_execute at collection time: too clever for a test file, and it breaks on any refactor of that function.

The check: test_the_guard_skips_the_rows_that_reach_filter_repo_and_no_other. It runs on every machine this file runs on, with the tool present or not.

  • Its params are CASES with their marks taken off, and whether needs_filter_repo is among the marks of the case or of test_the_plan_is_named_as_a_path_is (needs_filter_repo.mark in both), so it reads needs_filter_repo on CASES or on the test function, and it never skips with it.
  • It runs each of the 31 CASES rows once, at a plain plan path, with the tool hidden from the child.
  • A guarded row must exit 2 with a line beginning REFUSED filter-repo-missing: .
  • Every other row must say exactly what test_the_plan_is_named_as_a_path_is asserts of it with the tool: its exit, no Traceback, and its lines.
  • So it fails when needs_filter_repo on CASES or on the test function is too wide (an execute row or a check row guarded but refused before the tool), and when it is too narrow (a row that reaches the tool left unguarded). It reads no other guard (Known limits).
  • run_the_row and assert_the_row_says hold what the old test body did, so the check and the test run each row with the same arguments and assert the same lines. test_the_plan_is_named_as_a_path_is keeps its ids and its asserts.

How the check hides the tool: the module fixture no_filter_repo.

  • It builds the child's PATH from the session's, less each entry where shutil.which("git-filter-repo", path=entry or os.curdir) finds the tool: an empty entry is read as the current directory, as git reads it.
  • Where what is left finds another git than the session's (a package that installs both in one directory, with no other git on PATH, or with another one later), it puts a directory of its own first, holding a link to the session's git.
  • It asserts shutil.which finds no tool on the new PATH, then runs git filter-repo --version on it, as _require_filter_repo does.
  • It skips only where git still finds the tool in its own exec path, which no PATH hides.
  • CI's tests job installs the tool with pip into setup-python's environment, and its git is the runner's. On this bench git --exec-path holds no git-filter-repo.

Measured

Each run used the probe environment: a stub gh first on PATH, GH_TOKEN=bogus-w1286a (bogus-w1286b in the fix round), an empty GH_CONFIG_DIR, GIT_CONFIG_GLOBAL set to the null device, GIT_SSH_COMMAND=false, EMAIL set to a test address, LC_ALL=C.UTF-8 and env -u LANES_LANE. pytest 9.1.1 on CPython 3.12.3, git 2.43.0.

Tool hidden. The bench has git-filter-repo in one user-local bin directory on PATH (it is in PATH twice). The pytest process was given a PATH without every entry that holds a file named git-filter-repo. In that environment:

  • shutil.which("git-filter-repo") is None;
  • git --version says git version 2.43.0, and the system python3 runs;
  • git --exec-path holds no git-filter-repo;
  • git filter-repo --version exits 1 (git: 'filter-repo' is not a git command).

With the tool present, git filter-repo --version exits 0 (a40bce548d2c).

Each run's --junitxml was read by a script into one line per test id (outcome, and the skip reason or the first stderr line of a failure). A second script compares main's ids with head's (main's from the writer's run, head's from the fix round's, which the review's id tables for 3bec11599 match).

file, f39c6707a (main) vs 1cf7a37a2 (head) main head
tool hidden 35 failed, 139 passed, 14 skipped in 77.56s 170 passed, 49 skipped in 77.38s
tool present 188 passed in 139.73s 219 passed in 129.11s

By test id, tool hidden:

  • 188 ids on both, 31 on head only, all test_the_guard_skips_the_rows_that_reach_filter_repo_and_no_other[...], all passed.
  • failed -> skipped: 35, each main stderr beginning REFUSED filter-repo-missing: , and each head skip reading git filter-repo is not installed: `pip install git-filter-repo`.
  • No other id changed outcome, and the 14 skips that were already there keep their reason. The compare reports unexpected: 0.

By test id, tool present: 188 ids on both, 31 on head only (the check's, all passed), and changed: {}, unexpected: 0.

test_the_plan_is_named_as_a_path_is on head, tool hidden: 120 passed, 35 skipped. The 80 check ids pass. The execute ids that pass are 5 each of mistyped-plan, plan-wrong-kind, plan-wrong-kind-a-placement-plan, plan-unsupported-mode, plan-unreadable, plan-no-source, plan-bad-id-with-a-space and plan-bad-id-a-number. The check's 31 ids take about 15 to 20 s on this bench.

Mutants

Mutants ran in a scratch clone of this repository, checked out detached at 1cf7a37a2 (M1 to M6 first at 3bec11599, by the writer; the review's K6 and K7, and the fix round's re-run of M1 to M5, at 1cf7a37a2). Each mutant was applied alone by a script that asserts its anchor occurs once. M1 to M5 were run twice, tool hidden and tool present, over the node ids of the two tests that read ROWS, CASES and guarded: ::test_the_plan_is_named_as_a_path_is and ::test_the_guard_skips_the_rows_that_reach_filter_repo_and_no_other, 186 ids. No other test of the file reads what the mutants change.

Before and after each mutant, a script wrote the file back from git cat-file blob HEAD:tests/test_adopt_plan_and_remote_paths_spelled.py, and git hash-object printed c33740e090c3, the blob at 1cf7a37a2 (c33740e090c3862f97158abfb95dd5fed8371dbd), equal=True every time, equal=False never: 10 lines for M1 to M5 (before and after each), 2 each for K6 and K7, and 3 for N1r and N2r together. The clone ended with an empty git status --short, and git hash-object of its file and of the PR's worktree file both print c33740e090c3862f97158abfb95dd5fed8371dbd. The PR's worktree was never mutated.

id mutant tool hidden tool present killed
M1 the guard dropped: guarded returns () 42 failed, 144 passed in 100.48s: the test's 35 ids, and the check's 7 rows that reach the tool 7 failed, 179 passed in 119.02s: the check's same 7 rows yes, both
M2 the guard on every execute row: guarded asks command == "execute" alone 8 failed, 103 passed, 75 skipped in 68.74s: the check's 8 execute rows refused before the tool (mistyped-plan, both plan-wrong-kind rows, plan-unsupported-mode, plan-unreadable, plan-no-source, both plan-bad-id rows); the test only skips 40 more 8 failed, 178 passed in 98.26s: the same 8 yes, both, by the check alone
M3 one row that reaches the tool left unguarded: plan-not-the-source without reaches_filter_repo=True 6 failed, 150 passed, 30 skipped in 90.41s: the test's 5 plan-not-the-source-execute ids and the check's plan-not-the-source-execute 1 failed, 185 passed in 119.78s: the check's plan-not-the-source-execute yes, both
M4 the guard on a check row: guarded also gives it to uncovered-plan-check 1 failed, 145 passed, 40 skipped in 101.88s: the check's uncovered-plan-check; the test only skips 5 more 1 failed, 185 passed in 154.96s: the check's uncovered-plan-check yes, both, by the check alone
M5 the check's assert inverted: if not is_guarded: 31 failed, 120 passed, 35 skipped in 90.61s: every id of the check 31 failed, 155 passed in 115.06s: every id of the check yes, both
K6 the review's: @needs_filter_repo above test_the_plan_is_named_as_a_path_is, guarded unchanged (a guard on every id of the main test). Over the check's 31 ids 24 failed, 7 passed in 17.58s 24 failed, 7 passed in 19.54s yes, both (at 3bec11599 the check passed 31 of 31 under this mutant, as the review measured)
K7 the review's: if command == "execute" and shutil.which("git-filter-repo") is None: pytest.skip(...) first in the body of test_the_plan_is_named_as_a_path_is (a run-time skip of every execute row). Over the 186 ids of the two tests 111 passed, 75 skipped in 67.19s 186 passed in 105.92s no: a skip in a body is not a mark (Known limits)
K10 r1286b's: pytestmark = [pytestmark, needs_filter_repo] after needs_filter_repo is defined (a module guard). Over the check's 31 ids, at 1cf7a37a2 31 skipped in 0.23s 31 passed in 17.23s no: the module guard skips the check too where the tool is missing (Known limits)
K11 r1286b's: @pytest.mark.skipif(shutil.which("git-filter-repo") is None, reason="inline guard") above test_the_plan_is_named_as_a_path_is (a guard on every id, spelled another way). Over the check's 31 ids, at 1cf7a37a2 31 passed in 17.22s 31 passed in 18.29s no: the check reads needs_filter_repo itself (Known limits)
K12 r1286b's: a fixture the main test requests with usefixtures that skips execute rows when the tool is missing (a run-time skip). Over the check's 31 ids, at 1cf7a37a2 31 passed in 17.56s 31 passed in 17.35s no: a run-time skip, as K7 (Known limits)
N1r NIT 1 put back: the fixture asks path=entry, with the tool in the directory pytest runs from and an empty PATH entry. Over the check's 31 ids - 31 errors in 0.97s under the empty-entry layout (the fixture's own assert: the child's PATH still holds the empty entry) yes; with the fix 31 passed
N2r NIT 2 put back: the link only where no git is left, and last. Homebrew-like layout (the tool and a link to git in one first directory, the system git later), by the fixture's own body - child's git is the system one, nothing added yes, by probe; with the fix the child's git is the link

Killed: 8 of 12 above. The survivors, K7, K10, K11 and K12, are the known limit: the check reads needs_filter_repo itself, and no other guard. The control M6 (the check's assert on a guarded row dropped with M2's guard on every execute row; 111 passed, 75 skipped hidden, 186 passed present at 3bec11599) was not re-run at 1cf7a37a2: the round does not touch that assert. K7 is not killed because the check reads marks, and a skip in a body is not one: the first bullet of Known limits. The review measured the same two summaries at 3bec11599.

The fixture, on the probe layouts of the review (the fixture's own body, run under each PATH; then the check's 31 ids under each, all in the probe environment of Measured, on 1cf7a37a2):

layout what the child finds the check's 31 ids
tool hidden (the bench) drops nothing; git is the system one within 170 passed, 49 skipped
tool present (the bench, on PATH twice) drops both entries; git is the system one within 219 passed
apt-like: one folder links every system-bin program plus the tool, standing for both bin entries drops it, adds the git-alone link first; no sh, no env 31 passed in 19.30s
Homebrew-like: git and the tool in one first folder, the system git later drops it, adds the link first: the child's git is the link 31 passed in 18.72s
CI-like: a folder holding python3 and the tool, first on PATH drops it; git is the system one 31 passed in 20.23s
relative entry ../relbin holding the tool drops it 31 passed in 18.20s
empty entry, run from a folder that holds the tool drops the empty entry 31 passed in 19.06s

Tests

Each run was one pytest call at a time, in the probe environment above, on head 1cf7a37a2.

  • tests/test_adopt_plan_and_remote_paths_spelled.py, tool hidden: 170 passed, 49 skipped in 77.38s.
  • The same file, tool present: 219 passed in 129.11s.
    • These two ran on the worktree's file just before the commit. It was blob c33740e09, the blob the commit holds, and git status --short was empty after the commit.
    • At 3bec11599 the same two calls gave 170 passed, 49 skipped in 80.49s and 219 passed in 132.19s. By test id, the two heads have the same 219 ids, with the same outcome and the same skip reason in each, hidden and present.
  • Main f39c6707a, for the comparison: tool hidden 35 failed, 139 passed, 14 skipped in 77.56s; tool present 188 passed in 139.73s.
  • One call over tests/test_repo_hygiene.py, tests/test_path_guard_hygiene.py, tests/test_no_auto_maintenance.py and tests/test_adopt_unsearchable_source.py, tool present: 320 passed, 2 skipped in 52.00s (101 + 121 + 58 + 40 passed). The 2 skips are tests/test_no_auto_maintenance.py:222, "the session began with GIT_CONFIG_GLOBAL set, and its file includes that one", because the probe environment sets it.

Review round 1 (r1286a)

r1286a (opus) reviewed head 3bec11599 in issuecomment-6778507555 and read NOT READY: one SHOULD and two NITs, each with a fix it had tested. It found the guard itself right: the mark sits on exactly the seven execute rows that cmd_execute refuses after _require_filter_repo(), and every count and sha in this body matched what it measured. Commit 1cf7a37a2 (the one test file, +20 -12) takes all three findings as the review tested them:

  • SHOULD 1: the check saw only a guard that CASES carries. A @needs_filter_repo above test_the_plan_is_named_as_a_path_is, the form 48 files of this suite use, skipped every id of the file and the check still passed (K6: 31 passed, 155 skipped hidden; 186 passed present). GUARDS now also reads the test function's own marks: needs_filter_repo.mark in the marks of the case and of the test function's pytestmark. K6 now fails 24 ids of the check, hidden and present (the 16 check rows and the 8 execute rows refused before the tool). The body's wording for it (What, box 3; Why, the check's params and what it fails on) now says "a guard CASES or the test function carries". A run-time skip in the test's body (K7) cannot be read before the test runs, so the check cannot see it: that is the new first bullet of Known limits.
  • NIT 1: an empty PATH entry. shutil.which("git-filter-repo", path="") always answered None, so the fixture kept an empty entry that shutil.which over the joined PATH, and git, read as the current directory; from a folder holding the tool the check gave 31 errors. It now asks path=entry or os.curdir. With the old form put back (N1r) the empty-entry layout gives 31 errors again; with the fix it gives 31 passed.
  • NIT 2: another git later on PATH. The fixture linked the session's git only where none was left, and put the link last, so where the tool shared a directory with the session's git (Homebrew's bin directory) the child ran the git that came later. It now adds the git-alone link first whenever the cleaned PATH would find another git than the session's. With the old form put back (N2r) the Homebrew-like layout gives a child whose git is the later one; with the fix it is the link, in that layout and in the apt-like one.

The ids are unchanged: 219, and by test id the same outcome and the same skip reason as at 3bec11599, hidden and present. The counts are unchanged too (below). The merge with origin/main (f7f34fb09 when this round was made) is clean: git merge-tree --write-tree exits 0. Not run: CPython 3.14 and pytest 8.3.4 (CI's), which the review could not run either. GUARDS needs pytest.param to keep the marks it is given, which pytest 9.1.1 does.

Delta review (r1286b)

r1286b's delta review of 3bec1159..1cf7a37a (issuecomment-6782429192) reads READY. Its K6 fails 24 ids hidden and present, the empty-entry and Homebrew-like layouts pass, and the counts hold (170 passed, 49 skipped hidden, 219 passed present).

Its one NIT: this body said the check reads any guard CASES or the test function carries, where it reads needs_filter_repo itself. Lane 1 took the review's wording fix here, with no code change: the head stays 1cf7a37a. K10, K11 and K12 are in Mutants and Known limits. The review's optional code fix (read any skip or skipif mark on the test function) is not taken.

Known limits

  • reaches_filter_repo is set by hand on seven rows. It is not a list of ids, and the check holds every row's value to the tool on every run, so a wrong value fails in CI, where the tool is present, and not only on a machine without it.
  • The check runs each row once more, as a child: 31 children, about 15 to 20 s here.
  • The check reads needs_filter_repo itself, as a mark on a CASES row or on test_the_plan_is_named_as_a_path_is. It does not read a differently spelled skip mark on the test (K11), a needs_filter_repo in the module's pytestmark (K10, which also skips the check where the tool is missing), or a run-time skip, which cannot be read before the test runs: in the test's body (K7, if command == "execute" and shutil.which("git-filter-repo") is None: pytest.skip(...)) or in a fixture the test requests (K12). Mutants of those forms fail no id (Mutants). The issue names it as one of two ways to guard; this PR guards with marks, and a later guard of that form would not be held to the tool.
  • The check skips where git finds git-filter-repo in its own exec path, since no PATH hides it there. None of CI's environments does, and this bench does not.
  • needs_filter_repo asks shutil.which alone, in this file as in the others that define it, while _require_filter_repo also accepts a tool that only git filter-repo finds. On a machine with the tool only in git's exec path, the guard skips rows that would pass. That is the guard's wording in every file that has it, and this PR does not change it. Follow-up candidate, filed only on Brett Heap's word: make every needs_filter_repo ask as _require_filter_repo asks.
  • Not run: the full suite; the file under a locale other than UTF-8 (the rows' skip_where_cannot_carry handles those); CPython 3.14 and pytest 8.3.4 (CI's). The change uses no wording that depends on the Python version.

Lane: openreposhape-1 (openRepoShape-1)

🤖 Generated with Claude Code

…` rows that reach `_require_filter_repo` skip without git filter-repo, as each row's `reaches_filter_repo` says, and a check with the tool hidden holds the guard to them (#1286)

On a machine without git-filter-repo, test_the_plan_is_named_as_a_path_is
failed 35 rows on main (f39c670): the five characters of seven `execute`
rows, each `REFUSED filter-repo-missing`. `execute` asks for the tool
(`_require_filter_repo`) after the plan's keys, names, `org:` and `id:`,
the work directory and the opened source, and before `_against_its_source`,
`_repository_urls` and `_refuse_what_check_finds`; `check` never asks.

- `Row.reaches_filter_repo` (default False) is set on the seven rows refused
  after that point; `CASES` gives those `execute` params `needs_filter_repo`.
- `run_the_row` and `assert_the_row_says` hold what the test did, so the new
  check runs each row exactly as the test does.
- `test_the_guard_skips_the_rows_that_reach_filter_repo_and_no_other` runs
  every row of `CASES` once, at a plain path, with the tool hidden from the
  child (PATH less each directory holding `git-filter-repo`), on any
  machine: a guarded row must refuse `filter-repo-missing`, every other must
  say what it says with the tool.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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

Tests

Mark the seven execute rows that reach _require_filter_repo for skipping when the tool is unavailable, and document the row-level distinction.

  • tests/test_adopt_plan_and_remote_paths_spelled.py L56-64, L332-338, L413-425 (+7 small edits)

Extract shared row execution and assertions, then add a check that hides git filter-repo and verifies the guard skips exactly the rows that reach it.

  • tests/test_adopt_plan_and_remote_paths_spelled.py L448-452, L470-483, L488-548 (+2 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

Review of #1323 (#1286) for lane openRepoShape-1, by r1286a (opus), at 3bec115: NOT READY

The guard is right. The mark sits on exactly the seven execute rows that cmd_execute refuses after _require_filter_repo(). Every count, sha and table row in the body matches what I measured. The refactor keeps every assert. The merge with main is clean and gives the same results id by id.

It is NOT READY for one reason (SHOULD 1). The new check only sees a guard that CASES carries. It does not see a guard written the way most of this suite writes it: @needs_filter_repo on the test function, which 48 files use. That guard skips all 155 ids, and the check still passes. Two NITs are about rare PATH layouts. Each finding has a fix I tested.

Probe environment for every run:

  • a stub gh first on PATH, GH_TOKEN=bogus-r1286a and an empty GH_CONFIG_DIR;
  • GIT_CONFIG_GLOBAL set to the null device, GIT_SSH_COMMAND=false, EMAIL set to a test address;
  • LC_ALL=C.UTF-8, TMPDIR in my scratch folder, and env -u LANES_LANE.

Versions: pytest 9.1.1, CPython 3.12.3, git 2.43.0. Scratch folder S = /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1286a.

How I hid the tool (my own way, not the writer's). The bench has git-filter-repo in one user-local bin directory under the home directory, which is on PATH twice. I replaced both entries with S/shadow-localbin, a folder of links to all 92 other programs in that directory, everything except the tool. So nothing else left PATH. In that environment:

  • shutil.which("git-filter-repo") is None;
  • git filter-repo --version exits 1 (git: 'filter-repo' is not a git command);
  • git --version is still 2.43.0.

1. The property

I checked it two ways.

By reading the code. adopt-project.py (no change since base) has def cmd_execute at :17395 and _require_filter_repo() at :17414. grep -n "_require_filter_repo" finds only the def at :14699 and that one call, so cmd_check never asks for the tool.

By tracing. I wrote a scratch test (S/trace/test_r1286a_trace.py.txt). It runs each of the 31 CASES once at a plain path, with the tool present. PYTHONPATH points at S/trace/sitecustomize.py, which sys.setprofiles the child. It records each function cmd_execute or cmd_check calls directly, and whether _require_filter_repo ran.

  • Result: 31 passed in 18.37s, then rows: 31 | mark==called on every row: True.
  • Every guarded row calls _require_filter_repo as cmd_execute's 10th direct call. Example, uncovered-plan-execute: load, _refuse_a_mistyped_plan, names, _checked_org_and_id, _work_root, _refuse_an_unwritable_work_dir, open_source, _refuse_a_partial_clone_short, load, _require_filter_repo, _against_its_source, _checked_plan_values, _repository_urls, _refuse_an_unwritable_clone_url, _leg_paths, _refuse_what_check_finds.
row where execute stops after the tool? marked match
mistyped-plan _refuse_a_mistyped_plan (plan-bad-legs) no no yes
uncovered-plan _refuse_what_check_finds (plan-uncovered) yes yes yes
split-branch-taken _refuse_a_branch_in_the_split_branchs_way yes yes yes
plan-wrong-kind Plan.load no no yes
plan-wrong-kind-a-placement-plan Plan.load no no yes
plan-unsupported-mode Plan.load no no yes
plan-unreadable Plan.load no no yes
plan-no-source Plan.open_source no no yes
plan-bad-id-with-a-space _checked_org_and_id no no yes
plan-bad-id-a-number _checked_org_and_id no no yes
plan-bad-id-derived no execute case - - -
assembly-a-windows-device-name _repository_urls (adopt-bad-project-name) yes yes yes
org-with-two-hyphens _repository_urls (adopt-bad-org) yes yes yes
org-too-long _repository_urls (adopt-org-too-long) yes yes yes
topic-too-long _repository_urls (adopt-topic-too-long) yes yes yes
plan-not-the-source _against_its_source (plan-not-the-source) yes yes yes
  • The 16 check cases: _require_filter_repo never ran (called=False on all 16), and none is marked. All match.
  • Stops that depend on the environment: only the seven marked rows, and only through whether the tool can be found.
    • _require_filter_repo finds the tool two ways: shutil.which, then git filter-repo --version. needs_filter_repo uses only the first.
    • With the tool only in git's exec directory (GIT_EXEC_PATH pointed at S/execpath-sim, a copy of git's exec directory plus the tool), the file gives 139 passed, 80 skipped in 60.75s. That is 35 guard skips of rows that would pass there, 31 skips of the check and 14 old skips, with 0 failed. The body states this in Known limits.
    • No other row's stop moved in any of the 7 environments I ran.

2. The fixture no_filter_repo (:487-511)

I ran its own body, pulled out of the file with ast (S/tools/fixprobe.py), under each layout. Where marked, I also ran the check's 31 ids under that layout.

layout (how I simulated it) what the fixture does the child the check
bench, tool present (on PATH twice) drops both entries git found, no tool, probe exit 1 31 pass, within 219 passed
tool hidden my way drops nothing same 31 pass, within 170 passed, 49 skipped
apt-like: one scratch folder links every system-bin program plus the tool, standing for both system bin entries drops it and adds the git-alone link git through the link; no sh, no env 31 passed in 15.42s
Homebrew-like: git and the tool in one folder first on PATH, another git later drops it, adds no link the later git, not the session's probe only (NIT 2)
CI-like: a folder holding python3 and the tool but no git, first on PATH (setup-python's bin directory) drops it git found 31 passed in 15.64s
relative entry ../relbin holding the tool drops it git found 31 passed in 15.58s
repeated entry drops every copy git found as in the present run
empty entry, with the tool in the directory pytest runs from keeps "", and its own assert fires - 31 errors in 0.99s (NIT 1)
tool only in git's exec directory skips - 31 skipped
Windows the module's pytestmark (skipif(os.name == "nt")) is checked in the setup hook before fixtures, so the fixture never runs - read only, not run
  • Does the child still find every program? Yes, in every layout I ran. The 15 execute rows run only git. The session's gh guard starts from a #!/bin/sh launcher that names the interpreter by absolute path, so it needs nothing from PATH. The apt-like run proves it with sh and env gone.
  • The git-alone link is load-bearing there. K5 (link never added) in the apt-like layout gives 31 errors in 3.20s, each FileNotFoundError: [Errno 2] No such file or directory: 'git'.
  • Can the fixture's skip hide a real failure? Not one this file would otherwise show. It skips only when git filter-repo --version succeeds on the cleaned PATH. There the child has the tool, so no guard error can fail the main test either way. What is lost is the check's own verdict, and CI gives that.
  • The which assert (:503) is what stops a dirty PATH from becoming a silent skip. K3 (assert dropped) changes nothing on the bench. In the empty-entry setup it turns 31 errors into 31 skipped in 0.26s.

3. The check (:519-540)

  • It reads case.marks, which guarded filled and pytest applies.
    • K2 (a bug in guarded that also guards check rows) fails 7 ids in both environments.
    • K8 is a guard with the same condition and a different reason, which the check does not recognise as needs_filter_repo. It gives 7 failed, 24 passed in both environments. So when the check and the guard disagree, the check fails loudly; it never passes quietly.
  • It fails, not skips, for a guard too wide or too narrow in both environments. Too wide: K1, K2 and my re-run of the writer's M2. Too narrow: K9.
  • It is blind to a guard placed anywhere but CASES. That is SHOULD 1.
  • No module-scope leak. git grep -n "test_adopt_plan_and_remote_paths_spelled" exits 1 at the head and at origin/main, so no module imports this file. The fixture returns a dict, changes nothing in os.environ, and makes at most one folder under the basetemp.

4. The refactor

I compared the old body with run_the_row and assert_the_row_says statement by statement.

  • The 15 statements are the same text, in the same order.
  • skip_where_cannot_carry, where_the_plan_is and the typed not in assert stay in the test.
  • One move: request.getfixturevalue(row.source) now runs after where_the_plan_is. That function only builds a path and a string and touches no file.
  • run_adopt(*arguments, over=None) is the same as run_adopt(*arguments), because it is spread as **(over or {}).
  • All 155 ids are unchanged: 0 ids exist only on main, and all 155 pass with the tool present.

5. Main f39c6707a against the head 3bec11599, by test id (S/tools/byid.py over junit)

  • Tool hidden:
    • 188 ids on both; 31 only on the head, all the check's, all passed.
    • changed: {'failure -> skipped': 35}: 5 for each of the seven rows.
    • Every one of the 35 had stderr REFUSED filter-repo-missing: on main and skips with the reason git filter-repo is not installed: `pip install git-filter-repo` on the head.
    • any other change: 0. All 49 head skips carry that reason.
  • Tool present: changed: {}, any other change: 0, and the 31 new ids passed.
  • Breakdown of the head, tool hidden: the main test has 80 check ids passed, 40 execute ids passed (5 for each of the 8 rows refused before the tool) and 35 skipped.

6. Mutants

Mutants ran in S/mclone, a clone at 3bec11599. Each was applied by anchor, which must occur exactly once. The file was rewritten from HEAD before and after each one, and every time the output read restore: HEAD d4932c803d63 file d4932c803d63 equal=True. The clone ends with an empty git status --short.

id mutant tool hidden tool present result
K1 reaches_filter_repo=True on plan-bad-id-a-number 1 failed, 145 passed, 40 skipped 1 failed, 185 passed killed
K2 guarded also marks check rows 7 failed, 109 passed, 70 skipped 7 failed, 179 passed killed
K3 the fixture's which assert dropped (check ids) 31 passed 31 passed survived; equivalent except in NIT 1's setup, where it gives 31 skipped
K4 the fixture keeps the tool on PATH (check ids) 31 passed (nothing to drop) 31 errors killed
K5 the git-alone link never added (check ids) 31 passed (equivalent) apt-like: 31 errors killed
K6 @needs_filter_repo on the main test 31 passed, 155 skipped 186 passed survived
K7 a run-time skip of every execute row in the body 111 passed, 75 skipped 186 passed survived
K9 org-too-long left unguarded 6 failed, 150 passed, 30 skipped 1 failed, 185 passed killed
  • Killed 5 of 8. K3 is equivalent wherever the PATH filter works. K6 and K7 are SHOULD 1.
  • K8 is a probe of the disagreement path, not counted: 7 failed, 24 passed in both environments.
  • The writer's M2, re-run: 8 failed, 103 passed, 75 skipped hidden and 8 failed, 178 passed present, exactly the body's numbers.

7. With main now

8. Every pytest summary line

Before each call, /workspace had 22-23G free, / was at 40% of inodes, and at most 1 pytest process was running.

  • f39c6707a, file, tool hidden: 35 failed, 139 passed, 14 skipped in 83.01s
  • f39c6707a, file, tool present: 188 passed in 118.91s
  • 3bec11599, file, tool hidden: 170 passed, 49 skipped in 79.63s
  • 3bec11599, file, tool present: 219 passed in 131.37s
  • 965dd64c9 (head plus main), file, tool hidden: 170 passed, 49 skipped in 77.51s
  • 965dd64c9, file, tool present: 219 passed in 128.18s
  • 3bec11599, file, tool only in git's exec directory: 139 passed, 80 skipped in 60.75s
  • 3bec11599, the check under the apt-like, CI-like and relative layouts: 31 passed in 15.42s, 31 passed in 15.64s, 31 passed in 15.58s; under the empty-entry layout: 31 errors in 0.99s
  • 3bec11599, tests/test_adopt_unsearchable_source.py: 40 passed in 11.08s
  • 3bec11599, tests/test_path_guard_hygiene.py: 121 passed in 23.45s
  • 3bec11599, tests/test_no_auto_maintenance.py: 58 passed, 2 skipped in 11.13s. Both skips are at :222, "the session began with GIT_CONFIG_GLOBAL set", because the probe environment sets it.
  • 3bec11599, tests/test_repo_hygiene.py: 101 passed in 3.30s
  • the trace in the clone at 3bec11599: 31 passed in 18.37s
  • mutants and fixes: as in the tables in sections 6 and 10.

The 3.14-like sitecustomize shim does not apply here. The change uses no pathlib is_file, exists or is_dir check, only shutil.which and subprocess.

9. The body

I read it with gh pr view 1323 --json ... and compared it with pr-body-only.md.

10. Findings

SHOULD 1. tests/test_adopt_plan_and_remote_paths_spelled.py:516-517 (GUARDS); body lines 17, 36 and 40.

The check learns which rows are guarded from case.marks alone. It cannot see:

  • @needs_filter_repo above the test at :472, the form 48 files use and the issue quotes;
  • a run-time skip in the test's body, the issue's other option.

Evidence, over the node ids of the two tests:

  • K6 (@needs_filter_repo above test_the_plan_is_named_as_a_path_is, guarded unchanged): hidden 31 passed, 155 skipped in 15.16s; present 186 passed in 91.27s. Without the tool, all 80 check ids and the 40 ids refused before the tool skip, and the check passes 31 of 31.
  • K7 (if command == "execute" and shutil.which("git-filter-repo") is None: pytest.skip(...) first in the body): hidden 111 passed, 75 skipped in 59.33s; present 186 passed in 89.54s. This is literally the issue's third-box mutant, a guard on every execute row, and no id fails.

So the body's claims hold only for a guard that CASES carries: "it reads the guard the test really has" (line 36), "So it fails on a guard too wide" (line 40), and box 3, "A mutant that guards every execute row fails 8 ids" (line 17).

Fix (tested): also read the test function's own marks.

GUARDS = [pytest.param(*case.values, needs_filter_repo.mark in [
    getattr(mark, "mark", mark) for mark in (
        *case.marks,
        *getattr(test_the_plan_is_named_as_a_path_is, "pytestmark", []))],
    id=case.id) for case in CASES]
  • On its own (check ids): hidden 31 passed in 15.75s, present 31 passed in 16.41s.
  • With K6: hidden 24 failed, 7 passed in 18.73s, present 24 failed, 7 passed in 18.99s. The 24 are the 16 check rows and the 8 execute rows refused before the tool.

A run-time skip (K7) cannot be read before the test runs. Name it in Known limits, and reword lines 17, 36 and 40 to "a guard CASES or the test function carries".

NIT 1. :496-497.

shutil.which("git-filter-repo", path="") always returns None, so the fixture always keeps an empty PATH entry. But shutil.which over the joined PATH, and git, read an empty entry as the current directory.

  • Evidence: from a folder that holds the tool, with an empty entry in PATH, the check gives 31 errors in 0.99s, each AssertionError showing a child PATH with an empty entry. With K3 in the same setup it is 31 skipped in 0.26s.
  • Fix (tested): shutil.which("git-filter-repo", path=entry or os.curdir). Empty-entry layout 31 passed in 17.03s, hidden 31 passed in 16.84s, present 31 passed in 18.06s.

NIT 2. :498-501.

The fixture adds the link to the session's git only when kept holds no git at all, and puts it last. Where the tool shares a directory with the session's git and another git comes later on PATH, the child runs that other git. On macOS, Homebrew's bin directory holds both, and Apple's git comes later.

  • Evidence (fixprobe, Homebrew-like layout): the parent's git is S/brewsim/git, but the child finds the system git, and dropped: ['S/brewsim'] | added: [].
  • Fix (tested):
git = shutil.which("git")
if shutil.which("git", path=os.pathsep.join(kept)) != git:
    alone = tmp_path_factory.mktemp("git-alone")
    (alone / "git").symlink_to(git)
    kept.insert(0, os.fspath(alone))

With it, the child's git is the link in both the Homebrew-like and apt-like layouts. The check gives apt-like 31 passed in 16.86s and present 31 passed in 16.13s.

  • CI runs on Linux only, hence a NIT.

Not covered

  • CI's CPython 3.14 and pytest 8.3.4 were not run.
    • The PR's tests job (run 42887018652, started 19:36:53Z) was still running at 20:28:40Z. package, tests-git-bash and SonarCloud had passed.
    • needs_filter_repo in case.marks needs ParameterSet.param to keep marks as given. 9.1.1 does (I read its source), and so does the bench's system pytest 7 copy. I did not read 8.3.4's.
  • Real installs: I simulated apt, Homebrew and setup-python layouts with scratch link folders and did not install any of them.
  • Windows: read only, not run.
  • A person's own global git config (url.*.insteadOf and similar) was not tried, because the probe environment sets it to the null device.
  • Other: no full suite, and no locale other than UTF-8.

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-11-10T20:31:15Z) Lane 1's decision on r1286a's review (issuecomment-6778507555): take all three findings, as the review tested them, in one round by writer w1286b, which is running now.

  • SHOULD 1: GUARDS reads the test function's own marks as well as CASES's, so a @needs_filter_repo above the test (K6) fails the check. The body says "a guard CASES or the test function carries". Known limits says the check cannot see a skip at run time in the test's body (K7), because that cannot be read before the test runs.
  • NIT 1: an empty PATH entry is asked as the current directory, as git reads it.
  • NIT 2: the link to the session's git goes first on PATH whenever the cleaned PATH would find another git.
  • Then: a delta review of the round. Lane 1 pauses at its account's usage ceiling first, so that review runs after its next resume.

Lane: openreposhape-1 (openRepoShape-1)

…ads a `needs_filter_repo` on the test function as well as on `CASES`, the fixture reads an empty `PATH` entry as the current directory, and the child's git is the session's (#1286)

Fix round 1 for r1286a's review of #1323 (issuecomment-6778507555).

SHOULD 1: GUARDS also reads the test function's own marks, so a
`@needs_filter_repo` above test_the_plan_is_named_as_a_path_is (the form 48
files use) is a guard the check sees: it fails 24 ids where it passed 31 of
31 before. A skip inside the test's body is not a mark and cannot be read.

NIT 1: `shutil.which("git-filter-repo", path=entry or os.curdir)`, so an
empty PATH entry is read as the current directory, as git reads it.

NIT 2: the `git-alone` link is added first on PATH whenever the cleaned PATH
would find another git than the session's.

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

Copy link
Copy Markdown

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-11-10T21:05:39Z) Round 1 on #1323 is done at 1cf7a37a, and the body above now describes it, in a new "Review round 1 (r1286a)" section.

  • SHOULD 1: GUARDS reads needs_filter_repo on the test function as well as on CASES. K6 (@needs_filter_repo above the main test) now fails 24 of the check's ids, with the tool hidden and present. Known limits names K7, a skip at run time in the test's body, which the check cannot see before the test runs.
  • NIT 1: an empty PATH entry is asked as the current directory. The review's empty-entry layout now passes the check.
  • NIT 2: the link to the session's git goes first on PATH whenever the cleaned PATH would find another git. The Homebrew-like layout now runs the session's git.
  • Counts held: the file gives 170 passed, 49 skipped with the tool hidden and 219 passed with it present, unchanged by id. M1 to M5 are killed again.
  • Next: a delta review of 3bec1159..1cf7a37a, after lane 1's next resume. Lane 1 pauses now at its account's usage ceiling.

Lane: openreposhape-1 (openRepoShape-1)

@brettheap

Copy link
Copy Markdown
Contributor Author

Delta review of #1323 (#1286) for lane openRepoShape-1, by r1286b (sonnet), 3bec115..1cf7a37: READY

All three round-0 findings are fixed as r1286a tested them. Both pytest summaries and the merge with main match what the body claims. I found one NIT that needs only a body edit, not a new commit.

Probe environment for every run:

  • a stub gh first on PATH;
  • GH_TOKEN=bogus-r1286b and an empty GH_CONFIG_DIR;
  • GIT_CONFIG_GLOBAL set to the null device, GIT_SSH_COMMAND=false and EMAIL set to a test address;
  • LC_ALL=C.UTF-8, TMPDIR in my scratch folder, and env -u LANES_LANE.

Versions: pytest 9.1.1, CPython 3.12.3, git 2.43.0. My worktree is wt-r1286b under /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1286b/, detached at 1cf7a37a23ae13db9c3858d95c8637b795906a46. Before each pytest call /workspace had 16-17G free and / was at 41% of inodes. At most one pytest process of mine ran at a time.

How I hid the tool. I used r1286a's way, read-only. The one user-local bin directory on PATH that holds git-filter-repo is replaced by r1286a's shadow-localbin, a folder of links to the 90 other programs in it. In that environment shutil.which("git-filter-repo") is None, git filter-repo --version exits 1 (git: 'filter-repo' is not a git command), and git --version is still 2.43.0. With the tool present it exits 0 (a40bce548d2c).

1. The diff

git diff 3bec1159 1cf7a37a --stat shows 1 file changed, +20 -12: tests/test_adopt_plan_and_remote_paths_spelled.py and nothing else. I read every changed line. There are three hunks:

  • the fixture no_filter_repo, at :488-513;
  • the comment above GUARDS;
  • GUARDS itself, at :521-525.

Against the base: git diff --numstat f39c6707a 1cf7a37a gives 127 20, and git log --oneline f39c6707a..1cf7a37a lists exactly 2 commits (3bec11599, 1cf7a37a2). Blob 536b5a5cd goes to d4932c803 and then to c33740e09. All of that matches the body.

2. SHOULD 1 (the check reads the test function's marks)

The check is fixed. GUARDS now reads needs_filter_repo.mark in [getattr(mark, "mark", mark) for mark in (*case.marks, *getattr(test_the_plan_is_named_as_a_path_is, "pytestmark", []))]. GUARDS sits after the test is defined (:474 before :521), so pytestmark is already set when it is read.

K6: @needs_filter_repo above the parametrize lines of the main test, applied by exact replacement in my worktree and run over the check's 31 ids.

environment summary
tool hidden 24 failed, 7 passed in 18.38s
tool present 24 failed, 7 passed in 19.78s
  • The 24 failing ids are the 16 check rows and 8 execute rows: mistyped-plan, both plan-wrong-kind rows, plan-unsupported-mode, plan-unreadable, plan-no-source and both plan-bad-id rows. That is the writer's 24, and the 7 that pass are the 7 guarded execute rows.
  • Restore proof, from restore.py writing git cat-file blob HEAD:<path> back: restore: HEAD c33740e090c3 file c33740e090c3 equal=True before and after.

Other places a guard could sit. These are still unread by the check.

  • A class: the file has none. Moving the test into one would break GUARDS at import with a NameError, which is loud. I read this and did not run it.
  • The module's pytestmark: that is K10. After needs_filter_repo is defined I added pytestmark = [pytestmark, needs_filter_repo]. Tool hidden gives 31 skipped in 0.23s, because the module guard skips the check too. Tool present gives 31 passed in 17.23s. So it survives, and there is no failure in either environment.
  • A fixture's skip: that is K12. A fixture requested by the main test via usefixtures skips execute rows when the tool is missing. Tool hidden gives 31 passed in 17.56s and present 31 passed in 17.35s, so it survives.
  • A skip in the body (K7): known, and named in Known limits. I did not re-run it. r1286a measured it, and no code it depends on changed.
  • A guard on the test function that is not the file's needs_filter_repo object: that is K11, in NIT 1 below.
  • Restore proofs for K10, K11 and K12 each read equal=True before and after.

The new Known limit (line 134) names only the in-body skip and says the check "reads a guard that is a mark". That is broader than what is read.

3. NIT 1 and NIT 2 (fixture)

I ran the fixture's own body, pulled out of the file by ast (r1286a's fixprobe.py, adapted), under each PATH layout. Where marked, I ran the check's 31 ids under the layout as well.

layout the fixture the child the check's 31 ids
tool hidden (bench) drops nothing, adds nothing git is /usr/bin/git, no tool, probe exit 1 within 170 passed, 49 skipped
tool present drops the user-local bin entry git is /usr/bin/git, no tool, probe exit 1 within 219 passed
empty entry (run from a folder holding the tool) dropped: [''], adds nothing no tool, probe exit 1 31 passed in 18.55s
Homebrew-like (git and the tool in one first folder, /usr/bin later) drops it, adds a git-alone link git is the link; git --version equals the parent's 31 passed in 17.82s
apt-like (a folder links every system-bin program plus the tool) drops it, adds the link first git is the link; no sh, env or python3 31 passed in 18.21s
CI-like (a folder with python3 and the tool, first) drops it git is /usr/bin/git 31 passed in 16.81s
relative entry ../relbin holding the tool drops it git is /usr/bin/git 31 passed in 16.54s
  • The old forms fail where the writer says. N1r (path=entry put back) under the empty-entry layout gives 31 errors in 1.10s, each an AssertionError at the fixture's which assert showing a child PATH with an empty entry. N2r (the old link rule) in the Homebrew-like layout gives child finds git: /usr/bin/git and added: [], so the child runs the system git, not the session's.
  • shutil.which("git") is None. I ran the body under a PATH with no git. The link block is skipped, because None != None is false. The fixture's probe subprocess.run(["git", ...]) then raises FileNotFoundError: No such file or directory: 'git'. That is a loud error on a machine this suite cannot run on anyway. There is no symlink_to(None).
  • The session's git is in a directory that holds the tool.
    • With no other git on PATH: dropped: ['A/brewsim'] | added: [link]. which("git", kept) is None, which is not the session's git, so the link is added first. The child's git is the link, and filter-repo --version exits 1.
    • With another git later: the same, and the child runs the session's git.
  • Child's working directory. run_the_row passes no cwd, so the child shares pytest's current directory with the fixture. entry or os.curdir is therefore the right directory.

4. Pytest at the head 1cf7a37a2

  • Tool hidden: 170 passed, 49 skipped in 89.86s (0:01:29).
    • Of the 49 skips, 35 are the main test's, 6 + 4 + 4 are the other three filter-repo tests', and all carry git filter-repo is not installed: pip install git-filter-repo.
    • The check's 31 ids pass. The main test gives 120 passed, 35 skipped.
  • Tool present: 219 passed in 142.36s (0:02:22).

Both match the required counts. After every mutant the worktree read git status --short empty, and the final proof is git hash-object equal to c33740e090c3862f97158abfb95dd5fed8371dbd, the blob at HEAD.

5. With main

  • git merge-tree --write-tree 1cf7a37a origin/main exits 0 with tree 0582c865db4259eb864246ceb7b5b10c2fa5e4ce. Main is dcf63b8b9b167a1308ce4eb9ba170163efc771a4, and the merge base is f39c6707a.
  • The body's f7f34fb09 is an ancestor of main. git merge-tree --write-tree 1cf7a37a f7f34fb09 also exits 0, with tree 1faf4819caad42bc687f5903e5e55ffca883b080.
  • Main changed adopt-project.py by 455 lines, and cmd_execute is now at :17762 with _require_filter_repo() at :17781. I read cmd_execute on origin/main. The calls before the tool (Plan.load, _refuse_a_mistyped_plan, names, _checked_org_and_id, _work_root, _refuse_an_unwritable_work_dir, open_source, _refuse_a_partial_clone_short, NamingPolicy.load) and after it (_against_its_source, _checked_plan_values, _repository_urls, _refuse_an_unwritable_clone_url, _leg_paths, _refuse_what_check_finds, ...) are in the same order as the body lists. I did not run pytest on the merged tree.
  • git grep -n "test_adopt_plan_and_remote_paths_spelled" exits 1 at the head and at origin/main. A grep for from ... import, import ... and ... import forms also exits 1. No module imports from this file, so tests/test_bom_tool_io.py: the byte-order-mark rows hold each tool's own read and write and that only U+FEFF is cut, so a utf-8-sig read that drops the mark and a cut that also takes spaces no longer survive (#1176) #1188's lesson does not apply.

6. The body

I compared pr-body-only.md with the live PR body: live == file: True (20623 characters each). The PR's head is 1cf7a37a23ae13db9c3858d95c8637b795906a46, it is a draft, and its milestone is v1.2.2.

  • Shas, blobs and sizes: f39c6707a99d9988abaf3197363e4d9753d49468, 1cf7a37a23ae13db9c3858d95c8637b795906a46, the blobs and +127 -20 all match what I measured. The count of 2 commits and +20 -12 for round 1 match too.
  • Counts: 170 passed, 49 skipped, 219 passed, and K6's 24 failed, 7 passed hidden and present match. The 16 check and 8 execute ids named in the body are the ones I listed. The layout table's pass counts all match mine; its timings differ by a second or two.
  • Mutant bookkeeping: "186 ids" is 155 + 31. "Killed: 8 of 9" holds for the nine listed, with K7 the one survivor. N1r and N2r reproduce as described.
  • Closing form: Closes #1286 at line 1 is the only match of the closing-form grep, and closingIssuesReferences is [1286]. There is no "Covers" or "Part of" form.
  • Characters: the only non-ASCII character is U+1F916 in the footer, at line 141. There are no placeholders outside backticks. There is no email address, no folder outside /workspace, and no mention of the outside-v1.2.0 ruling.
  • Milestone line: line 3 reads Milestone v1.2.2: v1.2.1 is frozen, and lane 3 places this PR by its READY time.

7. Findings

NIT 1. Body lines 17, 36, 40 and 134 say more than GUARDS reads. Code at :521-525.

GUARDS recognises only the file's own needs_filter_repo mark, on a CASES row or on the test function. The body says "a guard CASES or the test function carries" (lines 17, 36, 40) and "reads a guard that is a mark" (line 134). That is true of needs_filter_repo and false of another skip mark on the same function.

Evidence is K11: an inline @pytest.mark.skipif(shutil.which("git-filter-repo") is None, reason="inline guard") above the main test, applied by exact replacement and run over the check's 31 ids. It guards every id of the test, which is a guard too wide on the test function.

  • Tool hidden: 31 passed in 17.22s.
  • Tool present: 31 passed in 18.29s.
  • Restore: equal=True before and after.

The suite spells a guard this way in 3 files. The other forms are 63 files with @needs_filter_repo (the form the check reads), 6 files with an in-body pytest.skip on filter-repo (the K7 form), and none with a module-level guard. This file defines needs_filter_repo, so K11 is a rare spelling here. That makes it a NIT, and a wording fix needs no new commit.

Fix, body only (no code change, so the head stays):

  • Reword lines 17, 36 and 40 from "a guard CASES or the test function carries" to "needs_filter_repo on CASES or on the test function".
  • Make line 134 read: "The check reads needs_filter_repo itself, as a mark on a CASES row or on the test function. It does not read a differently spelled skip mark on the test (K11), a needs_filter_repo in the module's pytestmark (K10, which also skips the check where the tool is missing), or a run-time skip in the body (K7) or in a fixture the test requests (K12); mutants of those forms fail no id."
  • In the Mutants section, list K10, K11 and K12 beside K7 as survivors. The sentence "the survivor, K7" at line 96 is accurate for the nine rows listed and incomplete for what exists.

Optional code fix, tested. In GUARDS, read any skip or skipif mark on the test function:

GUARDS = [pytest.param(*case.values,
    needs_filter_repo.mark in [getattr(mark, "mark", mark) for mark in case.marks]
    or any(getattr(mark, "mark", mark).name in ("skip", "skipif") for mark in getattr(
        test_the_plan_is_named_as_a_path_is, "pytestmark", [])),
    id=case.id) for case in CASES]
  • Alone: hidden 31 passed in 19.13s, present 31 passed in 18.82s.
  • With K11: hidden 24 failed, 7 passed in 19.70s, present 24 failed, 7 passed in 17.77s.
  • K6 is itself a skipif, so by name it is still caught. I did not re-run K6 on this fix.
  • It does not read the module's pytestmark, which already holds the legitimate skipif(os.name == "nt"), so K10 stays a Known limit. It is a code change on a head that has just been reviewed, so I would take the wording fix.

No other findings. The three round-0 findings are closed:

  • SHOULD 1 by K6 failing 24 ids in both environments;
  • NIT 1 by 31 passed under the empty-entry layout, with N1r giving 31 errors;
  • NIT 2 by the child's git being the link in the Homebrew-like and apt-like layouts, with N2r giving the system git.

Not covered

  • CI's CPython 3.14 and pytest 8.3.4. I did not run them. I read that MarkDecorator.mark and a function's pytestmark list are the interfaces GUARDS uses, but I did not read 8.3.4's source.
  • The merged tree. I did not run pytest on 0582c865d or 1faf4819c; I only checked that the merge is clean and that cmd_execute's order is unchanged on main.
  • M1 to M5 and K7. I did not re-run them. The writer re-ran M1 to M5 at the head, r1286a measured K7, and my K6, K10, K11, K12, N1r and N2r runs cover the code this round changed.
  • Real installs. Apt, Homebrew and setup-python layouts are simulated with link folders, as r1286a did, not installed.
  • A relative PATH entry holding the session's git together with the tool. shutil.which("git") would then return a relative path, and symlink_to of it would make a dangling link. This is contrived and I did not probe it. The old code had the same symlink_to(shutil.which("git")).
  • Windows (read only), locales other than UTF-8, a person's own global git config, and the full suite.

Scripts and logs are under /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1286b/ (tools/, logs/).

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-11-10T23:45:08Z) Lane 1's decision on r1286b's delta review (READY, issuecomment-6782429192): it takes NIT 1's wording fix in the body, and #1323 is ready for review.

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

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