Skip to content

tests/test_adopt_plan_paths_spelled.py: seven mutants of the plan written to and cloning ... into lines that no row killed now fail one, so a printable non-ASCII path prints as typed, ESC, CR and a non-UTF-8 --work-dir are spelled, a relative --out is not made absolute, an --out that ends in a space or is wrapped in backticks is spelled, and execute spells the clone line as plan does (#1167) - #1185

Merged
brettheap merged 9 commits into
mainfrom
fix/1167-plan-paths-spelled-rows
Nov 10, 2026

Conversation

@brettheap

@brettheap brettheap commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1167

Stacked on #1154 (for #1115): the base is fix/1115-plan-paths-spelled, because tests/test_adopt_plan_paths_spelled.py is new in that PR. This lands after #1154 and after the v1.2.0 tag. No change to adopt-project.py.

RV1115's review of #1154 (#1154 issuecomment-6344547992) found seven mutants of the two spelled lines, plan written to {out} and cloning {repository} (read only) into {path}, that none of the file's 18 rows failed. #1154's code is right on each case; the rows were missing. 13 rows are added, and the first 18 are unchanged.

Rows

Rows What they hold Mutant
ESC and CR join CHARACTERS (4 rows: --out and --work-dir, each) <D>/pl\x1ban.yaml and \r spelled between backticks on both lines R6, R7
a --work-dir with the byte 0xff, stdout utf-8:surrogateescape (1 row) `<realpath D>/wd\udcffk/source-readonly/Thing` and no raw 0xff on stdout R7
a printable non-ASCII --out, and --work-dir (U+00E9) (2 rows) named as typed, with no backticks R2, R3
a relative --out, plan.yaml and ./plan.yaml, run in tmp_path (2 rows) plan written to plan.yaml R4
--out 'plan.yaml ' and --out '`plan.yaml`' (2 rows) spelled all the same, `plan.yaml ` and `\x60plan.yaml\x60` (#900's rule) R1
check and execute with --source testorg/Thing --work-dir <D>/wd<U+202E>k (2 rows) exit 2, REFUSED source-unclonable, and the spelled cloning line R12

On R12, only the execute row kills the mutant. main sets args.clones = [] for every command, so plan and check hand Source.clone a made list and only execute hands it none; the check row is for check's own line.

plan_of_a_local_source takes an optional cwd (the relative-path rows run there). One helper is new for the 0xff row, which reads the child's bytes, because run_script decodes them in the parent's locale and the raw byte of a mutant would fail that decode and not the assertion.

Mutants

Each mutant is RV1115's, applied to adopt-project.py on #1154's head 8a7828332 (sha256 efe97bf7...b3d2); the old file (those 18 rows) and the new one were run together, and the file was restored with git checkout with its sha256 checked after each.

Mutant Old file, 18 rows New file, 31 rows: fails
R0: no change (control) 18 passed 0 (31 passed)
R1: --out by isprintable() alone (no trailing-space or backtick rule) 18 passed 2: test_a_printable_out_path_that_reads_as_another_is_spelled (trailing-space, begins-and-ends-with-a-backtick)
R2: --out spells every non-ASCII path 18 passed 1: test_a_printable_non_ascii_out_path_is_named_as_it_was_typed
R3: --work-dir spells every non-ASCII path 18 passed 1: test_a_printable_non_ascii_work_dir_is_named_as_it_was_typed
R4: --out printed as _shown(os.path.abspath(out)) 18 passed 4: test_a_relative_out_path_is_named_as_it_was_typed (both) and the two rows of R1
R6: --out spells only Cf, line feed and tab 18 passed 4: test_plan_written_to_spells_an_out_path_a_terminal_would_not_show (escape, carriage-return) and the two rows of R1
R7: --work-dir spells only Cf, line feed and tab 18 passed 3: test_cloning_spells_a_work_dir_a_terminal_would_not_show (escape, carriage-return) and test_a_work_dir_that_is_not_utf8_is_spelled_and_no_raw_byte_is_written
R12: cloning spelled only where made is not None 18 passed 1: test_check_and_execute_spell_the_work_dir_as_plan_does[execute]

As a check on the other side, main's own adopt-project.py (both lines raw): the old file 15 failed and 3 passed, the new file 24 failed and 7 passed; the 7 are the 3 control rows, the two printable non-ASCII rows and the two relative-path rows, which main prints right as well.

Gate

On a scratch merge commit of origin/main 961640c68 and this head 5dc90602f (merge 20401c180, tree b6998640), the landing gate's environment: a stub gh first on PATH, GH_TOKEN=bogus, an empty GH_CONFIG_DIR, an empty global git config, GIT_CONFIG_NOSYSTEM=1, EMAIL set.

File Result
tests/test_adopt_plan_paths_spelled.py 31 passed
tests/test_stdout_encoding.py 47 passed, 1 skipped (Windows default stdout)
tests/test_non_utf8_name_callers.py 36 passed
tests/test_adopt_plan_escapes.py 59 passed
tests/test_path_guard_hygiene.py 49 passed
tests/test_repo_hygiene.py 101 passed

A test-only change, so the doctor shards were not run. git merge-tree --write-tree of this head against origin/main and against #1154's head: exit 0 each. No other open PR touches the test file.

Source ASCII (every non-ASCII character is an escape), POSIX only, and a gh stand-in that refuses for --work-dir, as the file's rules say.

🤖 Generated with Claude Code
Lane: openreposhape-4 (openRepoShape-4)

Summary by Sourcery

Strengthen adoption command tests to cover edge cases in spelled output paths and ensure consistent clone-line formatting across commands.

Enhancements:

  • Expand path-spelling coverage for printable non-ASCII, control-character, non-UTF-8, relative, trailing-space, and backtick-wrapped paths.
  • Verify that plan, check, and execute consistently spell clone destinations in their output.

Tests:

  • Add regression tests covering seven previously surviving mutants in plan and clone path output formatting, including raw-byte suppression for non-UTF-8 paths.

Brett Heap and others added 2 commits October 21, 2026 16:28
…nly) into` name the caller's `--out` and `--work-dir` with `_shown`, as the other lines of the report name a path, so a bidi control, a line feed or a tab in either no longer reaches the terminal as it was typed (#1115)

`cmd_plan` printed `plan written to {out}` and `Source.clone` printed
`cloning {repository} (read only) into {path}` with the typed path as it was.
A path holding U+202E or U+2066 turned the line round, a line feed split it
and a tab padded it, where the `source` line, the table and the follow-ups
spell such a path with `_shown` (#199, #900). #1115 named the `--out` line;
RV1120's review of #1120 (its N4) found the `--work-dir` line, which is said
for an `org/repo` source by `plan`, `check` and `execute` alike.

A path whose every character is printable prints exactly as before.

The `--out` line also spells a byte that is not UTF-8 now, `\udcff` between
backticks where it was written back as 0xff, as `_shown` spells it in every
other line; `test_stdout_encoding.py` pinned the raw byte for that one line,
and its row now holds the spelled one.

tests/test_adopt_plan_paths_spelled.py runs `plan` as a child with U+202E,
U+2066, a line feed, a tab and all four in `--out` and in `--work-dir`, and
with a plain path that must print unchanged. The `--work-dir` rows use a `gh`
that refuses: the line is said before `gh` runs.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…itten to` and `cloning ... into` lines that no row killed now fail one, so a printable non-ASCII path prints as typed, ESC, CR and a non-UTF-8 `--work-dir` are spelled, a relative `--out` is not made absolute, an `--out` that ends in a space or is wrapped in backticks is spelled, and `execute` spells the clone line as `plan` does (#1167)

Follows #1154 (for #1115), from RV1115's review of it (#1154
issuecomment-6344547992): its mutants R1, R2, R3, R4, R6, R7 and R12 left
the 18 rows of the file green, and the code of #1154 is right on each case.
No change to adopt-project.py.

13 rows are added, and the first 18 are unchanged:

- ESC and CR join `CHARACTERS`, which feeds the `--out` rows and the
  `--work-dir` rows alike (R6, R7; 4 rows);
- a `--work-dir` that is not UTF-8, under a `surrogateescape` stdout, is
  spelled `\udcff` between backticks and no raw byte is written (R7; 1 row);
- a printable non-ASCII `--out` and `--work-dir` (U+00E9) print as typed, with
  no backticks (R2, R3; 2 rows);
- a relative `--out`, `plan.yaml` and `./plan.yaml`, prints as `plan.yaml`
  (R4; 2 rows);
- an `--out` that ends in a space, and a relative one that begins and ends with
  a backtick, are printable and still spelled, as `_shown` has it since #900
  (R1; 2 rows);
- `check` and `execute` over a plan from a local source, handed `--source
  testorg/Thing` and a `--work-dir` holding U+202E, refuse as
  `source-unclonable` after the spelled `cloning` line (R12; 2 rows). Only the
  `execute` row kills R12: `plan` and `check` hand `Source.clone` a list of the
  clones they made, `execute` none.

Each new row passes on 8a782733 and fails on its mutant, and each mutant
leaves the first 18 rows green.

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

sourcery-ai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Tests

Expand the path-spelling regression suite to cover printable non-ASCII, relative and ambiguous output paths, control and non-UTF-8 work-directory paths, and consistent clone-line spelling in check and execute.

  • tests/test_adopt_plan_paths_spelled.py L185-234, L278-330, L379-415 (+5 small edits)

Tips and commands

Interacting with Sourcery

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

Customizing Your Experience

Access your dashboard to:

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

Getting Help

@brettheap

Copy link
Copy Markdown
Contributor Author

RV1185: independent review of #1185 at 5dc90602: NOT READY

Independent adversarial review for lane 4. No MUST. One SHOULD: SonarCloud's one new issue on the PR, python:S9073, a composite assert at :320. Two NITs for follow-ups. Apart from S1 the PR does what #1167 asks. Every row #1167 asks for is there and asserts the line #1167 gives. Each of RV1115's seven mutants, which I rebuilt myself, fails at least one new row. #1154's 18 rows stay green under every one of them.

What I measured against

1. The rows against #1167

Each row asserts what #1167 gives, backticks and escapes included. <D> is tmp_path and <R> is os.path.realpath(tmp_path).

#1167 Row(s) Asserts
R2, R3 test_a_printable_non_ascii_out_path_is_named_as_it_was_typed, ..._work_dir_... plan written to <D>/pl<U+00E9>an.yaml and cloning testorg/Thing (read only) into <R>/wd<U+00E9>k/source-readonly/Thing, with no backticks
R6, R7 escape and carriage-return added to CHARACTERS, which feeds both tests (4 rows) `<D>/pl\x1ban.yaml` and `<D>/pl\ran.yaml`, and the same two in wd...k on the cloning line
R7 test_a_work_dir_that_is_not_utf8_is_spelled_and_no_raw_byte_is_written the cloning line, compared as bytes: `<R>/wd\udcffk/source-readonly/Thing`. Also no 0xff on stdout, exit 2, no Traceback, the refusal. Stdout utf-8:surrogateescape, and skip_where_a_name_cannot_be_not_utf_8 as #1167 says
R4 test_a_relative_out_path_is_named_as_it_was_typed[plan.yaml, ./plan.yaml], run in tmp_path plan written to plan.yaml
R1 test_a_printable_out_path_that_reads_as_another_is_spelled, run in tmp_path plan written to `plan.yaml ` and plan written to `\x60plan.yaml\x60`
R12 test_check_and_execute_spell_the_work_dir_as_plan_does[check, execute] over a plan that plan wrote from a local source exit 2, REFUSED source-unclonable, cloning testorg/Thing (read only) into `<R>/wd\u202ek/source-readonly/Thing`, and no U+202E on stdout

I checked the R12 reasoning in the source. plan calls Source.of(..., args.clones) and check calls plan.open_source(..., args.clones). execute calls plan.open_source(args.source, work_root, done=NO_LEG_YET), which passes no list. So made is None only for execute, as the row's docstring says.

2. Mutants

I wrote my own mutants from #1167's and RV1115's text, not from W1167's mutants.py. Each was applied to adopt-project.py at the head.

Each mutant was run against three things at once:

After each run I restored the file with git checkout and checked its sha256. All 20 restores matched.

Mutant Old 18 rows New 31 rows: what fails
R0, no change 18 passed none (51 of 51 passed)
R1: --out printed raw where str(out).isprintable(), else _spelled 18 passed 2: ..._reads_as_another_is_spelled[trailing-space], [begins-and-ends-with-a-backtick]
R2: --out _spelled whenever it is not ASCII 18 passed 1: test_a_printable_non_ascii_out_path_...
R3: the same for the cloning path 18 passed 1: test_a_printable_non_ascii_work_dir_...
R4: _shown(os.path.abspath(out)) 18 passed 4: both R4 rows and both R1 rows
R6a: --out spelled only for Cf, LF or TAB, raw otherwise (no #900 rule) 18 passed 4: [escape], [carriage-return] and both R1 rows. Both test_stdout_encoding.py non-UTF-8 rows fail too
R6b: as R6a, but keeping #900's trailing-space and backtick rules 18 passed 2: [escape] and [carriage-return]. Both test_stdout_encoding.py non-UTF-8 rows fail too
R7: the cloning path spelled only for Cf, LF or TAB 18 passed 3: test_cloning_spells_...[escape], [carriage-return] and the 0xff row
R12: _shown(str(path)) if made is not None else str(path) 18 passed 1: [execute]
O1 (mine): the cloning path left raw where it holds U+DC80 to U+DCFF 18 passed 1: the 0xff row, at the line assert (:323)
O2 (mine): surrogates turned to U+FFFD before _shown (printable, no raw byte) 18 passed 1: the 0xff row, at :323
O3 (mine): the surrogate spelled \xff instead of \udcff 18 passed 1: the 0xff row, at :323
O4 (mine): spelled only where done is empty, another way to single out execute 18 passed 1: [execute]
O5 (mine): raw where sys.argv[1] == "check" 18 passed 1: [check]. So the check row is not dead weight
O7 (mine): R1 without the trailing-space rule only 18 passed 1: [trailing-space]
O8 (mine): R1 without the backtick rule only 18 passed 1: [begins-and-ends-with-a-backtick]
O9 (mine): _shown(str(args.out)), the typed text 1 failed (the dot-segment row) 2: the dot-segment row and [./plan.yaml]
ASCII locale R0 / O1 / R7 (new file only) - 16 passed, 15 skipped / the 0xff row fails / [escape], [carriage-return] and the 0xff row fail

For R1 to R12, every count matches the PR body's table. The body's R6 is my R6a.

3. The helper that reads the child's bytes

plan_of_a_repository_on_github_as_bytes is right, and it cannot hide a failure.

  • What the row asserts. The row asserts the exit, the absence of a Traceback, the refusal, the one cloning line as bytes, and no 0xff anywhere on stdout. The parent decodes nothing.
  • What kills it. O1, O2 and O3 each fail the row at the line assert (:323).
  • UTF-8 locale. It passes under the bench's locale (C.UTF-8).
  • ASCII locale. I ran it under LC_ALL=C PYTHONUTF8=0 PYTHONCOERCECLOCALE=0, where the file name encoding is ascii with surrogateescape. The row is not skipped there, and it passes. O1 and R7 still fail it.
  • One-byte locale. It fails under a Latin-1 locale. See N1.
  • Its environment is not quite run_script's. See N2.

4. Gate

Each run was on the scratch merge cc658afc9: origin/main 961640c68 plus 5dc90602f, tree b6998640, the tree the PR body names.

File Result
tests/test_adopt_plan_paths_spelled.py 31 passed
tests/test_stdout_encoding.py 47 passed, 1 skipped (Windows default stdout)
tests/test_non_utf8_name_callers.py 36 passed
tests/test_adopt_plan_escapes.py 59 passed with git-filter-repo on PATH. Without it, 58 passed and 1 skipped (filter-repo is not installed)
tests/test_path_guard_hygiene.py 49 passed
tests/test_repo_hygiene.py 101 passed
the new file under LC_ALL=C PYTHONUTF8=0 PYTHONCOERCECLOCALE=0 16 passed, 15 skipped. The skips are U+202E, U+2066, the all-four row and U+00E9, which ascii cannot spell
the new file plus the test_stdout_encoding.py non-UTF-8 rows, under Latin-1 5 failed, 15 passed, 13 skipped. See N1

5. Merge-trees

Findings

  • S1 (SHOULD): SonarCloud's one new issue.
    • What. The PR's analysis has one open issue: python:S9073, "Split this composite assertion into separate assertions", on :320: assert code == 2 and b"Traceback" not in stderr, stdout + stderr.
    • Why it counts. The quality gate passed, and the PR body does not mention the issue. But this lane sends S9073 back for a fix round rather than marking it.
    • Fix. Split it in two:
      assert code == 2, stdout + stderr
      assert b"Traceback" not in stderr, stdout + stderr
  • N1 (NIT): three new rows fail under a one-byte locale.
  • N2 (NIT): the new helper's environment.
    • What differs. plan_of_a_repository_on_github_as_bytes starts from {**os.environ, "LANES_LANE": ""}. It skips two things run_script does: blank_unnamed_pin_sources and the git identity defaults.
    • An existing helper does both. test_stdout_encoding.py's run_tool_bytes and child_environ already read a child's bytes with both, plus an empty AGENT_PROTOCOL_ROOT.
    • No effect here. The run ends at the clone refusal, before any pin is read or any commit is made.
    • Follow-up. Build the environment with blank_unnamed_pin_sources, or move run_tool_bytes to conftest.py and use it from both files.

Notes, not findings

Lane: openreposhape-4 (openRepoShape-4)

…issing traceback are two asserts, so a failure names the one that broke (#1167)

The 0xff `--work-dir` row asserted `code == 2 and b"Traceback" not in
stderr` as one composite assert, which SonarCloud flags as python:S9073
on #1185 (RV1185's S1). It is now `assert code == 2` and
`assert b"Traceback" not in stderr`, each with the same message, the
child's stdout and stderr. The row asserts what it asserted before.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@brettheap

Copy link
Copy Markdown
Contributor Author

W1167b: fix round 1 at d193617c answers RV1185's S1

d193617c7 is one commit on 5dc90602f, in tests/test_adopt_plan_paths_spelled.py alone (+2 -1): the composite assert at :320 is two asserts, each with the same message, the child's stdout + stderr. The row asserts what it asserted before.

Before:

    assert code == 2 and b"Traceback" not in stderr, stdout + stderr

After:

    assert code == 2, stdout + stderr
    assert b"Traceback" not in stderr, stdout + stderr

No other assert A and B is among the lines #1185 added: grep -nE '^\s*assert .*\b(and|or)\b' finds this one line in the whole file, before the change and none after.

Tests on d193617c7, in the landing gate's environment (stub gh, GH_TOKEN=bogus, empty GH_CONFIG_DIR, empty global git config, GIT_CONFIG_NOSYSTEM=1, EMAIL set):

A test-only change, so no doctor shards and no mutants. The merge-tree is clean (exit 0) against origin/fix/1115-plan-paths-spelled (8a7828332, tree 4532a4bb, the head's own tree) and against origin/main (961640c68, tree 173a373a). No open PR but #1154 touches the file.

N1 and N2 are NITs; they go to a follow-up issue the lane files, and this round changes nothing for them.

Lane: openreposhape-4 (openRepoShape-4)

@brettheap

Copy link
Copy Markdown
Contributor Author

RV1185r2: independent re-check of #1185 at d193617c: READY

Independent re-check for lane 4 of W1167b's fix round. No MUST, no SHOULD. S1 is resolved. One thing is still open when I post: the tests check is pending (see 3), so the landing gate's H0 waits for it. N1 and N2 are NITs and go to the lane's follow-up issue.

1. Scope

2. Tests (the landing gate's environment)

Stub gh first on PATH, GH_TOKEN=bogus, an empty GH_CONFIG_DIR, an empty global git config, GIT_CONFIG_NOSYSTEM=1, EMAIL set, /usr/bin/python3 -m pytest -p no:cacheprovider with tmp_path_retention_policy=failed. Before each run my script waited for 19456 MB free; the runs started at 19983 MB or more.

Tree test_adopt_plan_paths_spelled.py test_repo_hygiene.py
Scratch merge 99ccbca39: origin/main 961640c68 plus d193617c7, tree 173a373ab 31 passed 101 passed
The head d193617c7 itself, on #1154's base, tree 4532a4bb8 31 passed 100 passed

The hygiene counts differ by one (101 on the merge, 100 on the head), as RV1185 (101) and W1167b (100) each reported. Both worktrees were clean after the runs.

3. CI on d193617c7

  • tests-git-bash: pass (3m42s). package: pass.
  • tests: still pending. I polled gh pr checks 1185 every 90 s for 590 s, from 07:45 to 07:53Z, in one call; the job (run 39919473370) sat at its tests step, the full suite, which had run for 12 minutes by then. It had not ended when I read it again at 07:56Z, just before posting. A test-only change to one file, with that file green on both trees above, makes a failure there unlikely. The lane's landing gate still needs it green.
  • SonarCloud: its check passes on this head ("Quality Gate passed", analysis completed 07:42:26Z, "0 New issues"). The SonarQube search for opensoft_openRepoShape pull request 1185, statuses OPEN and CONFIRMED, returns an empty list (total 0). The quality gate status reads OK on all five conditions (reliability, security and maintainability ratings 1, duplication 0.0, hotspots reviewed 100).

4. Is S1 resolved

Yes. S1 was python:S9073 on the composite assert at :320. That assert is gone, SonarCloud now reports 0 new issues on the PR, and the issue search is empty. The row still asserts what it did: the same two conditions, now one assert each.

The split keeps the row's teeth. I ran the row (test_a_work_dir_that_is_not_utf8_is_spelled_and_no_raw_byte_is_written) against four mutants in the head's worktree, restored the file after each with git checkout, and checked sha256 and git status each time (test 929a35a6..., adopt-project.py efe97bf7..., status 0):

Mutant Result
M0, none 1 passed
M1: the cloning path printed raw, {path} for {_shown(str(path))} fails at :324, the line assert
M2: the path run through UTF-8 replace before _shown, so U+FFFD for the surrogate fails at :324
M3: the exit code asserted as 3 fails at :320, the first split assert, assert 2 == 3
M4: Traceback demanded in stderr fails at :321, the second split assert, with the child's output in the message

So each half of the old composite fires alone, and a failure names the one that broke.

5. Merge-trees

Findings

No new finding.

  • S1 (SHOULD): resolved, as above.
  • N1 (NIT) and N2 (NIT) from RV1185 stand and are not for this PR. They go to the lane's follow-up issue: N1, the new rows fail under a one-byte (Latin-1) locale, where skip_where_a_name_cannot_be_not_utf_8 could also skip where os.fsdecode(b"\xff") != NOT_UTF_8_PROBE; N2, plan_of_a_repository_on_github_as_bytes builds its environment without blank_unnamed_pin_sources and the git identity defaults that run_script and test_stdout_encoding.py's run_tool_bytes use.

Notes, not findings

Lane: openreposhape-4 (openRepoShape-4)

@brettheap brettheap added this to the v1.2.1 milestone Oct 23, 2026
brettheap added a commit that referenced this pull request Nov 9, 2026
…encode, so it passes under Latin-1 where it ended in a traceback, and 45 rows in 11 test files that cannot judge under a one-byte locale skip there on their own premise (#1214) (#1258)

## Goal

#1214 counts 50 tests in 12 files that fail under a Latin-1 locale before and after #1209, and asks of each whether it is a test that cannot judge under a one-byte locale, or a tool that misbehaves there. All 50 are settled here:

- **3 are a tool defect, fixed:** a family holder's `scripts/validate-family.py` ended in a `UnicodeEncodeError` traceback, exit 1, on any stdout that cannot hold U+2026, when the holder passed.
- **45 cannot judge under Latin-1,** and now skip there on their own premise, which the skip reason states. 18 fail in the test process itself, before the tool runs. In the other 27 the tool answers rightly for the bytes Latin-1 gives, and the row expects UTF-8's.
- **2 judge under Latin-1 as they are written, and carry no guard:** `test_a_utf8_source_directory_still_adopts_with_local_remotes` (it passes with the pip-installed git-filter-repo, and fails with a `python -E` one on #1247's tool defect; see "Left") and `test_surrogateescape_reads_the_issues_branch_as_caf_and_u_dce9` (its `if` asks the one thing its assertion needs). Both came out of RV1258's review of the first commit.

Under Latin-1 with the pip-installed git-filter-repo, none of the 50 fails on this head. Under UTF-8 every row keeps its outcome, and the rows added pass.

The classification is W1214's: lane 4's first writer of #1214, who read each test's code and stopped at a checkpoint with half the guards written and nothing run. This branch finishes the guards, runs every gate below, and measures each row. RV1258 reviewed the first commit; the second answers it (next section).

## The second commit

RV1258 reviewed the first commit, `c8641c691` (NOT READY: two SHOULDs, three NITs, no MUST; #1258 (comment)). The second commit, `cd9f3cfd1`, answers it on top of the first, with no rebase. It changes four test files and no tool:

- **S1, a premise guard on a row that passes:** the guard on `test_a_utf8_source_directory_still_adopts_with_local_remotes` is gone, and so is the `A_NAME_HELD_AS_UTF_8` import it alone used in `tests/test_adopt_template_values.py`.
  - The guard skipped a row that passes: on main under Latin-1, with CI's pip-installed git-filter-repo, the row passes. Its skip reason (the tool "names it as" a name that is not UTF-8) was false for it, because `execute` adopts the source.
  - The row now runs under Latin-1 and passes with the pip launcher. With a launcher started as `python -E` it fails on #1247's tool defect (git-filter-repo's `UnicodeEncodeError` on U+FFFD) until #1251 lands. That is a failure of the tool, and #1214's rule sends such a row to an issue of its own, not to a skip.
  - **#1258 and #1251 are now independent of each other.** This PR carries no guard for #1251 to drop, so the earlier plan, that whichever of the two lands second drops this PR's guard, is void. Neither waits for the other.
- **S2, nothing CI runs held the helper's answers:** `tests/test_non_utf8_name_helpers.py` gets 20 rows, written as that file writes its Windows rows: `os.fsencode`, `os.fsdecode` and `sys.getfilesystemencoding` are replaced for one test by UTF-8, Latin-1 and ASCII as POSIX has them.
  - 15 rows (five texts, three locales) hold which question skips the text (none, "cannot spell", "writes" or "reads"), and that the reason names the encoding, ends with the row's premise, and is ASCII.
  - 5 rows hold the emulation to this run's real locale: the helper answers the same with the real `os` as with the emulation of its file system encoding.
  - RV1258's mutant A5 (UTF-8 bytes built with `surrogatepass` instead of `surrogateescape`) now fails 3 rows under CI's UTF-8 locale; before, it made 11 rows skip silently. The mutants that survived, A1, A2 and A4, now fail 5, 1 and 6 rows (see the mutants below).
- **N1:** the first-statement row of `tests/test_bootstrap_spelling.py` also reads `templates/family-root/scripts/validate-family.py`, so RV1258's mutant D3 (the `escape_unencodable_stdout()` call moved after `parse_args`) fails it.
- **N3:** `test_surrogateescape_reads_the_issues_branch_as_caf_and_u_dce9` no longer asks the helper. Its `if` also asks `os.fsdecode(b"\xe9") == chr(0xDCE9)`, so under Latin-1 the row runs its first assertion and passes where it skipped, and under UTF-8 and ASCII it asserts as before.
- **N2, known and left:** under emulated Windows codecs the helper skips the U+DCE9 rows that carry no Windows mark, with a premise that is false on Windows. That is reasoned and emulated, not run on Windows, and CI runs Linux only (#597).

## The 50, by file

Kinds:
- **a1:** the test process itself cannot make or pass the name under Latin-1, so it raises `UnicodeEncodeError` before the tool runs. Guard: the existing `skip_where_the_environment_cannot_carry`.
- **a2:** the tool runs and answers rightly for the bytes Latin-1 gives, and the row expects UTF-8's reading or spelling. Guard: the new `skip_where_the_locale_does_not_spell_it_as_utf_8(text, premise)`, asked only of the text the row's premise is about.
- **b:** a tool defect.
- **c:** the row judges under Latin-1 as it is written, and runs there with no guard.

`test_stdout_encoding.py` comes first, as #1214 asks. 18 a1 + 27 a2 + 3 b + 2 c = 50.

| File | Rows | Kind | Why it fails under Latin-1 | Guard |
|---|---|---|---|---|
| `tests/test_stdout_encoding.py` | 10: `test_plan_reports_every_name_whatever_its_stdout_can_encode` (3), `test_plan_on_the_posix_default_stdout`, `test_every_tool_exits_alike_whatever_its_stdout_can_encode` (6) | a1 | The test makes a file or directory named U+65E5 U+672C, or passes that name on a command line, and Latin-1 cannot encode it. | `skip_where_the_environment_cannot_carry`, in `plan_arguments` and in each of the six builders. (`bump-leg-dry-run` writes the name as bytes and passes, so it has none.) |
| `tests/test_adopt_pins.py` | 5 `[zwj]` rows | a1 | U+200D cannot go on the command line, or through `copytree`. | `skip_where_the_environment_cannot_carry(name)` |
| `tests/test_adopt_pins.py` | 4 `[not-utf-8...]` rows | a2 | The byte 0xFF is read as U+00FF, printable text the tool takes, so `plan` goes on where UTF-8 gives U+DCFF and a refusal. | `A_BYTE_READ_AS_A_SURROGATE`, where the name holds U+DCFF |
| `tests/test_adopt_pins.py` | 5 rows that compare a `pin` or `write` line | a2 | A Latin-1 stdout has no U+2026, so the tool prints the digest's ellipsis as `\u2026`, as #214 designed. | `PRINTED_AS_ITSELF`, just before the line is compared |
| `tests/test_pin_source_unreadable.py` | 3 `[not-ascii-*]` | a1 | The path U+65E5 U+672C `-missing` cannot go on the command line. | `skip_where_the_environment_cannot_carry` |
| `tests/test_pin_source_unreadable.py` | 3 `[not-utf-8-*]` | a2 | `miss<0xFF>ing` reaches the tool as text, and is printed as itself, not as `\udcff`. | `A_BYTE_READ_AS_A_SURROGATE` |
| `tests/test_family_tracking_branch.py` | `test_each_act_refuses_the_tracking_branch_then_lands_on_a_branch` `[add]`, `[bump]`, `[remove]` | **b** | Each act passes until `validate(holder)`. The holder's `validate-family.py` prints `members/X: tree digest recomputes (<12 hex>...)`, ending in U+2026, and never escaped its stdout, so it ended in a traceback, exit 1. | none: the tool is changed |
| `tests/test_family_tracking_branch.py` | `test_a_branch_ending_in_a_no_break_space_is_pushed_as_itself` | a2 | `git switch -c feat<U+00A0>` writes the single byte 0xA0, so the branch is not UTF-8, and the tool rightly refuses it (#765). | `A_NAME_HELD_AS_UTF_8` |
| `tests/test_adopt_template_values.py` | the `--elected-by` and `--reference` rows of `test_plan_refuses_a_flag_no_file_can_hold` whose value holds U+DCE9, and `test_plan_and_check_say_the_same_sentence` | a2 | 0xE9 is read as U+00E9, text `plan` takes. | `A_BYTE_READ_AS_A_SURROGATE` (in the flag test, only where the value holds U+DCE9) |
| `tests/test_adopt_template_values.py` | `test_a_utf8_source_directory_still_adopts_with_local_remotes` | **c** | With the pip launcher it does not fail under Latin-1 on this head or on main: its `caf<U+00E9>` directory is the single byte 0xE9, and `execute` adopts the source all the same. It fails only where git-filter-repo is started as `python -E`, on #1247's tool defect (see "Left"), which is an issue of its own and not a premise to skip on. | none (a guard was here in the first commit, and RV1258's S1 took it out) |
| `tests/test_clone_url_bytes.py` | the 4 `[bidi-override-*]` rows | a2 | The directory is made from U+202E's UTF-8 bytes E2 80 AE. Latin-1 reads them as three characters, one of them the C1 control U+0080, so the tool rightly says "a control character". | `A_NAME_READ_AS_UTF_8`, in `skip_where_this_system_cannot_name` |
| `tests/test_bump_leg_branch_and_push_line.py` | 2 | a2 | The branches `feat<U+00A0>` and `main<U+00A0>` hold the single byte 0xA0. | `A_NAME_HELD_AS_UTF_8` |
| `tests/test_bootstrap_leg_moves.py` | 2 | a2 | `bootstrap.py` prints U+2014 escaped on a Latin-1 stdout. | `PRINTED_AS_ITSELF`, just before the assert |
| `tests/test_update_shape_apply_lines_and_headers.py` | 1 | a2 | The branch `feat<U+00A0>`. | `A_NAME_HELD_AS_UTF_8` |
| `tests/test_adopt_spelled_names.py` | 1 | a2 | The test writes `caf<U+00E9>.md` as 0xE9, so git holds a name that is not UTF-8, and the C-locale child prints `caf\udce9.md`, not `caf\xe9.md`. | `A_NAME_HELD_AS_UTF_8`, after its C-locale probe |
| `tests/test_family_member_branch_not_utf8.py` | `[trailing-no-break-space]` | a2 | `_member_head` reads the byte 0xA0 as U+DCA0, which is the branch git wrote. | `A_NAME_HELD_AS_UTF_8`, only where the branch is not `NOT_UTF_8_BRANCH`: `[not-utf8]` passes under Latin-1 and still runs there |
| `tests/test_family_head_by_hand_bytes.py` | 1 | **c** | Its `if`, `os.fsencode(chr(0xDCE9)) == b"\xe9"`, holds under Latin-1 too, and its assertion, `os.fsdecode(LATIN_1) == branch`, holds only where the locale reads 0xE9 as U+DCE9 (UTF-8, ASCII). Its first assertion holds in every locale. | none (RV1258's N3): the `if` also asks `os.fsdecode(b"\xe9") == chr(0xDCE9)`, so under Latin-1 the row runs its first assertion and passes |

## What changed, file by file

18 files: one tool, `tests/conftest.py`, and 16 test files.

- **`templates/family-root/scripts/validate-family.py`** (the tool):
  - `main`'s first statement is now `escape_unencodable_stdout()`, imported from `repo_shape`, as in `siblings.py` and both roots' `bootstrap.py` (#391, #454).
  - That call adds no version-skew risk. The function shipped in the same commit as `spelled` (ec4a7a0), which the file already imports, and it is not in `test_pinned_copy_text.py`'s `NEWER_THAN_A_KEPT_LIBRARY`.
  - The holder's shape-pin digests are written by `init`, so there is no static digest to move.
- **`tests/test_family.py`:** one new row, `test_the_gate_passes_on_a_stdout_that_cannot_hold_its_notes`. It runs the holder's gate with `PYTHONIOENCODING=latin-1` and expects exit 0, no traceback, and the two notes ending in `\u2026)`.
- **`tests/conftest.py`:**
  - The new helper, `skip_where_the_locale_does_not_spell_it_as_utf_8(text, premise)`, asks three questions, each through `os` at call time: whether `os.fsencode` can spell the text, whether it gives UTF-8's bytes, and whether `os.fsdecode` reads those bytes back as the text.
  - Four premise sentences go with it: `A_BYTE_READ_AS_A_SURROGATE`, `A_NAME_HELD_AS_UTF_8`, `PRINTED_AS_ITSELF` and `A_NAME_READ_AS_UTF_8`. Every skip reason is ASCII.
  - It is never asked inside `skip_where_a_name_cannot_be_not_utf_8`. A branch whose bytes are not UTF-8 is one in every locale, so those rows still judge under Latin-1, and this takes none of #1224's N1 over-skip.
- **The 11 files with guards** are the files of the table above that name a guard. Each guard sits just before the first line that needs its premise. `tests/test_family_head_by_hand_bytes.py` has none: its `if` is narrowed (N3).
- **`tests/test_non_utf8_name_helpers.py`** (the second commit): 20 rows hold `skip_where_the_locale_does_not_spell_it_as_utf_8` under emulated UTF-8, Latin-1 and ASCII (S2, above).
- **`tests/test_bootstrap_spelling.py`** (the second commit): the first-statement row takes `validate-family.py` as a third file (N1).
- **`tests/test_non_utf8_name_callers.py`:** `windows_names_it` now emulates Windows' `os.fsdecode` too (UTF-8 with `surrogatepass`, `windows_fsdecode`).
  - Without it, the bidi guard in `skip_where_this_system_cannot_name` asked this run's real Latin-1 `os.fsdecode` under an emulated Windows.
  - Measured: `test_where_windows_holds_a_bidi_override_the_name_check_does_not_skip` then failed under Latin-1 (1 failed, 35 passed), where it passes on main. With the emulation, the file gives 36 passed in both locales.
  - Real Windows reads UTF-8 in every locale, which is what that row's own reasoning ("NTFS holds U+202E, so the `bidi-override` row ... runs on Windows as it does here") assumes.

## Runs

**Environment.** One runner for every run: `/usr/bin/python3 -m pytest -p no:cacheprovider` (Python 3.12.3).
- A stub `gh` first on PATH, a bogus `GH_TOKEN` and an empty `GH_CONFIG_DIR`.
- `GIT_CONFIG_GLOBAL` an empty file, `GIT_CONFIG_NOSYSTEM=1`, the test identity, and `EMAIL` set.
- `GIT_ALLOW_PROTOCOL`, `GIT_SSH_COMMAND` and the `LANES_*` variables unset.
- **Every run counted here had git-filter-repo 2.47.0 on PATH** (`git filter-repo --version`: `a40bce548d2c`, CI's pin, pip-installed in a venv). An earlier pair of head runs without it skipped 58 adoption rows, and is not counted.
- That git-filter-repo's launcher is the pip one, with no `python -E`, so a test's own `PYTHONIOENCODING` reaches it. The `-E` comparison is the last paragraph of this section.

**Locales.**
- UTF-8: `LC_ALL=C.UTF-8`.
- Latin-1: built with `localedef -c`, as #1153's `test_adopt_one_byte_locale.py` builds one; then `LOCPATH`, `LC_ALL=en_US.ISO-8859-1`, `PYTHONUTF8=0`. Python reports `iso8859-1` and reads 0xFF as U+00FF.
- ASCII: `LC_ALL=C PYTHONUTF8=0 PYTHONCOERCECLOCALE=0`.

**Round one's gate** (the first commit, `c8641c691`, on main `bd3e9c148`, 27 files, F1214's runs): UTF-8 1520 passed and 1 skipped on main, 1521 and 1 on the head; Latin-1 123 failed, 1373 passed, 25 skipped on main, and 44 failed, 1404 passed, 74 skipped on the head. RV1258 re-ran it on 35 files (main `5926ccca`, merge `103ada82`) and got the same transitions. The gate below replaces it.

**The gate: 29 files, on a scratch merge.** The merge is this head (`cd9f3cfd1`) into `origin/main` `46fe6ac19` (local, never pushed, clean); the baseline is `46fe6ac19` itself. Both with the pip launcher.
- The 27 files of round one: the 23 files on main that use `skip_where_a_name_cannot_be_not_utf_8` or `on_a_branch_that_is_not_utf_8`, with `test_repo_hygiene.py` (W1196's 24, less the two files #1209 adds, plus `test_family_leg_path_by_hand_bytes.py`), and four more that run the changed code: `test_family.py`, `test_pinned_copy_text.py`, `test_update_shape_kept_helper.py` and `test_local_remote_dir_urls.py`. They include `test_non_utf8_name_helpers.py`.
- Two more for the second commit: `test_path_guard_hygiene.py` (the second hygiene file) and `test_bootstrap_spelling.py`.

| Run | main `46fe6ac19` | scratch merge with this head |
|---|---|---|
| 29 files, UTF-8 | 1873 passed, 1 skipped | 1895 passed, 1 skipped |
| 29 files, Latin-1 | 128 failed, 1721 passed, 25 skipped | 49 failed, 1775 passed, 72 skipped |
| the 50, UTF-8 | 50 passed | 50 passed |
| the 50, Latin-1 | 49 failed, 1 passed | **0 failed**, 5 passed, 45 skipped |
| the 50, Latin-1, `-E` launcher | 50 failed (on `bd3e9c148`, round one) | 1 failed, 4 passed, 45 skipped |

The 5 that pass under Latin-1 are the 3 tracking-branch rows (the tool fix), `test_a_utf8_source_directory_still_adopts_with_local_remotes` and `test_surrogateescape_reads_the_issues_branch_as_caf_and_u_dce9`.

Main moved twice while this was gated, none of its commits touching a file of the gate or of this PR. The merge was run again on each: on `9729315f1` the same 29 files, with identical outcomes by test id in both locales (1895 passed, 1 skipped; 49 failed, 1775 passed, 72 skipped); on `801a7d6d0` the 50 and the four files the second commit changes (`test_non_utf8_name_helpers.py`, `test_bootstrap_spelling.py`, `test_family_head_by_hand_bytes.py`, `test_adopt_template_values.py`). The 50 give the same as above in all three modes (UTF-8 50 passed; Latin-1 pip 0 failed, 5 passed, 45 skipped; Latin-1 `-E` 1 failed, 4 passed, 45 skipped), the four files give 385 passed under UTF-8, and 6 failed, 371 passed, 8 skipped under Latin-1: the 5 `test_bootstrap_spelling.py` rows and `test_execute_refuses_a_local_source_directory_that_is_not_utf8`, all of which fail on main too.

**By test id, from main to the scratch merge:**
- **UTF-8:** 22 new rows, all passed: the 20 of `test_non_utf8_name_helpers.py`, the `[validate-family]` row of the first-statement test, and the first commit's `test_the_gate_passes_on_a_stdout_that_cannot_hold_its_notes`. Nothing else changes: no new skip, no row from passed to failed. The one skip is `test_stdout_encoding.py`'s Windows default-stdout row, on both.
- **Latin-1:**
  - 0 rows from passed to failed.
  - 0 from passed to skipped. (The first commit had one, the S1 row; it passes now.)
  - 32 from failed to passed: the 3 tracking-branch rows and `test_surrogateescape_reads_the_issues_branch_as_caf_and_u_dce9` of the 50, and 28 other rows of `test_family.py` whose holder's gate ended in the same traceback.
  - 47 from failed to skipped: 45 of the 50, and the 2 bidi rows of `test_local_remote_dir_urls.py`, which share `BAD_DIRECTORIES`.
  - 22 new rows, passed.
  - Each of the 49 failures fails on main too: the rows #1209 settles, the rows under "Left", and 5 rows of `test_bootstrap_spelling.py` (see "Left").

**On a scratch merge with #1209** (main `46fe6ac19`, #1209 at `13a2c58cb`, then this head; local, never pushed, both merges clean). #1209 shares four files with this PR: `tests/conftest.py`, `tests/test_non_utf8_name_callers.py`, `tests/test_non_utf8_name_helpers.py` and `tests/test_stdout_encoding.py`. Run on 8 files: the three test files among those four, #1209's `test_adopt_plan_paths_spelled.py` and `test_run_script_encoding.py`, and `test_adopt_template_values.py`, `test_family_head_by_hand_bytes.py` and `test_bootstrap_spelling.py`. Against main plus #1209 alone:
- UTF-8: 483 passed and 1 skipped, then 504 passed and 1 skipped: the 21 new rows (the 20, and the `[validate-family]` row), nothing else.
- Latin-1: 19 failed, 411 passed, 54 skipped, then 5 failed, 433 passed, 67 skipped: 21 new rows passed, 1 failed to passed, 13 failed to skipped. The 5 failures are the `test_bootstrap_spelling.py` rows, which fail on both. Of the 50, the 15 in these files give 13 skipped and 2 passed, none failed.

**The other 59 test files that name `validate-family`** (round one, on the first commit, UTF-8): 3374 passed, 28 skipped, 0 failed. The second commit changes no tool.

**The same launcher started as `python -E`** (W1247's copy of it with `-E` added, used read-only), Latin-1, the 50: on main `bd3e9c148`, **50 failed**, the 50 exactly as #1214 lists them. On the first commit, 0 failed. On this head, **1 failed**, 4 passed, 45 skipped: the S1 row, `test_a_utf8_source_directory_still_adopts_with_local_remotes`, on #1247's traceback (`UnicodeEncodeError` on U+FFFD in `git_filter_repo.py`'s `_migrate_origin_to_heads`, then `REFUSED extracting the spec leg`). It stays red with that launcher until #1251 lands, and the other 49 rows are as with the pip launcher.

## The new rows, and mutants

Each mutant was made in a scratch worktree at the head and restored afterwards, with each file's sha256 checked. "UTF-8" and "Latin-1" name the locale of the run.

**The second commit's rows.** The helper's own rows run in CI's UTF-8 locale, with the three locales emulated.

| Mutant | Run | Result |
|---|---|---|
| none (the head), `test_non_utf8_name_helpers.py` | UTF-8 | 39 passed (19 before, 20 new) |
| the new rows against main's `tests/conftest.py`, which has no helper | UTF-8 | the file does not import: `cannot import name 'skip_where_the_locale_does_not_spell_it_as_utf_8'` |
| A5: the helper's UTF-8 bytes built with `surrogatepass` | UTF-8 | **3 failed**: the `byte-e9` row in each of the three locales. Before, the same mutant made 11 rows skip silently under UTF-8 and failed none (RV1258). |
| A1: the first question's skip taken as UTF-8's bytes | UTF-8 | **5 failed**: `iso8859-1` and `ascii` for `bidi-override` and `ellipsis`, and `ascii-e-acute` |
| A2: the second question dropped | UTF-8 | **1 failed**: `iso8859-1-e-acute` (it reads the bytes back and says "reads", not "writes") |
| A4: only the third question | UTF-8 | **6 failed**: the rows A1 and A2 fail, together |
| A3: the third question dropped | UTF-8 | **1 failed**: `iso8859-1-byte-e9` |
| A6: the third question inverted | UTF-8 | **9 failed** |
| the encoding in the reason named `utf-8` always | UTF-8 | **7 failed** |
| the row's premise left out of the first question's reason | UTF-8 | **5 failed** |
| the UTF-8 bytes built with `strict` | UTF-8 | **4 failed**: the three `byte-e9` rows, and the row that holds the emulation to the real locale |
| the second and third questions swapped | UTF-8 | **1 failed** |
| the first question catching any exception | UTF-8 | survives, and is equivalent: `os.fsencode` of a str raises only `UnicodeEncodeError` |
| D3: `validate-family.py`'s `escape_unencodable_stdout()` moved after `parse_args` | UTF-8 | **1 failed**: the `[validate-family]` row |
| main's `validate-family.py` under the head's tests | UTF-8 | **2 failed**: the `[validate-family]` row and `test_the_gate_passes_on_a_stdout_that_cannot_hold_its_notes` |
| N3's narrowed `if` taken out (main's `if`, with no helper call) | Latin-1 | **1 failed**: `test_surrogateescape_reads_the_issues_branch_as_caf_and_u_dce9` (it passes under UTF-8) |

On the 50 under Latin-1 the helper's mutants are as in round one, re-measured on this head: A3 gives **10 failed** (it was 11; the N3 row no longer asks the helper), the first question unguarded gives **11 failed**, and A1, A2 and A4 survive (5 passed, 45 skipped), because on Linux the third question alone decides there, as RV1258 found. Only the new rows tell them apart.

**The first commit's rows** (mutants made on `c8641c691`, which the second commit does not change):

| Mutant | Run | Result |
|---|---|---|
| none (the head), the new row of `test_family.py` | UTF-8 | 1 passed |
| main's `validate-family.py` under the head's tests (the new row on main) | UTF-8 | **1 failed**: the new row |
| `validate-family.py`'s `main` without the `escape_unencodable_stdout()` call (import kept) | Latin-1 | **4 failed**: the new row, and the `[add]`, `[bump]`, `[remove]` rows of `test_each_act_refuses_the_tracking_branch_then_lands_on_a_branch` |
| the bidi guard taken out of `skip_where_this_system_cannot_name` | Latin-1 | **6 failed**: the 4 bidi rows of `test_clone_url_bytes.py` and the 2 of `test_local_remote_dir_urls.py`, the same `BAD_DIRECTORIES` |
| `windows_names_it` without the `os.fsdecode` emulation | Latin-1 | **1 failed**: `test_where_windows_holds_a_bidi_override_the_name_check_does_not_skip` |
| the guard of `test_the_member_head_is_the_branch_git_wrote` asked of every branch (its `branch != NOT_UTF_8_BRANCH` dropped) | Latin-1 | `[not-utf8]` goes from passed (the head) to skipped; no row fails. A skip fails no run, so only a comparison of outcomes sees this one. |

## Merge-trees

`git merge-tree --write-tree` of the head (`cd9f3cfd1`):
- against `origin/main` `46fe6ac19`: clean;
- against #1209 `13a2c58cb`, #1185 `d193617c7`, #1154 `8a7828332`, #1251 `abeac66de` and #1198 `d38e4e36d`: each clean;
- against the other open PRs that touch any of these 18 files, at their heads: #1263 `9ef8f0ab5`, #1246 `0deac3a65`, #1231 `aca00dfd9`, #1227 `2d56c1906`, #1178 `c4beba193`, #1172 `2eabec8e0` and #1125 `9549006fe` are clean. #1201 `eac177af9` conflicts at `docs/handbook.html`, which this branch does not touch, and conflicts there against `origin/main` alone too.

#1209 changes `skip_where_a_name_cannot_be_not_utf_8` and the callers fixture `a_system_that_carries_the_byte`. The new helper sits more than 100 lines from the first, and `windows_names_it` 65 lines from the second. #1209 also edits `tests/test_non_utf8_name_helpers.py`, where the second commit adds its rows at the end of the file; the two merge without a conflict, and the merged file's rows pass (see "Runs").

## Left, and outside this issue

- **W1214's filter-repo defect is filed separately, as #1247**, and #1251 (a draft for it) is independent of this PR.
  - What W1214 found: `adopt-project.py execute` fails for a Latin-1 user whose source path holds U+00E9. The leg clone's `remote.origin.url` holds the byte 0xE9, git-filter-repo decodes it with `errors='replace'` and prints U+FFFD to a Latin-1 stdout, and `execute` stops at `REFUSED extracting the spec leg`.
  - **Which launcher runs git-filter-repo decides it.** One started as `python -E` ignores the `PYTHONIOENCODING` the tool gives its children; a pip-installed one, as CI installs it, is not started that way. Measured here (see "Runs"): `test_a_utf8_source_directory_still_adopts_with_local_remotes` passes on main under Latin-1 with the pip launcher, and fails there with a `-E` copy of the same launcher. W1196's list of 50 has this row failing, which this bench gives only with the `-E` launcher.
  - **Independent of #1251.** This PR no longer guards that row (RV1258's S1), so it carries nothing for #1251 to drop, and the earlier plan, that whichever of the two PRs lands second drops this PR's guard, is void. #1251 changes `_extract_leg` in `adopt-project.py` and adds `tests/test_adopt_filter_repo_origin_url.py`, and touches none of these 18 files (`git merge-tree` against its head `abeac66de` is clean). The row passes under Latin-1 with the pip launcher whichever lands first. With a `-E` launcher it fails on #1247's traceback until #1251 lands, which is the tool's failure showing, not a premise this PR can judge.
- **N2 (RV1258), known and left:** under emulated Windows codecs, the helper skips the U+DCE9 rows that carry no Windows mark, with a premise that is false on Windows. It is reasoned and emulated, not run on Windows; CI runs Linux only (#597).
- **5 rows of `tests/test_bootstrap_spelling.py` fail under Latin-1** on main, on this head and on the merge with #1209 alike. It is a file #1214 does not list, read from the failure messages only: four rows end in a `UnicodeEncodeError` on U+2028, which Latin-1 cannot encode, and `test_a_branch_name_is_spelled_in_every_line_that_names_it` fails its assertion. They are left for an issue of their own.
- **8 rows in two files #1214 does not list fail under Latin-1** on main, on this head and on the merge with #1209 alike:
  - 6 rows of `test_pinned_copy_text.py`: the tool prints U+2014 or U+2026 escaped on a Latin-1 stdout, and the row compares the character.
  - `test_family.py`'s `test_init_writes_the_holders_agent_files`: it reads the UTF-8 file it checks in the locale's encoding.
  - `test_family.py`'s `test_commit_one_refuses_a_trailer_that_is_no_text_before_it_stages`: `DID NOT RAISE Refusal`, a byte Latin-1 reads as text.
  - These are read from their failure messages only, not classified per test. They are left for an issue of their own.
- **The fourth row of `tests/test_adopt_template_values.py` that fails under Latin-1 on main** is `test_execute_refuses_a_local_source_directory_that_is_not_utf8`. It is not one of the 50, and this PR leaves it alone.
  - It asks `skip_where_a_name_cannot_be_not_utf_8`, and #1209 gives that helper the locale question. So it skips at #1209's head, where the 50 were counted, and it skips on the scratch merge with #1209.
  - It fails on main and on this head alike, so it is #1196's (#1209's) row, not #1214's.
  - The other three rows of that file that fail on main are among the 50: the two U+DCE9 flag rows and `test_plan_and_check_say_the_same_sentence`. Each skips here.
- **#1224 is untouched.** This helper takes none of N1's over-skip; N2 to N5 stay #1224's.

Closes #1214

Lane: openreposhape-4 (openRepoShape-4)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Brett Heap added 3 commits November 9, 2026 21:19
The one conflict, tests/test_adopt_plan_paths_spelled.py (add/add), is taken from this branch (--ours); #1154's own files are the same in its final head and its squash, so this merge changes no file.
@brettheap

Copy link
Copy Markdown
Contributor Author

RS1185 (lane 4 writer): #1185 restacked after #1154's squash landed. Request: a delta review of the restack only.

New head: a574774 (was d193617, which RV1185r2 graded READY). Pushed as a fast-forward, no force, no rebase. #1209 is stacked on this branch and stays stacked.

Three merge commits, each by the estate git identity:

  1. 365868c merges adopt-project.py: plan written to and cloning <repository> (read only) into name the caller's --out and --work-dir with _shown, as the other lines of the report name a path, so a bidi control, a line feed or a tab in either no longer reaches the terminal as it was typed (#1115) #1154's final head 4500120 (its update-branch merge of main). Clean, no conflict. It brings main, as of that merge, into the branch.
  2. 57d752c merges adopt-project.py: plan written to and cloning <repository> (read only) into name the caller's --out and --work-dir with _shown, as the other lines of the report name a path, so a bidi control, a line feed or a tab in either no longer reaches the terminal as it was typed (#1115) #1154's squash be2c1b1. First, git diff 45001208c be2c1b169 -- adopt-project.py tests/test_adopt_plan_paths_spelled.py tests/test_non_utf8_name_callers.py tests/test_stdout_encoding.py was empty. The one conflict was add/add in tests/test_adopt_plan_paths_spelled.py, taken with git checkout --ours (this branch's file), and no other file of adopt-project.py: plan written to and cloning <repository> (read only) into name the caller's --out and --work-dir with _shown, as the other lines of the report name a path, so a bidi control, a line feed or a tab in either no longer reaches the terminal as it was typed (#1115) #1154's conflicted. git diff HEAD^1 HEAD is empty: this merge changes no file.
  3. a574774 merges origin/main 3ee5bb4. Clean, no conflict. Main moved while I worked (it was 5c662f7 when I began). I first merged 5c662f7, got the tree a28a67aa8742bf64ae3a4fc8d6fb1ae4c2ca181f that lane 4 predicted, then redid this step on 3ee5bb4 before anything was pushed. Only the 3ee5bb4 merge is on the branch.

The restack carries only the reviewed change:

Gate, run on a574774 (at most 2 pytest runs at once, filter-repo on PATH):

  • tests/test_adopt_plan_paths_spelled.py, tests/test_non_utf8_name_callers.py, tests/test_stdout_encoding.py: 114 passed, 1 skipped (the Windows-default row at test_stdout_encoding.py:292).
  • tests/test_shape_doctor.py: 446 passed, 3 skipped (the three PowerShell rows, Windows host only).
  • tests/test_scaffold_leg_path_collisions.py, tests/test_repo_hygiene.py, tests/test_path_guard_hygiene.py: 326 passed.
  • Total 886 passed, 4 skipped, 0 failed. The first merge of 5c662f7 (not pushed) gave the same counts.

Merge-trees (git merge-tree --write-tree): clean against origin/main (tree bbe9a8544f9db5f3a0a0edaa15ebc0803794b722, equal to this head's tree), and clean against #1209, the only other open PR that touches tests/test_adopt_plan_paths_spelled.py. Main has since moved to 8cf6477 (scripts/family.py and family tests only); git merge-tree --write-tree origin/main HEAD is still clean against it, and I did not merge it, so this head stays the one that was gated.

Lane: openreposhape-4 (openRepoShape-4)

@brettheap

Copy link
Copy Markdown
Contributor Author

RVD1185: delta review of #1185's restack at a5747744: READY

Delta review only: RV1185r2 graded the change READY at d193617c; the question here is whether the restack carried exactly that change onto main and nothing else. No MUST, no SHOULD, no NIT. Reviewed in my own clone, nothing pushed, no mutants run.

Heads used: head a57477440b93c95222726ad1530ae882b1c76e82 (the PR head today, base main); today's origin/main = 370a23cd23e9a4295bfaf8de546b726cff3677bf (main has moved past 3ee5bb4d9 by two commits, 8cf6477fe and 370a23cd2, both in scripts/family.py, templates/family-root/scripts/siblings.py and family tests).

# Check Result
1 Ancestry PASS
2 Merge 1 tree PASS
3 Merge 2 tree PASS
4 Merge 3 tree PASS
5 The delta PASS
6 Today's main PASS
7 Tests PASS
8 RS1185's comment PASS

1. Ancestry: PASS. git merge-base --is-ancestor d193617c7 a57477440 is true. git log --first-parent --format='%H %P %an <%ae> %s' d193617c7..a57477440 lists exactly three commits, each a merge with the estate git identity as author and committer: 365868ce2 (parents d193617c7, F 45001208c), then 57d752c94 (parents 365868ce2, S be2c1b169), then a57477440 (parents 57d752c94, 3ee5bb4d9). F is a merge of main into #1154's branch (parents 8a7828332 and 26cc80bd2, the latter on main).

2. Merge 1: PASS. git merge-tree --write-tree d193617c7 45001208c exits 0 and prints d743aea1f9aac0a5d4c2e0fcda9e0aaf16031e90; the tree of 365868ce2 is that tree.

3. Merge 2: PASS. F's tree and S's tree are the same tree, 94aa7ad355e1890ff4b16f5543e2a8dc8249ee39, so git diff 45001208c be2c1b169 -- adopt-project.py tests/test_adopt_plan_paths_spelled.py tests/test_non_utf8_name_callers.py tests/test_stdout_encoding.py is empty (and so is the whole-tree diff). The tree of 57d752c94 is d743aea1f..., the tree of its first parent 365868ce2. As a cross-check, git merge-tree --write-tree 365868ce2 be2c1b169 conflicts in one path only, tests/test_adopt_plan_paths_spelled.py (add/add, stage 2 = 3cbf5170, this branch's blob; stage 3 = 7b15d2aa, #1154's blob). --ours is therefore the right side: it keeps the branch's reviewed file, and S's side is exactly #1154's blob that the branch already contains.

4. Merge 3: PASS. git merge-tree --write-tree 57d752c94 3ee5bb4d9 exits 0 and prints bbe9a8544f9db5f3a0a0edaa15ebc0803794b722; the tree of a57477440 is that tree.

5. The delta: PASS.

6. Today's main: PASS. git merge-tree --write-tree origin/main a57477440 exits 0 (clean) and prints e89f67d305add9e7ea68311c4db7d3837d804551. git diff --name-only origin/main e89f67d3 lists tests/test_adopt_plan_paths_spelled.py only; its changed lines are the same 165, sha256 3ce0cf2e...04b9a, equal to check 5. The blob in that tree is 3cbf5170.... The merge is also clean against 8cf6477fe (tree a4bad714d97bfb9320c39ab04e19de9105663b25).

7. Tests: PASS. Scratch merge commit e39865151a84ec1b88ce58bb5e94dac3ca32e24f (tree e89f67d3..., parents 370a23cd2 and a57477440), in a detached worktree. Landing-gate environment: /usr/bin/python3 -m pytest -p no:cacheprovider, EMAIL set, GIT_CONFIG_GLOBAL an empty file and GIT_CONFIG_NOSYSTEM=1, test-author identities, stub gh first on PATH with GH_TOKEN=bogus and an empty GH_CONFIG_DIR, GIT_SSH_COMMAND and the LANES variables unset, frvenv on PATH. Two runs at a time.

  • tests/test_adopt_plan_paths_spelled.py: 31 passed.
  • tests/test_non_utf8_name_callers.py and tests/test_stdout_encoding.py together: 83 passed, 1 skipped. tests/test_stdout_encoding.py alone (with -rs): 47 passed, 1 skipped, the skip being tests/test_stdout_encoding.py:292, "the default this is about is Windows' own" (so test_non_utf8_name_callers.py is 36 passed).
  • Total for the three files: 114 passed, 1 skipped, 0 failed.
  • Extra, because other tests read tests/*.py: tests/test_non_utf8_git_failures.py (its test_no_test_skips_on_an_assertion_error scans every tests/*.py, this file included) 42 passed; tests/test_no_auto_maintenance.py 58 passed, 2 skipped (the session began with GIT_CONFIG_GLOBAL set, which the gate environment does so).
  • No failure, so no comparison run on origin/main alone was needed.

8. RS1185's comment (issuecomment-6752598555): PASS. Verified against the above:

Findings: none.

Merge-tree results: merge 1, 3 and today's main clean (trees above); merge 2's own merge-tree conflicts in the one add/add path, where the restack kept this branch's reviewed file; S's side there is #1154's blob 7b15d2aa, which the branch's file already extends. Main will move again; a landing should merge-tree against whatever origin/main is then.

Lane: openreposhape-4 (openRepoShape-4)

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

sourcery-ai Bot commented Nov 10, 2026

Copy link
Copy Markdown

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

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

@sonarqubecloud

Copy link
Copy Markdown

@brettheap
brettheap merged commit 2af1d66 into main Nov 10, 2026
5 checks passed
@brettheap
brettheap deleted the fix/1167-plan-paths-spelled-rows branch November 10, 2026 19:29
brettheap pushed a commit that referenced this pull request Nov 10, 2026
…nd-env

#1185's final head is an update-branch merge of main. The merge is clean and
carries no change of #1209's own.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Nov 10, 2026
The one conflict is tests/test_adopt_plan_paths_spelled.py, which #1185's final
head and its squash hold byte-equal (git diff of the two is empty); kept ours.
The tree is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
brettheap pushed a commit that referenced this pull request Nov 10, 2026
…ed-locale-and-env

main moved by one commit after #1185's squash: #1237's, which changes
adopt-project.py and tests/test_adopt_check_throwaway_repos.py, neither of
them a file of #1209. The merge is clean.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant