Skip to content

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

Open
brettheap wants to merge 5 commits into
mainfrom
fix/1283-bootstrap-branch-latin1

Conversation

@brettheap

@brettheap brettheap commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1283

Milestone v1.2.2: lane 3 placed #1283 there, and v1.2.1 is frozen.

Base: origin/main 5f06c3eb (5f06c3e), #1278's squash, which also carries #1281. Head: cb9ed806 (cb9ed80), review round 1's commit (see Review round 1). Its parent is dfd69ff7, GitHub's update-branch merge, whose two parents are:

dfd69ff7's tree, 2b159e15, is the one git merge-tree --write-tree 066e4468 5f06c3eb gives. The sections from What to Merge-tree were measured at c092d331 unless they name 066e4468, against main 0354a7e7, whose bootstrap.py is the same blob, 41c2eb42, as at 5f06c3eb. Review round 1 gives the runs at cb9ed806. The PR changes templates/assembly-root/scripts/bootstrap.py (blob 41c2eb42 to 8e0f76c7; 991c06ea before round 1) and adds tests/test_bootstrap_branch_one_byte_locale.py. It touches none of #1278's three files. Main has since moved to b607223b, which leaves bootstrap.py at 41c2eb42; lane 1 refreshes the branch when it lands.

What

Under a Latin-1 locale, a project whose project.yaml says tracking_branch: "tb\udcffx" (#715's spelling of the byte 0xFF) now gets what UTF-8 and ASCII get:

  • the first run says branch tb\udcffx created at <pin> in each leg, and the spec leg's branch tracks origin/tb<ff>x;
  • every later run says on tb\udcffx at <pin> (branch tip == pin).

On main the same run made the branch in both legs, with HEAD on it at the pin, then said:

  [spec] spec: could not create branch 'tb\udcffx' at the pin d6d63f5b099d; leaving detached
          `git checkout -b` exited 0, and HEAD is not on the branch at the pin
          nothing else is tried; the recorded pin is authoritative. Deal with what git said and run bootstrap again.

Every later run said branch tb\udcffx is at the pin d6d63f5b099d, and git refused to check it out:, over the same exited 0. Each run ended bootstrap ok, exit 0. Six more places in step (a) compared the same way (see the audit).

No exit code changes anywhere. On Windows under PYTHONLEGACYWINDOWSFSENCODING=1, _argument_fault lets a lone surrogate through, and git cannot be handed it as UTF-8. Since review round 1, _branch_ref compares such a name as main compared it, so no exit code changes there either, where dfd69ff7 raised UnicodeEncodeError out of step (a), a traceback. That is emulated, not run on Windows, and the row test_a_name_git_cannot_be_handed_is_compared_as_its_text holds it (Review round 1). No line changes under ASCII. Under UTF-8, one kind of name changes: one that spells UTF-8's own bytes as surrogates, such as caf\udcc3\udca9. Main misread it under UTF-8 in the same way (measured below). No existing row changes outcome under UTF-8 (see Tests).

Why

The cause, measured on main in the Latin-1 flow's own tree (Python 3.12.3, git 2.43.0, sys.getfilesystemencoding() iso8859-1):

  • The ref's bytes. git symbolic-ref HEAD | od -c in spec gives r e f s / h e a d s / t b 377 x \n, the same in code. git rev-parse HEAD is the pin in both.
  • What _head_of returns. It decodes those bytes with os.fsdecode, which gives 'refs/heads/tb\xffx'. That is U+00FF, Latin-1's character for the byte 0xFF.
  • The manifest's branch as text. It is 'tb\udcffx': U+DCFF, the surrogate that stands for the byte 0xFF. os.fsencode hands it to git as tb<ff>x in every locale.
  • The comparison that fails. create_at_pin asks _head_of(sub) != (pin, f"refs/heads/{branch}") (main :1755). That compares 'refs/heads/tb\xffx' with 'refs/heads/tb\udcffx' and finds them different. Measured in process under Latin-1 for HEAD on tb<ff>x: the text comparison gives False, and _branch_ref's gives True. Under UTF-8 and ASCII, os.fsdecode(b"\xff") is U+DCFF, so both give True.

The decision: compare with the ref read back, not with the manifest's text. _branch_ref(branch) is os.fsdecode(_handed_to_git(f"refs/heads/{branch}")). It is the bytes git is handed for the name (#961's own helper), decoded as _head_of decodes HEAD's ref. Each place that asks whether HEAD is on the tracking branch now compares _head_of's ref with it: eight comparisons in five functions, which _branch_ref's docstring names. _folded_twin is the one check that still compares text (audit row 8, #1306). A name git cannot be handed, which _handed_to_git raises UnicodeEncodeError on, is compared as its text, as main compared it; _paste_word keeps spelled's text for such a name the same way (Review round 1). The lines go on printing the manifest's spelling (spelled(branch), and {branch!r} in could not create). So row 13's lines are word for word what it asks, under every locale. Both sides now pass through os.fsdecode, so equal text means equal bytes on POSIX.

Rejected:

  • _head_of returning bytes. Its text is printed (_place_of), folded (_folded_twin) and prefix-tested (_on_a_branch), so every reader would change. The issue says so too.
  • Reading the branch back once, at the top of checkout_tracking_branch. That would reach every comparison in one line. But the lines print branch, so under Latin-1 every line would name tb U+00FF x where the manifest says tb\udcffx. Row 13 asserts the manifest's spelling.
  • Comparing bytes on both sides, os.fsencode(current) == os.fsencode(ref). On POSIX this is the same answer. On Windows with PYTHONLEGACYWINDOWSFSENCODING=1, os.fsencode is mbcs with replace, so two names the code page lacks could encode alike. _handed_to_git is UTF-8 there, which is what git for Windows stores. This is read from the code, not run on Windows.
  • Reading the branch back in _folded_twin too. It is not needed for the tracking branch itself: no fold turns U+00FF into U+DCFF, so it already answers "no twin" there in every locale (measured). It would also change what a twin is under Latin-1: bytes 0xC4 and 0xE4 would become twins, as U+00C4 and U+00E4 (computed in process), where UTF-8 calls them none. What a twin is for a name that is not UTF-8 is a question of its own, filed as assembly-root bootstrap.py: _folded_twin compares HEAD's ref as the locale reads it with the manifest's text, so a case twin is missed under Latin-1 (TB<ff>x for tb\udcffx) and UTF-8 (CAF<c3 a9> for caf\udcc3\udca9), and the branch is made #1306. See Known limits.
  • Keeping UTF-8's lines for caf\udcc3\udca9. Those lines were false under UTF-8 too. On main, HEAD was on refs/heads/caf<c3 a9> at the pin while the run said could not create, then git refused. Keeping them would keep the defect for UTF-8.

The pinned-copy rules hold. The file imports nothing new, and _branch_ref uses only os and the file's own _handed_to_git. tests/test_pinned_copy_text.py passes (Tests, call 3; Review round 1, R6).

Measured

A probe built one scaffold's recursive clone. For each case it copied the clone and set tracking_branch, set up the leg with git (naming the branch by the bytes the child hands git), and ran scripts/bootstrap.py --skip-validators with PYTHONIOENCODING=utf-8:strict. It runs in the probe environment, on main 0354a7e7 (blob 41c2eb42) and on the head c092d331 (blob 991c06ea).

Shas are normalized when lines are compared.

Case (the spec leg, unless named) Latin-1, main Latin-1, head UTF-8 ASCII
tb\udcffx, first run, origin/tb<ff>x in spec could not create branch ... leaving detached in both legs; spec has no upstream created in both legs; spec tracks refs/remotes/origin/tb<ff>x created, the same on both created, the same on both
the same, second run git refused to check it out in both legs on tb\udcffx at <pin> in both on, the same on both on, the same on both
the same, third run, code with a commit of its own spec refused; code: The checkout stays at <sha> (on tb U+00FF x) spec on; code: stays on tb\udcffx at its tip stays on ... at its tip, the same on both the same on both
branch behind the pin, HEAD on it git refused to move it:, git's fatal: cannot force update the branch 'tb<ff>x' used by worktree fast-forwarded <old> -> <new>, the pin fast-forwarded, the same on both the same on both
branch behind the pin, leg detached at the new pin moved ... -> <pin>, the pin, and git refused to check it out fast-forwarded fast-forwarded, the same on both the same on both
branch past the pin, its tip origin's, leg detached at the pin moved back ..., and git refused to check it out moved back ...; nothing is lost, origin/tb U+00FF x still holds those commits ... origin/tb\udcffx still holds ..., the same on both as UTF-8, the same on both
second run, a failing post-checkout hook git refused to check it out: and the hook's words on, then nothing to check out, and then git said: and the hook's words as Latin-1 head, the same on both the same on both
HEAD on tb<ff>x with no commit yet could not create branch ...; leaving it on tb U+00FF x created, and no line that the leg left a branch created, the same on both the same on both
caf\udcc3\udca9, three runs could not create, then git refused created, then on main: could not create, then git refused; head: created, then on created, then on, the same on both
CONTROL feature/x created, then on the same not run not run
CONTROL tb\xffx, U+00FF itself created (ref tb<ff>x), then on tb U+00FF x the same created (ref tb<c3 bf>x), the same on both did not try branch: #710's UNWRITABLE, the same on both

Across all 28 cases, between main and head:

  • 9 cases differ: the 8 Latin-1 cases over tb\udcffx and caf\udcc3\udca9, and caf\udcc3\udca9 under UTF-8.
  • The other 19 are the same line for line: every ASCII case, every UTF-8 case but that one, and both Latin-1 controls.
  • At head, each Latin-1 case over tb\udcffx prints what UTF-8 prints, but for the moved-back line's upstream (see the audit, row 9).
  • HEAD's bytes and commit after each run are the same on main and head, but in two cases. A branch behind the pin with HEAD on it stays at the old pin on main, and reaches the new pin at head. The spec leg's upstream is unset on main and set at head.

The audit

Every place in templates/assembly-root/scripts/bootstrap.py where a name git printed is compared with, or printed as, a name the manifest gave. Line numbers are main 0354a7e7's. "Wrong" means the place answers otherwise than UTF-8 does for the same bytes.

# Place What it does Latin-1, on main ASCII, on main Here
1 create_at_pin :1755 is HEAD on the new branch at the pin after checkout -b? wrong: could not create branch, upstream never set right _branch_ref
2 create_at_pin :1771 the the leg was on <x> line after created wrong from HEAD on the unborn tracking branch: the leg was said to have been on tb U+00FF x (mutant M9) right _branch_ref
3 _check_out :922 is HEAD on the branch at the pin after checkout? Reached from place_at_pin, fast_forward_to_pin (detached) and move_back_to_pin wrong: git refused to check it out right _branch_ref
4 place_at_pin :1501, already nothing to check out or checked out, under git's words after a non-zero exit wrong once 3 is mended: checked out, and then git said: (mutant M3) right _branch_ref
5 place_at_pin :1508 the the leg was on <x> line wrong once 3 is mended: the leg was on tb U+00FF x, which keeps its commits (mutant M4) right _branch_ref
6 fast_forward_to_pin :1584-1586 HEAD on the branch (merge --ff-only) or on another (branch -f)? wrong: branch -f on the checked-out branch, refused by git right _branch_ref
7 _stays :1679 on <branch> at its tip, or at <sha> (<where>) wrong: at <sha> (on tb U+00FF x) right _branch_ref
8 _folded_twin :1081-1084, through place_at_pin, fast_forward_to_pin, create_at_pin and _folded_spelling is HEAD's branch, or any branch, a twin of the tracking branch? right for the tracking branch itself: its fold never matches, so no twin (measured in every case above). A case twin whose bytes the locale reads as other text than the manifest's surrogates is missed: TB<ff>x for tb\udcffx under Latin-1 (UTF-8 and ASCII find it), and, under UTF-8 too, CAF<c3 a9> for caf\udcc3\udca9 (ASCII alone finds it). Measured in process and end to end: step (a) makes the branch beside the twin, and says could not create on main and created here (Review round 1) right not changed: #1306 (Known limits)
9 move_back_to_pin :1650-1651 prints the upstream _upstream_holding read prints git's name as this locale reads it: origin/tb U+00FF x under Latin-1, origin/tb\udcffx under UTF-8. The pasted word is the same bytes in both ("$(printf -- 'origin/tb\377x')"). This is not a comparison, and the name is git's, not the manifest's right not changed (Known limits)
10 _upstream_holding :883-888 reads the upstream's name and hands it back to rev-parse right: git's own bytes go back to git; only the ASCII prefix and the shas are compared right not changed
11 _place_of, through _say_left, _say_neither, _stays and create_at_pin's leaving it ... prints HEAD's ref right for another branch, printed as this locale reads it. For the tracking branch itself it is reached only through 2, 5 and 7 right through 2, 5 and 7
12 _say_twin, _say_spelling, _kept_name name a twin and give the rename right: the twin is git's name, and its paste word is its bytes right not changed
13 checkout_tracking_branch :1800-1803, and --set-upstream-to :1763 hand the manifest's name to git right: nothing is compared right not changed

ASCII is right everywhere. For every name _argument_fault lets through under ASCII, os.fsdecode(os.fsencode(name)) == name: ASCII text and U+DC80 to U+DCFF. Every ASCII case above is the same line for line on main and head. Under UTF-8, places 1 to 7 were wrong for a name that spells UTF-8's bytes as surrogates. Rows hold 1 and 3 for it. Place 8 misses such a name's case twin under UTF-8 too, and is not changed here (#1306).

templates/family-root/scripts/bootstrap.py has no _head_of and no refs/heads/{branch} comparison. Elsewhere, latent only: update-shape.py's Rollback compares _symbolic_head(root), which is git's bytes decoded as UTF-8 with surrogateescape, with f"refs/heads/{branch}", where --branch is argv decoded by the locale (:3779, :3796). :3815 is left out: it compares two texts that both come from _symbolic_head. Measured in process with HEAD on each name:

HEAD's bytes Latin-1 ASCII UTF-8
tb<ff>x differs equal equal
caf<c3 a9> differs differs equal

No run reaches it. Lane 1's investigator i1300a ran apply end to end under Latin-1, ASCII and UTF-8, with a hook that fails the commit so the rollback runs. A --branch that holds a byte that is not ASCII is refused as update-branch-invalid before anything is written: checked_branch asks BRANCH_RE (#227), which is ASCII only. A start branch that is not UTF-8 is refused as update-branch-not-utf8. The tree was the same after each of the 15 runs as before it. So no issue is filed. The comparison matters only if BRANCH_RE is ever widened past ASCII. Then :3779 and :3796, and the like comparisons at :3105 and :5759, must compare bytes.

Rows

tests/test_bootstrap_branch_one_byte_locale.py, 31 rows. Review round 1 added the 31st, which loads bootstrap.py in process (Review round 1); the table below is the first 30. Each of those runs bootstrap.py in a child under the locale it names, so a suite under UTF-8, as CI's is, measures Latin-1. The module builds its Latin-1 locale in its own module-scoped latin1 fixture with localedef -c, as #1153's and #1247's modules each build theirs. It imports neither: a module-scoped fixture imported into another module runs twice in the full suite (#1188). Where no Latin-1 locale can be built, the Latin-1 rows skip with localedef's words, and the UTF-8 and ASCII rows still run. On Windows the module skips.

Base is main's bootstrap.py (blob 41c2eb42) laid into a scratch clone at c092d331. The clone's file was then written back from HEAD's blob, and its blob, 991c06ea, equals HEAD's.

Row base head
test_the_first_run_says_it_made_the_branch_head_is_on[byte-0xff-latin1] failed: could not create branch 'tb\\udcffx' passed
...[utf-8-bytes-as-surrogates-latin1], ...[utf-8-bytes-as-surrogates-utf-8] 2 failed: could not create branch 'caf\\udcc3\\udca9' 2 passed
test_every_later_run_says_the_leg_is_on_the_branch[byte-0xff-latin1], [utf-8-bytes-as-surrogates-latin1], [utf-8-bytes-as-surrogates-utf-8] 3 failed: git refused to check it out 3 passed
test_a_hook_that_fails_where_nothing_moved_is_said_after_on[latin1] failed: git refused to check it out: and the hook's words passed
test_a_branch_behind_the_pin_is_fast_forwarded[latin1-head-on-the-branch] failed: git refused to move it: passed
...[latin1-detached-at-the-pin] failed: moved ..., and git refused to check it out: passed
test_a_branch_past_the_pin_with_no_commit_of_its_own_is_moved_back[latin1] failed: moved back ..., and git refused to check it out: passed
test_a_branch_with_a_commit_of_its_own_stays_with_head_on_it[latin1] failed: stays at <sha> (on tb U+00FF x) passed
test_a_leg_on_the_branch_with_no_commit_yet_is_not_said_to_leave_it[latin1] failed: could not create branch ...; leaving it on tb U+00FF x passed
CONTROLS: both flows over byte-0xff under UTF-8 and ASCII, ascii-name under Latin-1, u00ff-itself under Latin-1 and UTF-8, and utf-8-bytes-as-surrogates under ASCII (12); each single-site row under UTF-8 (6) 18 passed 18 passed
total 12 failed, 18 passed in 12.02 s 30 passed in 11.21 s (the same file before its commit; call 1 runs it at c092d331). On the edit committed as 066e4468: 30 passed in 13.06 s under UTF-8, and 30 passed in 13.06 s under a Latin-1 pytest. At cb9ed806, with the 31st row: 31 passed under UTF-8, Latin-1 and ASCII pytests (Review round 1)

Mutants

12 mutants of the changed lines, 11 killed at c092d331; at cb9ed806 the round 1 row kills M12 too, so 12 of 12 (delta review r1300b's Mvii). Each ran alone in the scratch clone at c092d331, over the new file and row 13. After each, bootstrap.py was written back from HEAD's blob and proved equal to it (991c06ea).

id mutant result rows that failed
M1 _branch_ref returns f"refs/heads/{branch}": the comparison put back to text, at every place KILLED, 12 failed every row that is not a CONTROL
M2 _check_out compares with the text KILLED, 6 failed the three later-run rows, the hook, detached-at-the-pin, moved_back
M3 place_at_pin's already with the text KILLED, 1 failed the hook row: checked out, and then git said:
M4 place_at_pin's the leg was on check with the text KILLED, 4 failed the three later-run rows, the hook
M5 fast_forward_to_pin's other_branch with the text KILLED, 1 failed [latin1-head-on-the-branch]
M6 fast_forward_to_pin's if current == ref with the text KILLED, 1 failed [latin1-head-on-the-branch]
M7 _stays with the text KILLED, 1 failed stays_with_head_on_it[latin1]
M8 create_at_pin's check after checkout -b with the text KILLED, 8 failed the three first-run rows and every Latin-1 single-site row that creates code's branch
M9 create_at_pin's the leg was on check with the text KILLED, 1 failed no_commit_yet_..._leave_it[latin1]
M10 read back as UTF-8 whatever the locale (os.fsencode(ref).decode("utf-8", "surrogateescape")): passes every UTF-8 row KILLED, 14 failed every Latin-1 row that is not a CONTROL, the U+00FF control under Latin-1, and the caf\udcc3\udca9 control under ASCII. Every UTF-8 row passes
M11 encoded as UTF-8 whatever the locale, read back as the locale reads (os.fsdecode(ref.encode("utf-8", "surrogateescape"))) KILLED, 2 failed the two CONTROL u00ff-itself-latin1 rows alone: it passes the UTF-8 controls and every Latin-1 row over tb\udcffx
M12 os.fsencode for _handed_to_git survived at c092d331, 31 passed; KILLED at cb9ed806 by the round 1 row ('refs/heads/tb?x' == 'refs/heads/tb\udcffx') equivalent on POSIX for the rows that run bootstrap.py (see below)

Tests

Python 3.12.3, git 2.43.0, in the probe environment, at most 2 calls at once, one basetemp per call slot. Calls run at head c092d331 under UTF-8 unless the row says otherwise. "Base" is main's bootstrap.py laid into the scratch clone at c092d331. Review round 1 gives the calls at cb9ed806.

call result
1. the new file, tests/test_bootstrap_spelling.py, tests/test_bootstrap_non_utf8_branch.py, tests/test_bootstrap_branch_bytes.py, UTF-8 head 329 passed in 66.92 s; base 12 failed (the new rows), 317 passed in 61.17 s
1b. the same four, under a Latin-1 pytest head 8 failed, 316 passed, 5 skipped in 58.11 s; base 21 failed, 303 passed, 5 skipped in 52.73 s
1c. the same four, under an ASCII pytest head 4 failed, 319 passed, 6 skipped in 75.48 s; base 16 failed, 307 passed, 6 skipped in 57.24 s
2. every tests/test_bootstrap_*.py (14 files) 673 passed, 3 skipped in 173.25 s
3. tests/test_pinned_copy_text.py, tests/test_assembly_root_unreadable_paths.py, tests/test_bom_reads.py 194 passed in 33.03 s
4. tests/test_scaffold_leg_path_collisions.py, tests/test_path_guard_hygiene.py, tests/test_no_auto_maintenance.py 283 passed, 2 skipped in 20.11 s
5. tests/test_agents_md_codes.py, tests/test_cli_reference.py, tests/test_repo_hygiene.py 171 passed in 24.47 s
6. tests/test_shape_doctor.py, shard 1 of 4 (113 ids) 111 passed, 2 skipped in 126.78 s
7. shard 2 of 4 (112 ids) 110 passed, 2 skipped in 115.88 s
8. shard 3 of 4 (112 ids) 111 passed, 1 skipped in 122.91 s
9. shard 4 of 4 (112 ids) 110 passed, 2 skipped in 120.79 s
row 13 alone, main 0354a7e7 Latin-1 1 failed (at tests/test_bootstrap_spelling.py:454, could not create branch); UTF-8 1 passed; ASCII 1 passed
row 13 alone, head c092d331 Latin-1 1 passed; UTF-8 1 passed; ASCII 1 passed
10. the new file, on the edit committed as 066e4468 (run just before the commit; the file's blob, 622cbf3a, is the same at 066e4468 and dfd69ff7) UTF-8 30 passed in 13.06 s; Latin-1 pytest 30 passed in 13.06 s

Row 13 on the merge with #1278

git merge-tree --write-tree c092d331 31f94270 (#1278's head) is clean: tree e4aa7b8e8d4df920e768cfd2ff336b7678f30e0a. A detached scratch worktree of a commit-tree of it (626c6a42, never pushed) gave:

run Latin-1 UTF-8
row 13 alone 1 passed in 2.12 s
#1278's rows 9 to 12 and row 13 of tests/test_bootstrap_spelling.py 1 passed, 4 skipped in 2.65 s (rows 9 to 12 skip: this system's file name encoding (iso8859-1) cannot spell 'sp\u2028ec', and the same of 'At\u2028las', 'Ink\u2028Router' and 'ta\u2028rget.py') 5 passed in 3.18 s
tests/test_bootstrap_spelling.py and the new file 233 passed, 4 skipped in 57.17 s 237 passed in 43.95 s

So with #1278 and this PR both in, tests/test_bootstrap_spelling.py has no failure under Latin-1. #1278 leaves row 13 as it is written, and it passes.

At 066e4468 the merge with #1278's head is clean too, tree 2fe4158216748a8c1d6c1bf3bbfe699bc3d52426. A commit-tree of it (c3853fe4, never pushed) was checked out in the same scratch worktree:

At the real head. #1278 landed as 5f06c3eb, and dfd69ff7 is GitHub's merge of it into 066e4468; its tree is the one merge-tree predicted (Base, above). Lane 1's reviewer r1300a ran at dfd69ff7, and this round ran at cb9ed806, in the probe environment:

run Latin-1 UTF-8 ASCII
row 13 alone, cb9ed806 1 passed in 2.35 s 1 passed in 1.86 s 1 passed in 2.29 s
#1278's rows 9 to 12 and row 13, cb9ed806 1 passed, 4 skipped in 3.10 s 5 passed in 4.23 s 1 passed, 4 skipped in 3.14 s
#1278's rows 9 to 12 and row 13, dfd69ff7 (r1300a) 1 passed, 4 skipped in 2.86 s 5 passed in 3.40 s 1 passed, 4 skipped in 2.86 s

Rows 9 to 12 skip under Latin-1 and ASCII with the words above, (iso8859-1) or (ascii). Row 13 passes in all three locales at the real head.

Merge-tree

Review round 1 (r1300a)

Lane 1's reviewer r1300a reviewed dfd69ff7 in issuecomment-6764753070: NOT READY, with F1 and F2 SHOULD and F3 to F5 NIT. It found the change right on POSIX, and its 8 mutants were all killed. This round is one commit, cb9ed806, on dfd69ff7, with no merge of main.

F1 (SHOULD): _folded_twin still compares HEAD's ref with the manifest's text, and no open issue named its misses (#1283's fourth box). Lane 1 ruled that _folded_twin stays as it is: what a case twin is for a name that is not UTF-8 is a question of its own, and w1283a's Latin-1 objection stands (the bytes 0xC4 and 0xE4 would become twins). This round:

End to end at cb9ed806, with HEAD on the twin at the pin and the tracking branch absent (the spec leg; code says created in each run):

  • TB<ff>x for tb\udcffx: UTF-8 and ASCII say branch tb\udcffx does not exist (the pin is 5985a5dad55d), and the checkout is on TB\udcffx, which differs from tb\udcffx only in case, and leave the leg. Latin-1 says branch tb\udcffx created at 5985a5dad55d U+2014 at the pin, then the leg was on TB U+00FF x, which keeps its commits; it is on tb\udcffx now.
  • CAF<c3 a9> for caf\udcc3\udca9: ASCII gives the twin lines. UTF-8 says created, then the leg was on CAF U+00E9 ...; Latin-1 does too, with CAF U+00C3 U+00A9.
  • On main, the same two misses make the branch beside the twin as well, then say assembly-root bootstrap.py: under Latin-1, tracking_branch tb\udcffx is made with HEAD on it at the pin, but _head_of reads the ref as another text, so it says could not create branch, then git refused to check it out, both false (#1259 row 13) #1283's could not create branch 'tb\udcffx' at the pin 5985a5dad55d; leaving it on TB U+00FF x (and the same for caf\udcc3\udca9 under UTF-8). HEAD and the branches after each run are the same on main and here. Every run exits 0.
  • HEAD detached at the pin, the twin a branch there: _folded_spelling misses TB<ff>x under Latin-1 (UTF-8 finds it) and CAF<c3 a9> under UTF-8 (ASCII finds it), and step (a) says created (in the issue).

F2 (SHOULD): on Windows under PYTHONLEGACYWINDOWSFSENCODING=1, _branch_ref raised UnicodeEncodeError for a name _argument_fault lets through. Lane 1 took the review's way (a):

  • _branch_ref catches UnicodeEncodeError from _handed_to_git and returns f"refs/heads/{branch}", main's comparison, as _paste_word already does for such a name.
  • _argument_fault and _fsencoded_length are unchanged. The review's way (b) would add a refusal that the issue does not ask for.
  • _argument_fault's docstring now says that its "a lone surrogate is never handed to git" holds under Windows' default surrogatepass. Under the legacy mode one passes, as on main, and _branch_ref falls back.
  • On POSIX the except is never taken for a name step (a) reaches: _argument_fault first refuses each character os.fsencode cannot write.

The row is test_a_name_git_cannot_be_handed_is_compared_as_its_text.

  • It sits in the new file, beside _branch_ref's other rows, rather than in tests/test_bootstrap_pasteable_lines.py, whose LegacyMbcsOs it mirrors. That file holds the pasted words, and this keeps the PR to its two files.
  • Its stand-in os is the file's own, so the file imports no further test module. The module skips on Windows, so the row runs on POSIX hosts, CI's included.
  • With the module's os set to the legacy mode's stand-in (nt, os.fsencode and os.fsdecode as cp1252 with replace for mbcs), it asserts three things:
    • _argument_fault("tb\udcffx") is None;
    • _branch_ref("tb\udcffx") is refs/heads/tb\udcffx;
    • _branch_ref of caf U+00E9 is git's UTF-8 as the code page reads it, refs/heads/caf U+00C3 U+00A9.
  • With dfd69ff7's blob 991c06ea laid into a scratch clone at cb9ed806, the row fails under UTF-8, Latin-1 and ASCII pytests with UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 13: surrogates not allowed. The blob written back is 8e0f76c7, equal to HEAD's, and git status --short is empty.

r1300a's legacy_emul.py, unchanged, at dfd69ff7 and at cb9ed806:

== legacy_emul.py on bootstrap-dfd69ff7.py (blob 991c06ea)
'tb\udcffx' fault: None; _branch_ref RAISES UnicodeEncodeError 'utf-8' codec can't encode character '\udcff' in position 13: surrogates not allowed
'caf\xe9' fault: None; _branch_ref: 'refs/heads/caf\xc3\xa9'; HEAD as _head_of reads git's UTF-8: 'refs/heads/caf\xc3\xa9' text equal: False ref equal: True
'main' fault: None; _branch_ref: 'refs/heads/main'; HEAD as _head_of reads git's UTF-8: 'refs/heads/main' text equal: True ref equal: True
== legacy_emul.py on bootstrap-cb9ed806.py (blob 8e0f76c7)
'tb\udcffx' fault: None; _branch_ref: 'refs/heads/tb\udcffx'; _branch_ref RAISES UnicodeEncodeError 'utf-8' codec can't encode character '\udcff' in position 13: surrogates not allowed
'caf\xe9' fault: None; _branch_ref: 'refs/heads/caf\xc3\xa9'; HEAD as _head_of reads git's UTF-8: 'refs/heads/caf\xc3\xa9' text equal: False ref equal: True
'main' fault: None; _branch_ref: 'refs/heads/main'; HEAD as _head_of reads git's UTF-8: 'refs/heads/main' text equal: True ref equal: True

At cb9ed806, _branch_ref returns 'refs/heads/tb\udcffx'. The RAISES printed after it comes from the probe's own next call, ("refs/heads/" + branch).encode("utf-8"), which stands in for the bytes git stores and has no UTF-8 for the surrogate either. A copy with _branch_ref's call in a try of its own (legacy_emul_split.py) prints, at cb9ed806:

'tb\udcffx' fault: None; _branch_ref: 'refs/heads/tb\udcffx' == main's text: True; git's stored bytes: no UTF-8 for it, not emulated
'caf\xe9' fault: None; _branch_ref: 'refs/heads/caf\xc3\xa9' == main's text: False; HEAD as _head_of reads git's UTF-8: 'refs/heads/caf\xc3\xa9' text equal: False ref equal: True

So tb\udcffx no longer raises, and caf U+00E9 still compares right: equal to HEAD's ref, where main's text was not.

F3 (NIT): the shas predated the update-branch. Base and Head now name cb9ed806, dfd69ff7 and main 5f06c3eb, and "Row 13 on the merge with #1278" cites runs at the real head.

F4 (NIT): an update-shape.py line number. The audit says :3779 and :3796. It leaves out :3815, whose two texts both come from _symbolic_head.

F5 (NIT): call 10. It says it ran on the edit committed as 066e4468.

Measured at cb9ed806, in the probe environment, one call at a time:

call result
R1. the new file, UTF-8 31 passed in 14.37 s
R2. the new file, Latin-1 pytest 31 passed in 14.82 s
R3. the new file, ASCII pytest 31 passed in 14.29 s
R4. the new file, tests/test_bootstrap_spelling.py, tests/test_bootstrap_non_utf8_branch.py, tests/test_bootstrap_branch_bytes.py, UTF-8 330 passed in 72.95 s
R5. every tests/test_bootstrap_*.py (14 files, listed into a file, checked non-empty, passed with xargs -d '\n' -a), UTF-8 674 passed, 3 skipped in 199.47 s
R6. tests/test_pinned_copy_text.py, tests/test_path_guard_hygiene.py, tests/test_no_auto_maintenance.py, UTF-8 266 passed, 2 skipped in 26.85 s
R7. row 13 alone Latin-1 1 passed in 2.35 s; UTF-8 1 passed in 1.86 s; ASCII 1 passed in 2.29 s
R8. #1278's rows 9 to 12 and row 13 Latin-1 1 passed, 4 skipped in 3.10 s; UTF-8 5 passed in 4.23 s; ASCII 1 passed, 4 skipped in 3.14 s
R9. the new row, dfd69ff7's bootstrap.py laid in UTF-8, Latin-1 and ASCII: 1 failed each (UnicodeEncodeError)
R10. tests/test_repo_hygiene.py, tests/test_scaffold_leg_path_collisions.py, tests/test_assembly_root_unreadable_paths.py, tests/test_bom_reads.py, UTF-8 312 passed in 26.04 s
  • R1, R4 and R5 are the counts before the round plus the one new row: 30 to 31, 329 to 330, 673 to 674.
  • R5's 3 skips are tests/test_bootstrap_ref_store.py:102: this git makes no reftable repository.
  • R6's 2 are tests/test_no_auto_maintenance.py:222, as call 4's.

Mutants of the fallback: 2 killed of 2. Each ran alone in a scratch clone at cb9ed806:

  • over the new file and row 13 under a UTF-8 pytest;
  • over the new row under Latin-1 and ASCII pytests.

After each, bootstrap.py was written back from HEAD's blob and proved equal, restored 8e0f76c7b470a7dc3dd0ebb20589d5ae716c6df1 HEAD 8e0f76c7b470a7dc3dd0ebb20589d5ae716c6df1 equal=True, and git status --short was empty.

id mutant UTF-8: new file and row 13 Latin-1 and ASCII: the new row
Mi the except taken out (dfd69ff7's body) KILLED, 1 failed, 31 passed: the new row, UnicodeEncodeError KILLED, 1 failed each
Mii the except returns the ref read back, os.fsdecode(os.fsencode(f"refs/heads/{branch}")), not the text KILLED, 1 failed, 31 passed: the new row, assert 'refs/heads/tb?x' == 'refs/heads/tb\udcffx' KILLED, 1 failed each

Mii is why the row sets a stand-in os rather than making _handed_to_git raise over this system's os. There, Mii's read-back gives refs/heads/tb\udcffx back under UTF-8 and ASCII (reasoned, not run). The stand-in's code page writes the surrogate as ?, so the row kills Mii in every locale.

Known limits

Not in this PR

Lane: openreposhape-1 (openRepoShape-1)

🤖 Generated with Claude Code

Brett Heap and others added 3 commits November 10, 2026 08:31
…branch as the bytes git was handed, read back as git's are, so under Latin-1 a branch `tb\udcffx` it made is said created, then on it, never `could not create` or `git refused` (#1283)

`_head_of` reads HEAD's ref with `os.fsdecode`, and step (a) compared that
text with `refs/heads/<branch>` as the manifest spells it. Under a locale of
one byte to a character the two differ for a name that holds a surrogate:
`tb\udcffx` is handed to git as `tb<ff>x` and read back as `tb` U+00FF `x`.

`_branch_ref(branch)` is the ref as `_head_of` reads it back: the bytes
`_handed_to_git` gives, through `os.fsdecode`. Every comparison of
`_head_of`'s ref with the tracking branch uses it: `_check_out`,
`place_at_pin` (`already` and the left-a-branch line), `fast_forward_to_pin`
(on the branch, or another), `_stays`, and `create_at_pin` (the check after
`checkout -b`, and the left-a-branch line). The lines still print the
manifest's spelling.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t's bootstrap.py under a Latin-1 locale it builds, over `tb\udcffx`, at each place step (a) asks whether HEAD is on the tracking branch (#1283)

30 rows. Each runs `bootstrap.py --skip-validators` in a child under the
locale it names, so a suite under UTF-8, as CI's is, measures Latin-1. The
locale is built by this module's own module-scoped `latin1` fixture with
`localedef -c`, not imported from `test_adopt_one_byte_locale.py` (#1188);
where none can be built the Latin-1 rows skip with `localedef`'s words.

- the first run and every later run, over `tb\udcffx` under Latin-1, UTF-8
  and ASCII, over `feature/x` and U+00FF itself under Latin-1, and over
  `caf\udcc3\udca9` under all three;
- a failing post-checkout hook where nothing moved, a branch behind the pin
  (HEAD on it, and detached at the new pin), a branch past the pin moved
  back, a branch with a commit of its own, and HEAD on the branch with no
  commit yet, each under Latin-1 and UTF-8.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…escape, so the file is ASCII (#1283)

The `u00ff-itself` row's two literals held the character itself. The AST is
the same before and after (`ast.dump` equal), so no row's value changes.

Lane: openreposhape-1 (openRepoShape-1)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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

Add _branch_ref to compare HEAD’s decoded ref with the tracking-branch bytes handed to Git, and use it at each step (a) branch check while preserving the manifest spelling in output.

  • templates/assembly-root/scripts/bootstrap.py L69-73, L701-708, L868-920 (+8 small edits)

Tests

Add locale-sensitive integration coverage for branch creation, later checkout and related step (a) paths, plus a Windows legacy-encoding emulation.

  • tests/test_bootstrap_branch_one_byte_locale.py L1-475

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 #1300 (#1283) for lane openRepoShape-1, by r1300a (opus), at dfd69ff: NOT READY

The fix is right on POSIX. On the head dfd69ff7 (the bootstrap.py blob is 991c06ea), all 8 changed comparisons in 5 functions now compare git's ref bytes with the bytes git was handed. I measured:

  • The cause under Latin-1, and the caf\udcc3\udca9 change under UTF-8.
  • The rows, base (main's blob) against head.
  • Row 13 in three locales.
  • 8 mutants of my own, all killed.

Two SHOULDs hold it, and neither needs much work:


Findings

F1 SHOULD: _folded_twin still compares HEAD's ref with the manifest's text. Its misses are measured, but no open issue names them, so #1283's fourth "Done when" box is unmet.

Where: templates/assembly-root/scripts/bootstrap.py:1110-1113 at dfd69ff7.

  • It is reached from place_at_pin:1522, fast_forward_to_pin:1609 and create_at_pin:1753 with HEAD's ref, and from _folded_spelling:1219 with every branch.
  • held != branch is meant to ask "not byte for byte". _fold(held) == _fold(branch) compares two texts that were decoded differently.

Evidence. The probe hands _folded_twin HEAD's ref as os.fsdecode reads it, with the head blob, in each locale:

$ <locale> python3 r1300a/probe/twin.py <head bootstrap.py>
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
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
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
$ gh issue view 896 / 962 --json state
896 CLOSED / 962 CLOSED

What this shows:

Fix:

  • Lane 1 files an issue for _folded_twin that names both cases (Latin-1 TB<ff>x, UTF-8 CAF<c3 a9>).
  • Cite that issue in Known limits and in "Not in this PR", and add the UTF-8 case to the Known limit.
  • Narrow the docstring's "Every check" to the 8 comparisons, or name _folded_twin as the exception.
  • Comparing held with _branch_ref(branch)[len("refs/heads/"):] is the other way out. It is lane 1's call, given the writer's Latin-1 Ä/ä objection.

F2 SHOULD: on Windows under PYTHONLEGACYWINDOWSFSENCODING=1, _branch_ref raises UnicodeEncodeError for a branch name that _argument_fault lets through. The result is a traceback (exit 1) where main exited 0. Read and emulated, not run on Windows.

Where:

  • bootstrap.py:886: _branch_ref calls _handed_to_git, which is strict UTF-8 on Windows (:1374-1375).
  • _argument_fault:719-736 measures each character with os.fsencode (_fsencoded_length:739-744). In legacy mode that is mbcs with replace, so a lone surrogate encodes to one byte, ?, and passes.
  • _git_runs catches only OSError (:350-361).
  • So the raise escapes create_at_pin (after its checkout -b has run), place_at_pin, fast_forward_to_pin, _stays and _check_out.
  • The docstring at :697-704 says a lone surrogate is never handed to git on Windows. That holds only under surrogatepass.

Evidence. This is a Linux emulation, not a Windows run. It sets os.name = "nt" and uses os.fsencode/os.fsdecode as cp1252 with replace, as a stand-in for mbcs:

$ python3 r1300a/probe/legacy_emul.py <head bootstrap.py>
'tb\udcffx' fault: None; _branch_ref RAISES UnicodeEncodeError 'utf-8' codec can't encode character '\udcff' in position 13: surrogates not allowed
'caf\xe9' fault: None; _branch_ref: 'refs/heads/caf\xc3\xa9'; HEAD as _head_of reads git's UTF-8: 'refs/heads/caf\xc3\xa9' text equal: False ref equal: True
'main' fault: None; _branch_ref: 'refs/heads/main'; HEAD as _head_of reads git's UTF-8: 'refs/heads/main' text equal: True ref equal: True

The same emulation shows the head improves legacy mode for an ordinary non-ASCII name: café compares right at the head and wrong on main. The body's "No exit code changes anywhere" therefore holds on POSIX only.

Fix (either):

  • (a) In _branch_ref, catch UnicodeEncodeError and return f"refs/heads/{branch}", main's comparison, for a name git cannot be handed, as _paste_word already does. A row can hold it with the monkeypatch pattern of tests/test_bootstrap_non_utf8_branch.py (ascii_fsencode).
  • (b) Have _fsencoded_length measure _handed_to_git(char), so a lone surrogate is refused on Windows in both modes, as the docstring says.

At the least, add a Known limit and qualify "No exit code changes" to POSIX.

F3 NIT: the body's shas predate the update-branch.

The body says "Base: origin/main 0354a7e7 ... Head: 066e4468, three commits." The head under review is dfd69ff7, a merge of main 5f06c3eb, which is #1278's squash and also carries #1281.

$ git rev-parse dfd69ff7^{tree}; git merge-tree --write-tree 066e4468 5f06c3eb
2b159e154c054b3c6045664f3ad5a5993bb3bef0
2b159e154c054b3c6045664f3ad5a5993bb3bef0

The real merge is the one predicted. The "Row 13 on the merge with #1278" section can now cite the real head: row 13 passes there in all three locales (runs 6 to 8 below).

Fix: update the Base/Head paragraph to dfd69ff7 and main 5f06c3eb.

F4 NIT: one update-shape.py line number in the audit is wrong.

The audit cites update-shape.py at "(:3779, :3794, :3815)", but :3794 is not a comparison:

$ git show 0354a7e70:update-shape.py | sed -n 3794p; ... 3796p
            done.append(f"absent    {branch} (never created)")
        if _symbolic_head(self.root) == ref:

The body's later sentence already says :3796. Fix: change :3794 to :3796.

F5 NIT: "call 10. the new file at 066e4468" was run before that commit existed.

The writer's logs _lane1-scratch/w1283a/logs/head3-newfile-{utf8,latin1}.log both record head=c092d331c3af, from 08:55:08Z to 08:55:21Z. 066e4468 was committed at 08:55:28Z, so both runs were on the uncommitted edit. The claim's substance holds: the file's blob is 622cbf3a at both 066e4468 and dfd69ff7, and my runs at dfd69ff7 give 30 passed under UTF-8, Latin-1 and ASCII.

Fix: say "on the edit committed as 066e446", or cite the runs at dfd69ff7.


What was checked

1. The cause, re-measured on main's blob 41c2eb42 under Latin-1

I built Latin-1 with localedef -c in scratch, as #1153's test builds it; the child reports iso8859-1. The probe used one scaffold per case, bootstrap.py --skip-validators, and PYTHONIOENCODING=utf-8:strict. spec had refs/remotes/origin/<bytes> at the pin.

===== main-latin1-ff
--- run 1: exit 0
  [spec] spec: could not create branch 'tb\udcffx' at the pin 7766d57ffa79; leaving detached
          `git checkout -b` exited 0, and HEAD is not on the branch at the pin
   spec: symbolic-ref b'refs/heads/tb\xffx\n' HEAD 7766d57ffa79
   code: symbolic-ref b'refs/heads/tb\xffx\n' HEAD b3a9d0ac22b7
   spec upstream: b'\n'
     fsenc iso8859-1
     _head_of 'refs/heads/tb\xffx' 7766d57ffa79
     manifest branch 'tb\udcffx'
     text ref 'refs/heads/tb\udcffx'
     _head_of(sub) != (pin, text ref): True
--- run 2: exit 0
  [spec] spec: branch tb\udcffx is at the pin 7766d57ffa79, and git refused to check it out:
          `git checkout` exited 0, and HEAD is not on the branch at the pin
===== head-latin1-ff
--- run 1: exit 0
  [spec] spec: branch tb\udcffx created at 7766d57ffa79 — at the pin
   spec upstream: b'refs/remotes/origin/tb\xffx\n'
     _branch_ref 'refs/heads/tb\xffx'
     _head_of(sub) != (pin, _branch_ref): False
--- run 2: exit 0
  [spec] spec: on tb\udcffx at 7766d57ffa79 (branch tip == pin)
  • The ref's bytes are tb\xff x.
  • _head_of returns U+00FF.
  • The manifest's branch is U+DCFF.
  • The text comparison at main :1755 answers "not on it" while HEAD is on the branch at the pin.

The body's cause section matches.

The U+00FF control (tracking_branch: "tb\xffx") under Latin-1 gives created, then on tbÿx, identical on main and head. That is #1283's fifth box.

2. The fix, place by place, at dfd69ff7

Code lines only, docstrings excluded:

line hit does it ask what the code means?
886 _branch_ref body yes: os.fsdecode(_handed_to_git(...)); on POSIX equal text means equal bytes, since surrogateescape decoding is injective
913, 1832 refs/heads/{branch} handed to git yes, nothing is compared (audit row 13)
928 _head_of(sub) != (pin, None) yes, the detached check
951 _check_out yes, _branch_ref
1531, 1538 place_at_pin already, current not in yes
1615, 1616 fast_forward_to_pin other_branch, current == ref yes
1709 _stays yes
1786, 1802 create_at_pin yes
1028, 1167, 1755 _place_of, _say_twin, the twin's name print git's name, right (audit rows 11, 12)
1074, 1110 startswith("refs/heads/") an ASCII prefix, right in every locale
1112-1113 _folded_twin still text: F1
1195, 1220, 1259 _heads, _folded_spelling, _kept_name fold git's names among themselves, consistent decoding (row 12); _folded_spelling inherits F1

Audit rows 8 to 13:

  • Row 8: right for the tracking branch itself; the twin miss is confirmed and is wider than the body says (F1).
  • Row 9 (the moved-back upstream line): it prints origin/tbÿx beside tb\udcffx under Latin-1. The paste word is "$(printf -- 'origin/tb\377x')" in both locales. test_a_branch_past_the_pin_with_no_commit_of_its_own_is_moved_back asserts exactly this and passes under Latin-1 and UTF-8. Not a comparison; the Known limit is honest.
  • Rows 10 to 13: right. The upstream is set at the head (spec upstream: b'refs/remotes/origin/tb\xffx\n' above).

All 17 main line numbers the audit cites were checked with sed -n on 0354a7e7 and match.

3. The change under UTF-8

caf\udcc3\udca9 main 41c2eb42 head 991c06ea
UTF-8, run 1 could not create branch 'caf\udcc3\udca9' ... over exited 0; HEAD b'refs/heads/caf\xc3\xa9\n' at the pin; no upstream; exit 0 branch caf\udcc3\udca9 created at 7766d57ffa79 — at the pin; upstream b'refs/remotes/origin/caf\xc3\xa9\n'; exit 0
UTF-8, run 2 git refused to check it out: over exited 0; exit 0 on caf\udcc3\udca9 at ...; exit 0
ASCII, runs 1 and 2 created, then on identical to main

4. Windows and other codecs, read (and emulated), not run

  • Default Windows (utf-8 with surrogatepass): _argument_fault refuses every surrogate (3 bytes, not 1). So for each name that reaches _branch_ref, it equals refs/heads/<branch>: the same answer as main. Git for Windows stores UTF-8, which _head_of decodes alike. Right.
  • PYTHONLEGACYWINDOWSFSENCODING=1: _head_of and _branch_ref both decode UTF-8 bytes with the code page, so a non-ASCII name now compares right where main compared wrong (emulated above). There is a new traceback for a lone surrogate (F2). Under a DBCS code page, replace can fold two byte strings into one text, so "equal text means equal bytes" holds on POSIX only, as the body says.
  • Other one-byte codecs: not run. _branch_ref is the same function of the codec as _head_of.

5. The rows

  • Base against head (the clone at dfd69ff7 with blob 41c2eb42 laid in): 12 failed, 18 passed. These are exactly the 12 rows the body lists:

    • 3 first-run;
    • 3 later-run;
    • the hook;
    • both fast-forward rows;
    • moved-back;
    • stays;
    • unborn.

    The messages are could not create branch 'tb\\udcffx' (x6), 'caf\\udcc3\\udca9' (x4), git refused to check it out (x17), git refused to move it (x2) and leaving it on tbÿx. After the restore: restored blob 991c06eaa4e1... HEAD blob 991c06eaa4e1... equal=yes, and git status is clean.

  • Head: 30 passed under a UTF-8, a Latin-1 and an ASCII pytest.

  • tests/test_bom_tool_io.py: the byte-order-mark rows hold each tool's own read and write and that only U+FEFF is cut, so a utf-8-sig read that drops the mark and a cut that also takes spaces no longer survive (#1176) #1188: the module-scoped latin1 fixture is the module's own. The names imported from test_bootstrap_after_bump, test_bootstrap_spelling and test_stdout_encoding (failing_post_checkout, DASH, bootstrap_of, edit, needs_a_byte_name, run, child_environ) are all plain functions or constants, not fixtures. project comes from conftest.py.

  • Skip words: with a stub localedef first on PATH (exit 4), the result is 16 passed, 14 skipped, each skip reading localedef could not build en_US.ISO-8859-1 here (exit 4: 'localedef: stub r1300a: cannot open charmap file'); a child in it reports 'ascii'. The [warning] line is filtered out, and the UTF-8 and ASCII rows still run. On Windows, pytestmark skips on os.name == "nt" (read).

  • 3.12 against 3.14:

  • Whole block: each of the 7 functions asserts lines == [...] over step_a's whole block. The slice drops only the blank line that print("\n(b) ...") puts there. The first-run row also asserts the spec upstream by its bytes.

  • The escape commit 066e4468: AST equal: True against c092d331, and the file is ASCII (0 non-ASCII lines, against 1 before).

7. Row 13 and #1278's rows 9 to 12 at the head

locale result
Latin-1 1 passed, 4 skipped: row 13 passes; rows 9 to 12 skip with this system's file name encoding (iso8859-1) cannot spell 'sp\u2028ec', and the same for 'At\u2028las', 'Ink\u2028Router' and 'ta\u2028rget.py'
UTF-8 5 passed
ASCII 1 passed, 4 skipped (the same four, (ascii))
Latin-1, base blob row 13 1 failed, at tests/test_bootstrap_spelling.py:455, the created at assert (:454 on 0354a7e7)

9. The body


Pytest summary lines

All runs are at head dfd69ff7 (the bootstrap.py blob is 991c06ea) unless marked base. Base means the scratch clone at dfd69ff7 with main's blob 41c2eb42 laid in, then restored and proven equal. Every run used the probe environment, one call at a time.

# run result
1 the new file, UTF-8 30 passed in 14.50s
2 the new file, Latin-1 pytest 30 passed in 14.51s
3 the new file, ASCII pytest 30 passed in 15.65s
4 the new file, UTF-8, base 12 failed, 18 passed in 18.74s
5 the new file, UTF-8, stub localedef 16 passed, 14 skipped in 9.13s
6 rows 9 to 13, Latin-1 1 passed, 4 skipped in 2.86s
7 rows 9 to 13, UTF-8 5 passed in 3.40s
8 rows 9 to 13, ASCII 1 passed, 4 skipped in 2.86s
9 row 13, Latin-1, base 1 failed in 1.95s
10 the new file + test_bootstrap_spelling.py + test_bootstrap_non_utf8_branch.py + test_bootstrap_branch_bytes.py, UTF-8 329 passed in 70.82s
11 the same four, Latin-1 pytest 4 failed, 316 passed, 9 skipped in 81.90s
12 every tests/test_bootstrap_*.py (14 files, listed into a file, checked non-empty, passed with xargs -d '\n' -a), UTF-8 673 passed, 3 skipped in 218.94s
13 tests/test_pinned_copy_text.py, UTF-8 87 passed in 7.66s

Mutants: 8 killed of 8

Each mutant ran alone in the scratch clone at dfd69ff7, over the new file and row 13, under a UTF-8 pytest. After each one, bootstrap.py was written back from HEAD's blob and proven equal: restored 991c06ea... HEAD 991c06ea... equal=True, eight times, and git status was clean.

id mutant result
R1 _branch_ref in _check_out only, the other 7 comparisons text KILLED, 12 failed
R2 _branch_ref without os.fsdecode (bytes compared with text) KILLED, 31 failed (every row and row 13)
R3 ref read back as Latin-1 whatever the locale (.decode("latin-1")) KILLED, 17 failed: every UTF-8 and ASCII control and row 13; every Latin-1 row passes (the inverse of M10, so the controls have teeth)
R4 both fast_forward_to_pin comparisons left as text KILLED, 1 failed ([latin1-head-on-the-branch])
R5 _head_of decodes as UTF-8 with surrogateescape whatever the locale (_branch_ref kept) KILLED, 14 failed
R6 _branch_ref in create_at_pin only KILLED, 8 failed (later-run x3, hook, both fast-forwards, moved-back, stays)
R7 _branch_ref only at the issue's two named checks (create_at_pin, _check_out) KILLED, 6 failed (later-run x3, hook, ff head-on-the-branch, stays): the 6 extra comparisons are each held
R8 place_at_pin says the leg left a branch whenever HEAD was on one KILLED, 11 failed

Not covered

  • Windows, macOS and any one-byte codec but Latin-1: Windows was read and emulated on Linux only. On macOS, whether git's core.precomposeunicode makes the stored bytes differ from _handed_to_git's for an NFD name was not looked at. Either way it would be pre-existing and unchanged here.

  • CPython 3.14: read only.

  • The writer's M1 to M12 were not re-run.

  • Of the writer's 28-case matrix, I re-ran 8 cases by probe:

    • Latin-1 tb\udcffx, runs 1 and 2, main and head;
    • UTF-8 and ASCII caf\udcc3\udca9, main and head;
    • Latin-1 U+00FF, main and head.

    The rows cover the rest, base against head.

  • The four-file gate on base under Latin-1 or ASCII was not re-run.

  • tests/test_no_auto_maintenance.py, tests/test_path_guard_hygiene.py, the test_shape_doctor.py shards and the doc trio were not run: they are lane 1's predicted-squash gate.

Scratch: /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1300a/

  • logs: logs/
  • probes: probe/probe_cause.py, probe/twin.py, probe/legacy_emul.py
  • mutants: mutants.py
  • detached review worktree: wt-r1300a, clean at dfd69ff7

No tracked file was changed, nothing was committed or pushed, and gh was used read-only.

…ison for a name git cannot be handed as UTF-8, and its docstring names `_folded_twin` as the check that still compares text (r1300a F1, F2)

On Windows under PYTHONLEGACYWINDOWSFSENCODING=1, os.fsencode is mbcs
with replace, so _argument_fault lets a lone surrogate such as
tb\udcffx through (one byte, `?`), while _handed_to_git is UTF-8 there
and raises UnicodeEncodeError. _branch_ref now catches it and returns
refs/heads/<branch>, the text every check compared before #1283, as
_paste_word keeps spelled's text for such a name. On POSIX no name
that _argument_fault passes reaches the except.

_argument_fault's docstring says its "never handed to git" holds under
Windows' default surrogatepass only. _branch_ref's docstring names the
eight checks it serves, and _folded_twin as the one check that still
compares text.

tests/test_bootstrap_branch_one_byte_locale.py gains
test_a_name_git_cannot_be_handed_is_compared_as_its_text, which emulates
legacy mode with a stand-in os (nt, cp1252 with replace).

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

Copy link
Copy Markdown

@brettheap

Copy link
Copy Markdown
Contributor Author

Delta review of #1300 (#1283) for lane openRepoShape-1, by r1300b (sonnet), dfd69ff..cb9ed80: READY

The round does what lane 1 decided. I found no MUST and no SHOULD, only NITs, all optional.

Findings

N1 NIT, body ## Mutants (body lines 139-160, row at 156): M12 is stale at cb9ed806.

  • The body says M12 "survived, 31 passed … equivalent on POSIX", and "11 killed" of 12. That was true at c092d331. The new row now kills it.
  • Evidence: my mutant Mvii makes _handed_to_git return os.fsencode(text) on every os. Over the new file plus row 13 under UTF-8 it gives 1 failed, 31 passed, and the failing row is the new one:
E  AssertionError: assert 'refs/heads/tb?x' == 'refs/heads/tb\udcffx'
  • Under a Latin-1 pytest and an ASCII pytest, the new row alone gives 1 failed each.
  • Fix (body only): add "at cb9ed806 the new row kills M12 too, 12 of 12". The sentence that M12 is equivalent on POSIX stays true.

N2 NIT, tests/test_bootstrap_branch_one_byte_locale.py:465: the row's docstring cites dfd69ff7.

  • That is GitHub's update-branch merge. It is not on main and will not be after the squash. The repo's tests cite main shas ("ON MAIN AT bf1f099").
  • Evidence: git merge-base --is-ancestor dfd69ff7 origin/main answers no.
  • Fix, optional: write "Without the fallback, _branch_ref raised …". This changes the test file's blob, so rerun the file.

N3 NIT, templates/assembly-root/scripts/bootstrap.py:878-885: the _folded_twin paragraph in _branch_ref's docstring cites no issue number.

The writer's doubt about _head_of's docstring (bootstrap.py:851-856)

I weighed it and recommend no change.

  • "A branch whose name is not UTF-8 reads back as _branch_ref of the same name" is exact wherever such a name exists, which is POSIX. Every row asserts it, and the 674 and 31 counts hold.
  • The fallback returns the text only for a name _handed_to_git cannot encode. No ref exists for such a name, so _head_of has nothing to read back and the claim has no counterexample.
  • If lane 1 wants it literal, append "that git can be handed" to the sentence. It is not worth a commit.

What I measured

1. The delta is the round and nothing more.

  • git diff --stat dfd69ff7 cb9ed806 shows two files, 85 insertions(+), 11 deletions(-).
  • Blobs: bootstrap.py 991c06ea to 8e0f76c7, test file 622cbf3a to 9c95e2f2.
  • With docstrings stripped, bootstrap.py differs in _branch_ref alone, and module-level statements are equal.
  • The test file differs by the two imports (ASSEMBLY_TEMPLATE, load_without_bytecode), the stand-in class and the one row.
  • The added lines have no non-ASCII character.

2. F2, POSIX: the except is never reached.

  • _handed_to_git is os.fsencode on POSIX. _argument_fault refuses every NUL, every surrogate that is not one byte, and every character with 0 bytes. Any name it passes is therefore encodable character by character.
  • Probe posix_never.py: every code point alone and as a<c>b, plus 200,000 random names (mixed-in surrogates). It wraps _handed_to_git to record a raise.
== utf8     fsenc utf-8 surrogateescape      passed: 309282; refused: 2118942; _handed_to_git raised on a passed name: 0; refused names git could not be handed: 191943
== latin1   fsenc iso8859-1 surrogateescape  passed: 5297;   refused: 2422927; raised on a passed name: 0; refused that git could not be handed: 2422179
== ascii    fsenc ascii surrogateescape      passed: 3603;   refused: 2424621; raised on a passed name: 0; refused that git could not be handed: 2424520
== C + PYTHONUTF8=1                          passed: 309282; refused: 2118942; raised on a passed name: 0

The nonzero "refused that git could not be handed" counts show _argument_fault is what stands in front of the except.

3. F2, legacy emulation. The emulation sets os.name='nt' and uses cp1252-with-replace for fsencode/fsdecode. I wrote legacy2.py, which reports _branch_ref apart from the probe's own arithmetic.

== cb9ed806 (blob 8e0f76c7)
'tb\udcffx'        fault=None; _branch_ref='refs/heads/tb\udcffx'; main's text='refs/heads/tb\udcffx'; HEAD reads (git cannot be handed it)
'caf\xe9'          fault=None; _branch_ref='refs/heads/caf\xc3\xa9'; main's text='refs/heads/caf\xe9'; HEAD reads 'refs/heads/caf\xc3\xa9'
'main'             fault=None; _branch_ref='refs/heads/main'; ...
'caf\udcc3\udca9'  fault=None; _branch_ref='refs/heads/caf\udcc3\udca9' (text)
== dfd69ff7 (blob 991c06ea)
'tb\udcffx'        _branch_ref=RAISES UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 13
'caf\udcc3\udca9'  _branch_ref=RAISES UnicodeEncodeError ... position 14-15
'caf\xe9'          _branch_ref='refs/heads/caf\xc3\xa9'
  • tb\udcffx and caf\udcc3\udca9 give main's text comparison with no traceback.
  • caf\xe9 still compares as git's bytes.
  • r1300a's own legacy_emul.py still prints RAISES for tb\udcffx at the head, and the body says why. The line _branch_ref: 'refs/heads/tb\udcffx' prints first, so the raise comes from the probe's own .encode("utf-8"). My probe separates the two.
  • Windows was emulated, not run.

4. The row holds.

  • dfd69ff7's blob (991c06ea) laid into my scratch worktree at cb9ed806: the new row gives 1 failed under UTF-8, Latin-1 and ASCII pytests. Each fails with UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 13: surrogates not allowed.
  • The except taken out (Mi) fails the same way. The mutants are in the table below.
  • Stand-in os, sound:
    • monkeypatch.setattr(module, "os", …) acts on a module object made by load_without_bytecode, a private load with no entry in sys.modules.
    • Probe leak.py ran the row's body with a real MonkeyPatch, then undid it: os.name posix, fsencode/fsdecode the originals, a fresh load's os is os True, and sys.modules['os'] is os True.
  • No fixture is imported (tests/test_bom_tool_io.py: the byte-order-mark rows hold each tool's own read and write and that only U+FEFF is cut, so a utf-8-sig read that drops the mark and a cut that also takes spaces no longer survive (#1176) #1188). An AST check of the imports finds conftest (REPO constant; git, git_answer_bytes, load_without_bytecode functions), test_bootstrap_spelling (ASSEMBLY_TEMPLATE, DASH constants; bootstrap_of, edit, needs_a_byte_name, run functions), test_bootstrap_after_bump (failing_post_checkout, a function) and test_stdout_encoding (child_environ, a function). None carries @pytest.fixture, and no new test module is imported.
  • The row passes in all three locales without the latin1 fixture.
  • The module skips on os.name == "nt", so the row runs on POSIX hosts, CI's included.

5. _argument_fault's qualified docstring (:705-708) is accurate against the emulation.

  • Default Windows (surrogatepass, 3 bytes) refuses the surrogate.
  • Legacy mbcs-with-replace writes ?, one byte, so fault=None, as in item 3.
  • "As before this check" matches the preceding sentence.
  • _argument_fault's code is unchanged (the AST diff shows only _branch_ref).
  • I could not run the real Windows mbcs behaviour.

6. F1: the docstring's eight are the eight in the code. At cb9ed806:

docstring line
_check_out's after checkout 983
place_at_pin's already 1563
place_at_pin's the leg was on check 1570
fast_forward_to_pin's two 1647 other_branch, 1648 current == ref
_stays's 1741
create_at_pin's after checkout -b 1818
create_at_pin's the leg was on check 1834
  • _folded_twin is held != branch and _fold(held) == _fold(branch), at :1144-1145. It is the one text comparison left.
  • The docstring's twin examples match twin.py at the head:
utf-8:     b'TB\xffx' vs 'tb\udcffx' twin=True;  b'CAF\xc3\xa9' vs 'caf\udcc3\udca9' twin=False
iso8859-1: b'TB\xffx' vs 'tb\udcffx' twin=False; b'CAF\xc3\xa9' vs 'caf\udcc3\udca9' twin=False
ascii:     b'TB\xffx' vs 'tb\udcffx' twin=True;  b'CAF\xc3\xa9' vs 'caf\udcc3\udca9' twin=True

7. End to end. I reran the writer's probe_twin_e2e.py with my own paths and a fresh scaffold: 8 head cases and 2 main cases. Python 3.12.3, git 2.43.0, every run exit 0, no traceback. The lines match the body (lines 235-239) exactly.

  • TB<ff>x for tb\udcffx:
    • UTF-8 and ASCII give the three twin lines and leave the leg on TB<ff>x.
    • Latin-1 gives branch tb\udcffx created at … — at the pin, then the leg was on TBÿx, which keeps its commits; it is on tb\udcffx now.
  • CAF<c3 a9> for caf\udcc3\udca9:
    • ASCII gives the twin lines.
    • UTF-8 gives created, then the leg was on CAFé.
    • Latin-1 gives created, then the leg was on CAFé.
  • Detached beside the twin: Latin-1 ff-det and UTF-8 caf-det both say created.
  • On main:
    • Latin-1 TB<ff>x gives could not create branch 'tb\udcffx' … leaving it on TBÿx.
    • UTF-8 CAF<c3 a9> gives … leaving it on CAFé.
    • HEAD and the branch lists are the same as at the head.

8. Merge with main b607223b.

  • git merge-tree --write-tree cb9ed806 origin/main exits 0 with tree 00cbf6a6a99b5a619d319b692ab02649ebcda868, the body's tree.
  • Both merge bases are 5f06c3eb.
  • origin/main's bootstrap.py is still 41c2eb42.
  • Main changed only validate-manifest.py, validate-family.py, tests/conftest.py, tests/test_family.py and tests/test_manifest_validator.py since 5f06c3eb.
  • git diff --stat origin/main...cb9ed806 shows only the two files.
  • I ran the new file and row 13 on a detached scratch worktree of commit-tree 920c8c5b (never pushed). load_without_bytecode and git_answer_bytes are still in main's conftest.py.

9. The body. Saved file w1300r/pr-body-only.md equals the live body byte for byte.

Pytest summary lines

I ran each pytest call in the probe environment: stub gh first on PATH, GH_TOKEN=bogus-r1300b, an empty GH_CONFIG_DIR, a null GIT_CONFIG_GLOBAL, GIT_SSH_COMMAND=false, EMAIL set, env -u LANES_LANE. I ran at most 2 calls at once. Scratch is /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1300b/; logs are in logs/.

At cb9ed806 (bootstrap.py blob 8e0f76c7):

run result
new file, UTF-8 pytest 31 passed in 17.23s
new file, Latin-1 pytest 31 passed in 17.16s
new file, ASCII pytest 31 passed in 16.56s
row 13 (test_a_branch_name_is_spelled_in_every_line_that_names_it), Latin-1 / UTF-8 / ASCII 1 passed in 2.49s / 1 passed in 2.53s / 1 passed in 2.29s
rows 9 to 13, Latin-1 1 passed, 4 skipped in 3.69s
rows 9 to 13, UTF-8 5 passed in 4.03s
rows 9 to 13, ASCII 1 passed, 4 skipped in 3.52s
every tests/test_bootstrap_*.py (14 files, listed into a non-empty file, passed with xargs -d '\n' -a), UTF-8 674 passed, 3 skipped in 219.35s
tests/test_pinned_copy_text.py, UTF-8 87 passed in 7.85s
test_pinned_copy_text, test_path_guard_hygiene, test_no_auto_maintenance, UTF-8 266 passed, 2 skipped in 36.17s
test_repo_hygiene, test_scaffold_leg_path_collisions, test_assembly_root_unreadable_paths, test_bom_reads, UTF-8 312 passed in 24.33s

On the merge, commit 920c8c5b (tree 00cbf6a6, bootstrap.py blob 8e0f76c7), new file plus row 13:

locale result
Latin-1 32 passed in 15.57s
UTF-8 32 passed in 15.83s

Base: 991c06ea laid into the scratch worktree at cb9ed806, then restored to 8e0f76c7. The restored blob equals HEAD's and git status --short is empty.

run result
new row, UTF-8 1 failed in 0.19s
new row, Latin-1 1 failed in 0.21s
new row, ASCII 1 failed in 0.23s
new file plus row 13, UTF-8 1 failed, 31 passed in 17.83s

Mutants of the delta's key lines: 7 killed of 8

Each ran alone in a scratch worktree at cb9ed806, over the new file plus row 13 under UTF-8. The new row alone was also run under Latin-1 and ASCII. After each, bootstrap.py was written back from HEAD's blob. Eight times I proved restored 8e0f76c7… HEAD 8e0f76c7… equal=True with git status --short empty.

id mutant result
Mi the except taken out (dfd69ff7's body) KILLED: 1 failed, 31 passed (the new row, UnicodeEncodeError at position 13); Latin-1 and ASCII 1 failed each
Mii the except returns os.fsdecode(os.fsencode(text)) KILLED: 1 failed ('refs/heads/tb?x' == 'refs/heads/tb\udcffx'); Latin-1 and ASCII 1 failed each
Miii except UnicodeDecodeError KILLED: 1 failed, 31 passed
Miv the except returns "refs/heads/" KILLED: 1 failed, 31 passed (+ refs/heads/)
Mv _branch_ref returns the text for every name KILLED: 13 failed, 19 passed (the 12 Latin-1 and caf rows plus the new row, which fails alone on its caf\xe9 assertion, + refs/heads/café); Latin-1 and ASCII 1 failed each
Mvi except Exception SURVIVED, 32 passed. Equivalent: os.fsencode of a str raises only UnicodeEncodeError.
Mvii _handed_to_git is os.fsencode on every os (the first round's M12) KILLED: 1 failed, 31 passed (see N1)
Mviii the except returns refs/remotes/<branch> KILLED: 1 failed, 31 passed

Not covered

  • Windows: read and emulated on Linux only. I did not run real Windows mbcs, which would show whether replace writes ? for every lone surrogate. I did not check what git for Windows stores for such a name. macOS precomposeunicode was not looked at.
  • CPython 3.14: read only; this bench has 3.12.3. The delta has no is_file, exists or is_dir guard, so I built no sitecustomize shim.
  • Not run: tests/test_agents_md_codes.py, tests/test_cli_reference.py and the tests/test_shape_doctor.py shards (lane 1's gate; the delta changes docstrings, one try/except and one test).
  • Merge with main: I did not run rows 9 to 13 on 920c8c5b, only the new file and row 13.
  • Not re-run:
    • the writer's M1 to M12 and the 28-case matrix (I re-ran 10 twin cases end to end);
    • the full 14-file block under Latin-1 or ASCII pytests (the brief asked for UTF-8);
    • r1300a's cause probe on main under Latin-1.
  • Voided runs and process slips, each redone cleanly:
    • My first legacy_emul.py call, without PYTHONDONTWRITEBYTECODE, wrote a stray ignored .pyc under the review worktree's templates/. That made 3 test_scaffold_leg_path_collisions rows fail with a UnicodeDecodeError on its 0xcb magic byte. I moved the __pycache__ out of the tree, with no delete, and reran: 312 passed.
    • A mutant harness and the 14-file run shared a basetemp. I stopped both by PID, restored the mutated file from HEAD's blob and proved it equal, then reran on separate basetemps.
    • One rows 9 to 13 call used $(cat ids), against the cont-rules. The ids file was non-empty, and I reran it with xargs -d '\n' -a.
  • Left behind:
    • Three scratch worktrees under …/r1300b/: wt-r1300b (clean at cb9ed806), wt-mut (clean) and wt-merge (detached at 920c8c5b, never pushed).
    • A moved-aside …/r1300b/stray-pycache-from-my-first-probe.

No tracked file was changed, nothing was committed or pushed, and gh was used read-only (issue view 1306 and 1283, pr view 1300).

@brettheap
brettheap marked this pull request as ready for review November 10, 2026 11:02
@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 5 days and 2 hours by commenting @sourcery-ai review. Upgrade to get a review now.

brettheap pushed a commit that referenced this pull request Nov 10, 2026
… 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]>

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

1 participant