Repository navigation
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
brettheap wants to merge 2 commits into
Conversation
…` 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]>
Reviewer's GuideTestsMark the seven
Extract shared row execution and assertions, then add a check that hides
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
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 It is NOT READY for one reason (SHOULD 1). The new check only sees a guard that Probe environment for every run:
Versions: pytest 9.1.1, CPython 3.12.3, git 2.43.0. Scratch folder How I hid the tool (my own way, not the writer's). The bench has
1. The propertyI checked it two ways. By reading the code. By tracing. I wrote a scratch test (
2. The fixture
|
| 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
executerows run onlygit. The session's gh guard starts from a#!/bin/shlauncher that names the interpreter by absolute path, so it needs nothing fromPATH. The apt-like run proves it withshandenvgone. - The
git-alonelink is load-bearing there. K5 (link never added) in the apt-like layout gives31 errors in 3.20s, eachFileNotFoundError: [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 --versionsucceeds on the cleanedPATH. 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
whichassert (:503) is what stops a dirtyPATHfrom becoming a silent skip. K3 (assert dropped) changes nothing on the bench. In the empty-entry setup it turns31 errorsinto31 skipped in 0.26s.
3. The check (:519-540)
- It reads
case.marks, whichguardedfilled and pytest applies.- K2 (a bug in
guardedthat also guardscheckrows) 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 gives7 failed, 24 passedin both environments. So when the check and the guard disagree, the check fails loudly; it never passes quietly.
- K2 (a bug in
- 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 atorigin/main, so no module imports this file. The fixture returns a dict, changes nothing inos.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_isand thetyped not inassert stay in the test.- One move:
request.getfixturevalue(row.source)now runs afterwhere_the_plan_is. That function only builds a path and a string and touches no file. run_adopt(*arguments, over=None)is the same asrun_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 reasongit 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
checkids passed, 40executeids 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
PATHfilter works. K6 and K7 are SHOULD 1. - K8 is a probe of the disagreement path, not counted:
7 failed, 24 passedin both environments. - The writer's M2, re-run:
8 failed, 103 passed, 75 skippedhidden and8 failed, 178 passedpresent, exactly the body's numbers.
7. With main now
git merge-tree --write-tree 3bec1159 2af1d6644exits 0 with treeae1d1747f.- I made a scratch
commit-treeof it,965dd64c9, and checked it out in a detached worktree. - Main's only change to
adopt-project.pysince base is adopt-project.py and repo_shape.py: a name that holds a default-ignorable character, which a terminal draws as nothing, is spelled by its code point inplan's lines and in theunsafe-valuerefusal, so a branchma<U+034F>inno longer prints asmain(#1128) #1171's_shownand_spelled_character, which leave the order incmd_executealone. - The junit tables are id-for-id identical to the head's in both environments (
identical id/outcome/detail tables: True).
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.01sf39c6707a, file, tool present:188 passed in 118.91s3bec11599, file, tool hidden:170 passed, 49 skipped in 79.63s3bec11599, file, tool present:219 passed in 131.37s965dd64c9(head plus main), file, tool hidden:170 passed, 49 skipped in 77.51s965dd64c9, file, tool present:219 passed in 128.18s3bec11599, file, tool only in git's exec directory:139 passed, 80 skipped in 60.75s3bec11599, 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.99s3bec11599,tests/test_adopt_unsearchable_source.py:40 passed in 11.08s3bec11599,tests/test_path_guard_hygiene.py:121 passed in 23.45s3bec11599,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.
- Shas, blobs and size:
f39c6707a,3bec11599, blob536b5a5cdtod4932c803, +119 -20. All match. - Code claims:
cmd_executeat :17395 and the call at :17414 match, and so do both lists of what comes before and after it (see the trace in section 1). - History claim: "adopt-project.py: a refused command's REFUSED block spells each character a terminal acts on in the command, its directory and what it printed, as
_first_saidspells gh's, so--local-remote-dirno longer reaches the terminal raw there; a NOTE beforeNEXT:says when the source's path in its clone command holds a character a terminal does not show as itself; and rows pin six sites #1177's 148 left to chance (#1195) #1225 (dc9a0bcc7) addedorg-too-long" is right.4552efa6ahas 14Row(s and noorg-too-long;dc9a0bcc7has 16, among themorg-too-longand the placement-plan row, which is refused before the tool. - Rejected alternatives: "
row.localholds 2 of the 7" and "check exits 1 on the 7 plusmistyped-plan" both match the trace's exit codes. - Counts: every count in What, the three boxes, Measured, Tests and M2 matches what I measured. My timings differ by a few seconds.
- Closing form:
Closes #1286is the only one, andclosingIssuesReferencesis[1286]. - Milestone and title: the milestone line reads v1.2.2, and the PR is on milestone v1.2.2. The title is 246 characters. The PR is a draft. The outside-v1.2.0 ruling is not named.
- Follow-up: the candidate is listed and not filed.
- Characters: the only non-ASCII character is the footer's U+1F916.
- Overstated: lines 17, 36 and 40 say more than the check does (SHOULD 1).
- For the squash: the live body also holds a "Summary by Sourcery" block after the footer, which is not in
pr-body-only.md. It has no closing keyword. Leave it out of the squash message.
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_repoabove 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_repoabovetest_the_plan_is_named_as_a_path_is,guardedunchanged): hidden31 passed, 155 skipped in 15.16s; present186 passed in 91.27s. Without the tool, all 80checkids 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): hidden111 passed, 75 skipped in 59.33s; present186 passed in 89.54s. This is literally the issue's third-box mutant, a guard on everyexecuterow, 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, present31 passed in 16.41s. - With K6: hidden
24 failed, 7 passed in 18.73s, present24 failed, 7 passed in 18.99s. The 24 are the 16checkrows and the 8executerows 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 gives31 errors in 0.99s, eachAssertionErrorshowing a childPATHwith an empty entry. With K3 in the same setup it is31 skipped in 0.26s. - Fix (tested):
shutil.which("git-filter-repo", path=entry or os.curdir). Empty-entry layout31 passed in 17.03s, hidden31 passed in 16.84s, present31 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, anddropped: ['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
testsjob (run 42887018652, started 19:36:53Z) was still running at 20:28:40Z.package,tests-git-bashand SonarCloud had passed. needs_filter_repo in case.marksneedsParameterSet.paramto 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.
- The PR'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.*.insteadOfand 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.
|
(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.
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]>
|
|
(lane openRepoShape-1, 2026-11-10T21:05:39Z) Round 1 on #1323 is done at
Lane: openreposhape-1 (openRepoShape-1) |
|
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:
Versions: pytest 9.1.1, CPython 3.12.3, git 2.43.0. My worktree is How I hid the tool. I used r1286a's way, read-only. The one user-local bin directory on 1. The diff
Against the base: 2. SHOULD 1 (the check reads the test function's marks)The check is fixed. K6:
Other places a guard could sit. These are still unread by the check.
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
4. Pytest at the head
|
|
(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.
|
|
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 |



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/mainwhen the branch was made (lane 1 saw the same commit there at 18:55Z). Head:1cf7a37a2(1cf7a37), two commits on it:3bec11599(the change) and1cf7a37a2(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, blob536b5a5cdtoc33740e09, +127 -20. No tool, no template, notests/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_isfailed every character of sevenexecuterows: 35 ids onf39c6707a, each with stderr beginningREFUSED filter-repo-missing:. The issue measured 30 (six rows) at4552efa6a; #1225 (dc9a0bcc7) added the roworg-too-long, whoseexecutereaches 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-longandplan-not-the-source. No other test of the file failed without the tool: its 14 otherfilter-repoids already carry@needs_filter_repoand 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 80checkids and the 40 ids of the eightexecuterows refused before the tool still run without it, and pass.The issue's three boxes:
executerow, withneeds_filter_repoonCASESor on the test function, fails ids of the new check, with the tool hidden and with it present: 8 for a guard on everyexecuterow inCASES(M2 below), 24 for@needs_filter_repoabove the test function (K6 below).Why
Where
executeasks for the tool.cmd_execute(adopt-project.py, line 17395 on base) calls_require_filter_repo()at line 17414. Before it comePlan.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_shortandNamingPolicy.load. After it come_against_its_source(plan-not-the-source),_checked_plan_values,_repository_urlswith_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_checknever calls it:_require_filter_repo()has one caller. So the property is whetherexecuterefuses the row's plan only after line 17414. That is exactly the seven rows that failed, and nocheckrow.How the guard is chosen.
Rowgets a field,reaches_filter_repo: bool = False, setTrueon the seven rows. A comment aboveROWSnames the functions that refuse them, each after_require_filter_repo.guarded(row, command)gives(needs_filter_repo,)for anexecuterow that reaches the tool, and()otherwise.CASESpasses that as eachpytest.param'smarks. 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.checklists it as a finding" (checkexits 1): it holds the 7 andmistyped-plantoo, whoseexecuteis refused by_refuse_a_mistyped_planbefore the tool. One row too wide.executerow: 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.filter-repo-missing, the issue's other option: it would also skip a row thatexecutewrongly started to refusefilter-repo-missingafter a reorder ofcmd_execute, so a regression would read as a skip. It also spends the child before it decides.cmd_executeat 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.CASESwith their marks taken off, and whetherneeds_filter_repois among the marks of the case or oftest_the_plan_is_named_as_a_path_is(needs_filter_repo.mark inboth), so it readsneeds_filter_repoonCASESor on the test function, and it never skips with it.CASESrows once, at a plain plan path, with the tool hidden from the child.REFUSED filter-repo-missing:.test_the_plan_is_named_as_a_path_isasserts of it with the tool: its exit, noTraceback, and its lines.needs_filter_repoonCASESor on the test function is too wide (anexecuterow or acheckrow 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_rowandassert_the_row_sayshold 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_iskeeps its ids and its asserts.How the check hides the tool: the module fixture
no_filter_repo.PATHfrom the session's, less each entry whereshutil.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.gitthan the session's (a package that installs both in one directory, with no other git onPATH, or with another one later), it puts a directory of its own first, holding a link to the session'sgit.shutil.whichfinds no tool on the newPATH, then runsgit filter-repo --versionon it, as_require_filter_repodoes.PATHhides.testsjob installs the tool withpipinto setup-python's environment, and its git is the runner's. On this benchgit --exec-pathholds nogit-filter-repo.Measured
Each run used the probe environment: a stub
ghfirst onPATH,GH_TOKEN=bogus-w1286a(bogus-w1286bin the fix round), an emptyGH_CONFIG_DIR,GIT_CONFIG_GLOBALset to the null device,GIT_SSH_COMMAND=false,EMAILset to a test address,LC_ALL=C.UTF-8andenv -u LANES_LANE. pytest 9.1.1 on CPython 3.12.3, git 2.43.0.Tool hidden. The bench has
git-filter-repoin one user-local bin directory onPATH(it is inPATHtwice). The pytest process was given aPATHwithout every entry that holds a file namedgit-filter-repo. In that environment:shutil.which("git-filter-repo")isNone;git --versionsaysgit version 2.43.0, and the systempython3runs;git --exec-pathholds nogit-filter-repo;git filter-repo --versionexits 1 (git: 'filter-repo' is not a git command).With the tool present,
git filter-repo --versionexits 0 (a40bce548d2c).Each run's
--junitxmlwas 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 for3bec11599match).f39c6707a(main) vs1cf7a37a2(head)35 failed, 139 passed, 14 skipped in 77.56s170 passed, 49 skipped in 77.38s188 passed in 139.73s219 passed in 129.11sBy test id, tool hidden:
test_the_guard_skips_the_rows_that_reach_filter_repo_and_no_other[...], all passed.failed -> skipped: 35, each main stderr beginningREFUSED filter-repo-missing:, and each head skip readinggit filter-repo is not installed: `pip install git-filter-repo`.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_ison head, tool hidden: 120 passed, 35 skipped. The 80checkids pass. Theexecuteids that pass are 5 each ofmistyped-plan,plan-wrong-kind,plan-wrong-kind-a-placement-plan,plan-unsupported-mode,plan-unreadable,plan-no-source,plan-bad-id-with-a-spaceandplan-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 at3bec11599, by the writer; the review's K6 and K7, and the fix round's re-run of M1 to M5, at1cf7a37a2). 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 readROWS,CASESandguarded:::test_the_plan_is_named_as_a_path_isand::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, andgit hash-objectprintedc33740e090c3, the blob at1cf7a37a2(c33740e090c3862f97158abfb95dd5fed8371dbd),equal=Trueevery time,equal=Falsenever: 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 emptygit status --short, andgit hash-objectof its file and of the PR's worktree file both printc33740e090c3862f97158abfb95dd5fed8371dbd. The PR's worktree was never mutated.guardedreturns()42 failed, 144 passed in 100.48s: the test's 35 ids, and the check's 7 rows that reach the tool7 failed, 179 passed in 119.02s: the check's same 7 rowsexecuterow:guardedaskscommand == "execute"alone8 failed, 103 passed, 75 skipped in 68.74s: the check's 8executerows refused before the tool (mistyped-plan, bothplan-wrong-kindrows,plan-unsupported-mode,plan-unreadable,plan-no-source, bothplan-bad-idrows); the test only skips 40 more8 failed, 178 passed in 98.26s: the same 8plan-not-the-sourcewithoutreaches_filter_repo=True6 failed, 150 passed, 30 skipped in 90.41s: the test's 5plan-not-the-source-executeids and the check'splan-not-the-source-execute1 failed, 185 passed in 119.78s: the check'splan-not-the-source-executecheckrow:guardedalso gives it touncovered-plan-check1 failed, 145 passed, 40 skipped in 101.88s: the check'suncovered-plan-check; the test only skips 5 more1 failed, 185 passed in 154.96s: the check'suncovered-plan-checkif not is_guarded:31 failed, 120 passed, 35 skipped in 90.61s: every id of the check31 failed, 155 passed in 115.06s: every id of the check@needs_filter_repoabovetest_the_plan_is_named_as_a_path_is,guardedunchanged (a guard on every id of the main test). Over the check's 31 ids24 failed, 7 passed in 17.58s24 failed, 7 passed in 19.54s3bec11599the check passed 31 of 31 under this mutant, as the review measured)if command == "execute" and shutil.which("git-filter-repo") is None: pytest.skip(...)first in the body oftest_the_plan_is_named_as_a_path_is(a run-time skip of everyexecuterow). Over the 186 ids of the two tests111 passed, 75 skipped in 67.19s186 passed in 105.92spytestmark = [pytestmark, needs_filter_repo]afterneeds_filter_repois defined (a module guard). Over the check's 31 ids, at1cf7a37a231 skipped in 0.23s31 passed in 17.23s@pytest.mark.skipif(shutil.which("git-filter-repo") is None, reason="inline guard")abovetest_the_plan_is_named_as_a_path_is(a guard on every id, spelled another way). Over the check's 31 ids, at1cf7a37a231 passed in 17.22s31 passed in 18.29sneeds_filter_repoitself (Known limits)usefixturesthat skipsexecuterows when the tool is missing (a run-time skip). Over the check's 31 ids, at1cf7a37a231 passed in 17.56s31 passed in 17.35spath=entry, with the tool in the directory pytest runs from and an emptyPATHentry. Over the check's 31 ids31 errors in 0.97sunder the empty-entry layout (the fixture's own assert: the child'sPATHstill holds the empty entry)31 passedKilled: 8 of 12 above. The survivors, K7, K10, K11 and K12, are the known limit: the check reads
needs_filter_repoitself, and no other guard. The control M6 (the check's assert on a guarded row dropped with M2's guard on everyexecuterow;111 passed, 75 skippedhidden,186 passedpresent at3bec11599) was not re-run at1cf7a37a2: 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 at3bec11599.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, on1cf7a37a2):170 passed, 49 skippedPATHtwice)219 passedgit-alonelink first; nosh, noenv31 passed in 19.30s31 passed in 18.72spython3and the tool, first onPATH31 passed in 20.23s../relbinholding the tool31 passed in 18.20s31 passed in 19.06sTests
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.219 passed in 129.11s.c33740e09, the blob the commit holds, andgit status --shortwas empty after the commit.3bec11599the same two calls gave170 passed, 49 skipped in 80.49sand219 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.f39c6707a, for the comparison: tool hidden35 failed, 139 passed, 14 skipped in 77.56s; tool present188 passed in 139.73s.tests/test_repo_hygiene.py,tests/test_path_guard_hygiene.py,tests/test_no_auto_maintenance.pyandtests/test_adopt_unsearchable_source.py, tool present:320 passed, 2 skipped in 52.00s(101 + 121 + 58 + 40 passed). The 2 skips aretests/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
3bec11599in 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 sevenexecuterows thatcmd_executerefuses after_require_filter_repo(), and every count and sha in this body matched what it measured. Commit1cf7a37a2(the one test file, +20 -12) takes all three findings as the review tested them:CASEScarries. A@needs_filter_repoabovetest_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).GUARDSnow also reads the test function's own marks:needs_filter_repo.mark inthe marks of the case and of the test function'spytestmark. K6 now fails 24 ids of the check, hidden and present (the 16checkrows and the 8executerows 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 guardCASESor 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.PATHentry.shutil.which("git-filter-repo", path="")always answeredNone, so the fixture kept an empty entry thatshutil.whichover the joinedPATH, and git, read as the current directory; from a folder holding the tool the check gave31 errors. It now askspath=entry or os.curdir. With the old form put back (N1r) the empty-entry layout gives31 errorsagain; with the fix it gives31 passed.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 thegit-alonelink first whenever the cleanedPATHwould 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 withorigin/main(f7f34fb09when this round was made) is clean:git merge-tree --write-treeexits 0. Not run: CPython 3.14 and pytest 8.3.4 (CI's), which the review could not run either.GUARDSneedspytest.paramto 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 skippedhidden,219 passedpresent).Its one NIT: this body said the check reads any guard
CASESor the test function carries, where it readsneeds_filter_repoitself. Lane 1 took the review's wording fix here, with no code change: the head stays1cf7a37a. K10, K11 and K12 are in Mutants and Known limits. The review's optional code fix (read anyskiporskipifmark on the test function) is not taken.Known limits
reaches_filter_repois 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.needs_filter_repoitself, as a mark on aCASESrow or ontest_the_plan_is_named_as_a_path_is. It does not read a differently spelled skip mark on the test (K11), aneeds_filter_repoin the module'spytestmark(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.git-filter-repoin its own exec path, since noPATHhides it there. None of CI's environments does, and this bench does not.needs_filter_repoasksshutil.whichalone, in this file as in the others that define it, while_require_filter_repoalso accepts a tool that onlygit filter-repofinds. 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 everyneeds_filter_repoask as_require_filter_repoasks.skip_where_cannot_carryhandles 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