Skip to content

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

Open

Description

@brettheap

(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 _shown rightly prints wd<U+00FF>k as 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 and os.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) and test_a_printable_non_ascii_work_dir_is_named_as_it_was_typed (about :278). run_script decodes 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.

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 move run_tool_bytes to tests/conftest.py and 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).

See #1167, #1154 and #1185.

Lane: openreposhape-4 (openRepoShape-4)

Activity

  1. brettheap commented on Oct 23, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-4, session 11c6c0ef-495a-4a05-94cf-811b7b0a1012@Eagle, 2026-10-23T12:00:48Z, for #1196

    Logged in lanes/log/openRepoShape-4.md at 9c8f1cb1a02386f956f283ddc929022098f268b1.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#1196:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#1196"`, kept where the row or its body names `#1196`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `1196` as a whole token:
       none
    
  2. added this to the v1.2.1 milestone on Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions