Skip to content

assembly-root bootstrap.py: a case twin is folded as UTF-8 reads git's bytes and as git for Windows names the file, whatever the locale, so step (a) finds a twin of a branch that is not UTF-8 and makes no branch beside it (#1306) - #1308

Open
brettheap wants to merge 6 commits into
fix/1283-bootstrap-branch-latin1from
fix/1306-folded-twin-bytes

Conversation

@brettheap

@brettheap brettheap commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1306

Milestone v1.2.2: v1.2.1 is frozen, and lane 3 places this PR by its READY time.

Stacked on #1300 (for #1283): this PR's base is #1300's branch, and it lands after #1300.

Base: #1300's head cb9ed806 (cb9ed80), on fix/1283-bootstrap-branch-latin1. Head: 4682320a980c (4682320), six commits:

  • dbf022ae, the first change and its rows. templates/assembly-root/scripts/bootstrap.py goes from blob 8e0f76c7 to c89f00ad, and tests/test_bootstrap_branch_one_byte_locale.py from 9c95e2f2 to 0496be7c.
  • 0ac4efbc, r1300b's NIT N2 on 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, on its own: the docstring of test_a_name_git_cannot_be_handed_is_compared_as_its_text cited dfd69ff7, GitHub's update-branch merge, which will not be on main. It now says "Without the fallback, _branch_ref raised ...". Test blob 1e5b4ccb; the AST without docstrings is equal.
  • 3beceb51, review round 1 (r1308a), F1, F2 and F5: git for Windows' reading, the -kept name through the same test, and the docstrings. bootstrap.py goes from c89f00ad to 2c470451, and the test file to 48858575. The DECIDED row and the 0xC4/0xE4 row change with the code, so the commit is green on its own.
  • 248669b1, review round 1, F2 to F4: the new rows. Test blob 1a0b5986.
  • 166d843dc56e, review round 1: one more pair row, tb84x for tb<84>x, which mutant W2 survived without (Mutants). Test blob 269a0d16.
  • 4682320a980c, review round 2 (r1308b's S1, N1 and N3): the xutftowcsn row's table gains five names, so mutants R3 and R7 fail it (Mutants); two docstrings and a comment are reworded. templates/assembly-root/scripts/bootstrap.py goes from 2c470451 to d3bedd42, docstrings only (ast.dump without docstrings is equal), and the test file from 269a0d16 to ccad672d.

Main is dc9a0bcc7 (dc9a0bc), whose bootstrap.py is blob 41c2eb42, as it was at f2a6527e9. git merge-tree --write-tree 4682320a980c origin/main is clean, rc 0 (tree 0cfc476e6ecf62fd4bbe1da0f784cf69a991c17b). Main is not merged here.

This body is ASCII. <ff>, <c3 a9>, <c4>, <e4> and <84> name bytes, and a character outside ASCII is written as its code point.

What

_folded_twin asks whether a branch is a case TWIN of the tracking branch (#896, #962): the same name under NFC and casefold(), and not byte for byte. At cb9ed806 it folded HEAD's ref, as _head_of decodes it, with the manifest's text. Where the locale read a twin's bytes as other text than the manifest's surrogate escapes, the twin was missed. Step (a) then made the tracking branch beside it with checkout -b and said created.

Each case below is one bootstrap.py --skip-validators run with the tracking branch absent. Each pair was missed in the locales the table names:

twin tracking branch missed at cb9ed806 under found at cb9ed806 under
TB<ff>x tb\udcffx Latin-1 (it reads TB U+00FF x) UTF-8, ASCII
CAF<c3 a9> caf\udcc3\udca9 UTF-8 (CAF U+00E9), Latin-1 (CAF U+00C3 U+00A9) ASCII

Now each is a twin in every locale, with HEAD on it, with the leg detached at the pin beside it (_folded_spelling), with HEAD on it beside the branch at the pin (place_at_pin), and with HEAD on it beside the branch behind the pin (fast_forward_to_pin). Under Latin-1, at cb9ed806, HEAD on TB<ff>x gave:

  [spec] spec: branch tb\udcffx created at b04b5f4584a0 <U+2014> at the pin
          the leg was on TB<U+00FF>x, which keeps its commits; it is on tb\udcffx now

HEAD was then on a new tb<ff>x, beside TB<ff>x. At the head the same run gives the twin lines UTF-8 and ASCII gave, but for the twin's name, which is git's name as Latin-1 reads it:

  [spec] spec: branch tb\udcffx does not exist (the pin is b763c87cce31), and the checkout is on TB<U+00FF>x, which differs from tb\udcffx only in case
          a disk that folds case (macOS, Windows) reads TB<U+00FF>x and tb\udcffx as one branch, so making tb\udcffx could hide the commits a branch spelled like tb\udcffx holds behind the new ref; the leg is left as it is
          rename TB<U+00FF>x to a name that differs from tb\udcffx by more than case, its commits staying on it: `git -C spec branch -m "$(printf -- 'TB\377x')" "$(printf -- 'TB\377x-kept')"`, and run bootstrap again.

HEAD stays on TB<ff>x, and no tb<ff>x is made.

No exit code changes. Every run exits 0 on both sides, with no traceback.

More answers change, by the same decision. Each is held by rows in every locale (Rows):

  • CAF<c3 89> for caf\udcc3\udca9, U+00E9 in capitals too: cb9ed806 said created in all three locales, ASCII included; the head gives the twin lines in all three (r1308a's F4).
  • tb<e4>x for tb\udcc4x, and TB<c4>x for tb\udce4x: cb9ed806 said created in all three locales; the head gives the twin lines in all three. git for Windows names the files tb U+00E4 x and tb U+00C4 x on NTFS, which folds case. The 0xC4/0xE4 row was a CONTROL, no twin in any locale; it is a twin row now, renamed test_the_bytes_0xc4_and_0xe4_are_twins_in_every_locale.
  • TB84X and tb84x for tb<84>x: created at cb9ed806, twins at the head. git for Windows writes a byte 0x80 to 0x9F that is not UTF-8 as two hex digits, so tb<84>x is the file tb84x there.
  • Under Latin-1, tb<c4>x for tracking_branch: "tb U+00E4 x" (U+00E4 itself, which Latin-1 hands to git as tb<e4>x): cb9ed806 called it a twin by its text compare, and the head does again, now by git for Windows' reading. 0ac4efbc made the branch beside it. Under UTF-8 the same name's twin, tb<c3 84>x, is found on every side. The DECIDED row holds both, renamed test_a_latin1_capital_is_a_twin_in_every_locale.
  • fast_forward_to_pin, the branch behind the pin and HEAD on its twin (move, bootstrap.py: on a disk that folds case, a leg on Main whose tracking branch main is behind the pin is moved under its own HEAD, and bootstrap says it is on main now over an index that undoes the pin #896's own harm): where cb9ed806 missed the twin it fast-forwarded the branch and checked it out, the leg leaving the twin, which a disk that folds case reads as that very ref. The head says tip ... is behind the PIN ..., and the checkout is on <twin>, which differs from <branch> only in case, and gives the switch (r1308a's F4).
  • The -kept name. Beside a branch caf<c3 89>-kept, the rename of CAF<c3 a9> is to CAF<c3 a9>-kept-2 in every locale. At 0ac4efbc, Latin-1 and ASCII printed -kept, a name a disk that folds case reads as that branch (r1308a's F2).

Unchanged:

Lane 1 re-decided #1306 on r1308a's F1, in issuecomment-6769183561. Its first confirmation, in this body, rested on "a disk that folds case reads a name as UTF-8", which is false for git for Windows: its xutftowcsn turns a byte 0xA0 to 0xFF that is not UTF-8 into that Latin-1 character. So on NTFS tb<c4>x and tb<e4>x are one file, and the cb9ed806 answer for them, a twin, was the right one. Lane 1 took r1308a's option (A), below.

Why

Lane 1's decision: a pair is a case twin when its bytes differ, and EITHER of two readings folds the two names alike under _fold (NFC, then casefold()), whatever the locale:

  1. git's bytes decoded as UTF-8 with surrogateescape, as 0ac4efbc did. That is the name APFS holds, which takes UTF-8 alone, and the name of every UTF-8 name on NTFS.
  2. git's bytes as git for Windows names the file on NTFS, exactly as xutftowcsn converts them (compat/mingw.c, called through xutftowcs_path and xutftowcs_long_path in compat/mingw.h for every path git opens or makes there, a loose ref's file among them):
    • valid UTF-8 as itself;
    • a byte 0xA0 to 0xFF that is not UTF-8 as U+00A0 to U+00FF;
    • a byte 0x80 to 0x9F that is not UTF-8 as two hex digits, in small letters, as the code writes them.

The UnicodeEncodeError fallback stays as it was.

The reason. The twin lines name the disks that fold case, "macOS, Windows". Whether two names are one file there is a question about git's bytes and how each such disk names them, not about how this locale reads them. So the answer is one in every locale, and w1283a's objection, which was about Latin-1 alone calling 0xC4 and 0xE4 twins, does not return: they are twins in every locale now, for a named disk. Under the decision:

The change, function by function (bootstrap.py, blob 8e0f76c7 to 2c470451):

function change why
_as_git_for_windows_names and _continues (new) git's bytes as xutftowcsn converts them, one UTF-16 unit for each unit it writes: a 4-byte form as a surrogate pair, the 3-byte form of a surrogate as that unit, an overlong or cut form byte by byte. The units are read back as Python reads a wide file name. The docstring cites xutftowcsn, xutftowcs_path and xutftowcs_long_path the second reading, followed step for step. r1308a's option_a.py codec handler gives the same text for every name but the 67 of 265,280 that hold the 3-byte form of a surrogate (Measured)
_as_a_folding_disk_reads (new) each name to _handed_to_git's bytes, then both readings, each a tuple of the names. Where _handed_to_git raises UnicodeEncodeError for any of them, one reading: the names' text the decision. The fallback is _branch_ref's (#1300's F2): no traceback, and the compare is cb9ed806's for that name
_folded_twin the bytes differ (the first reading, which is one to one) and either reading folds the pair alike the decision. Its signature stays: every caller, and the #896 and #962 helper rows, hand it text as before
_twin_words only in case where either reading folds the pair under casefold() alone without it, a twin found under Latin-1 (TB U+00FF x against tb\udcffx) is said to differ "only in case or Unicode form" (mutant M9 of round 0)
_taken, _kept_name _taken takes the branch names and folds each pair through _as_a_folding_disk_reads, as _folded_twin does, the slash rule (#1000) in each reading r1308a's F2: the rename the line prints is no twin of a branch already there, in any locale
_folded_spelling docstring only _heads reads names by _try_git's rule (#710), which _handed_to_git undoes on every system, so _folded_twin's own re-encoding already gives git's bytes for each name. The name it returns stays _heads' text, so _say_spelling prints git's name and pastes its bytes, as before
_branch_ref docstring only #1306's fifth box, and r1308a's F1: it no longer says a disk that folds case reads a name as UTF-8

What is printed keeps its form.

  • The twin is named as git's name in this locale, as _place_of names any other branch. Under Latin-1 that is TB U+00FF x, CAF U+00C3 U+00A9 and tb U+00E4 x; under UTF-8, TB\udcffx, CAF U+00E9 and tb\udce4x; under ASCII, TB\udcffx, CAF\udcc3\udca9 and tb\udce4x.
  • The tracking branch is printed as the manifest spells it.
  • Each paste word is the twin's bytes: "$(printf -- 'TB\377x')", "$(printf -- 'CAF\303\251')" and "$(printf -- 'tb\344x')", or, under UTF-8, 'CAF U+00E9 ', which the child prints as those bytes. The rows run every rename and switch word through /bin/sh in every locale and assert the bytes it hands git.

Windows, read and emulated, not run:

Rejected:

Measured

Python 3.12.3 and git 2.43.0 on Linux, in lane 1's probe environment: a stub gh first on PATH, GIT_CONFIG_GLOBAL=/dev/null and GIT_SSH_COMMAND=false.

  • Latin-1 is built as tests/test_adopt_one_byte_locale.py builds it: localedef -c, then LOCPATH, LC_ALL=en_US.ISO-8859-1 and PYTHONUTF8=0. The child reports iso8859-1.
  • UTF-8 is LC_ALL=C.UTF-8.
  • ASCII is LC_ALL=C PYTHONUTF8=0 PYTHONCOERCECLOCALE=0, and the child reports ascii.

In process. r1300a's twin.py hands _folded_twin HEAD's ref as os.fsdecode reads it, in a child under each locale. At cb9ed806 (blob 8e0f76c7):

utf-8: b'tb\xffx' vs 'tb\udcffx' twin=False; b'TB\xffx' vs 'tb\udcffx' twin=True; b'caf\xc3\xa9' vs 'caf\udcc3\udca9' twin=False; b'CAF\xc3\xa9' vs 'caf\udcc3\udca9' twin=False; b'Main' vs 'main' twin=True;
iso8859-1: b'tb\xffx' vs 'tb\udcffx' twin=False; b'TB\xffx' vs 'tb\udcffx' twin=False; b'caf\xc3\xa9' vs 'caf\udcc3\udca9' twin=False; b'CAF\xc3\xa9' vs 'caf\udcc3\udca9' twin=False; b'Main' vs 'main' twin=True;
ascii: b'tb\xffx' vs 'tb\udcffx' twin=False; b'TB\xffx' vs 'tb\udcffx' twin=True; b'caf\xc3\xa9' vs 'caf\udcc3\udca9' twin=False; b'CAF\xc3\xa9' vs 'caf\udcc3\udca9' twin=True; b'Main' vs 'main' twin=True;

At the head (blob 2c470451) the three lines are the same but for the codec's name:

utf-8: b'tb\xffx' vs 'tb\udcffx' twin=False; b'TB\xffx' vs 'tb\udcffx' twin=True; b'caf\xc3\xa9' vs 'caf\udcc3\udca9' twin=False; b'CAF\xc3\xa9' vs 'caf\udcc3\udca9' twin=True; b'Main' vs 'main' twin=True;

w1300r's fold_c4.py gives _folded_twin(HEAD on tb<e4>x, branch tb\udcc4x): False in all three locales at cb9ed806 and at 0ac4efbc, and True in all three at the head.

w1308r's check1.py asks the head's _folded_twin of 15 pairs in each locale. All 15 answers are the same in UTF-8 and Latin-1; under ASCII the two with tracking_branch: "tb U+00E4 x" say no twin, a name _argument_fault refuses there before step (a) reaches this:

utf-8: twin: b'TB\xffx'~'tb\udcffx'=True; b'tb\xffx'~'tb\udcffx'=False; b'CAF\xc3\xa9'~'caf\udcc3\udca9'=True; b'caf\xc3\xa9'~'caf\udcc3\udca9'=False; b'CAF\xc3\x89'~'caf\udcc3\udca9'=True; b'tb\xe4x'~'tb\udcc4x'=True; b'TB\xc4x'~'tb\udce4x'=True; b'tb\xc4x'~'tb\xe4x'=True; b'tb\xc3\x84x'~'tb\xe4x'=True; b'TBx'~'tb\udcffx'=False; b'TB\xc4x'~'tb\udcffx'=False; b'TB84X'~'tb\udc84x'=True; b'tb84x'~'tb\udc84x'=True; b'tb\x84x'~'tb\udc84x'=False; b'Main'~'main'=True

It also gives _kept_name for CAF<c3 a9> as CAF<c3 a9>-kept-2 beside caf<c3 89>-kept, beside CAFE<cc 81>-kept and beside caf<c3 89>-kept/x, in every locale. Folded as this locale reads the names back, tb<e4>x for tb\udcc4x is a twin under Latin-1 alone, and CAF<c3 89> under UTF-8 alone.

The second reading against git's code. gfw_cmp.py (w1308r's) checks _as_git_for_windows_names against a table of 26 names read from xutftowcsn, and against r1308a's codec handler over every name of one and two bytes and 200,000 random ones:

table: 26 of 26 as read from xutftowcsn; wrong: []
codec approximation: 265213 of 265280 names equal; 67 differ, 0 of them without an encoded surrogate

The row's table holds the probe's. XUTFTOWCSN in the rows file is parsed with ast, as is gfw_cmp.py's TABLE. At 166d843dc56e the row's table held 24 names, and two of the probe's were not in it, <c1 bf> and CAF<c3 89>; r1308b found that two mutants of the second reading, R3 and R7, then passed every row (Mutants). At 4682320a980c the row's table holds 29 names:

row table 29 probe table 26
in probe, not row: []
in row, not probe: [b'\xc1\x81', b'\xf5\x80\x80\x80', b'\xf7\xbf\xbf\xbf']
same values where shared: True

Every one of the probe's 26 names is in the row with the same value, and the row adds three: <c1 81>, <f5 80 80 80> and <f7 bf bf bf>. Each of the five new entries (four from r1308b, CAF<c3 89> from lane 1's decision) was checked against r1308b's xcore.py, a line-for-line port of xutftowcsn, before it was written: 5 of 5 equal.

The first reading never decides a twin alone. subsume.py (w1308r's) folds 111,561 random pairs of byte names both ways: both 66153, reading 1 alone 0, reading 2 alone 46. A surrogate escape folds to nothing but itself, and git for Windows writes the same character for the same byte in both names, so a pair the first reading folds alike, the second does too. The first reading is still the byte compare, and the decision's "either" is kept as written. Mutant W3 is equivalent for this reason.

End to end. At 0ac4efbc, w1300r's probe_twin_e2e.py, with its paths changed, built one scaffold's recursive clone. For each case it:

  1. copied the clone and set tracking_branch;
  2. put the spec leg on the twin at the pin, or made the twin a branch at the pin with the leg detached there; the tracking branch is absent;
  3. ran scripts/bootstrap.py --skip-validators once, with PYTHONIOENCODING=utf-8:strict.

Step (a)'s first spec line:

case Latin-1 base Latin-1 head UTF-8 base UTF-8 head ASCII base ASCII head
HEAD on TB<ff>x, tb\udcffx created, then the leg was on TB U+00FF x the checkout is on TB U+00FF x, which differs from tb\udcffx only in case twin twin, the same twin twin, the same
HEAD on CAF<c3 a9>, caf\udcc3\udca9 created, then the leg was on CAF U+00C3 U+00A9 the checkout is on CAF U+00C3 U+00A9 ... only in case created, then the leg was on CAF U+00E9 the checkout is on CAF U+00E9 ... only in case twin twin, the same
detached beside TB<ff>x created the leg has the branch TB U+00FF x ... twin twin, the same twin twin, the same
detached beside CAF<c3 a9> created the leg has the branch CAF U+00C3 U+00A9 ... created the leg has the branch CAF U+00E9 ... twin twin, the same
  • Where base made the branch, HEAD ended on it, beside the twin, and the leg's branches were the twin, main and the new branch. At the head HEAD stays where it was, and the branches are the twin and main.
  • The 6 cells marked "the same" match base line for line, with shas normalized. They also match in HEAD's ref and in the leg's branches.
  • The code leg says created in every run. Every run exits 0.
  • At 166d843dc56e the probe was not run again. The rows hold every head cell byte for byte in each locale, HEAD's ref and the leg's branches included, and they pass at the head (Tests).
  • r1308a re-ran the probe on the review (logs/e2e-u8.log, logs/e2e-move.log) and measured the CAF<c3 89>, TB<c4>x and move cases this round's rows now hold.

Rows

tests/test_bootstrap_branch_one_byte_locale.py, #1300's file: 71 new rows, 102 in all. Each e2e row runs bootstrap.py in a child under the locale it names, as the file's other rows do. Each asserts:

  • step (a)'s whole block;
  • HEAD's ref by its bytes, and its commit;
  • for the twin rows, what /bin/sh hands git from the printed command, and, where HEAD is on the twin or detached beside it, the leg's branches by their bytes.

Every setup git command names a branch by its bytes (os.fsdecode), so the rows hold under any pytest locale.

Base is cb9ed806's bootstrap.py (blob 8e0f76c7) laid into a scratch clone at 166d843dc56e; 0ac4efbc's (blob c89f00ad) is the first round. After each set of runs the clone's file was written back from HEAD's blob:

after cb9ed806's blob: laid HEAD:templates/assembly-root/scripts/bootstrap.py: file 2c4704514cf593060b66f2df802b27feae41600d HEAD 2c4704514cf593060b66f2df802b27feae41600d equal=True; status: (clean)
after 0ac4efbc's blob: laid HEAD:templates/assembly-root/scripts/bootstrap.py: file 2c4704514cf593060b66f2df802b27feae41600d HEAD 2c4704514cf593060b66f2df802b27feae41600d equal=True; status: (clean)

Each pytest ran the whole rows file once under each locale, UTF-8, Latin-1 and ASCII. Every row runs its child under the locale its id names, so each pytest locale ran every id, and each pytest failed the same rows:

bootstrap.py UTF-8 pytest Latin-1 pytest ASCII pytest
cb9ed806 (8e0f76c7), the base 40 failed, 62 passed 40 failed, 62 passed 40 failed, 62 passed
0ac4efbc (c89f00ad), round 0 16 failed, 86 passed 16 failed, 86 passed 16 failed, 86 passed
4682320a980c (d3bedd42), the head, and 166d843dc56e (2c470451) 102 passed 102 passed 102 passed

The rows, by what each base did (a row named by a test and the ids that fail):

row ids cb9ed806 0ac4efbc head
test_a_leg_on_a_case_twin_of_the_branch_is_left_in_every_locale (HEAD on the twin) byte-0xff-latin1, utf-8-bytes-as-surrogates-latin1 and -utf-8, utf-8-capital-* x3 6 fail pass pass
test_a_leg_detached_beside_a_case_twin_is_left_in_every_locale (_folded_spelling) the same 6 6 fail pass pass
test_a_leg_on_a_case_twin_of_the_branch_at_the_pin_is_left (place_at_pin) the same 6 6 fail pass pass
test_a_leg_on_a_case_twin_of_a_branch_behind_the_pin_is_left (fast_forward_to_pin, F4) the same 6 6 fail pass pass
test_the_bytes_0xc4_and_0xe4_are_twins_in_every_locale x3 3 fail 3 fail pass
test_a_latin1_capital_is_a_twin_in_every_locale (DECIDED) latin1 pass 1 fails pass
test_a_pair_is_a_twin_where_either_reading_folds_it_alike (F3) TB-c4-for-tb-e4 x3, TB84X-for-tb-84 x3, tb84x-for-tb-84 x3 9 fail 9 fail pass
the same, CONTROLS CONTROL-TBx-for-tb-ff x3, CONTROL-TB-c4-for-tb-ff x3 pass pass pass
test_the_rename_is_to_no_twin_of_a_branch_there_in_every_locale (F2) x3 3 fail 2 fail (latin1, ascii) pass
test_git_for_windows_names_each_file_as_xutftowcsn_does one row, in process fails (AttributeError: no _as_git_for_windows_names) fails, the same pass
  • Every other row passes on all three sides, the CONTROLS among them: HEAD on the branch itself (test_a_leg_on_the_branch_itself_has_no_twin_in_any_locale), Main for main, NFD for NFC under UTF-8, the twin rows' ids that each base found, and the legacy-mode and in-process rows (test_a_name_git_cannot_be_handed_is_compared_as_its_text, test_a_twin_git_cannot_be_handed_is_folded_as_its_text).
  • From 0ac4efbc the head changes 16 rows: the 0xC4/0xE4 row and the DECIDED row (F1), the nine pair rows that only git for Windows' reading finds (F1, F3), the -kept row under Latin-1 and ASCII (F2), and the xutftowcsn table.
  • 166d843dc56e adds three rows (tb84x-for-tb-84, one per child locale), which fail on both bases: neither has git for Windows' reading, so each says created for HEAD on tb84x with tb\udc84x. On 248669b1's 99 rows the bases failed 37 and 13.

Review round 1 (r1308a)

r1308a reviewed 0ac4efbc in issuecomment-6769157686: NOT READY, for F1 (MUST); F2 and F3 were SHOULDs, F4 to F6 NITs. Lane 1 re-decided #1306 on F1 in issuecomment-6769183561, and this round, by w1308r and then w1308s, applies that decision and answers the rest.

  • F1 (MUST), the disk model. "A disk that folds case reads a name as UTF-8" is false for git for Windows, and the DECIDED answer rested on it. Lane 1 took option (A): the second reading, _as_git_for_windows_names. Every docstring that stated the old model is corrected: _branch_ref, _folded_twin and _as_a_folding_disk_reads in bootstrap.py, and the rows file's module docstring and DECIDED row. The DECIDED row expects cb9ed806's answer, a twin, again, and is renamed; the 0xC4/0xE4 row is a twin row now, and is renamed. This body's reason and confirmation sentence are replaced (What, Why).
  • F2 (SHOULD), _kept_name and _taken. They fold each pair through _as_a_folding_disk_reads, as _folded_twin does. The new row test_the_rename_is_to_no_twin_of_a_branch_there_in_every_locale fails at 0ac4efbc under Latin-1 and ASCII (-kept), and passes at the head in all three.
  • F3 (SHOULD), N1 and N2. The asked rows are in test_a_pair_is_a_twin_where_either_reading_folds_it_alike: HEAD on TB<c4>x for tb\udce4x, now a twin in every locale, and on TBx for tb\udcffx, no twin. Under the decision the first cannot kill N1 or N2: "replace" and "ignore" call the pair a twin too, and so does the head. The second kills N2 alone. So the row also holds TB<c4>x for tb\udcffx, no twin, which both kill; the 0xC4/0xE4 row and the DECIDED row kill both as well (Mutants).
  • F4 (NIT), two changes not named. CAF<c3 89> is a TWIN_ROWS id (utf-8-capital) in all four twin rows, and test_a_leg_on_a_case_twin_of_a_branch_behind_the_pin_is_left holds fast_forward_to_pin's twin over every TWIN_ROWS id. Both are named in What. "Every ASCII case" is now "every pair of names that are both ASCII".
  • F5 (NIT). The short line is rewrapped.
  • F6 (NIT). The main line names main as it now is, f2a6527e9, and its merge-tree.

Review round 2 (r1308b)

r1308b reviewed 0ac4efbc..166d843dc56e in issuecomment-6774235356: NOT READY, for one SHOULD (S1), with three NITs (N1, N2, N3). The code applies lane 1's decision: r1308b compared _as_git_for_windows_names with a line-for-line Python port of git's xutftowcsn over 10,736,480 names, and none differed. This round, by w1308t, answers the four findings and changes no code of bootstrap.py:

  • S1 (SHOULD), no row checks the 0xC1 lead or the 0xF5 to 0xF7 leads. XUTFTOWCSN gains <c1 bf>, <c1 81>, <f5 80 80 80> and <f7 bf bf bf>, with the values r1308b gave, and CAF<c3 89>, so the row's table holds every name of the probe's table (Measured, "The row's table holds the probe's"). Mutants R3 and R7, which passed every row, now fail the row (Mutants). The sentence "the same table is a row" is replaced by what the row holds.
  • N1 (NIT), "git refuses a longer path there". The docstring of _as_git_for_windows_names names xutftowcs_long_path beside xutftowcs_path, in both places r1308b named, and says git refuses a longer path there, or, at the buffer's last unit, drops a hex pair's second digit. Docstrings only: ast.dump of bootstrap.py without docstrings is equal to 166d843dc56e's. Known limits and Why say the same.
  • N2 (NIT), main has moved. The main line names dc9a0bcc7 and its merge-tree, clean (tree 0cfc476e6ecf62fd4bbe1da0f784cf69a991c17b).
  • N3 (NIT), the PAIRS comment. It says "ignore" folds both pairs and "replace" the second, as the F3 paragraph above has it.

Mutants

10 killed of 11; the one survivor, W3, is equivalent. R3 and R7 are r1308b's (round 2): they survived every row at 166d843dc56e and are killed at 4682320a980c. Each mutant ran alone in a scratch clone, by exact replacement in bootstrap.py, in one UTF-8 pytest over the rows file, tests/test_bootstrap_casefold_twin.py, tests/test_bootstrap_create_twins.py and row 13 (test_a_branch_name_is_spelled_in_every_line_that_names_it): 176 tests at 248669b1, 179 at 166d843dc56e. After each one the clone's file was written back from HEAD's blob and read file 2c4704514cf5... HEAD 2c4704514cf5... equal=True; status: (clean).

id mutant at result rows that failed
W1 reading 2 dropped: UTF-8 with surrogateescape alone 248669b1 KILLED, 10 failed, 166 passed 0xC4/0xE4 x3; TB-c4-for-tb-e4 x3; TB84X-for-tb-84 x3; the latin1 capital (DECIDED) row
W2 reading 1 dropped: _as_a_folding_disk_reads gives git for Windows' reading alone 166d843dc56e KILLED, 3 failed, 176 passed tb84x-for-tb-84 x3
W3 reading 1 dropped from the fold alone, the byte compare kept 248669b1 survived, 176 passed: equivalent none: no pair the first reading folds alike escapes the second (subsume.py, Measured)
W4 "either" made "both" (all for any) 248669b1 KILLED, 10 failed, 166 passed the same 10 as W1
W5 a byte 0xA0 to 0xFF that is not UTF-8 written as hex 248669b1 KILLED, 8 failed, 168 passed 0xC4/0xE4 x3; TB-c4-for-tb-e4 x3; the latin1 capital row; test_git_for_windows_names_each_file_as_xutftowcsn_does
W6 a byte 0x80 to 0x9F that is not UTF-8 written 1:1 248669b1 KILLED, 4 failed, 172 passed TB84X-for-tb-84 x3; the xutftowcsn table row
W7 _taken and _kept_name on the locale's text, as at 0ac4efbc 166d843dc56e KILLED, 2 failed, 177 passed test_the_rename_is_to_no_twin_of_a_branch_there_in_every_locale[latin1] and [ascii]
N1 r1308a's N1: the first reading decoded with "replace" 166d843dc56e KILLED, 7 failed, 172 passed 0xC4/0xE4 x3; CONTROL-TB-c4-for-tb-ff x3; the latin1 capital row
N2 r1308a's N2: the first reading decoded with "ignore" 166d843dc56e KILLED, 10 failed, 169 passed 0xC4/0xE4 x3; CONTROL-TBx-for-tb-ff x3; CONTROL-TB-c4-for-tb-ff x3; the latin1 capital row
R3 r1308b's: 0xC1 <= lead < 0xE0 for the 2-byte form, so 0xC1 alone is taken as a lead (elif 0xC2 <= lead < 0xE0 and _continues(raw, at, 1):) 166d843dc56e survived there, 179 passed (r1308b). At 4682320a980c: KILLED, 1 failed in 0.23s the xutftowcsn row: <c1 bf> gave U+007F (not U+00C1 U+00BF) and <c1 81> gave A (not U+00C1 81)
R7 r1308b's: 0xF0 <= lead < 0xF8 for the 4-byte form, so 0xF5 to 0xF7 are taken as leads (elif (0xF0 <= lead < 0xF5 and _continues(raw, at, 3)) 166d843dc56e survived there, 179 passed (r1308b). At 4682320a980c: KILLED, 1 failed in 0.27s the xutftowcsn row: <f5 80 80 80> gave two lone surrogates and <f7 bf bf bf> gave \udfbf\udfff
  • W2 survived at 248669b1 (176 passed), and 166d843dc56e's row kills it. git for Windows' reading is not one to one: it writes the byte 0x84 as 84, so it holds tb84x and tb<84>x as one name. W2's byte compare, made on that reading, then calls the pair equal and no twin; the head compares the first reading, where they differ, and finds the twin.
  • N1 and N2 survived every row at 0ac4efbc (r1308a's F3). The pair rows and the 0xC4/0xE4 row now kill both.
  • R3 and R7 survived at 166d843dc56e because the row's table held no <c1 ...> name and its only lead from 0xF5 up was <f5 80>, cut short, which never reaches the 4-byte test (r1308b's S1). Each changes behaviour: under R3 tb<c1 81>x is a twin of tbax, though git for Windows names that file tb U+00C1 81x. 4682320a980c adds <c1 bf>, <c1 81>, <f5 80 80 80> and <f7 bf bf bf> to the row's table.
  • How R3 and R7 ran at 4682320a980c: by exact replacement (the old text occurs once) in w1308r's scratch clone, re-pointed to that head and checked clean, under UTF-8, against the xutftowcsn row alone, not the 179-test set. After each, the clone's file was written back from HEAD's blob: restored: file d3bedd42bfb400886170b389b0be26041a92be19 HEAD d3bedd42bfb400886170b389b0be26041a92be19 equal=True; status: (clean). The row passes on the clean clone: 1 passed in 0.32s.
  • Round 0's mutants (w1306a's M1 to M12) were not run again.

Tests

Python 3.12.3 on Linux, in the probe environment, one pytest call at a time, each -p no:cacheprovider -o tmp_path_retention_policy=failed with a basetemp in scratch. UTF-8, Latin-1 and ASCII name the pytest's own locale, as in Measured.

At the head, 4682320a980c (bootstrap.py d3bedd42, rows file ccad672d), and at 166d843dc56e (2c470451, 269a0d16):

run UTF-8 Latin-1 ASCII
the rows file at 4682320a980c (on the tree committed, the same two blobs) 102 passed in 46.43s 102 passed in 45.39s 102 passed in 46.62s
the rows file at 166d843dc56e (on the tree committed, the same two blobs) 102 passed in 47.54s 102 passed in 52.47s 102 passed in 55.50s
row 13, tests/test_bootstrap_spelling.py::test_a_branch_name_is_spelled_in_every_line_that_names_it, at 166d843dc56e 1 passed in 3.19s 1 passed in 2.87s 1 passed in 3.13s
at 166d843dc56e, every tests/test_bootstrap_*.py, 14 files listed into a file, then split into three lists of 7, 4 and 3, each checked non-empty and passed with xargs -d '\n' -a <list>, one call each 346 passed in 249.43s; 148 passed, 3 skipped in 35.20s; 251 passed in 86.16s
at 166d843dc56e, tests/test_pinned_copy_text.py tests/test_path_guard_hygiene.py tests/test_no_auto_maintenance.py 266 passed, 2 skipped in 44.61s

4682320a980c changes two docstrings, a comment and five entries of the xutftowcsn table, and nothing else: ast.dump of bootstrap.py without docstrings is equal at the two heads, and with docstrings it is not (ast_nodoc.py: 176566 characters each without, 255840 and 255984 with). So the runs in this table that are labelled 166d843dc56e were not run again at 4682320a980c; the rows file was, in each locale.

The 3 skips are tests/test_bootstrap_ref_store.py:102: this git makes no reftable repository (git 2.45 and later do). The 2 gate skips are tests/test_no_auto_maintenance.py:222, "the session began with GIT_CONFIG_GLOBAL set, and its file includes that one": the probe environment sets GIT_CONFIG_GLOBAL (Measured). The 14 files hold 748 tests: 346, 151 and 251 in the three calls.

The bases, laid into a scratch clone at 166d843dc56e (Rows): cb9ed806's 8e0f76c7, 40 failed, 62 passed in each of UTF-8 (60.23s), Latin-1 (58.31s) and ASCII (55.52s); 0ac4efbc's c89f00ad, 16 failed, 86 passed in each (56.62s, 73.63s, 62.95s).

The mutants, UTF-8, one call each (Mutants): at 166d843dc56e, W7 2 failed, 177 passed, N1 7 failed, 172 passed, N2 10 failed, 169 passed, W2 3 failed, 176 passed; at 248669b1, W1 10 failed, 166 passed, W2 176 passed, W3 176 passed, W4 10 failed, 166 passed, W5 8 failed, 168 passed, W6 4 failed, 172 passed; R3 and R7, r1308b's, at 166d843dc56e 179 passed each (r1308b: 79.56s and 86.22s), and at 4682320a980c, on the xutftowcsn row alone, 1 failed in 0.23s and 1 failed in 0.27s.

Earlier in this round, on the trees committed as 3beceb51 and 248669b1 (their blobs, before each commit): the rows file 65 passed, then 99 passed, under each locale; at 3beceb51, the two twin files and row 13, 77 passed.

The legacy emulation, w1306a's legacy_twin.py unchanged, on the head's bootstrap.py (blob 2c470451). No name _argument_fault passes raises in the twin path, emulated or on POSIX:

legacy emulation: names passed by _argument_fault: 166793 (the 8 named ones first), refused: 967327; _handed_to_git raised on a passed name (folded as text): 10727; raised in the twin path: 0
posix utf-8: names passed by _argument_fault: 164873 (the 8 named ones first), refused: 969247; _handed_to_git raised on a passed name (folded as text): 0; raised in the twin path: 0
posix iso8859-1: names passed by _argument_fault: 2471 (the 7 named ones first), refused: 1131649; _handed_to_git raised on a passed name (folded as text): 0; raised in the twin path: 0
posix ascii: names passed by _argument_fault: 1409 (the 5 named ones first), refused: 1132711; _handed_to_git raised on a passed name (folded as text): 0; raised in the twin path: 0

Under the emulation, tb\udcffx, caf\udcc3\udca9 and caf U+00E9 each find their twin in another case (_folded_twin True), are no twin of themselves, and are said to differ only in case.

Known limits

  • Windows was not run. The second reading is read from compat/mingw.c and compat/mingw.h on git's master, fetched 2026-11-10. Older git for Windows releases were not read, and no NTFS volume was used. The bound of the buffer xutftowcs_path and xutftowcs_long_path write to, MAX_PATH units for the first, is not followed: git refuses a longer path there, or, at the buffer's last unit, drops a hex pair's second digit (r1308b's N1: a port of xutftowcsn given a 260-unit buffer and a 259-byte name ending in the byte 0x84 writes the first digit and drops the second, and succeeds). r1308b also read git for Windows' main: mingw_open, mingw_rename, mingw_unlink and mingw_lstat call xutftowcs_long_path, and mingw_mkdir calls xutftowcs_path_ex; both wrappers call xutftowcsn with a 4096-unit buffer, and that xutftowcsn is the one of master byte for byte, so the second reading holds.
  • Linux mounts with an iocharset were not tried (vfat, exFAT or CIFS with iocharset=iso8859-1, which r1308a read as folding Latin-1 names too), nor Linux's case-folding directories, nor macOS (APFS, HFS+, core.precomposeunicode).
  • _fold folds the second reading too, and it is not NTFS's fold. NTFS folds case by its own table and folds no Unicode form. So cafe<cc 81> (NFD UTF-8) and caf<e9> (Latin-1's byte) are called twins, "only in case or Unicode form", though NTFS holds two files there and APFS refuses the second name; STRASSE and stra U+00DF e were already twins by casefold() (bootstrap.py: on a disk that folds case, a leg on Main whose tracking branch main is behind the pin is moved under its own HEAD, and bootstrap says it is on main now over an index that undoes the pin #896). Each such answer leaves the leg and prints a rename; none makes a branch. Measured in process (limits.py), not end to end.
  • A pair git for Windows names alike before any fold is said to differ "only in case". tb<c4>x and tb<c3 84>x, or tb<84>x and tb84x, are one name there, and the first line says they differ only in case; the second line, that a disk that folds case reads them as one branch, holds.
  • The twin is printed as git's name in this locale. Under Latin-1 one line names TB U+00FF x beside tb\udcffx, as the moved-back line names its upstream (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's audit row 9). The paste words are the bytes in every locale.
  • _kept_name still cannot see a reflog directory left under a name, or a name too long for the file system, as its docstring says.
  • Windows' legacy mode was emulated on Linux. On Windows _folded_twin answers as cb9ed806 did. Under the legacy mode _head_of reads git's UTF-8 through the code page, so a non-ASCII twin HEAD is on is missed there, as on cb9ed806.
  • CPython 3.14 and other one-byte codecs were not run. The change has no is_file, exists or is_dir guard.
  • No doc or --help changes, so the doc trio was not run. tests/test_shape_doctor.py was not run: this PR does not touch adopt-project.py.

Lane: openreposhape-1 (openRepoShape-1)

🤖 Generated with Claude Code

Brett Heap and others added 2 commits November 10, 2026 12:43
…racking branch as git's bytes read as UTF-8, whatever the locale, so a case twin of a name that is not UTF-8 is found in every locale and step (a) no longer makes the branch beside it (#1306)

`_folded_twin` folded HEAD's ref, as `_head_of` decodes it, with the
manifest's text. Where the locale read a twin's bytes as other text than
the manifest's surrogate escapes, the twin was missed and step (a) made the
branch beside it and said `created`: `TB<ff>x` for `tb\udcffx` under
Latin-1, and `CAF<c3 a9>` for `caf\udcc3\udca9` under UTF-8 and Latin-1,
with HEAD on the twin, detached beside it (`_folded_spelling`), or on it
beside the branch at the pin.

Lane 1's decision, the issue's second way out: both names are turned into
the bytes git is handed for them (`_handed_to_git`) and decoded by one
codec, UTF-8 with `surrogateescape`, in `_as_a_folding_disk_reads`. A disk
that folds case reads a ref's file name as Unicode from UTF-8, so a twin is
a question about those bytes, not about the locale. A surrogate escape
folds to nothing but itself, so `tb<e4>x` stays no twin of `tb\udcc4x`.

- `_folded_twin` and `_twin_words` fold the names so read; `_twin_words`
  must, or a twin found under Latin-1 is said to differ "in case or
  Unicode form".
- `_folded_spelling` is unchanged in code: `_heads` reads by `_try_git`'s
  rule, which `_handed_to_git` undoes on every system.
- A name `_handed_to_git` raises `UnicodeEncodeError` on (a lone surrogate
  on Windows under `PYTHONLEGACYWINDOWSFSENCODING=1`) is folded as its
  text, as before: no traceback.
- `_branch_ref`'s docstring no longer names `_folded_twin` as the check that
  still compares text.

Rows in tests/test_bootstrap_branch_one_byte_locale.py, each in a child under
the locale it names: HEAD on the twin, detached beside it and on it beside
the branch at the pin, for both names in Latin-1, UTF-8 and ASCII; controls
for the branch itself, the bytes 0xC4 and 0xE4, #896's `Main` and #962's
NFD; U+00E4 itself under Latin-1; and the twin path under the emulated
Windows legacy mode.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
… 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]>
@brettheap brettheap added this to the v1.2.2 milestone Nov 10, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Compare branch names using both UTF-8-with-surrogateescape and git for Windows’ filename conversion, and apply the same readings when describing twins and choosing a safe rename.

  • templates/assembly-root/scripts/bootstrap.py L1120-1212, L1232-1276, L1399-1415 (+6 small edits)

Tests

Add locale and byte-level regression coverage for twin detection, safe renaming, Windows filename conversion, and the legacy Windows fallback.

  • tests/test_bootstrap_branch_one_byte_locale.py L37-51, L464-956, L997-1060 (+2 small edits)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@brettheap

Copy link
Copy Markdown
Contributor Author

Review of #1308 (#1306) for lane openRepoShape-1, by r1308a (opus), at 0ac4efb: NOT READY

The code does what the body says, and every table, sha and count I re-measured matches. Python 3.12.3 and git 2.43.0 on Linux, in the probe environment (stub gh, GH_TOKEN=bogus-r1308a, empty GH_CONFIG_DIR, GIT_CONFIG_GLOBAL=/dev/null, GIT_SSH_COMMAND=false, env -u LANES_LANE). Latin-1 is w1283a's localedef build, and the child reports iso8859-1.

It is NOT READY for one reason: the decision's stated reason is false for Windows, which the twin lines name. Lane 1 confirmed the DECIDED answer on that reason (F1). Two SHOULDs and three NITs follow.

Findings

F1 MUST: "a disk that folds case reads a name as UTF-8" is false for git for Windows, and the DECIDED answer rests on it

  • Where:

    • templates/assembly-root/scripts/bootstrap.py:1164-1167: "A disk that folds case (APFS, NTFS) reads a ref's file name as Unicode from UTF-8".
    • bootstrap.py:1175-1177: "no disk that folds case reads two names that are not UTF-8 as one file (APFS refuses such a name)".
    • bootstrap.py:879-882, in _branch_ref's docstring.
    • tests/test_bootstrap_branch_one_byte_locale.py:44 and :753-755, the DECIDED row's docstring: "which no disk that folds case reads as one file".
    • The body: "They are not UTF-8, and a disk that folds case reads a name as UTF-8", "So the Latin-1 bytes tb<c4>x and tb<e4>x cannot be one file there", and "The reason."
  • Evidence. Read from git's source; Windows was not run. A loose ref's file is opened through mingw_open, which calls xutftowcs_path.

    • WebFetch https://raw.githubusercontent.com/git/git/master/compat/mingw.h:
      static inline int xutftowcs_path(wchar_t *wcs, const char *utf)
      {
      	int result = xutftowcsn(wcs, utf, MAX_PATH, -1);
      
      and the doc comment of xutftowcsn: "To support repositories with legacy-encoded file names, invalid UTF-8 bytes 0xa0 - 0xff are converted to corresponding printable Unicode chars \u00a0 - \u00ff, and invalid UTF-8 bytes 0x80 - 0x9f (which would make non-printable Unicode) are converted to hex-code."
    • WebFetch https://raw.githubusercontent.com/git/git/master/compat/mingw.c:
      } else if (c >= 0xa0) {
      	/* invalid utf-8 byte, printable unicode char: convert 1:1 */
      	wcs[wpos++] = c;
      
    • So on NTFS, which folds case by default (git for Windows sets core.ignorecase), the loose refs refs/heads/tb<c4>x and refs/heads/tb<e4>x are the files tbU+00C4x and tbU+00E4x. That is one file.
    • /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1308a/probe/option_a.py computes git for Windows' reading beside the PR's:
      b'tb\xe4x' / b'tb\xc4x': PR twin=False; option A twin=True; git for Windows names 'tb\xe4x' / 'tb\xc4x'
      b'tb\xc4x' / b'tb\xc3\xa4x': PR twin=False; option A twin=True; git for Windows names 'tb\xc4x' / 'tb\xe4x'
      b'tb\xc4x' / b'tb\xc3\x84x': PR twin=False; option A twin=True; git for Windows names 'tb\xc4x' / 'tb\xc4x'
      b'TB\xffx' / b'tb\xffx': PR twin=True; option A twin=True; ...
      b'CAF\xc3\xa9' / b'caf\xc3\xa9': PR twin=True; option A twin=True; ...
      
      The third pair has the same file name on Windows even with no case folding.
    • End to end (/workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1308a/probe/e2e.py, log logs/e2e-u8.log), with tracking_branch: "tb\xe4x" and HEAD on tb<c4>x:
      base-latin1-dec-on  TWIN(on; only in case)  after HEAD b'refs/heads/tb\xc4x'; branches [b'main', b'tb\xc4x']
      head-latin1-dec-on  CREATED                 after HEAD b'refs/heads/tb\xe4x'; branches [b'main', b'tb\xc4x', b'tb\xe4x']
      
  • Answering the brief's questions.

  • Fix. Lane 1 re-decides, knowing this. Either:

    • (A) Keep the PR's reading and add git for Windows' reading. A pair is a twin where the bytes differ and either reading folds them alike (option_a.py above). That still gives one answer in every locale, so w1283a's objection, which was about the locale, does not return. It finds both misses, restores base's DECIDED answer, and leans towards a rename rather than bootstrap.py: on a disk that folds case, a leg on Main whose tracking branch main is behind the pin is moved under its own HEAD, and bootstrap says it is on main now over an index that undoes the pin #896's harm. It changes the 0xC4/0xE4 control to a twin in every locale.
    • (B) Keep the decision, and correct the five places above and the Known limits plainly. For example: "git for Windows writes a byte 0xA0 to 0xFF of a name that is not UTF-8 as that Latin-1 letter, so on NTFS tb<c4>x and tb<e4>x are one file; step (a) calls them no twin in any locale, and under Latin-1 now makes tb<e4>x beside tb<c4>x." Lane 1 then confirms that answer again with this fact in hand.

F2 SHOULD: _kept_name/_taken miss more than the body says, under ASCII as well as Latin-1, and the twin path now reaches them under Latin-1

  • Where: bootstrap.py:1353 and :1355 (_kept_name), and :1334-1335 (_taken); the body's Known limits, fourth bullet ("It could miss an NFC/NFD clash ... read as Latin-1").
  • Evidence. probe/inproc.py, with _heads stubbed to CAF<c3 a9>, main and one other branch, at the head (blob c89f00ad):
    utf-8: _kept_name beside [b'caf\xc3\x89-kept']: b'CAF\xc3\xa9-kept-2'; folds (UTF-8) onto an existing branch: []
    iso8859-1: _kept_name beside [b'caf\xc3\x89-kept']: b'CAF\xc3\xa9-kept'; folds (UTF-8) onto an existing branch: [b'caf\xc3\x89-kept']
    iso8859-1: _kept_name beside [b'CAFE\xcc\x81-kept']: b'CAF\xc3\xa9-kept'; folds (UTF-8) onto an existing branch: [b'CAFE\xcc\x81-kept']
    ascii: _kept_name beside [b'caf\xc3\x89-kept']: b'CAF\xc3\xa9-kept'; folds (UTF-8) onto an existing branch: [b'caf\xc3\x89-kept']
    ascii: _kept_name beside [b'CAFE\xcc\x81-kept']: b'CAF\xc3\xa9-kept'; folds (UTF-8) onto an existing branch: [b'CAFE\xcc\x81-kept']
    
  • Effect.
  • Fix. Fold through the PR's own helper (two lines), with a row:
    held = {_fold(name) for name in _as_a_folding_disk_reads(
        *(ref[len("refs/heads/"):] for ref in _heads(sub)))}
    ...
    while _taken(held, _as_a_folding_disk_reads(name)[0]):
    Otherwise, restate the limit as measured and file a follow-up.

F3 SHOULD: no row holds that the decoding is one to one; two mutants survive every twin row

  • Where: bootstrap.py:1131, and the rows file (no pair that differs both in a byte that is not UTF-8 and in ASCII case).
  • Evidence.
    • N1 ("replace" for "surrogateescape"): 141 passed in 77.29s.
    • N2 ("ignore"): 141 passed in 75.82s.
    • probe/survivor.py under UTF-8:
      bootstrap-head.py utf-8 HEAD b'TB\xc4x' for 'tb\udce4x': twin=False; HEAD b'TBx' for 'tb\udcffx': twin=False; ...
      mutant-N1-copy.py utf-8 HEAD b'TB\xc4x' for 'tb\udce4x': twin=True; ...
      mutant-N2-copy.py utf-8 HEAD b'TB\xc4x' for 'tb\udce4x': twin=True; HEAD b'TBx' for 'tb\udcffx': twin=True; ...
      
    • End to end at the head, HEAD on TB<c4>x with "tb\udce4x" gives created in all three locales on both sides (logs/e2e-extra.log).
  • Fix. Add a row with HEAD on TB<c4>x for tb\udce4x in each locale, and one with HEAD on TBx for tb\udcffx. Under the current decision both say created. Under F1's option (A) the first gives the twin lines.

F4 NIT: two measured changes are not in the body or the rows

Neither is a defect; both are right under the decision.

  • CAF<c3 89> (the letter that is not ASCII in capitals) for caf\udcc3\udca9. At base it was created in all three locales; at the head it is a twin in all three. If the body's "Unchanged: every ASCII case" means the ASCII locale, it is false:
    base-ascii-cafE-on: |  [spec] spec: branch caf\udcc3\udca9 created at 59e8d3464068 <U+2014> at the pin
    head-ascii-cafE-on: |  [spec] spec: branch caf\udcc3\udca9 does not exist (...), and the checkout is on CAF\udcc3\udc89, which differs from caf\udcc3\udca9 only in case
    
  • fast_forward_to_pin's twin (move, bootstrap.py: on a disk that folds case, a leg on Main whose tracking branch main is behind the pin is moved under its own HEAD, and bootstrap says it is on main now over an index that undoes the pin #896's own harm), with the branch behind the pin and HEAD on the twin. At base, under Latin-1 (both names) and UTF-8 (caf), the run said branch ... fast-forwarded ... -> ..., the pin and moved the leg off the twin. At the head, every locale says tip ... is behind the PIN ..., and the checkout is on <twin>, which differs ... only in case, and the switch word gives tb<ff>x or caf<c3 a9> (logs/e2e-move.log).
  • Fix: name both in the body's table, and optionally add a move setup and a CAF<c3 89> id to TWIN_ROWS.

F5 NIT: 0ac4efbc leaves a short line

tests/test_bootstrap_branch_one_byte_locale.py:817 is a line holding only still read back as. Rewrap it.

F6 NIT: main has moved since the body

The body says main is 3add78e1c. origin/main is now 106f92ff9585; its bootstrap.py is still 41c2eb42. git merge-tree --write-tree 0ac4efbc origin/main gives 613b71f4646acf1ec53b39fca4b3758cfe22073c, rc 0. Against 3add78e1c it gives e7eae1cb55e9..., rc 0, as the body says. Update the line at the next refresh.

Checked and confirmed

  • Shas and blobs. 0ac4efbc is the PR head (refs/l1/pr/1308) and cb9ed806 its base. bootstrap.py goes from 8e0f76c7 to c89f00ad. The test file goes 9c95e2f2 to 0496be7c to 1e5b4ccb.
  • The misses at cb9ed806 and the fix at the head, end to end. I reproduced every cell of the body's table: HEAD on the twin, HEAD detached beside it, and place_at_pin (logs/e2e-u8.log, 72 runs). Every run exited 0 with no traceback.
    • Base said created for TB<ff>x under Latin-1, and for CAF<c3 a9> under Latin-1 and UTF-8.
    • Base place_at_pin said on ... (branch tip == pin) for Latin-1 ff and caf, and for UTF-8 caf.
    • The head gives the twin lines in every locale and leaves HEAD and the branches as they were.
    • Controls are unchanged in every locale on both sides: HEAD on the branch itself is ON-BRANCH, tb<e4>x for tb\udcc4x is CREATED, and Main for main is a twin.
  • _as_a_folding_disk_reads, _folded_twin's return and _twin_words are correct line by line.
    • The UTF-8 surrogateescape decode is one to one, so held != mine is a byte compare.
    • _twin_words reads both names as the fold does. In process, the head says only in case for all three twins in every locale; base said only in case or Unicode form under Latin-1 (M9 confirmed).
  • _folded_spelling's claim.
    • On POSIX, _handed_to_git(os.fsdecode(b)) == b for 20255 of 20255 names (every byte, plus 20000 random names) under UTF-8, Latin-1 and ASCII.
    • On Windows, by reading: _try_git decodes strict UTF-8 (:326) and _handed_to_git encodes strict UTF-8 (:1468-1469), which are exact inverses.
    • _head_of (:865) uses os.fsdecode on every system. Under the legacy mode that is not inverted, which the body's Known limits already says.
  • The fallback. No POSIX input reaches it. The emulated legacy-mode row passes. My N5, a per-name fallback, survives because it is equivalent: only the manifest's name can raise, and on Windows the other side's UTF-8 reading equals its text.
  • What is printed. I ran every paste word through /bin/sh in the child's own locale, with stdout both as utf-8:strict and as the locale's own encoding (logs/e2e-loc2.log).
    • Each word named the twin's bytes: <TB\xffx><TB\xffx-kept>, <CAF\xc3\xa9><CAF\xc3\xa9-kept>, and the switch words <tb\xffx> and <caf\xc3\xa9>.
    • I then ran each rename for real and ran bootstrap again: the twin became <twin>-kept and the second run said created, in all three locales.
    • Under Latin-1 the line names TB<U+00FF>x beside tb\udcffx "only in case". That is the body's stated limit, and I accept it.
  • Rows. There are 34 new rows, 65 in all. Base against head matches the body's table exactly: the same 10 failures in each locale. The controls hold on both sides.
  • 0ac4efbc is docstring-only. probe/astcmp.py on dbf022ae against 0ac4efbc printed ast without docstrings equal: True 104858 104858.
  • The body. Closes #1306 is its only closing form. gh pr view 1308 shows base fix/1283-bootstrap-branch-latin1, a draft, and closingIssuesReferences: [], as expected until it targets main. The twin grep at cb9ed806 lists 50 files, and only the two twin files name the helpers.

pytest summary lines

All UTF-8 unless named. The scratch clone is at 0ac4efbc, with bootstrap.py blob c89f00ad unless a line says otherwise.

Run Result
rows file, UTF-8 65 passed in 35.96s
rows file, Latin-1 65 passed in 35.21s
rows file, ASCII 65 passed in 32.44s
rows file, cb9ed806's blob 8e0f76c7 laid in, UTF-8 10 failed, 55 passed in 35.68s
the same, Latin-1 10 failed, 55 passed in 38.32s
the same, ASCII 10 failed, 55 passed in 36.41s
every tests/test_bootstrap_*.py (14 files, list checked non-empty) 708 passed, 3 skipped in 330.38s
tests/test_pinned_copy_text.py 87 passed in 11.96s
tests/test_path_guard_hygiene.py 121 passed in 27.68s
  • The 10 base failures are the same in each locale: the three twin tests for byte-0xff-latin1, utf-8-bytes-as-surrogates-latin1 and utf-8-bytes-as-surrogates-utf-8, plus test_a_latin1_capital_is_a_twin_only_where_its_bytes_are_utf_8[latin1].
  • After the base runs, the restore read restored: file c89f00adf524288833faa8e23282edab0e0ff7c9 HEAD c89f00adf524288833faa8e23282edab0e0ff7c9 status: [].
  • The 3 skips in the bootstrap run are tests/test_bootstrap_ref_store.py:102: this git makes no reftable repository.

Mutants: 3 killed of 6 (3 of 5, N5 being equivalent)

Each ran alone over the rows file, test_bootstrap_casefold_twin.py and test_bootstrap_create_twins.py (141 tests). After each, the file was restored from HEAD's blob and proved equal, c89f00ad against c89f00ad, status clean.

id mutant result rows that failed
N1 decode with "replace" SURVIVED, 141 passed none (F3)
N2 decode with "ignore" SURVIVED, 141 passed none (F3)
N3 the text's own UTF-8, not _handed_to_git KILLED, 7 failed the Latin-1 twin rows and DECIDED
N4 _twin_words reads only the twin KILLED, 9 failed the caf twin rows
N5 the fallback per name survived; equivalent (above) none
N6 NFC inside the helper KILLED, 5 failed the NFD rows

Not covered

  • Platforms: Windows, macOS (APFS, HFS+), and Linux case-folding mounts were neither run nor mounted. F1 rests on git's source.
  • Python: CPython 3.14 was not run, and I built no 3.14 shim, since the change has no path guard.
  • Writer's work not repeated: I did not re-run the writer's M1 to M12, legacy_twin.py, or row 13 on its own (it ran inside the bootstrap files run).
  • Out of scope: tests/test_shape_doctor.py was not run, since adopt-project.py is untouched.

Probes, logs and the scratch clone are under /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1308a/. Both trees there are clean, and nothing was pushed or posted.

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-11-10T13:55:44Z) Lane 1 re-decides #1306 on r1308a's F1, and takes its option (A). Lane 1's confirmation in the body rested on "a disk that folds case reads a name as UTF-8", which is false for git for Windows. Its xutftowcsn turns a byte 0xA0 to 0xFF that is not UTF-8 into that Latin-1 letter. So on NTFS, tb<c4>x and tb<e4>x are one file, and the cb9ed80 answer (a twin) was the right one.

The decision now: a pair is a case twin when its bytes differ and EITHER of two readings folds the two names alike:

  1. git's bytes decoded as UTF-8 with surrogateescape (APFS, and every name that is UTF-8);
  2. git's bytes as git for Windows names the file on NTFS: valid UTF-8 as itself, a byte 0xA0 to 0xFF that is not UTF-8 as U+00A0 to U+00FF, and a byte 0x80 to 0x9F as two hex digits, exactly as compat/mingw.c does.

Why this keeps one answer in every locale. w1283a's objection was that the pair 0xC4/0xE4 would be twins under one locale and not the others. Here it is a twin in every locale, for a named disk. The DECIDED row returns to base's answer, and the 0xC4/0xE4 control becomes a twin in every locale.

The fix round also takes:

  • F2: _kept_name and _taken fold through the same twin test, with a row.
  • F3: rows for TB<c4>x with tb\udce4x, and TBx with tb\udcffx.
  • F4: the body names the CAF<c3 89> and fast_forward_to_pin changes, with rows.
  • F5 and F6.

Each docstring and body sentence that states the old disk model is corrected.

Lane: openreposhape-1 (openRepoShape-1)

Brett Heap and others added 2 commits November 10, 2026 14:13
…git for Windows names the file on NTFS (`xutftowcsn`), so `tb<c4>x` and `tb<e4>x` are case twins in every locale, and `_kept_name` folds each pair as `_folded_twin` does (r1308a F1, F2, F5)

Lane 1's re-decision of #1306 on r1308a's F1 (issuecomment-6769183561):
a pair is a case twin where its bytes differ and EITHER of two readings
folds the two names alike under `_fold`:
1. git's bytes decoded as UTF-8 with `surrogateescape`, as before;
2. git's bytes as git for Windows names the file on NTFS, exactly as
   `xutftowcsn` in git's compat/mingw.c converts them (new
   `_as_git_for_windows_names`): valid UTF-8 as itself, a byte 0xA0 to
   0xFF that is not UTF-8 as U+00A0 to U+00FF, a byte 0x80 to 0x9F as
   two hex digits.

`_as_a_folding_disk_reads` now returns both readings; the
`UnicodeEncodeError` fallback is unchanged (one reading, the texts).
`_folded_twin` keeps its signature. `_twin_words` says "only in case"
where either reading folds the pair under `casefold()` alone.

F2: `_taken` takes the branch names and folds each pair through
`_as_a_folding_disk_reads`, as `_folded_twin` does, so the `-kept` name
the rename prints is no twin of a branch already there in any locale.

F1: the docstrings that said a disk that folds case reads a name as
UTF-8 are corrected (`_branch_ref`, `_folded_twin`, the rows file's
module docstring). The DECIDED row returns to cb9ed80's answer, a twin,
and is renamed `test_a_latin1_capital_is_a_twin_in_every_locale`; the
0xC4/0xE4 control is a twin in every locale now, and is renamed
`test_the_bytes_0xc4_and_0xe4_are_twins_in_every_locale`, so this commit
is green on its own.

F5: the short docstring line of the legacy-mode row is rewrapped.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…iffer in a byte that is not UTF-8 and in case, for `CAF<c3 89>`, for `fast_forward_to_pin`'s twin, for the `-kept` name, and for git for Windows' names (r1308a F2, F3, F4)

- F3: `test_a_pair_is_a_twin_where_either_reading_folds_it_alike`, in
  every locale: HEAD on `TB<c4>x` for `tb\udce4x` (a twin: git for
  Windows names them `TB` U+00C4 `x` and `tb` U+00E4 `x`), on `TBx` and
  on `TB<c4>x` for `tb\udcffx` (no twin; `"replace"` and `"ignore"` call
  them twins), and on `TB84X` for `tb<84>x` (a twin: git for Windows
  writes the byte 0x84 as `84`).
- F4: `utf-8-capital`, `CAF<c3 89>` for `caf\udcc3\udca9`, joins
  `TWIN_ROWS`, a twin in every locale with HEAD on it, beside it and at
  the pin; and `test_a_leg_on_a_case_twin_of_a_branch_behind_the_pin_is_left`
  holds `fast_forward_to_pin`'s twin (`move`) over every `TWIN_ROWS` id.
- F2: `test_the_rename_is_to_no_twin_of_a_branch_there_in_every_locale`:
  beside `caf<c3 89>-kept` the rename is to `CAF<c3 a9>-kept-2` in every
  locale.
- `test_git_for_windows_names_each_file_as_xutftowcsn_does` holds
  `_as_git_for_windows_names` against a table read from `xutftowcsn`.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-11-10T14:36:47Z) #1308's fix round is partway, paused at the account's usage ceiling. The head is now 248669b1. The PR body above still describes 0ac4efbc, and lane 1 replaces it when the round is done.

  • 3beceb51 makes lane 1's decision (issuecomment-6769183561): a pair is a twin when either reading folds it alike, UTF-8 with surrogateescape, or git for Windows' xutftowcsn name. It also takes r1308a's F2 (_taken folds through the same two readings), F5, and every docstring that stated the old disk model.
  • 248669b1 adds the rows for F3 and F4, the F2 rename row, and a 26-entry table of git for Windows' names. The rows file runs 99 passed under UTF-8, Latin-1 and ASCII pytests. On cb9ed806's bootstrap.py, 37 of them fail.
  • Left:
    • one row, so mutant W2 (reading 2 alone) dies;
    • mutants W7, N1 and N2;
    • the wider runs;
    • the body;
    • then a delta review.
  • Known limit to carry: git for Windows' reading is folded with NFC and casefold too, so cafe<cc 81> and caf<e9> are called twins, though NTFS holds them as two files.

Lane: openreposhape-1 (openRepoShape-1)

…twin of `tb\udc84x` in every locale, a pair only git for Windows' reading holds alike, so a twin test that drops the UTF-8 reading fails a row (#1306)

- `tb84x-for-tb-84` joins `PAIRS`: HEAD on `tb84x` at the pin, with
  `tracking_branch: "tb\udc84x"` and the branch not there. Read as UTF-8
  the bytes `tb84x` and `tb<84>x` differ; git for Windows writes the
  byte 0x84 as `84`, so both are the file `tb84x` on NTFS. In every
  locale: the three twin lines, the rename of `tb84x` to `tb84x-kept`,
  and the leg left on `tb84x`.
- Mutant W2 on #1308 (`_as_a_folding_disk_reads` gives git for Windows'
  reading alone) passed every row at 248669b: that reading is not one
  to one, so its byte compare held the two equal and no twin.
- The `PAIRS` comment says most pairs, not all, differ in ASCII case too.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@brettheap brettheap changed the title assembly-root bootstrap.py: _folded_twin folds HEAD's ref and the tracking branch as git's bytes read as UTF-8, whatever the locale, so step (a) finds a case twin of a branch that is not UTF-8 in every locale and makes no branch beside it (#1306) assembly-root bootstrap.py: a case twin is folded as UTF-8 reads git's bytes and as git for Windows names the file, whatever the locale, so step (a) finds a twin of a branch that is not UTF-8 and makes no branch beside it (#1306) Nov 10, 2026
@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-11-10T16:59:06Z) #1308's fix round is done at 166d843d, and the title and body above now describe it.

  • The commits: 3beceb51 and 248669b1 (w1308r) and 166d843d (w1308s) apply lane 1's re-decision (issuecomment-6769183561) and answer r1308a's F1 to F6.
  • The rows: the rows file runs 102 passed under UTF-8, Latin-1 and ASCII pytests. On cb9ed806's bootstrap.py 40 of them fail, and on 0ac4efbc's 16.
  • Mutants: 8 of 9 are killed. W3 is equivalent.
  • The wider runs: every tests/test_bootstrap_*.py file passes under UTF-8 (745 passed, 3 skipped).
  • Next: r1308b's delta review of 0ac4efbc..166d843d.

Lane: openreposhape-1 (openRepoShape-1)

@brettheap

Copy link
Copy Markdown
Contributor Author

Delta review of #1308 (#1306) for lane openRepoShape-1, by r1308b (opus), 0ac4efb..166d843: NOT READY

The code applies lane 1's decision correctly. I compared _as_git_for_windows_names against a line-for-line Python port of git's xutftowcsn over 10,736,480 names, and none differed. Every caller asks both readings. The fallback is still main's text compare, and the twin path raises nothing. All 102 rows pass in all three locales. The two older blobs fail 16 and 40 rows, as the writers measured.

It is NOT READY for one SHOULD: no row checks two of xutftowcsn's lead-byte rules, so two mutants of the second reading pass every row. The body hides this gap by saying the probe's table "is a row". Three NITs follow.

I ran everything on Python 3.12.3 and git 2.43.0 in the probe environment: stub gh, GH_TOKEN=bogus-r1308b, an empty GH_CONFIG_DIR, GIT_CONFIG_GLOBAL=/dev/null, GIT_SSH_COMMAND=false, env -u LANES_LANE. Latin-1 is w1283a's localedef build.

Findings

S1 SHOULD: no row checks the 0xC1 lead or the 0xF5 to 0xF7 leads, two mutants pass every row, and the body says the probe's table is a row

  • Where:
    • tests/test_bootstrap_branch_one_byte_locale.py:1028, XUTFTOWCSN.
    • The body's Measured section: "against a table of 26 names read from xutftowcsn (the same table is a row)".
  • Evidence.
    • The row's table is not the probe's. I parsed both tables with ast:
      row table 24 probe table 26
      in probe, not row: [b'\xc1\xbf', b'CAF\xc3\x89']
      in row, not probe: []
      same values where shared: True
      
    • Two mutants survive (my R3 and R7; Mutants below). Each passed the table row, then the 179-test set:
      • R3, 0xC1 <= lead < 0xE0: 179 passed in 79.56s (0:01:19).
      • R7, 0xF0 <= lead < 0xF8: 179 passed in 86.22s (0:01:26).
    • Each changes behaviour. probe/survivors.py checks both against my C port:
      R3: b'tb\xc1\x81x': C port 'tb\xc181x'; head 'tb\xc181x'; mutant 'tbAx'
      R3: b'tb\xc1\xbf': C port 'tb\xc1\xbf'; head 'tb\xc1\xbf'; mutant 'tb\x7f'
      R3: _folded_twin(HEAD on b'tb\xc1\x81x', 'tbax'): head False; mutant True
      R7: b'tb\xf5\x80\x80\x80x': C port 'tb\xf5808080x'; head 'tb\xf5808080x'; mutant 'tb\udcc0\udc00x'
      R7: b'\xf7\xbf\xbf\xbf': C port '\xf7\xbf\xbf\xbf'; head '\xf7\xbf\xbf\xbf'; mutant '\udfbf\udfff'
      
      Under R3, tb<c1 81>x becomes a twin of tbax, though git for Windows names that file tb U+00C1 81x.
    • Why the table misses both.
      • It checks 0xC0 (<c0 af>) but not 0xC1.
      • Its only lead from 0xF5 up is <f5 80>. That is cut short, so it never reaches the 4-byte test.
  • Fix:
    • Add these four entries to XUTFTOWCSN. Their values match the C port above.
      b"\xc1\xbf": "\u00c1\u00bf", b"\xc1\x81": "\u00c181",
      b"\xf5\x80\x80\x80": "\u00f5808080", b"\xf7\xbf\xbf\xbf": "\u00f7\u00bf\u00bf\u00bf",
    • Make the body's sentence true: say what the row holds, or drop "(the same table is a row)".

N1 NIT: "git refuses a longer path there" is not quite what git does, and git for Windows itself goes through xutftowcs_long_path

  • Where:
    • templates/assembly-root/scripts/bootstrap.py:1148-1149: "git refuses a longer path there (ENAMETOOLONG)".
    • :1130: "xutftowcs_path ... calls for each path git opens or makes there".
    • The body's Known limits, first bullet.
  • Evidence: the buffer edge. My port of xutftowcsn, given a 260-unit buffer (MAX_PATH):
    MAX_PATH buffer, 259 bytes ending b'\x84': port rc=259 last units 'aa8'; head len 260 last 'a84'
    MAX_PATH buffer, 259 bytes ending b'8': port rc=259 last units 'aa8'; head len 259 last 'aa8'
    MAX_PATH buffer, 4-byte form at unit 258: port rc ERANGE
    
    At the buffer's last unit, the C writes the first hex digit of a byte 0x80 to 0x9F, drops the second (if (wpos < wcslen)), and succeeds. It does not refuse.
  • Evidence: git for Windows' own tree.
    • In git-for-windows/git main, mingw_open, mingw_rename, mingw_unlink and mingw_lstat call xutftowcs_long_path, and mingw_mkdir calls xutftowcs_path_ex.
    • Both wrappers call xutftowcsn with a MAX_LONG_PATH (4096) buffer and then handle_long_path.
    • That xutftowcsn is byte for byte master's (the diff of the two function bodies is empty, 71 lines). So the second reading still holds.
  • Fix: say "git refuses a longer path there, or, at the buffer's last unit, drops a hex pair's second digit". Name xutftowcs_long_path beside xutftowcs_path.

N2 NIT: main has moved since the body

The body says main is f2a6527e9. origin/main is now dc9a0bcc7, and its bootstrap.py is still blob 41c2eb42:

git merge-tree --write-tree 166d843dc56e... origin/main   -> 1cb4472b5656b6fad239b3e97e8a32c48130756e, rc=0
git merge-tree --write-tree 166d843dc56e... f2a6527e9     -> 98b90b93396f5c89f1eae99fdd4ee6a33ecb8dd6, rc=0  (as the body says)

Fix: update the main line at the next refresh.

N3 NIT: the PAIRS comment credits "replace" with a fold it does not make

  • Where: tests/test_bootstrap_branch_one_byte_locale.py:774-775: "("replace" and "ignore" fold them)".
  • Evidence:
    replace TBx~tb<ff>x False | TB<c4>x~tb<ff>x True
    ignore TBx~tb<ff>x True | TB<c4>x~tb<ff>x True
    
    The body's F3 paragraph has this right: "The second kills N2 alone".
  • Fix: "("ignore" folds both; "replace" the second)".

Checked and confirmed

1. Reading 2 against git's code

I fetched compat/mingw.c and compat/mingw.h from git's master (sha1 9bf22b88... and 9c5f4db2...). They are identical to w1308r's copies. probe/xport.py is a line-for-line port of xutftowcsn: the NUL terminator is read as the C reads it, and utflen = -1.

1-2 byte: 65280 bad 0
3 byte, lead >= 0x80: 8323200 bad 0
structured 4 byte (+ in tb..x): 2048000 bad 0
random: 300000 bad 0
TOTAL checked 10736480 disagree 0 []
NUL: port [116, 98] head [116, 98, 0, 120]
  • ASCII: 1:1 on both sides.
  • NUL: git stops at a NUL and the head goes on, but no name reaches the head with one. _argument_fault refuses "U+0000, a NUL" (bootstrap.py:724-725), and git's refs hold none.
  • 2-byte forms: 0xC2 to 0xDF need one continuation byte. 0xC0 and 0xC1 go 1:1 as U+00C0 and U+00C1. Both match the C.
  • 3-byte forms:
    • The 0xE0 overlong check matches.
    • Encoded surrogates (0xED 0xA0 to 0xBF) are taken as one unit, as the C does.
    • A pair of them becomes one character: <ed a0 80 ed b0 80> and <f0 90 80 80> both give U+10000. The row checks this.
  • 4-byte forms: the 0xF0 overlong check and the 0xF4 >= 0x90 bound match. 0xF5 to 0xFF go 1:1.
  • Cut-short sequences: _continues checks at + step < len(raw), as the C's terminator does. Every cut form agrees in the 8.3M 3-byte set.
  • 0xA0 to 0xFF: 1:1. 0x80 to 0x9F: two lowercase hex digits.
  • The only differences are the NUL above and the buffer edge (N1).
  • What xutftowcs_path adds. On master, it only turns ERANGE into ENAMETOOLONG.
  • What git for Windows adds.
    • Its wrappers add handle_long_path, which calls GetFullPathNameW for absolute or long paths and may prefix \\?\. That changes no character of a ref name.
    • is_valid_win32_path runs first and refuses rather than renames. It refuses a component ending in . or a space, reserved names (aux, con/x), <>:"|?* and control characters. It runs only while core.protectNTFS is on, which is the default.
    • With core.protectNTFS off, Windows itself trims a trailing dot. git check-ref-format accepts refs/heads/a./b, so a./b and a/b would be one file. That is not a case question and is outside the decision. I read this from the code and did not measure it.

2. The decision's code (bootstrap.py 1120-1445)

  • The two readings. _as_a_folding_disk_reads returns (reading 1, reading 2), or (names,) when _handed_to_git raises UnicodeEncodeError.
  • _folded_twin. It takes held, mine = readings[0], so the byte compare uses reading 1, and applies any over both readings.
  • Every caller asks both readings.
    • _folded_twin: place_at_pin (:1705), fast_forward_to_pin (:1792), create_at_pin (:1936), and _folded_spelling (:1392).
    • _twin_words: through _say_fold (:1349) and _say_spelling (:1465).
    • _taken: through _kept_name (:1444).
    • No other _fold or casefold compare is left (grep).
  • The fallback. probe/fallback.py forced _handed_to_git to raise and compared the head with main (blob 41c2eb42):
    forced fallback: _folded_twin differs from main's 0 of 60000; _twin_words 0 of 60000; _taken 0 of 20000
    
  • No new traceback.
    • _as_git_for_windows_names never raised in the 10.7M names above. It writes units below 0x10000, and surrogatepass decodes any unit.
    • NFC and casefold of a lone surrogate raise nothing.
    • w1306a's legacy_twin.py (an unchanged copy) at the head:
      legacy emulation: names passed by _argument_fault: 166793 (the 8 named ones first), refused: 967327; _handed_to_git raised on a passed name (folded as text): 10727; raised in the twin path: 0
      posix utf-8: names passed by _argument_fault: 164873 (the 8 named ones first), refused: 969247; _handed_to_git raised on a passed name (folded as text): 0; raised in the twin path: 0
      
  • W3 is equivalent.
    • w1308r's subsume.py: pairs 111561: both 66153, reading 1 alone 0, reading 2 alone 46.
    • My subsume2.py put every byte 0x80 to 0xFF, and six invalid sequences, beside U+0301, U+0341, U+0345, iota, U+0130, sharp s, U+212A, U+212B, U+1FB3 and others: pairs 511344: reading 1 alone 0.

3. Docstrings and comments

  • r1308a's F1 list is fixed in the diff: bootstrap.py old 1164-1167, 1175-1177 and 879-882, and the rows file's 44 and 753-755.
  • git grep finds no sentence left that says a folding disk reads a name as UTF-8 alone.
  • The rewritten _branch_ref, _folded_twin, _as_a_folding_disk_reads, _twin_words, _folded_spelling, _taken and _kept_name each name the two readings as the code builds them.

4. The rows

  • At the head: 102 pass under each pytest locale (summary lines below).
  • With round 0's blob c89f00ad laid in (UTF-8): 16 fail:
    • the 0xC4/0xE4 row x3;
    • TB-c4-for-tb-e4, TB84X-for-tb-84 and tb84x-for-tb-84, x3 each;
    • the -kept row's latin1 and ascii;
    • the DECIDED row's latin1;
    • the xutftowcsn table.
  • With the base blob 8e0f76c7 laid in (UTF-8): 40 fail:
    • the four TWIN_ROWS tests x6 (byte-0xff-latin1, utf-8-bytes-as-surrogates-latin1 and -utf-8, utf-8-capital x3);
    • the 0xC4/0xE4 row x3;
    • the 9 twin pairs;
    • the -kept row x3;
    • the table.
  • Each row holds what its id and docstring say:
    • F3: TB-c4-for-tb-e4 is a twin, and CONTROL-TBx-for-tb-ff is no twin.
    • F4: utf-8-capital, and the move row with the base printing fast-forwarded.
    • F2: the -kept-2 row.
    • DECIDED: passes at base and fails at round 0's latin1.
    • The tb84x row: fails on both older blobs and passes at the head.
    • The controls: pass on every side.
  • Restores. After each laid-in blob, restored: file 2c4704514cf593060b66f2df802b27feae41600d HEAD 2c4704514cf593060b66f2df802b27feae41600d equal=True; status: (clean).

6. Item 6

All four calls passed (summary lines below).

7. The stack and main

  • git diff 0ac4efbc 166d843d --stat touches only bootstrap.py (223 lines) and the rows file (290 lines).
  • cb9ed806 is an ancestor of the head.
  • ls-remote shows fix/1283-bootstrap-branch-latin1 at cb9ed806 and fix/1306-folded-twin-bytes at 166d843dc.
  • Both merge-trees are clean (N2).

8. The body and title

  • Live copy. gh pr view 1308 returns the same body as pr-body-only.md (34080 characters) and the same title (229 characters, ASCII).
  • The PR's state: base fix/1283-bootstrap-branch-latin1, head 166d843dc56e, a draft. closingIssuesReferences: [], as expected until it targets main.
  • Closing forms. The only one is line 1, Closes #1306. The only character outside ASCII is the footer's.
  • Shas and blobs:
    • dbf022ae: c89f00ad / 0496be7c;
    • 0ac4efbc: c89f00ad / 1e5b4ccb;
    • 3beceb51: 2c470451 / 48858575;
    • 248669b1: 2c470451 / 1a0b5986;
    • 166d843dc: 2c470451 / 269a0d16;
    • base: 8e0f76c7 / 9c95e2f2;
    • five commits.
  • Probe outputs I re-ran:
    • r1300a's twin.py: base and head lines identical to the body's.
    • fold_c4.py: False/False/True as stated.
    • check1.py: all 15 answers. ASCII says no twin for the two tb U+00E4 x pairs, and _kept_name gives -kept-2 in all three locales.
    • gfw_cmp.py: table: 26 of 26 and 265213 of 265280.
    • subsume.py and the legacy lines: match the body.
  • Known limits. They are true. The NFC and casefold() bullet covers _fold applied to reading 2. Only N1's wording is off.
  • "Review round 1". It answers F1 to F6 as the code does.

pytest summary lines

head / tree run result
166d843dc56e, review worktree rows file, UTF-8 102 passed in 59.61s
same rows file, Latin-1 102 passed in 51.92s
same rows file, ASCII 102 passed in 52.36s
same test_bootstrap_casefold_twin.py, test_bootstrap_create_twins.py, test_bootstrap_spelling.py, UTF-8, one call 283 passed in 80.51s (0:01:20)
same row 13, Latin-1 1 passed in 2.68s
same row 13, ASCII 1 passed in 2.92s
166d843d clone, c89f00ad laid in rows file, UTF-8 16 failed, 86 passed in 54.82s
166d843d clone, 8e0f76c7 laid in rows file, UTF-8 40 failed, 62 passed in 47.44s

Mutants: 10 killed of 12

  • How they ran. Each mutant ran alone in the clone at 166d843d, by exact replacement (one occurrence asserted), under UTF-8.
    • First it ran against the xutftowcsn table row.
    • Where that passed, it ran against the 179-test set: the rows file, casefold_twin, create_twins and row 13.
    • After each, the clone read restored: ... equal=True; status: (clean).
id mutant result
R1 hex digits in capitals KILLED by the table, 1 failed in 0.22s (<9f> gave 9F). Twin answers do not change, since _fold lowercases.
R2 0xC0 and 0xC1 taken as 2-byte leads KILLED, 1 failed in 0.29s (<c0 af> gave /)
R3 0xC1 alone taken as a 2-byte lead SURVIVED, 179 passed (S1)
R4 the 0xE0 overlong check dropped KILLED, 1 failed in 0.32s (<e0 80 80> gave NUL)
R5 the 0xF0 overlong check dropped KILLED, 1 failed in 0.28s (OverflowError)
R6 the 0xF4 bound dropped KILLED, 1 failed in 0.21s (<f4 90 80 80> gave \udc00\udc00)
R7 0xF5 to 0xF7 taken as 4-byte leads SURVIVED, 179 passed (S1)
R8 encoded surrogates refused, as Python's UTF-8 does KILLED, 1 failed in 0.32s
R9 _continues true past the end (a cut form read whole) KILLED, 1 failed in 0.31s (IndexError)
R10 the 2-byte form's continuation check dropped KILLED, 1 failed in 0.19s (tb<c4>x gave U+0138)
R11 _twin_words asks reading 1 only KILLED, 13 failed, 166 passed in 79.66s: 0xC4/0xE4 x3, TB-c4-for-tb-e4 x3, TB84X-for-tb-84 x3, tb84x-for-tb-84 x3, DECIDED latin1
R12 Latin-1 0xC0 to 0xFF with the case bit flipped KILLED, 1 failed in 0.52s
  • Survivors that matter: R3 and R7. The four XUTFTOWCSN entries in S1 kill both (probe/survivors.py output above).

Not covered

  • Windows and other disks.
    • Windows was not run, and no NTFS volume was used. Item 1 rests on git's source.
    • I read git for Windows' main only for xutftowcsn, the path wrappers, handle_long_path and is_valid_win32_path.
    • I did not compare NTFS's upcase table with casefold() in either direction.
  • Python 3.14. It was not run, and I built no 3.14 shim: the change has no path guard.
  • Wider runs not repeated: the full set of 14 test_bootstrap_*.py files, the gate trio, w1300r's end-to-end probe, and the writers' mutants W1 to W7, N1 and N2.
  • Base blobs were laid in under UTF-8 only, as the brief asks.
  • Short-cut mutant runs. The nine table-killed mutants ran only the table row, so the other rows they would fail were not listed.

Probes, logs and the scratch clone are under /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1308b/. The review worktree wt-r1308b and the clone are both clean, and nothing was pushed or posted.

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-11-10T17:24:27Z) Lane 1's decision on r1308b's delta review (issuecomment-6774235356): take all four findings, in one round by writer w1308t, which is running now.

Lane: openreposhape-1 (openRepoShape-1)

…holds the probe's 26 names and three more, so a 2-byte lead from 0xC1 or a 4-byte lead to 0xF7 fails it; bootstrap.py's docstring names `xutftowcs_long_path` (#1306)

- S1: `XUTFTOWCSN` gains `<c1 bf>`, `<c1 81>`, `<f5 80 80 80>`, `<f7 bf bf bf>`
  and `CAF<c3 89>`, with the values r1308b's port of `xutftowcsn` gives.
  The row's table now holds all 26 names of the probe's table (29 in
  all, was 24). Mutants R3 (0xC1 taken as a 2-byte lead) and R7 (0xF5 to
  0xF7 taken as 4-byte leads) passed every row at 166d843; each now
  fails the row.
- N1: `_as_git_for_windows_names`'s docstring names `xutftowcs_long_path`
  beside `xutftowcs_path`, and says git refuses a longer path there, or,
  at the buffer's last unit, drops a hex pair's second digit. Docstrings
  only: `ast.dump` of the module without docstrings is equal.
- N3: the `PAIRS` comment says `"ignore"` folds both pairs and
  `"replace"` the second.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-11-10T17:32:06Z) Round 2 on #1308 is done at 4682320a, and the body above now describes it, in a new "Review round 2 (r1308b)" section.

  • S1: the XUTFTOWCSN row now holds 29 names: all 26 of the probe's, with the same values, and three more. r1308b's survivors now fail the row: R3 (0xC1 as a 2-byte lead) and R7 (0xF5 to 0xF7 as 4-byte leads).
  • N1: _as_git_for_windows_names's docstring names xutftowcs_long_path beside xutftowcs_path, and says that at the buffer's last unit git drops a hex pair's second digit. ast.dump without docstrings is equal to 166d843d's.
  • N2: the body names main dc9a0bcc7. git merge-tree --write-tree 4682320a origin/main is clean.
  • N3: the PAIRS comment is corrected.
  • The rows file runs 102 passed under UTF-8, Latin-1 and ASCII pytests at 4682320a.
  • Next: a delta review of 166d843d..4682320a. Lane 1 pauses at its account's usage ceiling first, so that review runs after the next resume.

Lane: openreposhape-1 (openRepoShape-1)

@brettheap

Copy link
Copy Markdown
Contributor Author

Delta review of #1308 (#1306) for lane openRepoShape-1, by r1308c (sonnet), 166d843..4682320: READY

Round 2 closes r1308b's S1, N1, N2 and N3 as the writer and body say. I reached all six items. One new NIT, and one optional wording NIT. Neither holds the PR.

I ran on Python 3.12.3 in the probe environment: stub gh, GH_TOKEN=bogus-r1308c, an empty GH_CONFIG_DIR, GIT_CONFIG_GLOBAL=/dev/null, GIT_SSH_COMMAND=false, env -u LANES_LANE, UTF-8 as LC_ALL=C.UTF-8. My review tree was clean after every step. The mutant worktree was clean after each restore.

Findings

N1 NIT: the body's main line is stale again

  • Where: the body's main line (body line 16), and its round-2 "N2" bullet (body line 243).
  • Evidence: the body names main as dc9a0bcc7, with merge-tree tree 0cfc476e6ecf62fd4bbe1da0f784cf69a991c17b. origin/main is now f39c6707a (fix: keep ignored compatibility links within their declared Git leg #1316 landed). The body's own command now gives a different tree:
    git merge-tree --write-tree 4682320a980cd6482f2fa8de7a3c70a23daaa294 origin/main   -> 9718d3c6c02855473305b1f39ca5610d4be041e6, rc=0
    git merge-tree --write-tree 4682320a980cd6482f2fa8de7a3c70a23daaa294 dc9a0bcc7     -> 0cfc476e6ecf62fd4bbe1da0f784cf69a991c17b, rc=0 (the body's tree)
    git diff --name-only dc9a0bcc7 origin/main
      adopt-project.py, shape-doctor.py, tests/test_adopt_source_github_limits.py,
      tests/test_adopt_unsearchable_source.py, tests/test_doctor_local_leg_aliases.py, tests/test_shape_doctor.py
    
    • Both merges are clean.
    • bootstrap.py is not among those six files, so main's blob is unchanged. I read that from the file list; I did not hash the blob.
  • Fix: at the next refresh, name main as f39c6707a (f39c670) with tree 9718d3c6c02855473305b1f39ca5610d4be041e6. Do the same in the "N2" bullet.

N2 NIT, optional: "call" is one remove short in git for Windows

  • Where: templates/assembly-root/scripts/bootstrap.py:1129-1131 ("xutftowcs_path and xutftowcs_long_path ... call" xutftowcsn), and the same wording in the body's Known limits.
  • Evidence: r1308b's cached copy of git for Windows' compat/mingw.h, lines 199 and 211-215:
    xutftowcs_path:      return xutftowcs_path_ex(wcs, utf, MAX_PATH, -1, MAX_PATH, 0);
    xutftowcs_long_path: return xutftowcs_path_ex(wcs, utf, MAX_LONG_PATH, -1, MAX_PATH, are_long_paths_enabled());
    xutftowcs_path_ex:   int result = xutftowcsn(wcs, utf, wcslen, utflen);
    
  • Both wrappers reach xutftowcsn through xutftowcs_path_ex. The docstring is true in effect. This holds nothing.
  • Fix, if wanted: add "through xutftowcs_path_ex".

Checked and confirmed

1. The diff touches only the two files

git diff 166d843d 4682320a --stat
 templates/assembly-root/scripts/bootstrap.py   | 12 +++++++-----
 tests/test_bootstrap_branch_one_byte_locale.py |  7 ++++++-
 2 files changed, 13 insertions(+), 6 deletions(-)

I read every changed line:

  • Docstring: bootstrap.py:1127-1151, two hunks.
  • Table: four added lines, 1042-1045, holding five entries.
  • Comment: lines 774-776.
  • Width: no changed docstring line in bootstrap.py is over 79 columns.

2. The table values and the probe's names

I ran r1308c/probe/tables.py. It uses r1308b's xcore.py port of xutftowcsn and parses both tables with ast. Its output:

row table entries: 29  probe TABLE entries: 26
NEW b'\xc1\xbf': row '\xc1\xbf' port '\xc1\xbf' equal=True
NEW b'\xc1\x81': row '\xc181' port '\xc181' equal=True
NEW b'\xf5\x80\x80\x80': row '\xf5808080' port '\xf5808080' equal=True
NEW b'\xf7\xbf\xbf\xbf': row '\xf7\xbf\xbf\xbf' port '\xf7\xbf\xbf\xbf' equal=True
NEW b'CAF\xc3\x89': row 'CAF\xc9' port 'CAF\xc9' equal=True
ALL row entries vs port: disagree 0 []
probe names missing from row: []
shared names with a different value: []
in row, not in probe: [b'\xc1\x81', b'\xf5\x80\x80\x80', b'\xf7\xbf\xbf\xbf']
row 29 = probe 26 + extra 3
probe values vs port: 0 disagree
  • Neither dict literal has duplicate keys: 29 keys, 29 distinct in the row; 26 and 26 in TABLE (probe/dupkeys.py).
  • gfw_cmp.py's TABLE has "à80" + "80" concatenations, so ast.literal_eval refuses it. I evaluated the value node with no builtins instead.
  • The commit message and the body say the same: 29 names, was 24, the probe's 26 plus three.

3. bootstrap.py is docstring-only, and N1's wording is true

blob bytes 126871 127012
ast.dump WITH docstrings equal: False
ast.dump WITHOUT docstrings equal: True len 176566
docstrings that differ: [('FunctionDef', '_as_git_for_windows_names')]
comment lines equal: True
  • The wording against git for Windows' source. r1308b's cached copy of compat/mingw.h from git for Windows main (r1308b/gfwsrc/mingw.h) is the source I read:
    • xutftowcs_path is xutftowcs_path_ex(..., MAX_PATH, ...).
    • xutftowcs_long_path is xutftowcs_path_ex(..., MAX_LONG_PATH, ...), and MAX_LONG_PATH is 4096.
    • The new docstring says "the buffer xutftowcs_path and xutftowcs_long_path write to (MAX_PATH units, or more for the second)". That is true.
    • w1308t's naming of the buffer of both functions, one step past the review's text, is correct.
  • The hex-pair clause. It matches r1308b's measured port: a 260-unit buffer and a 259-byte name ending in 0x84 write the first digit and drop the second (if (wpos < wcslen)).
  • Not re-fetched. I did not fetch git for Windows' source again. I used r1308b's recorded copy.

4. The PAIRS comment says what r1308b's N3 evidence shows

The comment at tests/test_bootstrap_branch_one_byte_locale.py:774-776 reads ""ignore" folds both; "replace" the second". My probe, r1308c/probe/pairs.py, gives the same as r1308b:

replace [(b'TBx', b'tb\xffx', False), (b'TB\xc4x', b'tb\xffx', True)]
ignore  [(b'TBx', b'tb\xffx', True),  (b'TB\xc4x', b'tb\xffx', True)]

5. pytest, one call at a time

Each call was UTF-8, with the disk gate (25G free, 39% inodes) and no other pytest running.

Run Head Result
tests/test_bootstrap_branch_one_byte_locale.py 4682320a980c (bootstrap blob d3bedd42, rows blob ccad672d) ============================= 102 passed in 45.25s =============================
R3 alone, XUTFTOWCSN row only 4682320a980c ============================== 1 failed in 1.07s ===============================
R7 alone, XUTFTOWCSN row only 4682320a980c ============================== 1 failed in 0.21s ===============================
  • Both mutants were exact replacements, each text occurring once, in a separate detached worktree of the head. They are r1308b's R3 and R7: 0xC2 <= lead to 0xC1 <= lead, and lead < 0xF5 to lead < 0xF8.
  • Why R3 fails: the assertion diff names the new entries.
    {b'\xc1\x81': 'A'} != {b'\xc1\x81': 'Á81'}
    {b'\xc1\xbf': '\x7f'} != {b'\xc1\xbf': 'Á¿'}
    
  • Why R7 fails:
    {b'\xf7\xbf\xbf\xbf': '\udfbf\udfff'} != {b'\xf7\xbf\xbf\xbf': '÷¿¿¿'}
    {b'\xf5\x80\x80\x80': '\udcc0\udc00'} != {b'\xf5\x80\x80\x80': 'õ808080'}
    
  • Restores proved by blob equality, after each run:
    restored: file d3bedd42bfb400886170b389b0be26041a92be19 HEAD d3bedd42bfb400886170b389b0be26041a92be19 equal=True; status: (clean)
    
  • The body's R3 and R7 rows say 1 failed in 0.23s and 1 failed in 0.27s. My times differ, but only in wall clock; the failing assertions are the ones the body names.

6. The body's round-2 parts

  • Shas, counts and blobs. All seven shas the body names exist: dbf022ae, 0ac4efbc, 3beceb51, 248669b1, 166d843dc56e, 4682320a980c, cb9ed806. The blob claims match:
    bootstrap.py  166d843d 2c470451  ->  4682320a d3bedd42   (body: 2c470451 to d3bedd42)
    rows file     166d843d 269a0d16  ->  4682320a ccad672d   (body: 269a0d16 to ccad672d)
    
  • Claims. I checked these against what I measured:
    • 24 names to 29, and 26 probe names in the row.
    • The three extra names.
    • 5 of 5 equal to the port.
    • ast.dump without docstrings equal.
    • R3 and R7 killed at the head.
  • Closing forms. Closes #1306 on line 1 is the only closing form. A grep for close/fix/resolve ... #N over the body found nothing else.
  • ASCII. The body is ASCII apart from the footer line 319, 🤖 Generated with [Claude Code](...).
  • merge-tree. The tree the body names, 0cfc476e6ecf..., is what git merge-tree --write-tree 4682320a dc9a0bcc7 gives, rc=0. Against current origin/main it is a different tree (N1).

What I did not cover

  • Locales: I ran only the UTF-8 pass. I did not run Latin-1 or ASCII, or a 3.14-like path shim. The change is table entries, docstrings and a comment, with no path guard.
  • Wider runs: I did not run the other test_bootstrap_*.py files, the gate trio, or any base-versus-head run. The code is unchanged apart from docstrings, which the ast.dump equality shows. r1308b's earlier measurements stand.
  • Body reading: I read only the round-2 parts and the parts naming shas, counts and the closing form. I did not re-read the 319-line body in full.
  • Port correctness: I used r1308b's xcore.py as the oracle without re-deriving it from the C. Its 10.7M-name agreement is r1308b's measurement; I did not repeat it.
  • Git for Windows' source: I did not fetch it again.

No pytest run is left going. Probes and logs are in /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1308c/: probe/tables.py, probe/dupkeys.py, probe/astcmp.py, probe/pairs.py, probe/mut.py, pt.sh, runmut.sh and logs/.

@brettheap
brettheap marked this pull request as ready for review November 10, 2026 17:55
@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026

Copy link
Copy Markdown

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 19 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@brettheap

Copy link
Copy Markdown
Contributor Author

(lane openRepoShape-1, 2026-11-10T17:55:22Z) Lane 1's decision on r1308c's delta review (issuecomment-6774955700, READY at 4682320a): #1308 is marked ready for review.

Lane: openreposhape-1 (openRepoShape-1)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant