Repository navigation
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
Conversation
…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]>
Reviewer's GuideTestsExpand 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.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
RV1185: independent review of #1185 at 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 #1167Each row asserts what #1167 gives, backticks and escapes included.
I checked the R12 reasoning in the source. 2. MutantsI wrote my own mutants from #1167's and RV1115's text, not from W1167's Each mutant was run against three things at once:
After each run I restored the file with
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
4. GateEach run was on the scratch merge
5. Merge-trees
Findings
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]>
|
W1167b: fix round 1 at
Before: assert code == 2 and b"Traceback" not in stderr, stdout + stderrAfter: assert code == 2, stdout + stderr
assert b"Traceback" not in stderr, stdout + stderrNo other Tests on
A test-only change, so no doctor shards and no mutants. The merge-tree is clean (exit 0) against 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) |
|
RV1185r2: independent re-check of #1185 at 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 1. Scope
2. Tests (the landing gate's environment)Stub
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
|
| 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
- Against
origin/main(961640c68, unchanged on the remote when I started):git merge-tree --write-treeexits 0, tree173a373ab. That tree differs from main in four files only, all adopt-project.py:plan written toandcloning <repository> (read only) intoname the caller's--outand--work-dirwith_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:adopt-project.py,tests/test_adopt_plan_paths_spelled.py,tests/test_non_utf8_name_callers.py,tests/test_stdout_encoding.py. It matches the tree W1167b named. - Against adopt-project.py:
plan written toandcloning <repository> (read only) intoname the caller's--outand--work-dirwith_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 head (origin/fix/1115-plan-paths-spelled,8a7828332): exit 0, tree4532a4bb8, the head's own tree.
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_8could also skip whereos.fsdecode(b"\xff") != NOT_UTF_8_PROBE; N2,plan_of_a_repository_on_github_as_bytesbuilds its environment withoutblank_unnamed_pin_sourcesand the git identity defaults thatrun_scriptandtest_stdout_encoding.py'srun_tool_bytesuse.
Notes, not findings
- The PR stays a draft. I changed nothing on it. The closing keyword in the body is not live while the base is adopt-project.py:
plan written toandcloning <repository> (read only) intoname the caller's--outand--work-dirwith_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 branch, as RV1185 noted. - I did not rerun RV1185's full mutant table: the change is a split of one assert, the source and every other row are byte for byte what RV1185 measured, and the four mutants above cover the split row.
Lane: openreposhape-4 (openRepoShape-4)
…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]>
…to fix/1167-plan-paths-spelled-rows
|
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:
The restack carries only the reviewed change:
Gate, run on a574774 (at most 2 pytest runs at once, filter-repo on PATH):
Merge-trees ( Lane: openreposhape-4 (openRepoShape-4) |
|
RVD1185: delta review of #1185's restack at Delta review only: RV1185r2 graded the change READY at Heads used: head
1. Ancestry: PASS. 2. Merge 1: PASS. 3. Merge 2: PASS. F's tree and S's tree are the same tree, 4. Merge 3: PASS. 5. The delta: PASS.
6. Today's main: PASS. 7. Tests: PASS. Scratch merge commit
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 Lane: openreposhape-4 (openRepoShape-4) |
|
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 |
|
…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]>
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]>
…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]>



Closes #1167
Stacked on #1154 (for #1115): the base is
fix/1115-plan-paths-spelled, becausetests/test_adopt_plan_paths_spelled.pyis new in that PR. This lands after #1154 and after the v1.2.0 tag. No change toadopt-project.py.RV1115's review of #1154 (#1154 issuecomment-6344547992) found seven mutants of the two spelled lines,
plan written to {out}andcloning {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
CHARACTERS(4 rows:--outand--work-dir, each)<D>/pl\x1ban.yamland\rspelled between backticks on both lines--work-dirwith the byte 0xff, stdoututf-8:surrogateescape(1 row)`<realpath D>/wd\udcffk/source-readonly/Thing`and no raw 0xff on stdout--out, and--work-dir(U+00E9) (2 rows)--out,plan.yamland./plan.yaml, run intmp_path(2 rows)plan written to plan.yaml--out 'plan.yaml 'and--out '`plan.yaml`'(2 rows)`plan.yaml `and`\x60plan.yaml\x60`(#900's rule)checkandexecutewith--source testorg/Thing --work-dir <D>/wd<U+202E>k(2 rows)REFUSED source-unclonable, and the spelledcloninglineOn R12, only the
executerow kills the mutant.mainsetsargs.clones = []for every command, soplanandcheckhandSource.cloneamadelist and onlyexecutehands it none; thecheckrow is forcheck's own line.plan_of_a_local_sourcetakes an optionalcwd(the relative-path rows run there). One helper is new for the 0xff row, which reads the child's bytes, becauserun_scriptdecodes 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.pyon #1154's head8a7828332(sha256efe97bf7...b3d2); the old file (those 18 rows) and the new one were run together, and the file was restored withgit checkoutwith its sha256 checked after each.--outbyisprintable()alone (no trailing-space or backtick rule)test_a_printable_out_path_that_reads_as_another_is_spelled(trailing-space, begins-and-ends-with-a-backtick)--outspells every non-ASCII pathtest_a_printable_non_ascii_out_path_is_named_as_it_was_typed--work-dirspells every non-ASCII pathtest_a_printable_non_ascii_work_dir_is_named_as_it_was_typed--outprinted as_shown(os.path.abspath(out))test_a_relative_out_path_is_named_as_it_was_typed(both) and the two rows of R1--outspells only Cf, line feed and tabtest_plan_written_to_spells_an_out_path_a_terminal_would_not_show(escape, carriage-return) and the two rows of R1--work-dirspells only Cf, line feed and tabtest_cloning_spells_a_work_dir_a_terminal_would_not_show(escape, carriage-return) andtest_a_work_dir_that_is_not_utf8_is_spelled_and_no_raw_byte_is_writtencloningspelled only wheremade is not Nonetest_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/main961640c68and this head5dc90602f(merge20401c180, treeb6998640), the landing gate's environment: a stubghfirst on PATH,GH_TOKEN=bogus, an emptyGH_CONFIG_DIR, an empty global git config,GIT_CONFIG_NOSYSTEM=1,EMAILset.tests/test_adopt_plan_paths_spelled.pytests/test_stdout_encoding.pytests/test_non_utf8_name_callers.pytests/test_adopt_plan_escapes.pytests/test_path_guard_hygiene.pytests/test_repo_hygiene.pyA test-only change, so the doctor shards were not run.
git merge-tree --write-treeof this head againstorigin/mainand 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
ghstand-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:
plan,check, andexecuteconsistently spell clone destinations in their output.Tests: