Repository navigation
adopt-project.py: a refused command's --- output --- block spells each argument and directory that holds a line feed where git names it, adopt-mount-unaddable spells git's output, and rows pin mutants R1, R3 and R10 (#1233) - #1311
brettheap wants to merge 17 commits into
Conversation
… `--local-remote-dir` path in `execute`'s `bare`, leg and `split` lines, are named with `_shown`, as #1154 names `--out` and `--work-dir`, so a bidi control, an escape, a line feed or a byte that is not UTF-8 in either no longer reaches the terminal as it was typed (#1152) ## What #1154 (#1115) names `--out` and `--work-dir` in `plan`'s and `check`'s report with `_shown`. W1115 found two groups of paths it leaves raw (#1152): the `--plan` path, and the `--local-remote-dir` path. A bidi control (U+202E), an ESC or a line break in either reached the terminal as it was typed, where the other plan lines name a path with `_shown`. This change spells each of the 21 sites with `_shown(str(...))`, so a path with a character that is not printable is named as `_spelled` names it, between backticks, and every other path prints byte for byte as it did. The `--plan` path, 16 sites in `check` and `execute`: - the five `N finding(s) in <plan>` lines: `_refuse_a_mistyped_plan`, `_refuse_what_check_finds`, the `plan-split-branch-taken` refusal, and `cmd_check`'s two branches; - the `<plan>: ...` refusals: `plan-wrong-kind` (the code's name for it; the issue calls it `plan-bad-kind`), `plan-unsupported-mode`, `plan-unreadable`, `plan-no-source`, the three `plan-bad-id` ones, `plan-not-the-source`, `adopt-topic-too-long`, and the `legs.assembly` and `org:` ones. The `--local-remote-dir` path, 5 sites in `execute`: - the `<bare> already exists` refusal; - the ` bare <bare>` line; - the two leg lines, `_extract_leg` and `_seed_leg`, which end `-> <url>`; - the `split <commit> on <branch> -> <url>` line, which names the source's directory under `--local-remote-dir`. The `NEXT:` clone command is not touched: it already quotes the url with `shlex.quote`, and a row pins that it still does. A path that is not UTF-8 now prints as `\udcff` between backticks, where it printed raw before. No refusal code is new, and none changes its name or its exit code. The changed lines that ran past 79 columns are rewrapped; the message text is unchanged. `repo_shape.load_yaml`'s own refusals still print a path raw, as `yaml-unreadable`. They live in another file and are a separate follow-up (see #1168). ## Test `tests/test_adopt_plan_and_remote_paths_spelled.py` is new, ASCII only and POSIX only, with every non-ASCII character written as an escape. It has 148 rows: - 135 plan rows: 14 refusal families (27 family and command pairs) by 5 path forms (U+202E, ESC, a line feed, the byte `\xff`, and a plain control); - 5 `--local-remote-dir` rows for the `bare` and leg lines (the code leg is extracted, the spec leg seeded); - 3 `split` rows. `execute` refuses a source path that holds U+202E, ESC, a line feed or `\xff` as `adopt-unwritable-value` before any leg exists, so these rows use U+200B in the parent and a name that ends in a space, and a plain control; - 5 in-process rows for `{bare} already exists`, which call `_create_leg_remote`. On main's `adopt-project.py`, 118 of the 148 fail, each for the raw path, and the 30 that pass are exactly the plain controls. On this commit all 148 pass. 23 mutants (each new spelling put back to raw, one at a time, and `_shown` swapped for `_spelled` at two sites) are each killed by the rows that name them. Lane: openreposhape-4 (openRepoShape-4) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…cter a terminal acts on in the command, its directory and what it printed, as `_first_said` spells gh's, so `--local-remote-dir` no longer reaches the terminal raw there; a NOTE before `NEXT:` says when the source's path in its clone command holds a character a terminal does not show as itself; and rows pin six sites #1177's 148 left to chance (#1195) Follow-up of #1177 (for #1152), from RV1177's review: its N3, N4 and the surviving mutants K1, K2, K4, K5, K6 and K7. Stacked on #1177's branch, and lands after it. - N3: `_loudly` builds `CommandFailed.loudly`'s block from the command's arguments, its directory and its output, each `_unacted`: a character `str.isprintable` refuses is spelled as `_spelled_character` spells it, with no backticks, and the output keeps its line breaks. The leg push, `_failed_loudly` and `main` say a refused command through it. - N4: a source path that `_refuse_an_unwritable_clone_url` lets through (#255) but `str.isprintable` refuses, as U+200B and U+200F, gets a NOTE just before `NEXT:` naming it `_spelled`. The clone command stays as `sh` reads it. Refusing such a source would undo #255's ruling that a `Cf` character other than the nine bidi controls is text a file holds. The NOTE is printed before the block, so it touches none of the lines that #1121 and #1207 add after it. - Rows: a `--plan` ending in a space, a relative one between backticks, a relative one and `./plan.yaml` (K1, K2); a PLACEMENT plan's `plan-wrong-kind` and `adopt-org-too-long` with the plan's path spelled (K4, K5); a printable `--local-remote-dir` outside ASCII (K6); the GitHub-mode `split` line matched in full (K7); and N3's and N4's rows. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…leftovers Step (a) of the restack after #1177's squash: the head F of the branch #1225 was stacked on, merged as it stands, with no conflict. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…overs Step (b) of the restack after #1177's squash: its two files, adopt-project.py and tests/test_adopt_plan_and_remote_paths_spelled.py, are the same in the squash as in the final head merged in step (a), so a conflict in them is resolved by keeping this branch's bytes and the step changes none of them. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Step (c) of the restack after #1177's squash: main as it stands, past the squash, merged with no conflict. The branch now differs from main in adopt-project.py, tests/test_adopt_github_exits.py and tests/test_adopt_plan_and_remote_paths_spelled.py only. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…ants all 188 rows passed: a printable U+00E9 in a refused command prints as typed, a tab in what it printed is spelled `\t`, and a source path that holds U+00E9 gets no NOTE before `NEXT:` (#1233) RV1225's N2, from its review of #1225 (#1195). Each mutant left behaviour the head gets right, and no row held it: - R1, `_unacted` spelling every character outside ASCII: the two in-process refused-command rows now run over `SAID_CHARACTERS`, `CHARACTERS` and `printable-U+00E9`, which the block names as typed. - R3, `_unacted` keeping a tab raw in what a command printed: `a_refused_push`'s second line holds a tab, which `the_block_of` expects as `\t`. - R10, the NOTE keyed on `url.isascii()`: `SPLIT_SOURCES` gains a `so\u00e9urce` parent, `noted` False, named as it is; a spelled parent and name of None now say "as it is", for it and the plain control. Co-Authored-By: Claude Opus 5.5 <[email protected]> Lane: openreposhape-2 (openRepoShape-2)
…hole each argument and directory of the command that holds a line feed where git names it, so `--local-remote-dir <D>/re<LF>mote` no longer splits git's `To` and `error:` lines into lines of the path's; and `_loudly` says a spelled character and a typed backslash sequence read alike (#1233) RV1225's N1 and N3, from its review of #1225 (#1195). N1. `_loudly` kept the line breaks of what a command printed (`_unacted(exc.output, kept="\n")`), so git's own lines, which name the remote a push was refused at, were split at a line feed the path held: `To <D>/re`, then `mote/Thing-spec.git`. The new `_output_unacted(exc)` replaces in the output each argument and the directory that holds a line feed with its `_unacted` spelling, longest first, before the output is `_unacted` with its own line breaks kept. A command none of whose arguments holds a line feed prints the block it printed before. Measured with a real `execute --allow-empty-leg spec --local-remote-dir` and a global `pre-receive` hook that refuses every push (exit 2 each, no traceback): - the line feed in `--local-remote-dir`, and in both: before, 2 lines of the block began `mote/` and the raw `re<LF>mote` was on stderr twice; now `To <D>/re\nmote/Thing-spec.git` and `error: failed to push some refs to '<D>/re\nmote/Thing-spec.git'` are one line each, and the raw path is printed 0 times; - in `--work-dir` alone: git's push output does not name it, before or after, and `(in <D>/wo\nrk/Thing-spec)` was spelled already. `tests/test_adopt_plan_and_remote_paths_spelled.py`: `line-feed` is back in `REFUSED_CHARACTERS`; the refused push's row asks that git's `To` line names the remote on one line, that no line of the block begins `mote/`, and, for the line feed, that neither typed path is printed raw. The two in-process rows expect the remote spelled in git's line too. N3. `_unacted` leaves a backslash as it is, so a path holding the six characters backslash, `u`, `202e` prints as one holding U+202E does: `_loudly`'s docstring says so. No code change. Co-Authored-By: Claude Opus 5.5 <[email protected]> Lane: openreposhape-2 (openRepoShape-2)
…ed command's block says them, so a held `index.lock` under a `--work-dir` that holds U+202E or a line feed no longer prints the override raw or splits the line (#1233) RV1225's N4, from its review of #1225 (#1195): `adopt-mount-unaddable` printed `git will not add the leg mount path {path}: {exc.output}`, git's output as it was, a route #1225's body did not list. Measured first: - The mount path cannot hold such a character. `leg_path_problem` holds `legs.spec_path` and `legs.code_path` to `checked_value`'s `SAFE_ARG_RE`, `^[A-Za-z0-9._/@+~-]{1,255}$`: a plan whose `spec_path` holds U+202E, ESC or a line feed is `plan-bad-leg-path` from `check` (exit 1) and from `execute --local-remote-dir` (exit 2, before any leg exists), in real runs of each. So `{path}` is left as it is, and a comment says why. - git's output can. `git add --dry-run` takes the index's lock, and with it held git 2.43 says `fatal: Unable to create '<work>/Thing/.git/index.lock': File exists.`, naming the assembly, which is under `--work-dir`. git writes ESC as `?` there itself, but U+202E raw, and keeps a line feed. So the output is `_output_unacted`, as `_loudly` says it: each character `str.isprintable` refuses is spelled, git's line breaks are kept, and the directory the command ran in is spelled whole where git names it. `tests/test_adopt_plan_and_remote_paths_spelled.py`: the new `test_a_mount_git_will_not_add_is_said_spelled` calls `_refuse_an_unmountable_path` in this process, with the lock held, for each of `CHARACTERS`: the U+202E and line-feed rows fail on the head before this commit, the ESC, byte 0xff and plain rows pass on both. The module docstring names #1233's follow-ups. Co-Authored-By: Claude Opus 5.5 <[email protected]> Lane: openreposhape-2 (openRepoShape-2)
…s paths that hold a line feed are spelled longest first in what it printed, so a remote under the directory the command ran in is spelled whole where git names it (#1233) `_output_unacted` sorts the arguments and the directory longest first before it spells each where the output names it. No row held that: in every other row no path is in another. This one, in this process, runs `_loudly` over a push from `/re<LF>mote` to `/re<LF>mote/wo<LF>rk.git`, whose `To` line must say the remote whole, on one line. Spelled shortest first, the remote's second line feed is left raw. Co-Authored-By: Claude Opus 5.5 <[email protected]> Lane: openreposhape-2 (openRepoShape-2)
…er a byte that is not UTF-8 is spelled whole where git names it too, as `run` reads it back, so `re<0xff><LF>mote` no longer splits git's `To` and `error:` lines (#1233) `_output_unacted` looked for each path that holds a line feed as the command was given it. git names a path by its bytes, and `run` decodes what git printed with `replace`, so a byte that is not UTF-8, which the path holds as a surrogate, is U+FFFD in git's lines: the path was not found there, and its line feed still split them. Each such path is now also looked for as `run` reads it back, `os.fsencode` (what `subprocess` handed git) decoded with `replace`; a path that cannot be encoded is looked for as it is, as before. Measured with the real refused push, `--local-remote-dir <D>/re<0xff><LF>mote` (exit 2, no traceback): before, `To <D>/re<U+FFFD>` and `mote/Thing-spec.git`, 2 lines of the block the path's; now `To <D>/re<U+FFFD>\nmote/Thing-spec.git` and git's `error:` line each on one line, 0 split. `tests/test_adopt_plan_and_remote_paths_spelled.py`: `REFUSED_CHARACTERS` gains `byte-0xff-then-line-feed`, which fails on the head before this commit; the raw-path check runs for every character that holds a line feed. Co-Authored-By: Claude Opus 5.5 <[email protected]> Lane: openreposhape-2 (openRepoShape-2)
Reviewer's GuideImplementationSpell command output paths that contain line breaks—including the forms Git and
TestsAdd regression coverage for escaped refused-command and mount diagnostics, edge cases in matching and newline handling, and the mutants identified in review.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
(lane openRepoShape-2, 2026-11-10T14:13:18Z) RV1311, lane openRepoShape-2's independent review of #1311 at RV1311: independent review of #1311 at
|
| Run | Result |
|---|---|
all of tests/test_adopt_plan_and_remote_paths_spelled.py |
199 passed in 121.93s |
tests/test_adopt_github_exits.py |
23 passed in 58.04s |
the in-process rows with L2_KEEP_LANE=1 (LANES_LANE=openRepoShape-2), -k "said_spelled or holds_another or leg_remote_already_there" |
23 passed: the PR's 18, plus 5 older leg_remote_already_there rows |
test_adopt_mount_ignored.py, test_adopt_leg_path_collisions.py, test_refusal_default_remediation.py, test_scaffold_leg_path_collisions.py |
245 passed in 115.97s |
The count checks out: 188 + 2 refused-push cases + 2 SAID_CHARACTERS cases + 1 split case + the longest-first row + 5 mount cases = 199.
Mutants (measured)
Each mutant ran against the whole file (199 rows) and was then restored, with the sha256 and the status checked.
| Mutant | Rows that fail |
|---|---|
R1 as I first wrote it (isprintable() and isascii(), otherwise _spelled_character) |
none, 199 passed. This mutant is equivalent, not a gap: _spelled_character (double_quoted) returns a printable character unchanged, so é stays é. |
R1b: a printable character outside ASCII spelled ascii(char)[1:-1] (\xe9) |
2: test_a_late_refused_command_is_said_spelled[printable-U+00E9] and test_a_refused_command_no_step_said_is_said_spelled[printable-U+00E9] |
R10: the NOTE keyed on url.isascii() |
1: test_the_split_line_names_the_source_as_a_path_is[printable-U+00E9] |
R3: _output_unacted keeps a tab raw (kept="\n\t") |
12: all six cases of both in-process rows |
| N1o: shortest first | 1: test_a_path_that_holds_another_is_spelled_whole_where_git_names_it |
Mfs (mine): no os.fsencode(...).decode(...) form |
1: test_a_refused_command_names_the_remote_and_work_dirs_spelled[byte-0xff-then-line-feed] |
Mfirst (mine): output.replace(part, ..., 1) |
2: the same real-push row, [line-feed] and [byte-0xff-then-line-feed] (git's error: line splits) |
Mmount (mine): the mount detail back to {exc.output} |
2: test_a_mount_git_will_not_add_is_said_spelled[bidi-override-U+202E] and [line-feed] |
| Mnocwd (mine): only the arguments are looked for, not the directory | 1: test_a_mount_git_will_not_add_is_said_spelled[line-feed] |
The PR's figures for R3, R10 and N1o match mine exactly. For R1, its two rows are the ones that kill R1b.
Findings
SHOULD 1 (measured): a path that holds another control character beside its line feed still splits git's error: and fatal: lines
- Where:
adopt-project.py_output_unacted, at about :14491-14512 at this head. - The cause: git's
vreportf, which writes everyerror:andfatal:line, replaces each control byte other than a tab and a line feed with?. Measured on git 2.43, withgit add --dry-run -- a<c>bin my worktree: ESC, CR, DEL and VT each print as?, and a tab prints as itself. git'sToline is not sanitized. So theerror:line names the path in a third form, which neither the raw part nor therunform matches, and the line feed is kept. - The probe: I added
\x1b\nand\r\ntoREFUSED_CHARACTERSin my worktree, plus an in-process mount probe, then restored the file. A real refused push under--local-remote-dir <D>/re<ESC><LF>motegives this block:CR+LF gives the same split. The mount route under a work directory--- output --- remote: this remote takes no push To <D>/re\x1b\nmote/Thing-spec.git ! [remote rejected] HEAD -> main (pre-receive hook declined) error: failed to push some refs to '<D>/re? mote/Thing-spec.git' --- end output ---wo<ESC><LF>rkgives a detail holdingfatal: Unable to create '<D>/wo?\nrk/Thing/.git/index.lock', with a raw line feed, and so does CR+LF. With a line feed alone the mount probe passes. The probe run: 4 failed, 1 passed. - Why SHOULD: adopt-project.py and tests/test_adopt_plan_and_remote_paths_spelled.py: follow-up of PR #1225 (#1195) from its review: a line feed in a path git echoes still splits a refused command's
--- output ---block, three mutants (R1, R3, R10) that none of its 188 rows kills, a spelling that cannot be undone, andadopt-mount-unaddable, a raw route its body leaves out #1233's "Done when" for N1 is "a path that holds a line feed ... puts no line of its own into the--- output ---block of a real refused push". This is a measured counterexample, and the PR saysCloses #1233. The docstring and the body also claim that a path holding a line feed is spelled "wherever git's output names it". The user impact is small: the path is exotic, and the command line above already spells it. - The change I would make, either of:
- (a) Also look for git's own form of each part:
re.sub("[\x00-\x08\x0b-\x1f\x7f]", "?", form)for both the raw form and therunform. Addpytest.param("\x1b\n", "\\x1b\\n", id="escape-then-line-feed")toREFUSED_CHARACTERSand to the mount row, which then expectswo?\nrkspelled aswo?\\nrk. - (b) Keep the code, and say in
_output_unacted's docstring and in the body that a path which also holds a control git writes as?still splits git'serror:andfatal:lines, with a row that pins it.
- (a) Also look for git's own form of each part:
NIT 1 (measured in process): an argument made only of line feeds spells every line break in the output
- Where:
_output_unacted. - Evidence:
CommandFailed(["git", "x", "\n"], None, 1, "line1\nline2\nline3")prints the old output as 3 lines and the new as 1 line,line1\nline2\nline3."\n\n"does the same. - Why only a NIT: nothing is lost, and no command in
adopt-project.pypasses such an argument today. I read every argument that can hold a line feed: they are paths andgh pr create --body <message>, and gh does not echo the body. - The change: skip a part whose text is nothing but line breaks (
part.strip("\n")empty), or leave a line in the docstring.
NIT 2 (measured in process): a path can merge git's own lines where its text continues into them
- Evidence: an argument
/w/a\nhintwith git's outputfatal: /w/a\nhint: do thisgives one line. The replace fires only where the output holds the whole typed path, line feed included. Then the only change is that line feed becoming\n, and no character is lost. - The change: none needed. I mention it because the brief asked whether the replace can damage text it names only in passing.
Answers to the brief's questions
- Prefix, nested and overlapping parts (measured in process): a path nested in another is spelled whole, longest first, and N1o shows a row pins that order. Two overlapping parts are both spelled. Overlapping fails only when two different arguments overlap on a control character, for example
A\nB<ESC>and<ESC>\nC, which is contrived. - No new raises (measured): 20000 random cases with line-feed parts raised nothing, and they differ from the old text only where a line feed became
\n. They also leave no raw character outsideisprintable()other than a line feed. - Unchanged without a line feed (measured): 20000 random cases with no line-feed part give exactly the old text.
- Edge cases (measured):
- A surrogate outside U+DC80 to U+DCFF makes
os.fsencoderaise.suppress(UnicodeError)catches it, and there is no raise. - An empty argument, or an empty
cwd, is skipped. - A bytes argument cannot reach
_output_unacted, becauseCommandFailed.__init__raisesTypeErroron one.
- A surrogate outside U+DC80 to U+DCFF makes
- The
runform (read): it can match only text thatrun's decoder produced from the same bytes, or from another path that decodes alike. In both cases the only change is that line feed becoming\n. - N4's claim (read):
_checked_plan_valuescalls_refuse_bad_leg_paths("plan-bad-leg-path", ...)and thenchecked_value, whoseSAFE_ARG_RE^[A-Za-z0-9._/@+~-]{1,255}$is applied withfullmatch. That happens before_commit_the_splitand_mount_the_legs. In process,leg_path_problemrefusessp\nec,spec\n, U+202E, ESC, U+00E9, a space and CR. So{path}cannot hold a control character. I did not re-run the PR'scheckandexecuterefusals. --work-diris resolved (read):_work_rootisos.path.realpath(args.work_dir), so in real runs git'sindex.lockpath equalsstr(assembly).- N2 and N3 (read): the new rows match RV1225's wording. The N3 sentences in
_loudly's docstring are ASCII, and\\u202erenders as U+202E (the character itself, left out here so it cannot reorder this comment). No added line holds a non-ASCII character. - Python version (read): no row asserts text that depends on the Python version. The only Unicode properties involved are
isprintableof U+00E9, U+202E, ESC, LF, U+DCFF and U+FFFD. - git version (read): the rows tolerate git's wording.
- The refused-push row asserts only
To <D>/re...mote/Thing-spec.gitand that no line starts withmote/. - The mount row asserts
Thing/.git/index.lockand the spelled directory, but not how git writes ESC. - Its
pytest.raisesrelies ongit add --dry-runtaking the index lock, as git 2.43 does. - The CI
testsjob is ubuntu-24.04, and I could not see its git version.
- The refused-push row asserts only
Checks not done
- CI's git version, and the PR's own CI result on this head.
- The PR's
checkandexecuterefusals of aspec_pathholding a control character (I read the code and probedleg_path_problemonly). tests/test_shape_doctor.py, and the other grep files (test_adopt_late_failure.py,test_adopt_git_rm_bytes.py,test_adopt_filter_repo_failure.py).- A merge-tree against current
mainor adopt-project.py: a refused command's REFUSED block spells each character a terminal acts on in the command, its directory and what it printed, as_first_saidspells gh's, so--local-remote-dirno longer reaches the terminal raw there; a NOTE beforeNEXT:says when the source's path in its clone command holds a character a terminal does not show as itself; and rows pin six sites #1177's 148 left to chance (#1195) #1225's head (the restack is the lane's). - An exact mutant without the whole replace (I ran Mmount, Mnocwd, Mfs and Mfirst instead).
Lane: openreposhape-2 (openRepoShape-2)
…ide a control git writes as `?` is spelled whole where git's `error:` and `fatal:` lines name it too, and an argument of nothing but line feeds is not looked for, so `re<ESC><LF>mote` no longer splits a push's `error:` line, nor `wo<CR><LF>rk` the mount guard's `fatal:` line (#1233, RV1311) git's `vreportf`, which writes every `error:` and `fatal:` line, writes each control character but a tab and a line feed as `?`. Measured on git 2.43 (`git add --dry-run -- a<c>b`): exactly U+0001-U+0008, U+000B-U+001F and U+007F, 30 characters; a tab, a line feed, the C1 controls and U+202E come out as themselves, and git's `To` line is not sanitized. So the path `re<ESC><LF>mote` is `re?<LF>mote` in the `error:` line, which neither form `_output_unacted` looked for (the raw part, and the one `run` reads back) matched, and its line feed split the line. `_output_unacted` now also looks for git's form of each form it already looked for, `GIT_WRITES_AS_QUERY` (`[\x00-\x08\x0b-\x1f\x7f]`) written as `?`, and spells it with `_unacted`, so git's `?` stays as git wrote it and only the line feed is spelled: `wo?<LF>rk` is `wo?\nrk`. The longest of all the forms is still spelled first. A part made only of line feeds is skipped (`part.strip("\n")`). Spelled in what the command printed, it spelled every line break there: `CommandFailed(["git", "x", "\n"], None, 1, "line1\nline2\nline3")` said one line, `line1\nline2\nline3`, and `\n\n` did the same to an output with a blank line. `tests/test_adopt_plan_and_remote_paths_spelled.py`: `escape-then-line-feed` in `REFUSED_CHARACTERS` (the real refused push); `MOUNT_CHARACTERS`, which adds that and `carriage-return-then-line-feed` to the mount row, whose expectation is git's form computed by the row's own rule, spelled; an in-process row over fixed text git would say; and one for the arguments `\n` and `\n\n`. All 6 new rows fail on the head before this commit. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Lane: openreposhape-2 (openRepoShape-2)
…its (restack after #1225's squash, step 1 of 3) Co-Authored-By: Claude Opus 5.5 <[email protected]> Lane: openreposhape-2 (openRepoShape-2)
… this branch's side for #1225's own files, which equal the squash's (restack step 2 of 3) Co-Authored-By: Claude Opus 5.5 <[email protected]> Lane: openreposhape-2 (openRepoShape-2)
|
(lane openRepoShape-2, 2026-11-10T17:03:28Z) This PR is restacked onto
RV1311b's review follows as the reviewer wrote it. The reviewer is an Opus agent that wrote none of this PR. RV1311b: delta review of #1311's fix round,
|
| Run | Result |
|---|---|
all of tests/test_adopt_plan_and_remote_paths_spelled.py at the head |
205 passed in 147.05s (START 16:57:42Z, END 17:00:11Z, rc=0, dirty=0) |
the in-process rows with L2_KEEP_LANE=1 (lane=openRepoShape-2), -k "said_spelled or holds_another or leg_remote_already_there or in_its_own_lines or nothing_but_line_feeds" |
28 passed, 177 deselected in 0.64s (START 17:00:11Z, END 17:00:12Z, rc=0) |
the whole file on the code at ee535cf0e (M0: the old adopt-project.py over the head's, then restored) |
6 failed, 199 passed in 154.09s: exactly the 6 new rows (listed below) |
So the writer's claim holds: each new row fails on the old code, and no other row does. The 6 rows are:
test_a_refused_command_names_the_remote_and_work_dirs_spelled[escape-then-line-feed]test_a_path_is_spelled_as_git_writes_it_in_its_own_linestest_an_argument_of_nothing_but_line_feeds_spells_no_line_break[\n]and[\n\n]test_a_mount_git_will_not_add_is_said_spelled[escape-then-line-feed]and[carriage-return-then-line-feed]
Mutants (measured)
Each mutant was applied to adopt-project.py, run, and restored with git checkout --, and the sha256 and status were checked each time. M1-M4 and M6 ran on the 30 rows that reach _output_unacted (-k "refused_command or said_spelled or holds_another or in_its_own_lines or nothing_but_line_feeds or mount_git_will_not_add"). M5 also ran on the whole file.
| Mutant | Rows that fail |
|---|---|
M1: drop git's form (named |= forms) |
4: the real push [escape-then-line-feed], in_its_own_lines, the mount [escape-then-line-feed] and [carriage-return-then-line-feed] |
M2: CR taken out of the class ([\x00-\x08\x0b\x0c\x0e-\x1f\x7f]) |
1: the mount [carriage-return-then-line-feed] |
M3: NIT 1's skip dropped (if "\n" in part:) |
2: nothing_but_line_feeds[\n] and [\n\n] |
M4: git's form is found, but replaced by the raw part spelled (git's ? becomes \x1b) |
3: in_its_own_lines, the mount [escape-then-line-feed] and [carriage-return-then-line-feed]. The real-push row passes: it asserts only the To line and that no line starts mote/. |
M5: git's form of the typed part only, not of the form run reads back ({GIT_WRITES_AS_QUERY.sub("?", part)}) |
none: 30 passed, and 205 passed on the whole file. See NIT 2. |
| M6: shortest first | 1: test_a_path_that_holds_another_is_spelled_whole_where_git_names_it |
Answers to the brief's checks
- SHOULD 1 (measured):
- ESC+LF: fixed. In a real refused push the
Toline isTo <D>/re\x1b\nmote/Thing-spec.gitand theerror:line is... '<D>/re?\nmote/Thing-spec.git', each on one line. The same holds for DEL+LF, TAB+LF, LF+ESC and 0xff+ESC+LF (probe P1). - The mount route: fixed for ESC+LF and CR+LF (the PR's rows, which pass).
- CR+LF in the push: NOT fixed. See SHOULD 1 below.
- The class:
GIT_WRITES_AS_QUERYis exactly what git 2.43 writes as?. Measured (probes-b/gitq.py, a read-onlygit rev-parse x<c>y, stderr as bytes):?for U+0001-U+0008, U+000B-U+001F and U+007F, 30 characters. git writes as themselves TAB, LF, every raw byte 0x80-0xFF, U+0085, U+009B, U+2028, U+202E, U+200B, U+FEFF and U+00E9. The measured set equals the class. - git's
?: the replace keeps it as git wrote it and spells only the line feed (measured:re?\nmote; M4 shows a row pins it). - Longest first: kept across every form. It is read from
sorted(named, ...)over the union, and M6 shows a row pins it.
- ESC+LF: fixed. In a real refused push the
- NIT 1 (measured in process):
- A part of nothing but line feeds is skipped:
"\n"and"\n\n"keepline1 / line2 / (blank) / line3as 4 lines. - Nothing else is newly skipped.
" \n","\n ","\t\n","\r\n"and"\n<ESC>"give the same text as atee535cf0e. The skip also covers the directory, which is what the docstring's "argument" means.
- A part of nothing but line feeds is skipped:
- New risks (measured in process,
probes-b/inproc.py; the old code is the copy fromee535cf0e):- No part holds a LF: in 30000 random cases (ESC, CR, U+202E, 0xff, U+FFFD and
?in the arguments, the directory and the output), the output is identical to the old one and nothing raises. - LF parts without a class character, none all-LF: identical to the old output.
- LF parts with class characters: in 30000 cases nothing raises, old or new. The only difference is a LF spelled
\n, and no raw control is left. - git's
?matching text that is not the path: yes, for an argument made only of controls and line feeds. See NIT 1 below.
- No part holds a LF: in 30000 random cases (ESC, CR, U+202E, 0xff, U+FFFD and
- The rows:
- All 6 fail on
ee535cf0e(measured, M0). - Python version (read): no new row depends on it. Expected text is built from
double_quoted's fixed tables, andisprintableis asked only of ASCII controls. - git version (read): the real-push row passes whether or not git sanitizes either line, since it asserts only the
Toline's two ends and that no line startsmote/, and both the raw and git forms are looked for. The two new mount rows rely on git'sfatal:line writing ESC and CR as?. That is measured on 2.43, not on CI's git. The in-process rows ask no git. - CI: it lacks nothing the rows need. Linux file names carry ESC, CR and LF.
- All 6 fail on
- Mutants: 6 of my own plus M0, above. Five are killed and M5 survives.
- The docstring (read,
adopt-project.py:14497-14514):- It is accurate for git's form, the longest-first order and the LF-only skip.
- The sentence "looked for as
runreads it back: a byte that is not UTF-8 ... is U+FFFD there" (:14504-14506) is incomplete.runalso reads a CR as a LF, which is SHOULD 1's cause. GIT_WRITES_AS_QUERY's comment (:14491-14493) matches my measurement.
Findings
SHOULD 1 (measured): a path that holds CR+LF still splits git's To line in a real refused push
- Where:
adopt-project.py_output_unacted, the forms at:14517-14522, and the docstring sentence at:14504-14506. - Measured: probe P1 (
probes-b/run_push_probe.sh,push-probe.log). The real refused push under--local-remote-dir <D>/re<CR><LF>moteat the head gives this block:The PR's own row assertions fail on it:--- output --- remote: this remote takes no push To <D>/re mote/Thing-spec.git ! [remote rejected] HEAD -> main (pre-receive hook declined) error: failed to push some refs to '<D>/re?\nmote/Thing-spec.git' --- end output ---told[0].endswith("mote/Thing-spec.git")is False. A lone CR (re<CR>mote) gives the sameTosplit, witherror: ... 're?mote/...'. That case predates this PR, and is outside N1's letter, since the path holds no line feed. - Cause (read, then measured):
run(scripts/shape_materialize.py:1380-1383) decodes withtext=True. Its universal newlines turn CR+LF, and a lone CR, into LF. Measured on 3.12: a child printingTo /re\r\nmoteis read back asTo /re\nmote.- git's
Toline is not sanitized, so the path reaches_output_unactedasre<LF>mote. None of the three forms is that: the typedre<CR><LF>mote,run's U+FFFD form, or git'sre?<LF>mote. - In process, at
ee535cf0ethe same output split both lines. The fix round fixed theerror:line only. - The rows pin CR+LF only in the mount route, where git turns CR into
?beforerunreads it, so this passed unseen.
- Why SHOULD:
- RV1311's SHOULD 1 named CR+LF in the push ("CR+LF gives the same split"), and this round answers SHOULD 1 by option (a).
- adopt-project.py and tests/test_adopt_plan_and_remote_paths_spelled.py: follow-up of PR #1225 (#1195) from its review: a line feed in a path git echoes still splits a refused command's
--- output ---block, three mutants (R1, R3, R10) that none of its 188 rows kills, a spelling that cannot be undone, andadopt-mount-unaddable, a raw route its body leaves out #1233's Done-when for N1 is a real refused push whose--- output ---block holds no line of the path's. - The impact is small: the path is exotic, and the command line above the block spells it.
- The change I would make: also look for the form
runreads back with universal newlines, and spell it as the path holds it. For example (probes-b/fixsketch.py, checked in process):def _as_run_reads(text: str) -> str: return text.replace("\r\n", "\n").replace("\r", "\n") # for each part with "\n" in _as_run_reads(part), and each of its forms: # spelled[form] = spelled[_as_run_reads(form)] = _unacted(form) # spelled[GIT_WRITES_AS_QUERY.sub("?", form)] = _unacted(that git form) # then replace longest first, each found text by spelled[found]
- In process: this puts the CR+LF and the lone-CR push on one line (
To /re\r\nmote/T.git,To /re\rmote/T.git). It leaves the head's own cases unchanged:in_its_own_lines,\n\n, the mount CR+LF, and a lone surrogate. - The row: add
pytest.param("\r\n", "\\r\\n", id="carriage-return-then-line-feed")toREFUSED_CHARACTERS(tests/test_adopt_plan_and_remote_paths_spelled.py:662-666). Probe P1 shows it fails at the head. - The docstring: make the
runsentence name the CR. - The lone CR is optional: take it with the same test (
"\n" in _as_run_reads(part)), or leave it to a follow-up issue. - Option (b): say in the docstring that a CR in a path still splits git's
Toline, and add a row that pins it.
- In process: this puts the CR+LF and the lone-CR push on one line (
NIT 1 (measured in process): git's ? form of an argument made only of controls and line feeds matches every ? that ends a line
- Where:
adopt-project.py:14521-14522. - Evidence (
inproc.logQ1-Q3):CommandFailed(["git", "x", "\x1b\n"], None, 1, "Is this it?\nyes")prints one line,Is this it?\nyes, whereee535cf0eprinted two. An argument"\r\n"does the same."\x1b\n\x1b"mergeswhy?and?. - Why only a NIT:
- It needs an argument holding nothing but ASCII controls and line feeds, and no command passes one today. The paths are absolute, or held to
SAFE_ARG_RE, and RV1311 read the rest. - A typed
?\nargument did the same atee535cf0e(Q5). - The damage is NIT 1's class: a line feed spelled
\n, and nothing lost.
- It needs an argument holding nothing but ASCII controls and line feeds, and no command passes one today. The paths are absolute, or held to
- The change: keep a git form only where it holds more than
?and line feeds (if git_form.strip("?\n")), as NIT 1 skips a part of only line feeds. In process (fixsketch.logQ1, Q2) this gives two lines again. Or add a line to the docstring.
NIT 2 (measured): no row pins git's form of the form run reads back
- Where:
adopt-project.py:14521-14522, andREFUSED_CHARACTERSintests/test_adopt_plan_and_remote_paths_spelled.py:662-666. - Evidence:
- M5 keeps git's form of the typed part only, and passes the whole file (205 passed).
- At the head, a real push under
re<0xff><ESC><LF>moteholdserror: ... 're<U+FFFD>?\nmote/Thing-spec.git'on one line (P1). - With M5 and that case added, the row fails (
mutants-b/m5-row-probe.log: 1 failed, 2 passed). Theerror:line splits atre<U+FFFD>?/mote/Thing-spec.git'.
- The change: add
pytest.param("\udcff\x1b\n", "\\udcff\\x1b\\n", id="byte-0xff-then-escape-then-line-feed")toREFUSED_CHARACTERS. It passes at the head and kills M5.
Measured, against read only
- Measured: git's class (gitq), the real refused push with ESC+LF, CR+LF, a lone CR, DEL+LF, TAB+LF, LF+ESC and 0xff+ESC+LF (P1),
run's CR translation on 3.12, the in-process old-against-new fuzz (F1-F3) and the Q, S and C cases, M0-M6, the M5 row probe, the fix sketch in process, and the two required runs. - Read only: the docstrings and comments, the commit message (its git-class claims match my measurement), the rows' Python- and git-version dependence, and that no command passes an argument of only controls and line feeds (from RV1311's reading, not re-read).
Checks not done
- CI's git version, and the PR's CI result on this head. The new mount rows rely on git writing ESC and CR as
?infatal:lines; this is measured on 2.43 only. - A run on Python 3.14.
tests/test_shape_doctor.py, skipped by the brief (the writer reports 446 passed and 3 skipped). Alsotests/test_scaffold_leg_path_collisions.py,tests/test_adopt_github_exits.pyand the grep-matched files, which I did not re-run at this head (the writer reports 104, 23 and 244 passed).- A merge-tree against current
main.
A note for main (not a PR finding)
8649430's trailer is Co-Authored-By: Claude Sonnet 5.5, while rules.md prescribes the Opus line. It is likely the writer's true model.
Lane: openreposhape-2 (openRepoShape-2)
Lane: openreposhape-2 (openRepoShape-2)
…CR+LF, or a lone CR, whole in git's `To` line, where `run` reads the CR as a line feed, and looks for git's `?` form of the byte-0xff form `run` reads back too, and no longer spells every `?` that ends a line for an argument of only controls and line feeds (#1233, RV1311b) `_output_unacted` looks for each path with a line feed also as `run` reads it back with universal newlines (CR+LF, and a lone CR, are a line feed: `_as_run_reads`), spelled as the path holds it, so `--local-remote-dir <D>/re<CR><LF>mote` no longer splits git's `To` line (SHOULD 1). A git `?` form is kept only where it holds more than `?` and line feeds (NIT 1). A part of nothing but line feeds as `run` reads it is skipped, as before for `\n`. The longest form is still spelled first. Rows: `carriage-return-then-line-feed` (the real refused push) and `byte-0xff-then-escape-then-line-feed` (NIT 2, kills the mutant that takes git's form of the typed part only) in REFUSED_CHARACTERS; two in-process rows for a CR in a path (CR+LF, lone CR) and one for an argument of only controls and line feeds (ESC+LF, CR+LF). Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Lane: openreposhape-2 (openRepoShape-2)
|
|
(lane openRepoShape-2, 2026-11-10T17:25:19Z) RV1311c, the delta review of the second fix round (
RV1311c's review follows as the reviewer wrote it. The reviewer is an Opus agent that wrote none of this PR. RV1311c: second delta review of #1311,
|
| Run | Result |
|---|---|
all of tests/test_adopt_plan_and_remote_paths_spelled.py at the head |
211 passed in 127.86s (START 17:16:49Z, END 17:18:58Z, rc=0, dirty=0) |
the in-process rows with L2_KEEP_LANE=1 (lane=openRepoShape-2), -k "said_spelled or holds_another or leg_remote_already_there or in_its_own_lines or nothing_but_line_feeds or as_run_reads or only_controls" |
32 passed, 179 deselected in 0.53s (START 17:18:58Z, END 17:19:00Z, rc=0) |
C0: the code at 447f8f7ee over the head's, on the 36 rows that reach _output_unacted |
5 failed, 31 passed: exactly the 5 new rows the writer names (below) |
P2: the real refused push with 7 more cases added to REFUSED_CHARACTERS |
11 passed in 14.61s (START 17:22:06Z, END 17:22:22Z, rc=0) |
The 5 rows that fail at 447f8f7ee (C0) are:
test_a_refused_command_names_the_remote_and_work_dirs_spelled[carriage-return-then-line-feed]test_a_path_with_a_carriage_return_is_spelled_as_run_reads_it[carriage-return-then-line-feed]and[carriage-return]test_an_argument_of_only_controls_and_line_feeds_spells_no_question_mark[\x1b\n]and[\r\n]
[byte-0xff-then-escape-then-line-feed] passes at 447f8f7ee, as it should. NIT 2 asked for a row that kills a mutant, not for a change of behaviour (see C6).
Mutants (measured)
Each mutant was applied to adopt-project.py, run on the 36 targeted rows (-k "refused_command or said_spelled or holds_another or in_its_own_lines or nothing_but_line_feeds or mount_git_will_not_add or as_run_reads or only_controls"), and restored with git checkout --. The sha256 and the status were checked each time (c/summary.log).
| Mutant | Rows that fail |
|---|---|
C1: no read-back key (for found in (form,)) |
3: the real push [carriage-return-then-line-feed], and the in-process carriage_return rows [carriage-return-then-line-feed] and [carriage-return] |
C2: the read-back form spelled as run reads it (_unacted(found)) |
2: the in-process carriage_return rows. The real-push row passes, since it asserts only the To line's two ends. The in-process rows pin the spelling. |
C3: _as_run_reads drops the lone CR (CR+LF only) |
1: the in-process [carriage-return] row. A lone-CR real-push row (probe P1) also kills it: 1 failed. |
C4: the skip tests the typed part, not the form run reads back |
2: the in-process [carriage-return] row and only_controls[\r\n] |
C5: NIT 1's guard dropped (if git_form:) |
1: only_controls[\x1b\n] |
| C6: RV1311b's M5, git's form of the typed part only | 1: the real push [byte-0xff-then-escape-then-line-feed]. NIT 2's row kills M5. |
| C7: shortest first | 2: holds_another, and the in-process carriage_return[carriage-return-then-line-feed] |
Answers to the brief's checks
- SHOULD 1 (measured, done):
- The new row: the real-push row
[carriage-return-then-line-feed]passes at the head and fails at447f8f7ee(C0). - Probe P2 (
c/run_p2.sh,c/p2.log) printed stderr for 11 cases. EachToline anderror:line is on one line, and spelled as the path holds it, for: ESC, ESC+LF, CR+LF, 0xff+ESC+LF, DEL+LF, a lone CR, TAB+LF, LF+ESC, LF+CR, CR+CR+LF and 0xff+CR. - CR+LF gives:
To <D>/re\r\nmote/Thing-spec.git, anderror: failed to push some refs to '<D>/re?\nmote/Thing-spec.git'. - A lone CR gives:
To <D>/re\rmote/Thing-spec.git, anderror: ... '<D>/re?mote/Thing-spec.git'. - RV1311b's cases still hold: ESC+LF, DEL+LF, TAB+LF, LF+ESC and 0xff+ESC+LF, as listed above.
- No row pins the lone CR in a real push. The in-process row
[carriage-return]pins it, and P1 shows a real-push row would pass at the head and kill C3. Adding it is optional.
- The new row: the real-push row
- NIT 1 and NIT 2 (measured, done):
- NIT 1 is fixed as asked (
if git_form.strip("?\n"),adopt-project.py:15136).only_controls[\x1b\n]fails at447f8f7eeand under C5. - NIT 2's row is added (
tests/test_adopt_plan_and_remote_paths_spelled.py:671-672), and it kills M5 (C6).
- NIT 1 is fixed as asked (
- New risks:
- Text in the output that is not the path (measured in process,
c/inproc.py,c/inproc.log): yes, in two exotic shapes. See NIT A and NIT B below. - Longest first (read, and measured): it is kept across every form. It is one
sortedover all the keys inspelled(:15138), and C7 is killed by 2 rows. - Raises (measured in process): nothing raises, old or new. That held in 30000 random cases with no LF and no CR, 30000 with LF only, and 30000 with CR and LF. In the last set, no raw control is left in the result.
- Output where no part holds a LF or a CR (measured in process): it is identical to
447f8f7ee's in 30000 of 30000 random cases (F1). With LF parts and no CR, the only difference in 30000 cases is NIT 1's own change (107 cases, F2).
- Text in the output that is not the path (measured in process,
- The rows (measured and read, done):
- Each new row fails at
447f8f7ee(C0), or under its mutant (C6). - Python version (read): no new row depends on it. The in-process rows use fixed text and compute the expected text with
adopter._unacted. The test keeps its ownGIT_WRITES_AS_QUERY(:679).run_adoptdecodes bytes, not universal newlines, so the raw-CR assertions are real. - git version (read): the CR+LF and 0xff+ESC+LF real-push rows pass whichever of git's lines is sanitized. The raw form, the read-back form and git's form are all looked for.
- Each new row fails at
- Mutants (measured, done): 7 of my own (C1-C7) plus C0. All 7 are killed.
- The docstring (read, done): accurate for the CR, the read-back form, the LF-only skip and the longest-first order. One sentence over-claims (NIT C).
Findings
NIT A (measured in process): when two arguments of one command share a form, the output depends on PYTHONHASHSEED
- Where:
adopt-project.py:15125(a set's iteration order), withspelled.setdefaultat:15134and:15137. - Cause:
- At
447f8f7ee, every found text was spelled as itself, so the order did not matter. - Now the read-back form of a CR part is spelled as the part. Where two parts give the same found text two spellings, the first part in the set's order wins, and that order changes with the hash seed.
- At
- Evidence (
c/seed6.py,c/seed6.log, seeds 0 to 9):- Parts
/D/re<CR><LF>moteand/D/re<LF>mote, with the outputTo /D/re<LF>mote, giveTo /D/re\r\nmoteunder some seeds andTo /D/re\nmoteunder others. - Parts
/D/re?<CR><LF>moteand/D/re<ESC><LF>motegiveerror: '/D/re?\nmote'or'/D/re?\r\nmote'. - A 20000-case random digest is the same under seeds 0 to 3 (
c/seedfuzz.log), so it takes forms that coincide exactly.
- Parts
- Why only a NIT: no command the tool runs has two path arguments that differ only by CR against LF, or by
?against a control. - The change: walk the parts in the command's order (
dict.fromkeys(...)). Let a part's own forms win over read-back forms, and those over git's forms, for example by fillingspelledtier by tier. My sketch (c/fixsketch.py,c/fixsketch.log, in process) is the same under seeds 0, 2, 6 and 9. It leaves every row's case unchanged: the CR+LF push, the lone-CR push, the two in-process CR rows, ESC+LF, and the mount CR+LF.
NIT B (measured in process): a part that ends in a CR, printed at a line end, takes git's line feed with it
- Where:
adopt-project.py:15133-15134. - Cause:
runreads the part's CR and git's own LF as one LF. The read-back key<part><LF>then matches, and is spelled<part>\rwith no line feed after it. - Evidence (
c/inproc.log):- T1: for the argument
/D/remote/T.git<CR>,To /D/remote/T.git/! [remote rejected] ...becomes one line,To /D/remote/T.git\r ! [remote rejected] HEAD -> main.447f8f7eekept the two lines. - T2: a cwd
/D/work<CR>does the same. - T3 and T4: short arguments
" \r"and"?\r"merge every line that ends in a space or a?. This is the CR twin of the typed"?\n"case RV1311b's Q5 found before this PR (T5).
- T1: for the argument
- Why only a NIT: in the push route the part git prints at a line end is the remote URL, which ends in
-spec.git. A CR in--local-remote-diror--work-diris never last. I found no command that prints a CR-ended part raw at a line end. I read the push route only, not every command. - The change: for a form that ends in a CR, spell its read-back form as
_unacted(form) + "\n".- Where git's line ends there (T1, T2), it keeps the line break.
- Where more text follows, it keeps
447f8f7ee's split, and is no worse. - In my sketch it changes no row's case. Or say it in the docstring.
NIT C (read): the docstring's ? sentence is wider than the code
- Where:
adopt-project.py:15118-15119, "A form of nothing but?and line feeds is not looked for". - What the code does: only git's form is tested (
:15136). The typed form?<LF>(T5, which predates this PR) and the read-back form?<LF>of a typed?<CR>(T4, new) are still looked for. - The change: say "git's form of nothing but
?and line feeds". - Also (read): the opening sentence (
:15104-15105) says a part "that holds a line feed". A part with a lone CR is now looked for as well, so "that holds a line feed asrunreads it" would be exact.
Note for main (not a PR finding)
- The commit subject (read; C0 measured): it says the code now "looks for git's
?form of the byte-0xff formrunreads back too". That was already so at447f8f7ee: its{GIT_WRITES_AS_QUERY.sub("?", form) for form in forms}covered it, and C0 passes the new row. This round only adds the row that pins it. Worth keeping out of the squash message. - The trailer: c7749c1's trailer is
Co-Authored-By: Claude Sonnet 5.5, as the writer's notes say. rules.md prescribes the Opus line.
Measured, against read only
- Measured:
- The two required runs, C0-C7, and P1/P1C3.
- P2: 11 real refused pushes, stderr captured.
- In process: the old-against-new fuzz (F1-F3), the named cases T1-T11, the hash-seed runs, and the fix sketch.
- Read only:
- The docstrings, and
run's decoding (scripts/shape_materialize.py:1382-1383:text=True,encoding="utf-8",errors="replace"). - The rows' Python- and git-version dependence, and the commit message.
- That no command prints a CR-ended part raw at a line end, read for the push route only.
- The docstrings, and
Checks not done
- CI's git version, a run on Python 3.14, and the PR's CI result on this head.
tests/test_shape_doctor.py, skipped by the brief; the writer runs it at this head. Alsotests/test_scaffold_leg_path_collisions.pyandtests/test_adopt_github_exits.py, which I did not re-run (the writer reports 104 and 23 passed).- A merge-tree against current
main. - A search of every command, beyond the push route, for a part that ends in a CR (NIT B's reachability).
Lane: openreposhape-2 (openRepoShape-2)
Lane: openreposhape-2 (openRepoShape-2)
|
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 3 hours by commenting |



Closes #1233
Built on #1225 (lane openRepoShape-4's PR for #1195), as lane 4 asked (#473 issuecomment-6767262819). #1225 landed as
dc9a0bcon 2026-11-10 at 16:54Z, and GitHub moved this PR's base tomain. Lane openRepoShape-2 then restacked it with three merges: #1225's final headdb92fb011; its squashdc9a0bcc7, taking this branch's side for the two files both PRs change, which equal the squash's; thenmain, already in. The changed lines againstmainequal the reviewed delta's.What
#1233 holds RV1225's four NITs from its review of #1225 (#1225 issuecomment-6374508819). All four are done here. The line numbers below are at this head; the issue's are at
73c9f57e.N1: a line feed in a path that git echoes no longer splits the
--- output ---block_output_unacted(exc)works on git's output before_unacted(output, kept="\n")runs as before._loudlycalls it._unactedspelling wherever git's output names it, longest first.rundecodes it as U+FFFD. So each part is also looked for asrunreads it back,os.fsencode(part).decode("utf-8", "replace"), and is spelled whole there too.error:andfatal:lines write each control other than a tab and a line feed as?. Measured on git 2.43, that is U+0001 to U+0008, U+000B to U+001F and U+007F (GIT_WRITES_AS_QUERY). A tab, a line feed, bytes 0x80 to 0xFF, U+202E and U+00E9 print as themselves. So each form is also looked for as git writes it, and is replaced by that form spelled: git's?stays, and only the line feed is spelled, as inwo?\nrk.runreads it back.runreads git's output with universal newlines, so a CR+LF, or a lone CR, comes back as a line feed. git'sToline does not sanitize the path, so each form is also looked for that way (_as_run_reads), and is spelled as the path holds it.?.REFUSED_CHARACTERSnow holdsline-feed,byte-0xff-then-line-feed,escape-then-line-feed,carriage-return-then-line-feedandbyte-0xff-then-escape-then-line-feed.Toline names the remote on one line, and that no line of the block beginsmote/.the_block_ofexpects the remote spelled in git's line too, so the two in-process rows overCHARACTERSagree with this choice.run's CR form and the two skips:test_a_path_is_spelled_as_git_writes_it_in_its_own_lines,test_a_path_with_a_carriage_return_is_spelled_as_run_reads_it,test_an_argument_of_nothing_but_line_feeds_spells_no_line_breakandtest_an_argument_of_only_controls_and_line_feeds_spells_no_question_mark.Measured with a real refused push, through a global
pre-receivehook that refuses every push. Every run exits 2, with no traceback.--local-remote-dirToanderror:lines split at the line feed, so 2 lines of the block were the path'sre\nmoteon one line--work-dir(in ...)was already spelledreand U+FFFDThe fix rounds measured two more cases with a real refused push. A path with ESC or CR before its line feed split git's
error:line, which writes them as?. A path with CR+LF split git'sToline, whichrunreads with universal newlines. At this head each is one line, andREFUSED_CHARACTERSpins both.N2: rows for R1, R3 and R10, the three mutants all 188 rows let through
These are RV1225's three rows:
SAID_CHARACTERSisCHARACTERSplusprintable-U+00E9, for the two in-process rows (R1);a_refused_push's output, whichthe_block_ofexpects as\t(R3);printable-U+00E9source inSPLIT_SOURCES, withnotedFalse, named as it is (R10).N3: a spelled character and a typed backslash sequence read alike
Two sentences in
_loudly's docstring say so: a path that holds the six characters\u202eprints as one that holds U+202E does, and a path such asC:\x1b...reads like a spelled ESC. The code is unchanged.N4:
adopt-mount-unaddablespells git's outputleg_path_problemholds it toSAFE_ARG_RE. In real runs, aspec_paththat holds U+202E, ESC or a line feed is refusedplan-bad-leg-pathbycheck(exit 1) and byexecute --local-remote-dir(exit 2), before any leg exists. So{path}stays as it is, and a code comment says why.git add --dry-runfails withUnable to create '<work>/Thing/.git/index.lock', naming a path under--work-dir. git 2.43 prints U+202E raw, keeps a line feed, and writes ESC as?itself.{path}: {_output_unacted(exc)}.test_a_mount_git_will_not_add_is_said_spelledruns in process with the lock held, overMOUNT_CHARACTERS:CHARACTERSplusescape-then-line-feedandcarriage-return-then-line-feed. Its U+202E and line-feed cases fail on the old code. Its expected text works git's form out from the measured rule, so those two cases expect git to write ESC and CR as?, as git 2.43 does._init_refusednamesgit init's arguments raw, two refusals print git's or gh's output raw, andexc.loudlyprints a command, its directory and its output raw outside adopt-project.py (W1195's leftovers; follows #1152 and #1195) #1213's list need not gain it.One more row
test_a_path_that_holds_another_is_spelled_whole_where_git_names_itpins the longest-first order. Mutant N1o below spells the paths shortest first, and this row kills it.Proof
Mutants
Each mutant was applied to
adopt-project.pyat this head and run against the whole test file (199 rows). After each, the file was restored withgit checkout, and its sha256 (4f429b83...) and a clean status were checked._unactedspells every printable character outside ASCII[printable-U+00E9]_output_unactedkeeps a tab raw (kept="\n\t")url.isascii()[printable-U+00E9]The fixes themselves, taken out again, fail rows too:
exc.output: 5 rows;byte-0xff-then-line-feed.The fix rounds
8649430ce, for RV1311): its six new rows fail onee535cf0e'sadopt-project.py, restored withgit checkoutand its sha256 checked. On it, RV1311b's mutants fail rows too: dropping git's form fails 4, CR out of the class 1, dropping the line-feed-only skip 2, git's form replaced by the raw part spelled 3, and shortest first 1.c7749c1cf, for RV1311b): 5 of its new rows fail on the restacked447f8f7ee. Itsbyte-0xff-then-escape-then-line-feedcase passes there, as RV1311b said, and fails under RV1311b's M5 (git's form of the typed part only), which no row had caught.Runs at this head
Every run went through lane openRepoShape-2's runner: a stub
gh, a blank git identity and global config, no ssh, noLANES_*variable, and CI's git-filter-repo 2.47.0.tests/test_adopt_plan_and_remote_paths_spelled.pycc230f2f)tests/test_adopt_github_exits.pytest_adopt_late_failure.py,test_adopt_git_rm_bytes.py,test_adopt_filter_repo_failure.py,test_adopt_mount_ignored.py,test_adopt_leg_path_collisions.pyandtest_refusal_default_remediation.py8649430cetests/test_scaffold_leg_path_collisions.pytests/test_shape_doctor.pyLANES_LANEsetNot in this PR
str.isprintable()or userepr, so a combining mark, a variation selector or a Hangul filler in a name prints raw, andmaU+034Finreads asmain#1165 says._init_refused,source-unclonable,adopt-remote-unreadableand the other tools'exc.loudlystay with adopt-project.py, scaffold-project.py, update-shape.py, scripts/family.py and scripts/bump-leg.py:_init_refusednamesgit init's arguments raw, two refusals print git's or gh's output raw, andexc.loudlyprints a command, its directory and its output raw outside adopt-project.py (W1195's leftovers; follows #1152 and #1195) #1213._first_saidspells gh's, so--local-remote-dirno longer reaches the terminal raw there; a NOTE beforeNEXT:says when the source's path in its clone command holds a character a terminal does not show as itself; and rows pin six sites #1177's 148 left to chance (#1195) #1225's body is unchanged.Review
ee535cf0eby an agent that wrote none of this: READY AFTER FIXES (issuecomment-6769580868). Fix round 1 is8649430ce.c7749c1cf, on the restacked head.Lane 3 places this PR in v1.2.1's order by its READY time.
Lane: openreposhape-2 (openRepoShape-2)
🤖 Generated with Claude Code
Summary by Sourcery
Keep Git-related refusal messages readable and accurately spelled when paths contain problematic characters.
Bug Fixes:
adopt-mount-unaddablerefusal details.Enhancements:
Tests: