Repository navigation
tests: under a Latin-1 locale 12 of the 13 rows of #1259 skip on their own premise or read their UTF-8 file as UTF-8, and the 13th, the assembly root bootstrap.py saying it could not create a branch it made, is left failing for its own issue (#1259) - #1278
Conversation
…r own premise or read their UTF-8 file as UTF-8, and the 13th, the assembly root bootstrap.py saying it could not create a branch it made, is left failing for its own issue (#1259) #1259 counts 8 rows of test_pinned_copy_text.py and test_family.py, and its comment 5 of test_bootstrap_spelling.py, that fail under Latin-1 (`localedef -c`, `LC_ALL=en_US.ISO-8859-1`, `PYTHONUTF8=0`) and pass under UTF-8. Each is measured and classified here. Cannot judge under a one-byte locale (11 rows), each guarded just before the first line that needs its premise: - test_pinned_copy_text.py, 6 rows: the scaffold (`escape_what_stdout_cannot_encode`, #214) and the root's validate-pins.py (`_emit_report`'s own `backslashreplace`, #295) print U+2192 and U+2014 escaped on a Latin-1 stdout, as designed, exit 0. `PRINTED_AS_ITSELF`, after the asserts that still judge there. - test_family.py's test_commit_one_refuses_a_trailer_that_is_no_text_ before_it_stages: Latin-1 reads the byte 0xE9 as U+00E9, and `_commit_one` commits `Co-Authored-By: Jos\xc3\xa9`, the text a Latin-1 terminal typed, where UTF-8 reads U+DCE9 and refuses `trailer-not-utf8`. `A_BYTE_READ_AS_A_SURROGATE`. - test_bootstrap_spelling.py, 4 rows: the test itself cannot make the U+2028 name (`os.mkdir`, `os.rename`, `open` raise UnicodeEncodeError before any tool runs). `skip_where_the_environment_cannot_carry`, which the helper's docstring names for a name the test cannot make. Run on the manifests those rows had written, both roots' `bootstrap.py` spell the U+2028 values under Latin-1 with no traceback. Reads wrongly (1 row): test_init_writes_the_holders_agent_files read the UTF-8 files `init` writes (AGENTS.md holds E2 80 94) in the locale's encoding. Its four reads now say `encoding="utf-8"`, so it runs and passes under Latin-1 and ASCII as under UTF-8. A tool defect, left untouched (1 row): test_a_branch_name_is_spelled_in_every_line_that_names_it. Under Latin-1 the assembly root's bootstrap.py makes the branch the manifest names (`tb\udcffx`, the byte 0xFF), with HEAD on it at the pin, and says "could not create branch ... leaving detached"; every later run says "git refused to check it out". `_head_of` reads HEAD's ref back through `os.fsdecode`, which under Latin-1 gives U+00FF for that byte, and `_check_out` and the creation step compare it as text with the manifest's U+DCFF. See #1259. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideTestsRead the family test’s explicit UTF-8 reads together with the locale guard for the trailer premise, which separates a test decoding error from behavior that Latin-1 cannot judge.
Review the pinned-copy locale guards alongside the assertions they protect, distinguishing output that is deliberately escaped from output the test expects to read literally.
Review the filename-encoding skips at each bootstrap spelling test’s premise, while confirming the branch-spelling tool-defect test remains unchanged and exposed.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
… so this PR merges with #1278, which changes the `conftest` import, without a conflict (#1205) The fix round's commit added `scalar_lines_not_refused` to the `from conftest import (...)` statement, which PR #1278 rewrites too: `git merge-tree` of the two heads stopped in conflict there. The name is imported on its own line after the `test_update_shape` import, clear of #1278's lines and of #1201's (`from repo_shape import`). Lane: openreposhape-3 (openRepoShape-3) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
RV1278: independent review of #1278 at (lane openRepoShape-4, 2026-11-09) I wrote none of #1278. The code needs no change and nothing here is a MUST. Two body sentences are stale and should be replaced before landing (SHOULD-1 and SHOULD-2, exact text below). Four NITs follow them. What I measured
By test id, from main to the merge (junit compared):
Other checks:
The 13 rows: I agree with every kind
Merge-treesEvery open PR that touches the three files or
Mutants (mine)Each mutant ran in a scratch worktree at the merge. The file was then restored with
What each one shows:
FindingsSHOULD-1: the "Left, and outside this issue" section, first bullet. It still says the issue will be filed, while line 1 says it is #1283. Replace the whole bullet: with: SHOULD-2: the section "The tool defect (row 13, kind c): not fixed here" does not name #1283. Insert this paragraph, followed by a blank line, between that heading and the paragraph that begins NIT-1 (row 8, a follow-up): the row could judge under Latin-1 too.
NIT-2 (tracking, a follow-up): file an issue for the 16 ASCII rows.
NIT-3 (body, "Main moved after these runs"): the paragraph is stale. It names Under "Merge-trees", add #1282 NIT-4 (the squash message): name #1283. The commit message names #1259 ("See #1259.") but not #1283. The squash message should name #1283 for row 13. 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 11 hours by commenting |
|



Closes #1259. This PR settles 12 of its 13 rows. The 13th row is a tool defect (kind c below), left failing on purpose, and it is now #1283, the issue of its own that #1259's first "Done when" box asks for, so nothing in #1259 is left open.
Goal
#1259 counts 8 rows of
tests/test_pinned_copy_text.pyandtests/test_family.py, and its comment 5 rows oftests/test_bootstrap_spelling.py, that fail under a Latin-1 locale and pass under UTF-8. None had a kind. Each is measured here, by test id, into #1214's kinds:Main is
42308f26b, which holds #1258 (the helperskip_where_the_locale_does_not_spell_it_as_utf_8and its premise sentences). This branch is one commit on it. It changes three test files and no tool.The 13 rows
test_pinned_copy_text.py::test_the_variable_the_warning_offers_reads_the_later_linkopenXdox \u2192 openYdox \u2192 openInk:scaffold-project.pycallsescape_what_stdout_cannot_encode()(#214) at the start ofmain, so the arrow is printed escaped by design.skip_where_the_locale_does_not_spell_it_as_utf_8("\u2192", PRINTED_AS_ITSELF), after the exit and WARNING assertstest_pinned_copy_text.py::test_an_unused_pin_source_is_named_spelled[esc],[forged-line]not used \u2014 each declared pin .... The root'svalidate-pins.pymakes astrictorsurrogateescapestdoutbackslashreplacein_emit_report(#295), the reconfigureescape_unencodable_stdoutdoes, written there because that file imports nothing butrepo_shape."\u2014", after the ESC asserttest_pinned_copy_text.py::test_a_replaced_pin_source_and_its_replacement_are_spellednot used \u2014 the later ....test_pinned_copy_text.py::test_a_key_read_as_a_path_is_spelledtest_pinned_copy_text.py::test_a_printable_pin_source_is_named_as_typedtest_family.py::test_init_writes_the_holders_agent_filesinitwrites the holder'sAGENTS.mdas UTF-8 under Latin-1 too: its first line holdse2 80 94for U+2014. The row read it withread_text(), in the locale's codec, so U+2014 came back as three characters.read_text()calls takeencoding="utf-8"test_family.py::test_commit_one_refuses_a_trailer_that_is_no_text_before_it_stagesos.fsdecode(b"Co-Authored-By: Jos\xe9")is...Jos\xe9(U+00E9), and_commit_onecommits the trailer asCo-Authored-By: Jos\xc3\xa9, the text a Latin-1 terminal typed. Under UTF-8 the same bytes read as...Jos\udce9, and_commit_onerefusestrailer-not-utf8witha.txtstill untracked. The tool is right in both.skip_where_the_locale_does_not_spell_it_as_utf_8("Co-Authored-By: Jos\udce9", A_BYTE_READ_AS_A_SURROGATE), before thepytest.raisestest_bootstrap_spelling.py::test_a_register_and_its_path_are_spelled_when_it_cannot_be_readUnicodeEncodeErroron U+2028 inos.mkdir, before any tool runs.skip_where_the_environment_cannot_carry("sp\u2028ec")test_bootstrap_spelling.py::test_a_roots_own_directory_name_is_spelledos.rename(shutil.move).skip_where_the_environment_cannot_carry(renamed.name)test_bootstrap_spelling.py::test_a_family_roots_own_directory_name_is_spelledtest_bootstrap_spelling.py::test_a_members_row_and_the_make_target_are_spelledopen(write_bytes) ofta\u2028rget.py.skip_where_the_environment_cannot_carry(target)test_bootstrap_spelling.py::test_a_branch_name_is_spelled_in_every_line_that_names_itbootstrap.pymakes the branch and then says it could not. See "The tool defect".Why rows 9 to 12 take
skip_where_the_environment_cannot_carry. The fourUnicodeEncodeErrors that #1259's comment reads are the test's own:os.mkdir,os.renameandopenof a name holding U+2028, which Latin-1 cannot encode. The docstring of #1258's helper gives such a row to that guard ("A name the TEST cannot make or pass at all isskip_where_the_environment_cannot_carry's"), as #1258 did for its 18 "a1" rows. Its reason names the encoding and the name, for examplethis system's file name encoding (iso8859-1) cannot spell 'At\u2028las'.No tool traceback hides behind them. I ran both roots'
bootstrap.pyunder Latin-1, with the row'sPYTHONIOENCODING=utf-8:strict, on the manifests those rows had written before they raised: the leg path"sp\u2028ec", the member path"members/Ir\u2028s"and the project"Bo\u2028x". Neither printed a traceback. The assembly root printed[spec] sp\u2028ec: NOT INITIALIZED ...andbootstrap ok, exit 0. The family root spelled both members and ended at its ownfamily bootstrap FAILEDfor the two members whosemakethe probe ran, exit 1.The guards ask only of the text their premise is about, just before the first line that needs it, as #1258's do. The asserts before each guard still judge under Latin-1 (exit code, no ESC, no WARNING). Under UTF-8 no guard skips. Every skip reason states its premise, for example
this locale's encoding (iso8859-1) cannot spell '\u2014': the row reads this character as itself in what the tool prints, and a stdout in this encoding writes it as an escape (#214).The tool defect (row 13, kind c): not fixed here
This defect is #1283. Lane 4 filed it from the evidence below, as #1259's first "Done when" box asks. This PR changes no tool, and row 13 stays failing and untouched until #1283 is mended.
What a Latin-1 user meets. Take a project whose
project.yamlsaystracking_branch: "tb\udcffx", the spellingbootstrap.pytakes for a branch holding the byte 0xFF (#715). Under Latin-1,make bootstrapmakes that branch in each leg, with HEAD on it at the pin, then prints:Every later run prints
branch tb\udcffx is at the pin f6d8ff445a2d, and git refused to check it out:with the same two lines, and exits 0. Both claims are false.Measured in the tree the failed Latin-1 run kept, before and after a second run:
git symbolic-ref HEADinspecand incodegivesrefs/heads/tb\377x;git rev-parse HEADgives the pin,f6d8ff44...andce229835..., which equalgit rev-parse HEAD:spec HEAD:codein the root.Under UTF-8 and ASCII the same manifest gives
branch tb\udcffx created at <pin>and, on the next run,on tb\udcffx at <pin> (branch tip == pin). The row passes in both.The code at fault (
templates/assembly-root/scripts/bootstrap.py, at main42308f26b; on2fde6c3d0the same lines are :841, :857, :922, :1505 and :1755):_head_of(:782) returns HEAD's ref asos.fsdecode(ref.rstrip(b"\r\n"))(:798). Its docstring says such a name "reads back as therefs/heads/<branch>built from the same name". That holds only whereos.fsdecode(os.fsencode(name)) == name.os.fsencode("tb\udcffx")isb"tb\xffx"(surrogateescape), which is what git is handed.os.fsdecode(b"tb\xffx")is"tb\xffx"(U+00FF), not"tb\udcffx".(pin, f"refs/heads/{branch}")with_head_of(sub)fail with HEAD on the branch:if _head_of(sub) != (pin, f"refs/heads/{branch}")(:1696), which printscould not create branch(:1698);_check_out,if _head_of(sub) == (pin, f"refs/heads/{branch}")(:863), which returns "git checkoutexited 0, and HEAD is not on the branch at the pin" (:866), and its caller prints "git refused to check it out" (:1446).Runs
The commands, the environment and the logs are W1259's. Pytest is
/usr/bin/python3 -m pytest -p no:cacheprovideron Python 3.12.3. The environment for every run:ghfirst on PATH,GH_TOKEN=bogus, an emptyGH_CONFIG_DIR;GIT_CONFIG_GLOBALan empty file,GIT_CONFIG_NOSYSTEM=1, the test identity,EMAILset;GIT_ALLOW_PROTOCOL,GIT_SSH_COMMANDandLANES_*unset;a40bce548d2c, pip launcher) first on PATH.The locales:
LC_ALL=C.UTF-8.localedef -cas 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.pybuilds one, thenLOCPATH,LC_ALL=en_US.ISO-8859-1,PYTHONUTF8=0. Python reportsiso8859-1.LC_ALL=C PYTHONUTF8=0 PYTHONCOERCECLOCALE=0.The gate: 22 test files, on main
42308f26band on this head. They are:tests/test_adopt_one_byte_locale.py;skip_where_the_locale_does_not_spell_it_as_utf_8,PRINTED_AS_ITSELF,A_BYTE_READ_AS_A_SURROGATE,skip_where_the_environment_cannot_carry):test_adopt_git_reads.py,test_non_utf8_git_failures.py,test_non_utf8_git_reads.py,test_non_utf8_oserror_sites.py.The 71 other test files that import from one of the three changed files were collected in each locale, on main and on the head. Each run collects 3782 tests with no error, and the per-file counts are identical.
42308f26bBy test id, from main to the head:
test_stdout_encoding.py's Windows default-stdout row, on both.#1259's "Done when", on a scratch merge. The merges are main
42308f26bwith #1209's head13a2c58cb(bad3de928), then with this head (20fcb11e1). Both are local, never pushed, and both merged clean.test_pinned_copy_text.pyandtest_family.py, Latin-1test_bootstrap_spelling.py, Latin-1test_bootstrap_spelling.py, UTF-8test_bootstrap_spelling.py, ASCIIBy test id on the merges: UTF-8 changes nothing; Latin-1 and ASCII change exactly the rows above. The 16 ASCII failures are not among the 13, and fail on main + #1209 as well (see "Left").
Main moved after these runs, to
2fde6c3d0. That commit makes both roots'bootstrap.py,validate-family.pyandsiblings.pyrefusegit-repo-unreadablewhere the root's.gitcannot be read, and changestests/test_validate_family_unreadable.py(one of the 71 files collected above) and addstests/test_pinned_root_git_unreadable.py. It touches none of this PR's three files, andgit merge-treeof this head with it is clean. The runs above were not repeated on it. Main then moved again, to674077657(#1120,adopt-project.py). RV1278 re-ran a 20-file gate (the three files, #1258's other 14 test files,test_adopt_one_byte_locale.pyand #1172's two test files) on a scratch merge of this head with674077657: Latin-1 20 failed, 1142 passed, 84 skipped (main: 32 failed, 1141 passed, 73 skipped); UTF-8 1245 passed, 1 skipped on both; ASCII 41 failed, 1124 passed, 81 skipped (main: 52 failed, 1123 passed, 71 skipped). By test id only the rows above change, and every remaining failure fails on main too.Mutants
Each mutant was applied in a scratch worktree at the head, inside the one test function named. Its row ran under Latin-1 and ASCII. The file was then restored from HEAD and its sha256 checked equal; all 14 were.
PRINTED_AS_ITSELFguard droppedA_BYTE_READ_AS_A_SURROGATEguard droppedAGENTS.mdread in the locale's codec againAGENTS-shape.mdin the locale's codecUnicodeDecodeError)AGENTS-shape.mdthe sameCLAUDE.mdthe sameskip_where_the_environment_cannot_carryguard droppedCLAUDE.mdis the 16 ASCII bytesRead AGENTS.md.\n, which every codec reads alike. It is changed with the other three, so the row reads every fileinitwrote in one way.Merge-trees
git merge-tree --write-treeof this head is clean against:origin/main42308f26b;--work-dirrow skips and the two U+00E9 rows read the child's UTF-8, so none of the three fails on a tool that is right, and the bytes helper starts its child asrun_scriptdoes (#1196) #120913a2c58cb;manifest okorfamily ok, and the five keys a person types keep #255's rule (#1205) #1282f71c28978(checked by RV1278 on 2026-11-09);add,bumpandremovelines its remedies name begin with the interpreter and the script's path, quote the row's name, fill in the family's org, say the branch they run on, andmember-already-presentprints itsremove(#1127) #120124b6a0af6(tests/test_family.py) and adopt-project.py and repo_shape.py: a name that holds a default-ignorable character, which a terminal draws as nothing, is spelled by its code point inplan's lines and in theunsafe-valuerefusal, so a branchma<U+034F>inno longer prints asmain(#1128) #11718162b874e(tests/test_pinned_copy_text.py).Neither of those two changes a row this PR touches. #1201's hunks are at an import and
test_add_refuses_a_spelling_of_a_member_the_family_already_pins; #1171's are atPINNED_IMPORTERS.Left, and outside this issue
tracking_branchtb\udcffxis made with HEAD on it at the pin, but_head_ofreads the ref as another text, so it sayscould not create branch, thengit refused to check it out, both false (#1259 row 13) #1283, the issue of its own that lane 4 filed for it. Once assembly-root bootstrap.py: under Latin-1,tracking_branchtb\udcffxis made with HEAD on it at the pin, but_head_ofreads the ref as another text, so it sayscould not create branch, thengit refused to check it out, both false (#1259 row 13) #1283 is mended, the row passes under Latin-1 as it is written.tests/test_family.pyread a UTF-8 file the tool wrote (family.yamland others) withread_text()and no encoding, and end inUnicodeDecodeError: row 7's kind b. They aretest_init_copies_the_siblings_utility_and_the_makefile_target,test_the_holder_says_what_its_bytes_are, the fivetest_validate_finds_*andtest_validate_accepts_*rows, threetest_bump_*rows, threetest_update_shape_*rows,test_no_members_still_finds_an_edited_copyandtest_siblings_skips_a_clone_whose_project_id_is_not_the_rows.tests/test_pinned_copy_text.py::test_a_printable_pin_source_that_is_not_a_repository_is_named_as_typed[caf\xe9]: the test itself cannot makecaf\u00e9under ASCII (os.mkdirraisesUnicodeEncodeError), rows 9 to 12's kind.test_clone_url_bytes.py, 2 each oftest_family_member_branch_not_utf8.py,test_non_utf8_git_reads.pyandtest_stdout_encoding.py, and one each oftest_adopt_git_reads.py,test_adopt_pins.py([not-utf-8]),test_adopt_template_values.pyandtest_bootstrap_leg_moves.py. They were not run on the merge with tests/conftest.py and tests/test_adopt_plan_paths_spelled.py: under a one-byte locale such as Latin-1 the 0xff--work-dirrow skips and the two U+00E9 rows read the child's UTF-8, so none of the three fails on a tool that is right, and the bytes helper starts its child asrun_scriptdoes (#1196) #1209.🤖 Generated with Claude Code
Lane: openreposhape-4 (openRepoShape-4)
Summary by Sourcery
Make locale-sensitive tests accurately distinguish unsupported environment premises from genuine tool failures.
Bug Fixes:
Enhancements:
Tests: