tests/test_adopt_plan_paths_spelled.py: follow-up of PR #1185 (#1167) from its review: three of its rows fail under a one-byte locale where the tool is right (the 0xff --work-dir and the two U+00E9 paths), and its new helper builds the child's environment without blank_unnamed_pin_sources or the git identity defaults #1196
Description
(lane openRepoShape-4, 2026-10-23T07:51:07Z)
Found by: RV1185, the independent review of PR #1185 (for #1167) at 5dc90602 (#1185 issuecomment-6356497748, #1185 (comment)). It graded the PR NOT READY on one SHOULD (SonarCloud's python:S9073 on a composite assert at about :320, which goes back to #1185's branch) and left two NITs for follow-ups: N1 and N2, which are this issue's. Line numbers are approximate, at 5dc90602 (#1185's head, one commit on #1154's head 8a7828332; adopt-project.py there is #1154's, byte for byte). The file is tests/test_adopt_plan_paths_spelled.py, and the helpers are in tests/conftest.py and tests/test_stdout_encoding.py. #1185 is a draft with #1154's branch as its base, and neither is on main, so this goes onto a branch after #1185 lands. RV1185 says #1185 itself needs no change for either.
What is missing
Nothing a user can see: the tool is right in every case below. The two NITs are about the new rows' premises and about one helper's environment.
N1: three new rows fail under a one-byte locale
RV1185 built a Latin-1 locale with localedef -c, as #1153's test_adopt_one_byte_locale.py does, and ran with LOCPATH, LC_ALL=en_US.ISO-8859-1 and PYTHONUTF8=0. The new file plus the two non-UTF-8 --out rows of test_stdout_encoding.py gave 5 failed, 15 passed, 13 skipped. Three of the failures are #1185's:
- The 0xff row,
test_a_work_dir_that_is_not_utf8_is_spelled_and_no_raw_byte_is_written(about :309). The child reads the byte 0xff as U+00FF, which is printable, so_shownrightly printswd<U+00FF>kas typed, with no backticks. The row's premise, in its docstring, "Python reads it in as U+DCFF", does not hold. Its skip,skip_where_a_name_cannot_be_not_utf_8(tests/conftest.py, about :1157), asks the disk andos.fsencode, and neither says the locale decodes the byte as a surrogate. - The two U+00E9 rows,
test_a_printable_non_ascii_out_path_is_named_as_it_was_typed(about :185) andtest_a_printable_non_ascii_work_dir_is_named_as_it_was_typed(about :278).run_scriptdecodes the child's UTF-8 stdout (PYTHONIOENCODING=utf-8) as Latin-1, so the parent reads the two bytes of U+00E9 as two Latin-1 characters.
RV1185 also says #1154's sibling rows in test_stdout_encoding.py fail there too, and earlier: their source holds U+65E5 U+672C .md, which Latin-1 cannot spell, and nothing skips for it. So a one-byte locale is not a configuration these files run under today, and CI and the bench run UTF-8. The same file under an ASCII locale (LC_ALL=C PYTHONUTF8=0 PYTHONCOERCECLOCALE=0) is fine: 16 passed and 15 skipped (the rows ascii cannot spell); the 0xff row is not skipped there, it passes, and RV1185's mutants O1 and R7 still fail it.
- Fix, RV1185's:
skip_where_a_name_cannot_be_not_utf_8also skips whereos.fsdecode(b"\xff") != NOT_UTF_8_PROBE(NOT_UTF_8_PROBEis"\udcff", about :1132). - The two U+00E9 rows need their own skip or their own decode (RV1185 gave none), for example reading the child's bytes as UTF-8 as
plan_of_a_repository_on_github_as_bytesdoes. - Or decide that these files do not run under a one-byte locale, and write that in
conftest.py's helper docstring. For a one-byte locale elsewhere in the suite see adopt-project.py: under a one-byte locale such as Latin-1, a clonecheckmakes again for a plan's clone record that neither spelling names is compared with both, so it is kept and the next run reads it rather than cloning again (#1112) #1153'stest_adopt_one_byte_locale.py, and adopt-project.py: under a one-byte locale such as Latin-1, a plan written in UTF-8 is asked only as written, so a source that is there isplan-source-gone; ask its UTF-8 bytes too when the first spelling names nothing #1078 and adopt-project.py: under a one-byte locale,checkcompares a clone it made again for a plan's clone record only with the spelling as written, so it removes that clone instead of keeping it and every run clones again #1112 (both aboutadopt-project.py's own behaviour under one).
N2: the new helper's environment is not run_script's
plan_of_a_repository_on_github_as_bytes (about :292) starts from {**os.environ, "LANES_LANE": "", **a_gh_that_refuses(tmp_path), "PYTHONIOENCODING": "utf-8:surrogateescape"}. It skips two things run_script does: blank_unnamed_pin_sources and the git identity defaults. test_stdout_encoding.py's run_tool_bytes and child_environ (about :101 and :129) already read a child's bytes with both, plus an empty AGENT_PROTOCOL_ROOT. It has no effect here: the run ends at the clone refusal, before any pin is read or any commit is made.
- Fix, RV1185's: build the environment with
blank_unnamed_pin_sources, or moverun_tool_bytestotests/conftest.pyand use it from both files.
Done when
Under the Latin-1 locale as RV1185 built it, the three rows skip, or pass, and do not fail; under UTF-8 the file's 31 rows still pass and under the ASCII locale it still gives 16 passed and 15 skipped. plan_of_a_repository_on_github_as_bytes gets its environment from blank_unnamed_pin_sources and the git identity defaults, or from one shared helper, and RV1185's mutants O1, O2 and O3 still fail the 0xff row at its line assert (about :323).
Lane: openreposhape-4 (openRepoShape-4)
Activity
brettheap commentedon Oct 23, 2026
CLAIMED — lane openRepoShape-4, session 11c6c0ef-495a-4a05-94cf-811b7b0a1012@Eagle, 2026-10-23T12:00:48Z, for #1196
Logged in
lanes/log/openRepoShape-4.mdat9c8f1cb1a02386f956f283ddc929022098f268b1.The three reads (lane-collision-protocol Rule 1):
validate-family.py: the holder's gate escapes what its stdout cannot …