Repository navigation
assembly-root bootstrap.py: step (a) asks whether HEAD is on the tracking branch by the bytes git was handed, so under a Latin-1 locale tb\udcffx is said created, then on, where it said could not create branch and git refused (#1283) - #1300
brettheap wants to merge 5 commits into
Conversation
…branch as the bytes git was handed, read back as git's are, so under Latin-1 a branch `tb\udcffx` it made is said created, then on it, never `could not create` or `git refused` (#1283) `_head_of` reads HEAD's ref with `os.fsdecode`, and step (a) compared that text with `refs/heads/<branch>` as the manifest spells it. Under a locale of one byte to a character the two differ for a name that holds a surrogate: `tb\udcffx` is handed to git as `tb<ff>x` and read back as `tb` U+00FF `x`. `_branch_ref(branch)` is the ref as `_head_of` reads it back: the bytes `_handed_to_git` gives, through `os.fsdecode`. Every comparison of `_head_of`'s ref with the tracking branch uses it: `_check_out`, `place_at_pin` (`already` and the left-a-branch line), `fast_forward_to_pin` (on the branch, or another), `_stays`, and `create_at_pin` (the check after `checkout -b`, and the left-a-branch line). The lines still print the manifest's spelling. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t's bootstrap.py under a Latin-1 locale it builds, over `tb\udcffx`, at each place step (a) asks whether HEAD is on the tracking branch (#1283) 30 rows. Each runs `bootstrap.py --skip-validators` in a child under the locale it names, so a suite under UTF-8, as CI's is, measures Latin-1. The locale is built by this module's own module-scoped `latin1` fixture with `localedef -c`, not imported from `test_adopt_one_byte_locale.py` (#1188); where none can be built the Latin-1 rows skip with `localedef`'s words. - the first run and every later run, over `tb\udcffx` under Latin-1, UTF-8 and ASCII, over `feature/x` and U+00FF itself under Latin-1, and over `caf\udcc3\udca9` under all three; - a failing post-checkout hook where nothing moved, a branch behind the pin (HEAD on it, and detached at the new pin), a branch past the pin moved back, a branch with a commit of its own, and HEAD on the branch with no commit yet, each under Latin-1 and UTF-8. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
…escape, so the file is ASCII (#1283) The `u00ff-itself` row's two literals held the character itself. The AST is the same before and after (`ast.dump` equal), so no row's value changes. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideImplementationAdd
TestsAdd locale-sensitive integration coverage for branch creation, later checkout and related step (a) paths, plus a Windows legacy-encoding emulation.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Review of #1300 (#1283) for lane openRepoShape-1, by r1300a (opus), at dfd69ff: NOT READY The fix is right on POSIX. On the head
Two SHOULDs hold it, and neither needs much work:
FindingsF1 SHOULD:
|
| line | hit | does it ask what the code means? |
|---|---|---|
| 886 | _branch_ref body |
yes: os.fsdecode(_handed_to_git(...)); on POSIX equal text means equal bytes, since surrogateescape decoding is injective |
| 913, 1832 | refs/heads/{branch} handed to git |
yes, nothing is compared (audit row 13) |
| 928 | _head_of(sub) != (pin, None) |
yes, the detached check |
| 951 | _check_out |
yes, _branch_ref |
| 1531, 1538 | place_at_pin already, current not in |
yes |
| 1615, 1616 | fast_forward_to_pin other_branch, current == ref |
yes |
| 1709 | _stays |
yes |
| 1786, 1802 | create_at_pin |
yes |
| 1028, 1167, 1755 | _place_of, _say_twin, the twin's name |
print git's name, right (audit rows 11, 12) |
| 1074, 1110 | startswith("refs/heads/") |
an ASCII prefix, right in every locale |
| 1112-1113 | _folded_twin |
still text: F1 |
| 1195, 1220, 1259 | _heads, _folded_spelling, _kept_name |
fold git's names among themselves, consistent decoding (row 12); _folded_spelling inherits F1 |
Audit rows 8 to 13:
- Row 8: right for the tracking branch itself; the twin miss is confirmed and is wider than the body says (F1).
- Row 9 (the moved-back upstream line): it prints
origin/tbÿxbesidetb\udcffxunder Latin-1. The paste word is"$(printf -- 'origin/tb\377x')"in both locales.test_a_branch_past_the_pin_with_no_commit_of_its_own_is_moved_backasserts exactly this and passes under Latin-1 and UTF-8. Not a comparison; the Known limit is honest. - Rows 10 to 13: right. The upstream is set at the head (
spec upstream: b'refs/remotes/origin/tb\xffx\n'above).
All 17 main line numbers the audit cites were checked with sed -n on 0354a7e7 and match.
3. The change under UTF-8
caf\udcc3\udca9 |
main 41c2eb42 |
head 991c06ea |
|---|---|---|
| UTF-8, run 1 | could not create branch 'caf\udcc3\udca9' ... over exited 0; HEAD b'refs/heads/caf\xc3\xa9\n' at the pin; no upstream; exit 0 |
branch caf\udcc3\udca9 created at 7766d57ffa79 — at the pin; upstream b'refs/remotes/origin/caf\xc3\xa9\n'; exit 0 |
| UTF-8, run 2 | git refused to check it out: over exited 0; exit 0 |
on caf\udcc3\udca9 at ...; exit 0 |
| ASCII, runs 1 and 2 | created, then on |
identical to main |
- Under UTF-8 on main,
_head_ofread'refs/heads/caf\xe9'against the text'refs/heads/caf\udcc3\udca9'. The old lines were false. The change has the same cause as 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, and the issue's own Direction (os.fsdecode(os.fsencode(...))) implies it, so it is right and in scope. - No existing row, doc or AGENTS.md line pins the old lines for such a name.
grepovertests/for the\udcc3\udca9spellings finds only_argument_faultrows (test_bootstrap_non_utf8_branch.py:564) and_paste_wordpath rows.could not create branchandrefused to check it outappear in no*.mdoutsidetests/. - No exit code changes on POSIX: every probe run exits 0 on main and head. For Windows legacy mode, see F2.
4. Windows and other codecs, read (and emulated), not run
- Default Windows (
utf-8withsurrogatepass):_argument_faultrefuses every surrogate (3 bytes, not 1). So for each name that reaches_branch_ref, it equalsrefs/heads/<branch>: the same answer as main. Git for Windows stores UTF-8, which_head_ofdecodes alike. Right. PYTHONLEGACYWINDOWSFSENCODING=1:_head_ofand_branch_refboth decode UTF-8 bytes with the code page, so a non-ASCII name now compares right where main compared wrong (emulated above). There is a new traceback for a lone surrogate (F2). Under a DBCS code page,replacecan fold two byte strings into one text, so "equal text means equal bytes" holds on POSIX only, as the body says.- Other one-byte codecs: not run.
_branch_refis the same function of the codec as_head_of.
5. The rows
-
Base against head (the clone at
dfd69ff7with blob41c2eb42laid in): 12 failed, 18 passed. These are exactly the 12 rows the body lists:- 3 first-run;
- 3 later-run;
- the hook;
- both fast-forward rows;
- moved-back;
- stays;
- unborn.
The messages are
could not create branch 'tb\\udcffx'(x6),'caf\\udcc3\\udca9'(x4),git refused to check it out(x17),git refused to move it(x2) andleaving it on tbÿx. After the restore:restored blob 991c06eaa4e1... HEAD blob 991c06eaa4e1... equal=yes, andgit statusis clean. -
Head: 30 passed under a UTF-8, a Latin-1 and an ASCII pytest.
-
tests/test_bom_tool_io.py: the byte-order-mark rows hold each tool's own read and write and that only U+FEFF is cut, so a
utf-8-sigread that drops the mark and a cut that also takes spaces no longer survive (#1176) #1188: the module-scopedlatin1fixture is the module's own. The names imported fromtest_bootstrap_after_bump,test_bootstrap_spellingandtest_stdout_encoding(failing_post_checkout,DASH,bootstrap_of,edit,needs_a_byte_name,run,child_environ) are all plain functions or constants, not fixtures.projectcomes fromconftest.py. -
Skip words: with a stub
localedeffirst on PATH (exit 4), the result is16 passed, 14 skipped, each skip readinglocaledef could not build en_US.ISO-8859-1 here (exit 4: 'localedef: stub r1300a: cannot open charmap file'); a child in it reports 'ascii'. The[warning]line is filtered out, and the UTF-8 and ASCII rows still run. On Windows,pytestmarkskips onos.name == "nt"(read). -
3.12 against 3.14:
- Nothing in the file depends on 3.12. Codec names are compared through
codecs.lookup, andPYTHONUTF8=0is explicit, which also holds under 3.15's UTF-8 default. - The diff has no
is_file,existsoris_dirguard, so the 3.14 shim does not apply. - The locale build is adopt-project.py: under a one-byte locale such as Latin-1, a clone
checkmakes 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's technique; glibc here is 2.39.
- Nothing in the file depends on 3.12. Codec names are compared through
-
Whole block: each of the 7 functions asserts
lines == [...]overstep_a's whole block. The slice drops only the blank line thatprint("\n(b) ...")puts there. The first-run row also asserts thespecupstream by its bytes. -
The escape commit
066e4468:AST equal: Trueagainstc092d331, and the file is ASCII (0 non-ASCII lines, against 1 before).
7. Row 13 and #1278's rows 9 to 12 at the head
| locale | result |
|---|---|
| Latin-1 | 1 passed, 4 skipped: row 13 passes; rows 9 to 12 skip with this system's file name encoding (iso8859-1) cannot spell 'sp\u2028ec', and the same for 'At\u2028las', 'Ink\u2028Router' and 'ta\u2028rget.py' |
| UTF-8 | 5 passed |
| ASCII | 1 passed, 4 skipped (the same four, (ascii)) |
| Latin-1, base blob | row 13 1 failed, at tests/test_bootstrap_spelling.py:455, the created at assert (:454 on 0354a7e7) |
9. The body
Closes #1283is the only closing form: a regex scan over every close/fix/resolve form, andclosingIssuesReferencesis[1283].- The title is 239 characters; the milestone is v1.2.2.
- The blob change
41c2eb42to991c06eais right. - Against main
5f06c3eb, the PR touches onlybootstrap.pyand the new file, none of 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's three files. - These counts match my runs: rows 12/18 and 30, call 1 (329 passed), call 2 (673 passed, 3 skipped).
- The merge-tree trees
2fe41582(with 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's head) and515bee9a(with0354a7e7) match. - The 28-case table's arithmetic is consistent: 8 flows x 3 locales, plus 4 control cases, = 28; 9 differ and 19 match.
- The GitHub body is the saved file plus Sourcery's appended summary, which has no closing keyword.
- Known limits are honest but incomplete (F1 and F2).
Pytest summary lines
All runs are at head dfd69ff7 (the bootstrap.py blob is 991c06ea) unless marked base. Base means the scratch clone at dfd69ff7 with main's blob 41c2eb42 laid in, then restored and proven equal. Every run used the probe environment, one call at a time.
| # | run | result |
|---|---|---|
| 1 | the new file, UTF-8 | 30 passed in 14.50s |
| 2 | the new file, Latin-1 pytest | 30 passed in 14.51s |
| 3 | the new file, ASCII pytest | 30 passed in 15.65s |
| 4 | the new file, UTF-8, base | 12 failed, 18 passed in 18.74s |
| 5 | the new file, UTF-8, stub localedef |
16 passed, 14 skipped in 9.13s |
| 6 | rows 9 to 13, Latin-1 | 1 passed, 4 skipped in 2.86s |
| 7 | rows 9 to 13, UTF-8 | 5 passed in 3.40s |
| 8 | rows 9 to 13, ASCII | 1 passed, 4 skipped in 2.86s |
| 9 | row 13, Latin-1, base | 1 failed in 1.95s |
| 10 | the new file + test_bootstrap_spelling.py + test_bootstrap_non_utf8_branch.py + test_bootstrap_branch_bytes.py, UTF-8 |
329 passed in 70.82s |
| 11 | the same four, Latin-1 pytest | 4 failed, 316 passed, 9 skipped in 81.90s |
| 12 | every tests/test_bootstrap_*.py (14 files, listed into a file, checked non-empty, passed with xargs -d '\n' -a), UTF-8 |
673 passed, 3 skipped in 218.94s |
| 13 | tests/test_pinned_copy_text.py, UTF-8 |
87 passed in 7.66s |
- Run 11's 4 failures are exactly the four tests: under a Latin-1 locale 4 rows of test_bootstrap_non_utf8_branch.py and test_bootstrap_branch_bytes.py fail on main, expecting the byte 0xFF spelled
a\udcffbas UTF-8 reads it where bootstrap.py rightly prints U+00FF, and no issue names them #1301 rows:..._moved_back_whatever_its_upstream_is_named[the-byte-0xff], both..._placed_on_every_runrows, and..._still_carried_and_the_branch_made. The 9 skips are rows 9 to 12, plus 5 skips that the test files make themselves under a non-UTF-8 pytest. - Run 12's 3 skips are
test_bootstrap_ref_store.py:102: this git makes no reftable repository.
Mutants: 8 killed of 8
Each mutant ran alone in the scratch clone at dfd69ff7, over the new file and row 13, under a UTF-8 pytest. After each one, bootstrap.py was written back from HEAD's blob and proven equal: restored 991c06ea... HEAD 991c06ea... equal=True, eight times, and git status was clean.
| id | mutant | result |
|---|---|---|
| R1 | _branch_ref in _check_out only, the other 7 comparisons text |
KILLED, 12 failed |
| R2 | _branch_ref without os.fsdecode (bytes compared with text) |
KILLED, 31 failed (every row and row 13) |
| R3 | ref read back as Latin-1 whatever the locale (.decode("latin-1")) |
KILLED, 17 failed: every UTF-8 and ASCII control and row 13; every Latin-1 row passes (the inverse of M10, so the controls have teeth) |
| R4 | both fast_forward_to_pin comparisons left as text |
KILLED, 1 failed ([latin1-head-on-the-branch]) |
| R5 | _head_of decodes as UTF-8 with surrogateescape whatever the locale (_branch_ref kept) |
KILLED, 14 failed |
| R6 | _branch_ref in create_at_pin only |
KILLED, 8 failed (later-run x3, hook, both fast-forwards, moved-back, stays) |
| R7 | _branch_ref only at the issue's two named checks (create_at_pin, _check_out) |
KILLED, 6 failed (later-run x3, hook, ff head-on-the-branch, stays): the 6 extra comparisons are each held |
| R8 | place_at_pin says the leg left a branch whenever HEAD was on one |
KILLED, 11 failed |
Not covered
-
Windows, macOS and any one-byte codec but Latin-1: Windows was read and emulated on Linux only. On macOS, whether git's
core.precomposeunicodemakes the stored bytes differ from_handed_to_git's for an NFD name was not looked at. Either way it would be pre-existing and unchanged here. -
CPython 3.14: read only.
-
The writer's M1 to M12 were not re-run.
-
Of the writer's 28-case matrix, I re-ran 8 cases by probe:
- Latin-1
tb\udcffx, runs 1 and 2, main and head; - UTF-8 and ASCII
caf\udcc3\udca9, main and head; - Latin-1 U+00FF, main and head.
The rows cover the rest, base against head.
- Latin-1
-
The four-file gate on base under Latin-1 or ASCII was not re-run.
-
tests/test_no_auto_maintenance.py,tests/test_path_guard_hygiene.py, thetest_shape_doctor.pyshards and the doc trio were not run: they are lane 1's predicted-squash gate.
Scratch: /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1300a/
- logs:
logs/ - probes:
probe/probe_cause.py,probe/twin.py,probe/legacy_emul.py - mutants:
mutants.py - detached review worktree:
wt-r1300a, clean atdfd69ff7
No tracked file was changed, nothing was committed or pushed, and gh was used read-only.
…ison for a name git cannot be handed as UTF-8, and its docstring names `_folded_twin` as the check that still compares text (r1300a F1, F2) On Windows under PYTHONLEGACYWINDOWSFSENCODING=1, os.fsencode is mbcs with replace, so _argument_fault lets a lone surrogate such as tb\udcffx through (one byte, `?`), while _handed_to_git is UTF-8 there and raises UnicodeEncodeError. _branch_ref now catches it and returns refs/heads/<branch>, the text every check compared before #1283, as _paste_word keeps spelled's text for such a name. On POSIX no name that _argument_fault passes reaches the except. _argument_fault's docstring says its "never handed to git" holds under Windows' default surrogatepass only. _branch_ref's docstring names the eight checks it serves, and _folded_twin as the one check that still compares text. tests/test_bootstrap_branch_one_byte_locale.py gains test_a_name_git_cannot_be_handed_is_compared_as_its_text, which emulates legacy mode with a stand-in os (nt, cp1252 with replace). Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
|
Delta review of #1300 (#1283) for lane openRepoShape-1, by r1300b (sonnet), dfd69ff..cb9ed80: READY The round does what lane 1 decided. I found no MUST and no SHOULD, only NITs, all optional.
FindingsN1 NIT, body
N2 NIT,
N3 NIT,
The writer's doubt about
|
| docstring | line |
|---|---|
_check_out's after checkout |
983 |
place_at_pin's already |
1563 |
place_at_pin's the leg was on check |
1570 |
fast_forward_to_pin's two |
1647 other_branch, 1648 current == ref |
_stays's |
1741 |
create_at_pin's after checkout -b |
1818 |
create_at_pin's the leg was on check |
1834 |
_folded_twinisheld != branch and _fold(held) == _fold(branch), at:1144-1145. It is the one text comparison left.- The docstring's twin examples match
twin.pyat the head:
utf-8: b'TB\xffx' vs 'tb\udcffx' twin=True; b'CAF\xc3\xa9' vs 'caf\udcc3\udca9' twin=False
iso8859-1: b'TB\xffx' vs 'tb\udcffx' twin=False; b'CAF\xc3\xa9' vs 'caf\udcc3\udca9' twin=False
ascii: b'TB\xffx' vs 'tb\udcffx' twin=True; b'CAF\xc3\xa9' vs 'caf\udcc3\udca9' twin=True
- The 0xC4/0xE4 claim holds: under Latin-1 the read-back texts fold equal (
True), so they would become twins. Under UTF-8 and ASCII they do not (False)._folded_twin(HEAD on tb<e4>x, branch tb\udcc4x)isFalsein all three. - assembly-root bootstrap.py:
_folded_twincompares HEAD's ref as the locale reads it with the manifest's text, so a case twin is missed under Latin-1 (TB<ff>xfortb\udcffx) and UTF-8 (CAF<c3 a9>forcaf\udcc3\udca9), and the branch is made #1306 is open, has no milestone, and its body namesTB<ff>xunder Latin-1 andCAF<c3 a9>under UTF-8. - 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's fourth box ("either reads right or is named in an issue") is met. Its fifth box, the U+00FF control, is held by the file'su00ff-itselfrows.
7. End to end. I reran the writer's probe_twin_e2e.py with my own paths and a fresh scaffold: 8 head cases and 2 main cases. Python 3.12.3, git 2.43.0, every run exit 0, no traceback. The lines match the body (lines 235-239) exactly.
TB<ff>xfortb\udcffx:- UTF-8 and ASCII give the three twin lines and leave the leg on
TB<ff>x. - Latin-1 gives
branch tb\udcffx created at … — at the pin, thenthe leg was on TBÿx, which keeps its commits; it is on tb\udcffx now.
- UTF-8 and ASCII give the three twin lines and leave the leg on
CAF<c3 a9>forcaf\udcc3\udca9:- ASCII gives the twin lines.
- UTF-8 gives
created, thenthe leg was on CAFé. - Latin-1 gives
created, thenthe leg was on CAFé.
- Detached beside the twin: Latin-1
ff-detand UTF-8caf-detboth saycreated. - On main:
- Latin-1
TB<ff>xgivescould not create branch 'tb\udcffx' … leaving it on TBÿx. - UTF-8
CAF<c3 a9>gives… leaving it on CAFé. - HEAD and the branch lists are the same as at the head.
- Latin-1
8. Merge with main b607223b.
git merge-tree --write-tree cb9ed806 origin/mainexits 0 with tree00cbf6a6a99b5a619d319b692ab02649ebcda868, the body's tree.- Both merge bases are
5f06c3eb. origin/main'sbootstrap.pyis still41c2eb42.- Main changed only
validate-manifest.py,validate-family.py,tests/conftest.py,tests/test_family.pyandtests/test_manifest_validator.pysince5f06c3eb. git diff --stat origin/main...cb9ed806shows only the two files.- I ran the new file and row 13 on a detached scratch worktree of
commit-tree 920c8c5b(never pushed).load_without_bytecodeandgit_answer_bytesare still in main'sconftest.py.
9. The body. Saved file w1300r/pr-body-only.md equals the live body byte for byte.
- Closing form: a scan for close/fix/resolve forms finds only
Closes #1283, andclosingIssuesReferencesis[1283]. Milestone is v1.2.2 and the title is 239 characters. The body has no@, no path outside/workspace, and no outside-v1.2.0 line. - F3:
cb9ed806's parent isdfd69ff7, whose parents are066e4468and5f06c3eb.5f06c3eb..066e4468is08059698,c092d331and066e4468.dfd69ff7's tree is2b159e15, equal tomerge-tree 066e4468 5f06c3eb.066e4468to0354a7e7gives515bee9a.066e4468withrefs/l1/pr/1278gives2fe41582.c092d331with31f94270givese4aa7b8e.5f06c3ebis 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's squash, with adopt-project.py:plan-wrong-kind,plan-unsupported-mode,plan-bad-legandplan-bad-idsay a plan value that is not text as_read_assays what the plan's reader read,kind is the number 7anddeclares leg a list of 2 item(s)wherereprspelled it7,Trueand['a', 'b'], and a plan with nokind:ormode:line saysabsentwhere it saidNone(#1199) #1281's squash as its parent.
- F4:
- At
0354a7e7,update-shape.py:3779 and :3796 are_symbolic_head(self.root) == ref, as the body says. - :3815 is
head == f"refs/heads/{start}", wherestart = _branch_of(_symbolic_head(self.root))(:3378) andheadis_symbolic_head. Both texts come from_symbolic_head, as the body says.
- At
- F5: commit time of
066e4468is 08:55:28Z, and the blob622cbf3ais the same at066e4468anddfd69ff7. "On the edit committed as066e4468" is accurate. - Review round 1 table:
- R1-R3 31 passed, R5 674 passed and 3 skipped, R6 266 passed and 2 skipped, R7 and R8 as listed, R9
1 failedeach, and R10 312 passed all match my runs. - R4's 330 is subsumed by R5, which includes those four files.
- The 3 skips are
test_bootstrap_ref_store.py:102(reftable).-rsconfirms it:SKIPPED [3] tests/test_bootstrap_ref_store.py:102: this git makes no reftable repository.
- R1-R3 31 passed, R5 674 passed and 3 skipped, R6 266 passed and 2 skipped, R7 and R8 as listed, R9
- Mutants of the fallback:
- Mi and Mii results match: Mi
1 failed, 31 passedwithUnicodeEncodeError, Mii withassert 'refs/heads/tb?x' == 'refs/heads/tb\udcffx'. - The "Mii reasoned, not run" aside holds.
fsdecode(fsencode("refs/heads/tb\udcffx")) == textis True under UTF-8 and ASCII and False under Latin-1.
- Mi and Mii results match: Mi
- Known limits: the
CAFline ("UTF-8 misses it, and so does Latin-1; ASCII alone finds it") matchestwin.py. - Not in this PR: it cites assembly-root bootstrap.py:
_folded_twincompares HEAD's ref as the locale reads it with the manifest's text, so a case twin is missed under Latin-1 (TB<ff>xfortb\udcffx) and UTF-8 (CAF<c3 a9>forcaf\udcc3\udca9), and the branch is made #1306. - The only stale claim is N1.
Pytest summary lines
I ran each pytest call in the probe environment: stub gh first on PATH, GH_TOKEN=bogus-r1300b, an empty GH_CONFIG_DIR, a null GIT_CONFIG_GLOBAL, GIT_SSH_COMMAND=false, EMAIL set, env -u LANES_LANE. I ran at most 2 calls at once. Scratch is /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1300b/; logs are in logs/.
At cb9ed806 (bootstrap.py blob 8e0f76c7):
| run | result |
|---|---|
| new file, UTF-8 pytest | 31 passed in 17.23s |
| new file, Latin-1 pytest | 31 passed in 17.16s |
| new file, ASCII pytest | 31 passed in 16.56s |
row 13 (test_a_branch_name_is_spelled_in_every_line_that_names_it), Latin-1 / UTF-8 / ASCII |
1 passed in 2.49s / 1 passed in 2.53s / 1 passed in 2.29s |
| rows 9 to 13, Latin-1 | 1 passed, 4 skipped in 3.69s |
| rows 9 to 13, UTF-8 | 5 passed in 4.03s |
| rows 9 to 13, ASCII | 1 passed, 4 skipped in 3.52s |
every tests/test_bootstrap_*.py (14 files, listed into a non-empty file, passed with xargs -d '\n' -a), UTF-8 |
674 passed, 3 skipped in 219.35s |
tests/test_pinned_copy_text.py, UTF-8 |
87 passed in 7.85s |
test_pinned_copy_text, test_path_guard_hygiene, test_no_auto_maintenance, UTF-8 |
266 passed, 2 skipped in 36.17s |
test_repo_hygiene, test_scaffold_leg_path_collisions, test_assembly_root_unreadable_paths, test_bom_reads, UTF-8 |
312 passed in 24.33s |
On the merge, commit 920c8c5b (tree 00cbf6a6, bootstrap.py blob 8e0f76c7), new file plus row 13:
| locale | result |
|---|---|
| Latin-1 | 32 passed in 15.57s |
| UTF-8 | 32 passed in 15.83s |
Base: 991c06ea laid into the scratch worktree at cb9ed806, then restored to 8e0f76c7. The restored blob equals HEAD's and git status --short is empty.
| run | result |
|---|---|
| new row, UTF-8 | 1 failed in 0.19s |
| new row, Latin-1 | 1 failed in 0.21s |
| new row, ASCII | 1 failed in 0.23s |
| new file plus row 13, UTF-8 | 1 failed, 31 passed in 17.83s |
Mutants of the delta's key lines: 7 killed of 8
Each ran alone in a scratch worktree at cb9ed806, over the new file plus row 13 under UTF-8. The new row alone was also run under Latin-1 and ASCII. After each, bootstrap.py was written back from HEAD's blob. Eight times I proved restored 8e0f76c7… HEAD 8e0f76c7… equal=True with git status --short empty.
| id | mutant | result |
|---|---|---|
| Mi | the except taken out (dfd69ff7's body) |
KILLED: 1 failed, 31 passed (the new row, UnicodeEncodeError at position 13); Latin-1 and ASCII 1 failed each |
| Mii | the except returns os.fsdecode(os.fsencode(text)) |
KILLED: 1 failed ('refs/heads/tb?x' == 'refs/heads/tb\udcffx'); Latin-1 and ASCII 1 failed each |
| Miii | except UnicodeDecodeError |
KILLED: 1 failed, 31 passed |
| Miv | the except returns "refs/heads/" |
KILLED: 1 failed, 31 passed (+ refs/heads/) |
| Mv | _branch_ref returns the text for every name |
KILLED: 13 failed, 19 passed (the 12 Latin-1 and caf rows plus the new row, which fails alone on its caf\xe9 assertion, + refs/heads/café); Latin-1 and ASCII 1 failed each |
| Mvi | except Exception |
SURVIVED, 32 passed. Equivalent: os.fsencode of a str raises only UnicodeEncodeError. |
| Mvii | _handed_to_git is os.fsencode on every os (the first round's M12) |
KILLED: 1 failed, 31 passed (see N1) |
| Mviii | the except returns refs/remotes/<branch> |
KILLED: 1 failed, 31 passed |
Not covered
- Windows: read and emulated on Linux only. I did not run real Windows mbcs, which would show whether
replacewrites?for every lone surrogate. I did not check what git for Windows stores for such a name. macOSprecomposeunicodewas not looked at. - CPython 3.14: read only; this bench has 3.12.3. The delta has no
is_file,existsoris_dirguard, so I built nositecustomizeshim. - Not run:
tests/test_agents_md_codes.py,tests/test_cli_reference.pyand thetests/test_shape_doctor.pyshards (lane 1's gate; the delta changes docstrings, onetry/exceptand one test). - Merge with main: I did not run rows 9 to 13 on
920c8c5b, only the new file and row 13. - Not re-run:
- the writer's M1 to M12 and the 28-case matrix (I re-ran 10 twin cases end to end);
- the full 14-file block under Latin-1 or ASCII pytests (the brief asked for UTF-8);
- r1300a's cause probe on main under Latin-1.
- Voided runs and process slips, each redone cleanly:
- My first
legacy_emul.pycall, withoutPYTHONDONTWRITEBYTECODE, wrote a stray ignored.pycunder the review worktree'stemplates/. That made 3test_scaffold_leg_path_collisionsrows fail with aUnicodeDecodeErroron its0xcbmagic byte. I moved the__pycache__out of the tree, with no delete, and reran: 312 passed. - A mutant harness and the 14-file run shared a basetemp. I stopped both by PID, restored the mutated file from HEAD's blob and proved it equal, then reran on separate basetemps.
- One rows 9 to 13 call used
$(cat ids), against the cont-rules. The ids file was non-empty, and I reran it withxargs -d '\n' -a.
- My first
- Left behind:
- Three scratch worktrees under
…/r1300b/:wt-r1300b(clean atcb9ed806),wt-mut(clean) andwt-merge(detached at920c8c5b, never pushed). - A moved-aside
…/r1300b/stray-pycache-from-my-first-probe.
- Three scratch worktrees under
No tracked file was changed, nothing was committed or pushed, and gh was used read-only (issue view 1306 and 1283, pr view 1300).
|
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 5 days and 2 hours by commenting |
… docstring says what happened without `_branch_ref`'s fallback, not at `dfd69ff7`, a merge that will not be on main (r1300b N2) r1300b's NIT N2 on #1300: `test_a_name_git_cannot_be_handed_is_compared_as_its_text` cited `dfd69ff7`, GitHub's update-branch merge, which the squash leaves off main. It now says "Without the fallback, `_branch_ref` raised ...". The docstring alone changes: the AST without docstrings is equal. Lane: openreposhape-1 (openRepoShape-1) Co-Authored-By: Claude Opus 5.5 <[email protected]>



Closes #1283
Milestone v1.2.2: lane 3 placed #1283 there, and v1.2.1 is frozen.
Base:
origin/main5f06c3eb(5f06c3e), #1278's squash, which also carries #1281. Head:cb9ed806(cb9ed80), review round 1's commit (see Review round 1). Its parent isdfd69ff7, GitHub's update-branch merge, whose two parents are:066e4468's line, this PR's own three commits:08059698(the fix),c092d331(the rows) and066e4468, which spells U+00FF in the new file by its escape (the AST is equal before and after);5f06c3eb, 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's squash.dfd69ff7's tree,2b159e15, is the onegit merge-tree --write-tree 066e4468 5f06c3ebgives. The sections from What to Merge-tree were measured atc092d331unless they name066e4468, against main0354a7e7, whosebootstrap.pyis the same blob,41c2eb42, as at5f06c3eb. Review round 1 gives the runs atcb9ed806. The PR changestemplates/assembly-root/scripts/bootstrap.py(blob41c2eb42to8e0f76c7;991c06eabefore round 1) and addstests/test_bootstrap_branch_one_byte_locale.py. It touches none of #1278's three files. Main has since moved tob607223b, which leavesbootstrap.pyat41c2eb42; lane 1 refreshes the branch when it lands.What
Under a Latin-1 locale, a project whose
project.yamlsaystracking_branch: "tb\udcffx"(#715's spelling of the byte 0xFF) now gets what UTF-8 and ASCII get:branch tb\udcffx created at <pin>in each leg, and thespecleg's branch tracksorigin/tb<ff>x;on tb\udcffx at <pin> (branch tip == pin).On main the same run made the branch in both legs, with HEAD on it at the pin, then said:
Every later run said
branch tb\udcffx is at the pin d6d63f5b099d, and git refused to check it out:, over the sameexited 0. Each run endedbootstrap ok, exit 0. Six more places in step (a) compared the same way (see the audit).No exit code changes anywhere. On Windows under
PYTHONLEGACYWINDOWSFSENCODING=1,_argument_faultlets a lone surrogate through, and git cannot be handed it as UTF-8. Since review round 1,_branch_refcompares such a name as main compared it, so no exit code changes there either, wheredfd69ff7raisedUnicodeEncodeErrorout of step (a), a traceback. That is emulated, not run on Windows, and the rowtest_a_name_git_cannot_be_handed_is_compared_as_its_textholds it (Review round 1). No line changes under ASCII. Under UTF-8, one kind of name changes: one that spells UTF-8's own bytes as surrogates, such ascaf\udcc3\udca9. Main misread it under UTF-8 in the same way (measured below). No existing row changes outcome under UTF-8 (see Tests).Why
The cause, measured on main in the Latin-1 flow's own tree (Python 3.12.3, git 2.43.0,
sys.getfilesystemencoding()iso8859-1):git symbolic-ref HEAD | od -cinspecgivesr e f s / h e a d s / t b 377 x \n, the same incode.git rev-parse HEADis the pin in both._head_ofreturns. It decodes those bytes withos.fsdecode, which gives'refs/heads/tb\xffx'. That is U+00FF, Latin-1's character for the byte 0xFF.'tb\udcffx': U+DCFF, the surrogate that stands for the byte 0xFF.os.fsencodehands it to git astb<ff>xin every locale.create_at_pinasks_head_of(sub) != (pin, f"refs/heads/{branch}")(main :1755). That compares'refs/heads/tb\xffx'with'refs/heads/tb\udcffx'and finds them different. Measured in process under Latin-1 for HEAD ontb<ff>x: the text comparison givesFalse, and_branch_ref's givesTrue. Under UTF-8 and ASCII,os.fsdecode(b"\xff")is U+DCFF, so both giveTrue.The decision: compare with the ref read back, not with the manifest's text.
_branch_ref(branch)isos.fsdecode(_handed_to_git(f"refs/heads/{branch}")). It is the bytes git is handed for the name (#961's own helper), decoded as_head_ofdecodes HEAD's ref. Each place that asks whether HEAD is on the tracking branch now compares_head_of's ref with it: eight comparisons in five functions, which_branch_ref's docstring names._folded_twinis the one check that still compares text (audit row 8, #1306). A name git cannot be handed, which_handed_to_gitraisesUnicodeEncodeErroron, is compared as its text, as main compared it;_paste_wordkeepsspelled's text for such a name the same way (Review round 1). The lines go on printing the manifest's spelling (spelled(branch), and{branch!r}incould not create). So row 13's lines are word for word what it asks, under every locale. Both sides now pass throughos.fsdecode, so equal text means equal bytes on POSIX.Rejected:
_head_ofreturning bytes. Its text is printed (_place_of), folded (_folded_twin) and prefix-tested (_on_a_branch), so every reader would change. The issue says so too.checkout_tracking_branch. That would reach every comparison in one line. But the lines printbranch, so under Latin-1 every line would nametbU+00FFxwhere the manifest saystb\udcffx. Row 13 asserts the manifest's spelling.os.fsencode(current) == os.fsencode(ref). On POSIX this is the same answer. On Windows withPYTHONLEGACYWINDOWSFSENCODING=1,os.fsencodeismbcswithreplace, so two names the code page lacks could encode alike._handed_to_gitis UTF-8 there, which is what git for Windows stores. This is read from the code, not run on Windows._folded_twintoo. It is not needed for the tracking branch itself: no fold turns U+00FF into U+DCFF, so it already answers "no twin" there in every locale (measured). It would also change what a twin is under Latin-1: bytes 0xC4 and 0xE4 would become twins, as U+00C4 and U+00E4 (computed in process), where UTF-8 calls them none. What a twin is for a name that is not UTF-8 is a question of its own, filed as assembly-root bootstrap.py:_folded_twincompares HEAD's ref as the locale reads it with the manifest's text, so a case twin is missed under Latin-1 (TB<ff>xfortb\udcffx) and UTF-8 (CAF<c3 a9>forcaf\udcc3\udca9), and the branch is made #1306. See Known limits.caf\udcc3\udca9. Those lines were false under UTF-8 too. On main, HEAD was onrefs/heads/caf<c3 a9>at the pin while the run saidcould not create, thengit refused. Keeping them would keep the defect for UTF-8.The pinned-copy rules hold. The file imports nothing new, and
_branch_refuses onlyosand the file's own_handed_to_git.tests/test_pinned_copy_text.pypasses (Tests, call 3; Review round 1, R6).Measured
A probe built one scaffold's recursive clone. For each case it copied the clone and set
tracking_branch, set up the leg with git (naming the branch by the bytes the child hands git), and ranscripts/bootstrap.py --skip-validatorswithPYTHONIOENCODING=utf-8:strict. It runs in the probe environment, on main0354a7e7(blob41c2eb42) and on the headc092d331(blob991c06ea).checkmakes 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's test builds it:localedef -c, thenLOCPATH,LC_ALL=en_US.ISO-8859-1,PYTHONUTF8=0. The child reportsiso8859-1.LC_ALL=C.UTF-8.LC_ALL=C PYTHONUTF8=0 PYTHONCOERCECLOCALE=0, and the child reportsascii.Shas are normalized when lines are compared.
specleg, unless named)tb\udcffx, first run,origin/tb<ff>xinspeccould not create branch ... leaving detachedin both legs;spechas no upstreamcreatedin both legs;spectracksrefs/remotes/origin/tb<ff>xcreated, the same on bothcreated, the same on bothgit refused to check it outin both legson tb\udcffx at <pin>in bothon, the same on bothon, the same on bothcodewith a commit of its ownspecrefused;code:The checkout stays at <sha> (on tbU+00FFx)specon;code:stays on tb\udcffx at its tipstays on ... at its tip, the same on bothgit refused to move it:, git'sfatal: cannot force update the branch 'tb<ff>x' used by worktreefast-forwarded <old> -> <new>, the pinfast-forwarded, the same on bothmoved ... -> <pin>, the pin, and git refused to check it outfast-forwardedfast-forwarded, the same on bothorigin's, leg detached at the pinmoved back ..., and git refused to check it outmoved back ...; nothing is lost, origin/tbU+00FFx still holds those commits... origin/tb\udcffx still holds ..., the same on bothgit refused to check it out:and the hook's wordson, thennothing to check out, and then git said:and the hook's wordstb<ff>xwith no commit yetcould not create branch ...; leaving it on tbU+00FFxcreated, and no line that the leg left a branchcreated, the same on bothcaf\udcc3\udca9, three runscould not create, thengit refusedcreated, thenoncould not create, thengit refused; head:created, thenoncreated, thenon, the same on bothfeature/xcreated, thenontb\xffx, U+00FF itselfcreated(reftb<ff>x), thenon tbU+00FFxcreated(reftb<c3 bf>x), the same on bothdid not try branch: #710'sUNWRITABLE, the same on bothAcross all 28 cases, between main and head:
tb\udcffxandcaf\udcc3\udca9, andcaf\udcc3\udca9under UTF-8.tb\udcffxprints what UTF-8 prints, but for the moved-back line's upstream (see the audit, row 9).specleg's upstream is unset on main and set at head.The audit
Every place in
templates/assembly-root/scripts/bootstrap.pywhere a name git printed is compared with, or printed as, a name the manifest gave. Line numbers are main0354a7e7's. "Wrong" means the place answers otherwise than UTF-8 does for the same bytes.create_at_pin:1755checkout -b?could not create branch, upstream never set_branch_refcreate_at_pin:1771the leg was on <x>line aftercreatedtbU+00FFx(mutant M9)_branch_ref_check_out:922checkout? Reached fromplace_at_pin,fast_forward_to_pin(detached) andmove_back_to_pingit refused to check it out_branch_refplace_at_pin:1501,alreadynothing to check outorchecked out, under git's words after a non-zero exitchecked out, and then git said:(mutant M3)_branch_refplace_at_pin:1508the leg was on <x>linethe leg was on tbU+00FFx, which keeps its commits(mutant M4)_branch_reffast_forward_to_pin:1584-1586merge --ff-only) or on another (branch -f)?branch -fon the checked-out branch, refused by git_branch_ref_stays:1679on <branch> at its tip, orat <sha> (<where>)at <sha> (on tbU+00FFx)_branch_ref_folded_twin:1081-1084, throughplace_at_pin,fast_forward_to_pin,create_at_pinand_folded_spellingTB<ff>xfortb\udcffxunder Latin-1 (UTF-8 and ASCII find it), and, under UTF-8 too,CAF<c3 a9>forcaf\udcc3\udca9(ASCII alone finds it). Measured in process and end to end: step (a) makes the branch beside the twin, and sayscould not createon main andcreatedhere (Review round 1)move_back_to_pin:1650-1651_upstream_holdingreadorigin/tbU+00FFxunder Latin-1,origin/tb\udcffxunder UTF-8. The pasted word is the same bytes in both ("$(printf -- 'origin/tb\377x')"). This is not a comparison, and the name is git's, not the manifest's_upstream_holding:883-888rev-parse_place_of, through_say_left,_say_neither,_staysandcreate_at_pin'sleaving it ..._say_twin,_say_spelling,_kept_namecheckout_tracking_branch:1800-1803, and--set-upstream-to:1763ASCII is right everywhere. For every name
_argument_faultlets through under ASCII,os.fsdecode(os.fsencode(name)) == name: ASCII text and U+DC80 to U+DCFF. Every ASCII case above is the same line for line on main and head. Under UTF-8, places 1 to 7 were wrong for a name that spells UTF-8's bytes as surrogates. Rows hold 1 and 3 for it. Place 8 misses such a name's case twin under UTF-8 too, and is not changed here (#1306).templates/family-root/scripts/bootstrap.pyhas no_head_ofand norefs/heads/{branch}comparison. Elsewhere, latent only:update-shape.py'sRollbackcompares_symbolic_head(root), which is git's bytes decoded as UTF-8 withsurrogateescape, withf"refs/heads/{branch}", where--branchis argv decoded by the locale (:3779, :3796). :3815 is left out: it compares two texts that both come from_symbolic_head. Measured in process with HEAD on each name:tb<ff>xcaf<c3 a9>No run reaches it. Lane 1's investigator i1300a ran
applyend to end under Latin-1, ASCII and UTF-8, with a hook that fails the commit so the rollback runs. A--branchthat holds a byte that is not ASCII is refused asupdate-branch-invalidbefore anything is written:checked_branchasksBRANCH_RE(#227), which is ASCII only. A start branch that is not UTF-8 is refused asupdate-branch-not-utf8. The tree was the same after each of the 15 runs as before it. So no issue is filed. The comparison matters only ifBRANCH_REis ever widened past ASCII. Then :3779 and :3796, and the like comparisons at :3105 and :5759, must compare bytes.Rows
tests/test_bootstrap_branch_one_byte_locale.py, 31 rows. Review round 1 added the 31st, which loadsbootstrap.pyin process (Review round 1); the table below is the first 30. Each of those runsbootstrap.pyin a child under the locale it names, so a suite under UTF-8, as CI's is, measures Latin-1. The module builds its Latin-1 locale in its own module-scopedlatin1fixture withlocaledef -c, as #1153's and #1247's modules each build theirs. It imports neither: a module-scoped fixture imported into another module runs twice in the full suite (#1188). Where no Latin-1 locale can be built, the Latin-1 rows skip withlocaledef's words, and the UTF-8 and ASCII rows still run. On Windows the module skips.Base is main's
bootstrap.py(blob41c2eb42) laid into a scratch clone atc092d331. The clone's file was then written back from HEAD's blob, and its blob,991c06ea, equals HEAD's.test_the_first_run_says_it_made_the_branch_head_is_on[byte-0xff-latin1]could not create branch 'tb\\udcffx'...[utf-8-bytes-as-surrogates-latin1],...[utf-8-bytes-as-surrogates-utf-8]could not create branch 'caf\\udcc3\\udca9'test_every_later_run_says_the_leg_is_on_the_branch[byte-0xff-latin1],[utf-8-bytes-as-surrogates-latin1],[utf-8-bytes-as-surrogates-utf-8]git refused to check it outtest_a_hook_that_fails_where_nothing_moved_is_said_after_on[latin1]git refused to check it out:and the hook's wordstest_a_branch_behind_the_pin_is_fast_forwarded[latin1-head-on-the-branch]git refused to move it:...[latin1-detached-at-the-pin]moved ..., and git refused to check it out:test_a_branch_past_the_pin_with_no_commit_of_its_own_is_moved_back[latin1]moved back ..., and git refused to check it out:test_a_branch_with_a_commit_of_its_own_stays_with_head_on_it[latin1]stays at <sha> (on tbU+00FFx)test_a_leg_on_the_branch_with_no_commit_yet_is_not_said_to_leave_it[latin1]could not create branch ...; leaving it on tbU+00FFxbyte-0xffunder UTF-8 and ASCII,ascii-nameunder Latin-1,u00ff-itselfunder Latin-1 and UTF-8, andutf-8-bytes-as-surrogatesunder ASCII (12); each single-site row under UTF-8 (6)c092d331). On the edit committed as066e4468: 30 passed in 13.06 s under UTF-8, and 30 passed in 13.06 s under a Latin-1 pytest. Atcb9ed806, with the 31st row: 31 passed under UTF-8, Latin-1 and ASCII pytests (Review round 1)refused, or athe leg was on.git symbolic-ref HEADequal torefs/heads/and the bytes the child hands git, and its commit, the pin. The first-run row also asserts thespecleg's upstream by its bytes (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's second box).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's last box.tracking_branch: "tb\xffx"under Latin-1 gives the reftb<ff>xandcreated, thenon tbU+00FFx, on main and at head.os.fsdecodeof the child's bytes, so the rows hold whatever locale pytest itself runs in. Under a Latin-1 pytest the new file passes at head (call 1b).Mutants
12 mutants of the changed lines, 11 killed at
c092d331; atcb9ed806the round 1 row kills M12 too, so 12 of 12 (delta review r1300b's Mvii). Each ran alone in the scratch clone atc092d331, over the new file and row 13. After each,bootstrap.pywas written back from HEAD's blob and proved equal to it (991c06ea)._branch_refreturnsf"refs/heads/{branch}": the comparison put back to text, at every place_check_outcompares with the textdetached-at-the-pin,moved_backplace_at_pin'salreadywith the textchecked out, and then git said:place_at_pin'sthe leg was oncheck with the textfast_forward_to_pin'sother_branchwith the text[latin1-head-on-the-branch]fast_forward_to_pin'sif current == refwith the text[latin1-head-on-the-branch]_stayswith the textstays_with_head_on_it[latin1]create_at_pin's check aftercheckout -bwith the textcode's branchcreate_at_pin'sthe leg was oncheck with the textno_commit_yet_..._leave_it[latin1]os.fsencode(ref).decode("utf-8", "surrogateescape")): passes every UTF-8 rowcaf\udcc3\udca9control under ASCII. Every UTF-8 row passesos.fsdecode(ref.encode("utf-8", "surrogateescape")))u00ff-itself-latin1rows alone: it passes the UTF-8 controls and every Latin-1 row overtb\udcffxos.fsencodefor_handed_to_gitc092d331, 31 passed; KILLED atcb9ed806by the round 1 row ('refs/heads/tb?x' == 'refs/heads/tb\udcffx')bootstrap.py(see below)_handed_to_gitisos.fsencode. It differs only on Windows, where_handed_to_gitis UTF-8, the bytes git for Windows stores._handed_to_gitis kept because it is the file's own answer to "the bytes git is handed" (the assembly root's bootstrap.py: a paste word that begins with=is expanded by zsh, the NOT INITIALIZED line is neither quoted nor a paste word, and_paste_wordasks the stdout's codec where git is handed the filesystem's bytes #961)._branch_ref's fallback, both killed, are in Review round 1.Tests
Python 3.12.3, git 2.43.0, in the probe environment, at most 2 calls at once, one basetemp per call slot. Calls run at head
c092d331under UTF-8 unless the row says otherwise. "Base" is main'sbootstrap.pylaid into the scratch clone atc092d331. Review round 1 gives the calls atcb9ed806.tests/test_bootstrap_spelling.py,tests/test_bootstrap_non_utf8_branch.py,tests/test_bootstrap_branch_bytes.py, UTF-8tests/test_bootstrap_*.py(14 files)tests/test_pinned_copy_text.py,tests/test_assembly_root_unreadable_paths.py,tests/test_bom_reads.pytests/test_scaffold_leg_path_collisions.py,tests/test_path_guard_hygiene.py,tests/test_no_auto_maintenance.pytests/test_agents_md_codes.py,tests/test_cli_reference.py,tests/test_repo_hygiene.pytests/test_shape_doctor.py, shard 1 of 4 (113 ids)0354a7e7tests/test_bootstrap_spelling.py:454,could not create branch); UTF-8 1 passed; ASCII 1 passedc092d331066e4468(run just before the commit; the file's blob,622cbf3a, is the same at066e4468anddfd69ff7)tests/test_bootstrap_spelling.py, which 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 settles;test_bootstrap_non_utf8_branch.py's..._moved_back_whatever_its_upstream_is_named[the-byte-0xff]and both..._placed_on_every_runrows, andtest_bootstrap_branch_bytes.py's..._still_carried_and_the_branch_made. They are tests: 50 tests in 12 files fail under a Latin-1 locale before and after #1209 (ten of them rows oftest_stdout_encoding.py), and whether each is a test that cannot judge under a one-byte locale or a tool defect is not measured (W1196's leftovers; follows #1196) #1214's kind a, and not among tests: 8 tests in test_pinned_copy_text.py and test_family.py, files #1214 does not list, fail under a Latin-1 locale on main and on #1258, and whether each cannot judge there or is a tool defect is not classified (F1214's leftovers; follows #1214) #1259's 13. Lane 1 filed them as tests: under a Latin-1 locale 4 rows of test_bootstrap_non_utf8_branch.py and test_bootstrap_branch_bytes.py fail on main, expecting the byte 0xFF spelleda\udcffbas UTF-8 reads it where bootstrap.py rightly prints U+00FF, and no issue names them #1301 and claimed it.tests/test_no_auto_maintenance.py:222, because the probe environment setsGIT_CONFIG_GLOBAL=/dev/null. The shards' 7 are 4 rows that needgit filter-repo, which the probe environment's PATH does not hold, and 3 rows oftests/test_shape_doctor.py:10516that run only on a Windows host.bootstrap.pywere searched for intests/before the runs. No test matches their bytes by pattern.Row 13 on the merge with #1278
git merge-tree --write-tree c092d331 31f94270(#1278's head) is clean: treee4aa7b8e8d4df920e768cfd2ff336b7678f30e0a. A detached scratch worktree of acommit-treeof it (626c6a42, never pushed) gave:tests/test_bootstrap_spelling.pythis system's file name encoding (iso8859-1) cannot spell 'sp\u2028ec', and the same of'At\u2028las','Ink\u2028Router'and'ta\u2028rget.py')tests/test_bootstrap_spelling.pyand the new fileSo with #1278 and this PR both in,
tests/test_bootstrap_spelling.pyhas no failure under Latin-1. #1278 leaves row 13 as it is written, and it passes.At
066e4468the merge with #1278's head is clean too, tree2fe4158216748a8c1d6c1bf3bbfe699bc3d52426. Acommit-treeof it (c3853fe4, never pushed) was checked out in the same scratch worktree:At the real head. #1278 landed as
5f06c3eb, anddfd69ff7is GitHub's merge of it into066e4468; its tree is the onemerge-treepredicted (Base, above). Lane 1's reviewer r1300a ran atdfd69ff7, and this round ran atcb9ed806, in the probe environment:cb9ed806cb9ed806dfd69ff7(r1300a)Rows 9 to 12 skip under Latin-1 and ASCII with the words above,
(iso8859-1)or(ascii). Row 13 passes in all three locales at the real head.Merge-tree
git merge-tree --write-tree 066e4468 refs/l1/pr/1278(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's head31f942700e78808f44b602dad9a4f73b48756498): clean, tree2fe4158216748a8c1d6c1bf3bbfe699bc3d52426. Atc092d331it was clean too, treee4aa7b8e8d4df920e768cfd2ff336b7678f30e0a.git merge-tree --write-tree 066e4468 origin/main(0354a7e7): clean, tree515bee9ad7c332f53cf656ffdad0a96b4adb35e4.git merge-tree --write-tree 066e4468 5f06c3eb(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's squash): clean, tree2b159e154c054b3c6045664f3ad5a5993bb3bef0, which isdfd69ff7's tree.git merge-tree --write-tree cb9ed806 b607223b(main now): clean, tree00cbf6a6a99b5a619d319b692ab02649ebcda868.b607223bchanges none of this PR's two files.Review round 1 (r1300a)
Lane 1's reviewer r1300a reviewed
dfd69ff7in issuecomment-6764753070: NOT READY, with F1 and F2 SHOULD and F3 to F5 NIT. It found the change right on POSIX, and its 8 mutants were all killed. This round is one commit,cb9ed806, ondfd69ff7, with no merge of main.F1 (SHOULD):
_folded_twinstill compares HEAD's ref with the manifest's text, and no open issue named its misses (#1283's fourth box). Lane 1 ruled that_folded_twinstays as it is: what a case twin is for a name that is not UTF-8 is a question of its own, and w1283a's Latin-1 objection stands (the bytes 0xC4 and 0xE4 would become twins). This round:_folded_twincompares HEAD's ref as the locale reads it with the manifest's text, so a case twin is missed under Latin-1 (TB<ff>xfortb\udcffx) and UTF-8 (CAF<c3 a9>forcaf\udcc3\udca9), and the branch is made #1306, with both misses measured in process and end to end;_branch_ref's docstring from "Every check of whether HEAD is on the tracking branch" to the eight comparisons it serves, and named_folded_twinthere as the one check that still compares text;End to end at
cb9ed806, with HEAD on the twin at the pin and the tracking branch absent (thespecleg;codesayscreatedin each run):TB<ff>xfortb\udcffx: UTF-8 and ASCII saybranch tb\udcffx does not exist (the pin is 5985a5dad55d), and the checkout is on TB\udcffx, which differs from tb\udcffx only in case, and leave the leg. Latin-1 saysbranch tb\udcffx created at 5985a5dad55dU+2014at the pin, thenthe leg was on TBU+00FFx, which keeps its commits; it is on tb\udcffx now.CAF<c3 a9>forcaf\udcc3\udca9: ASCII gives the twin lines. UTF-8 sayscreated, thenthe leg was on CAFU+00E9...; Latin-1 does too, withCAFU+00C3 U+00A9.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'scould not create branch 'tb\udcffx' at the pin 5985a5dad55d; leaving it on TBU+00FFx(and the same forcaf\udcc3\udca9under UTF-8). HEAD and the branches after each run are the same on main and here. Every run exits 0._folded_spellingmissesTB<ff>xunder Latin-1 (UTF-8 finds it) andCAF<c3 a9>under UTF-8 (ASCII finds it), and step (a) sayscreated(in the issue).F2 (SHOULD): on Windows under
PYTHONLEGACYWINDOWSFSENCODING=1,_branch_refraisedUnicodeEncodeErrorfor a name_argument_faultlets through. Lane 1 took the review's way (a):_branch_refcatchesUnicodeEncodeErrorfrom_handed_to_gitand returnsf"refs/heads/{branch}", main's comparison, as_paste_wordalready does for such a name._argument_faultand_fsencoded_lengthare unchanged. The review's way (b) would add a refusal that the issue does not ask for._argument_fault's docstring now says that its "a lone surrogate is never handed to git" holds under Windows' defaultsurrogatepass. Under the legacy mode one passes, as on main, and_branch_reffalls back.exceptis never taken for a name step (a) reaches:_argument_faultfirst refuses each characteros.fsencodecannot write.The row is
test_a_name_git_cannot_be_handed_is_compared_as_its_text._branch_ref's other rows, rather than intests/test_bootstrap_pasteable_lines.py, whoseLegacyMbcsOsit mirrors. That file holds the pasted words, and this keeps the PR to its two files.osis the file's own, so the file imports no further test module. The module skips on Windows, so the row runs on POSIX hosts, CI's included.osset to the legacy mode's stand-in (nt,os.fsencodeandos.fsdecodeas cp1252 withreplaceformbcs), it asserts three things:_argument_fault("tb\udcffx")isNone;_branch_ref("tb\udcffx")isrefs/heads/tb\udcffx;_branch_refofcafU+00E9 is git's UTF-8 as the code page reads it,refs/heads/cafU+00C3 U+00A9.dfd69ff7's blob991c06ealaid into a scratch clone atcb9ed806, the row fails under UTF-8, Latin-1 and ASCII pytests withUnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 13: surrogates not allowed. The blob written back is8e0f76c7, equal to HEAD's, andgit status --shortis empty.r1300a's
legacy_emul.py, unchanged, atdfd69ff7and atcb9ed806:At
cb9ed806,_branch_refreturns'refs/heads/tb\udcffx'. TheRAISESprinted after it comes from the probe's own next call,("refs/heads/" + branch).encode("utf-8"), which stands in for the bytes git stores and has no UTF-8 for the surrogate either. A copy with_branch_ref's call in a try of its own (legacy_emul_split.py) prints, atcb9ed806:So
tb\udcffxno longer raises, andcafU+00E9 still compares right: equal to HEAD's ref, where main's text was not.F3 (NIT): the shas predated the update-branch. Base and Head now name
cb9ed806,dfd69ff7and main5f06c3eb, and "Row 13 on the merge with #1278" cites runs at the real head.F4 (NIT): an
update-shape.pyline number. The audit says :3779 and :3796. It leaves out :3815, whose two texts both come from_symbolic_head.F5 (NIT): call 10. It says it ran on the edit committed as
066e4468.Measured at
cb9ed806, in the probe environment, one call at a time:tests/test_bootstrap_spelling.py,tests/test_bootstrap_non_utf8_branch.py,tests/test_bootstrap_branch_bytes.py, UTF-8tests/test_bootstrap_*.py(14 files, listed into a file, checked non-empty, passed withxargs -d '\n' -a), UTF-8tests/test_pinned_copy_text.py,tests/test_path_guard_hygiene.py,tests/test_no_auto_maintenance.py, UTF-8dfd69ff7'sbootstrap.pylaid inUnicodeEncodeError)tests/test_repo_hygiene.py,tests/test_scaffold_leg_path_collisions.py,tests/test_assembly_root_unreadable_paths.py,tests/test_bom_reads.py, UTF-8tests/test_bootstrap_ref_store.py:102: this git makes no reftable repository.tests/test_no_auto_maintenance.py:222, as call 4's.Mutants of the fallback: 2 killed of 2. Each ran alone in a scratch clone at
cb9ed806:After each,
bootstrap.pywas written back from HEAD's blob and proved equal,restored 8e0f76c7b470a7dc3dd0ebb20589d5ae716c6df1 HEAD 8e0f76c7b470a7dc3dd0ebb20589d5ae716c6df1 equal=True, andgit status --shortwas empty.excepttaken out (dfd69ff7's body)UnicodeEncodeErrorexceptreturns the ref read back,os.fsdecode(os.fsencode(f"refs/heads/{branch}")), not the textassert 'refs/heads/tb?x' == 'refs/heads/tb\udcffx'Mii is why the row sets a stand-in
osrather than making_handed_to_gitraise over this system'sos. There, Mii's read-back givesrefs/heads/tb\udcffxback under UTF-8 and ASCII (reasoned, not run). The stand-in's code page writes the surrogate as?, so the row kills Mii in every locale.Known limits
_folded_twincompares HEAD's ref as the locale reads it with the manifest's text, so a case twin is missed under Latin-1 (TB<ff>xfortb\udcffx) and UTF-8 (CAF<c3 a9>forcaf\udcc3\udca9), and the branch is made #1306).tracking_branch: "tb\udcffx"and HEAD onTB<ff>x,_folded_twinsays twin under UTF-8 and ASCII, and not under Latin-1.tracking_branch: "caf\udcc3\udca9"and HEAD onCAF<c3 a9>, it says twin under ASCII alone: UTF-8 misses it, and so does Latin-1.created; main saidcould not create.Mainwhose tracking branchmainis behind the pin is moved under its own HEAD, and bootstrap saysit is on main nowover an index that undoes the pin #896 and the assembly root's bootstrap.py:create_at_pinstill hides a branch's commits behind a new loose ref when HEAD is detached or a third spelling is packed, and_folded_twindoes not fold NFC and NFD #962, which are both closed, so assembly-root bootstrap.py:_folded_twincompares HEAD's ref as the locale reads it with the manifest's text, so a case twin is missed under Latin-1 (TB<ff>xfortb\udcffx) and UTF-8 (CAF<c3 a9>forcaf\udcc3\udca9), and the branch is made #1306 tracks this. WhetherTB<ff>xandtb<ff>xare one file on any disk is part of its question: APFS refuses a name that is not UTF-8. Unchanged here.branch tb\udcffxandorigin/tbU+00FFxfor the same byte. The command to paste gives the bytes in both locales._handed_to_gitis UTF-8 and_head_ofdecodes withos.fsdecode, so_branch_refreads git's UTF-8 back as_head_ofdoes._argument_faultrefuses every lone surrogate there, sincesurrogatepasswrites three bytes for it.PYTHONLEGACYWINDOWSFSENCODING=1, a stand-inos(nt, cp1252 withreplaceformbcs) shows two things.cafU+00E9 compares right here where main compared it wrong. A lone surrogate, which_argument_faultlets through, is compared as main compared it (the 31st row, andlegacy_emul.py)._head_ofreads back, was not emulated.replacecan fold two byte strings into one text, so "equal text means equal bytes" holds on POSIX only._branch_refis the same function of the locale's codec as_head_of, so any codec that reads the bytes back as other text is met the same way. That is the reading, not a measurement.Not in this PR
update-shape.py'sRollbackcomparison (see the audit). WhileBRANCH_REis ASCII only, no run reaches it, so no issue is filed._folded_twinfor a name the locale reads back as other text than the manifest's: assembly-root bootstrap.py:_folded_twincompares HEAD's ref as the locale reads it with the manifest's text, so a case twin is missed under Latin-1 (TB<ff>xfortb\udcffx) and UTF-8 (CAF<c3 a9>forcaf\udcc3\udca9), and the branch is made #1306 (Known limits).templates/family-root/scripts/bootstrap.py, or to the docs: no doc describes how step (a) reads HEAD back.Lane: openreposhape-1 (openRepoShape-1)
🤖 Generated with Claude Code