Repository navigation
update-shape.py: _by_hand's lines, the NEXT lines of check and apply, update-root-missing, update-upstream-not-a-repo and update-branch-not-utf8 print --root as typed, so a bidi control, an ESC or a line feed in it reaches the terminal raw (follow-up to #1288) #1318
Description
Follow-up to #1288. It is filed from #1310's Known limits (#1310 is the draft PR for #1288, stacked on #1284), which says: "_by_hand's other lines in update-shape.py quote a root raw. Neither is in #1288; each is a candidate follow-up." The independent review of #1310 (NIT 1, #1310 issuecomment-6773301382) found more refusals of this tool that print a path raw: update-root-missing and update-upstream-not-a-repo. The other candidate that Known limits names, family-root-missing in scripts/family.py, is filed on its own, with the family root's bootstrap.py and validate-family.py.
What #1288/#1310 do, and what is left. #1288's table makes update-shape.py's update-pin-missing and update-pin-commit name the pin as shown_path does, and #1310 adds the four check_pin refusals it read. While measuring update-pin-row, #1310 found that its remedy still named the root raw: git -C <root> log -- contracts/shape-pin.yaml, quoted by _by_hand, and a quote passes an ESC and a line feed through. #1310's pin_rows_remediation now spells the root where it does not print (a printable root keeps _by_hand's line), and left _by_hand's other lines as they were. This issue is those lines. Measuring them found the tool names a typed --root raw in more lines that do not go through _by_hand (the second table), in the REFUSED line of update-branch-not-utf8, which sits beside a _by_hand line of its own, and names a typed --upstream raw once.
Measured. The runs were real, with a stub gh first on PATH, GH_TOKEN=bogus, an empty GH_CONFIG_DIR, GIT_SSH_COMMAND=false and GIT_CONFIG_GLOBAL=/dev/null, with --root a folder named with U+202E (wd-pl<U+202E>an), then an ESC (wd-<ESC>[31mRED), then a line feed (wd-<LF>WARNING forged-line: pwned), and a printable name (wd <e-acute> and a space). Line numbers are at main f2a6527e9 (#1289's squash, 2026-11-10T14:12Z). 72 runs. Each of the 54 over a name that does not print puts the U+202E or the ESC on a stream raw, or ends its line at wd- and begins a line WARNING forged-line: pwned/...; each of the 18 printable runs prints the folder as typed. 64 of the 72 were run again at #1310's head 6b9a4ece5 (not landing_failed's NEXT line, nor the pin's unsafe-value): update-pin-row is spelled there (0 of its 6 non-printable runs raw) and every other row answers as at main.
The roots were a real project: a clone of main as the upstream, with a commit that changes the copied scripts/validate-manifest.py and adds a file the copy lists name; the project cut from it by scaffold-project.py --local-remote-dir; a copy of the project in the folder named, for each run. update-pin-row needs no upstream: a pin whose files: is 5 or [5]. The source_repository: rows edit that field of the project's contracts/shape-pin.yaml.
The _by_hand lines, and the one REFUSED line that sits with them. The rollback lines are reached by a real apply that fails after its first write, three ways: a validator the root runs, the upstream's new validate-manifest.py, that makes contracts/shape-pin.yaml read-only and exits 1 (update-validators-red, whose REFUSED line names no root); a pre-commit hook in the root that does the same and refuses the commit; and the same hook also making .git read-only, so the rollback's git checkout and git update-index cannot take their lock, or taking refs/heads/<branch>.lock, so update-ref -d fails.
| code or line | site | run | runs | raw |
|---|---|---|---|---|
update-pin-row, remedy git -C <root> log -- contracts/shape-pin.yaml |
update-shape.py:870, pin_rows_remediation (spelled by #1310; listed because main prints it raw, and it is the rule's model) |
check --root, files: 5 and files: [5] |
8 | 6 of 6 |
update-branch-not-utf8, remedy git -C <root> branch -m <a new name>, and its REFUSED line <root> is on the branch b'caf\xe9' ... |
:2819 (_by_hand) and :2814 (an f-string of {root}) |
apply --branch, HEAD on a branch named with the bytes caf and 0xE9 |
4 | 3 of 3 |
update-branch-exists, remedy git -C <root> checkout <branch> |
:3116 |
apply --branch shape/someone-elses, a branch that exists |
4 | 3 of 3 |
rollback file <path> was not put back ...: git -C <root> --literal-pathspecs checkout HEAD -- <path>, under update-validators-red |
:3590, _restore_by_hand |
apply over a root whose new validator goes red after making the pin read-only |
4 | 3 of 3 |
rollback file <path> ...: git -C <root> cat-file blob <id> > <root>/<path> (the root twice), under update-validators-red |
:3601 and :3602 |
the same, contracts/ read-only too |
4 | 3 of 3 |
the same checkout HEAD line, under REFUSED committing ... |
:3590 |
apply --branch, the commit refused by a hook, the pin read-only |
4 | 3 of 3 |
rollback index <path> may still hold this run's entry; it had none before: git -C <root> update-index --force-remove -- <path>; HEAD is not back on <branch>: git -C <root> checkout <branch>; branch <branch> ... was not deleted because HEAD is still on it ...: git -C <root> checkout ... && git -C <root> branch -D ... (the root four times) |
:3932 (_index_by_hand), :3792, :3800-3801 (_undo_branch) |
apply --branch --add <file>, the commit refused, the pin and .git read-only |
4 | 3 of 3 |
rollback branch <branch>, which this run created, is still there: git -C <root> branch -D <branch> |
:3807 (_undo_branch) |
apply --branch, the commit refused, the new branch's ref lock held |
4 | 3 of 3 |
Lines that name the root and do not go through _by_hand:
| line | site | run | runs | raw |
|---|---|---|---|---|
check's root <root> header (stdout), and its NEXT python3 update-shape.py apply --root <root> ... (stdout) |
:2466 (report) and :2617-2620 (apply_command, shlex.join) |
check --root over a root behind the standard, exit 1 |
4 | 3 of 3 |
apply's NEXT git -C <root> checkout -b ... && git -C <root> commit ... |
:6397-6401 (next_line) |
apply without --branch, exit 0 |
4 | 3 of 3 |
apply --branch's NEXT git -C <root> push -u origin ... && gh pr create ... |
:6339 (next_line) |
apply --branch, exit 0 |
4 | 3 of 3 |
landing_failed's NEXT, the same push line |
:5681 |
apply --branch --push, origin not there, exit 2 |
4 | 3 of 3 |
update-root-missing: <root> is not a directory |
:2530 (prepare) |
check --root <a folder that is not there>, exit 2 |
4 | 3 of 3 |
update-upstream-not-a-repo, update-upstream-unresolvable and unsafe-value for the pin's source_repository:, each <root>/contracts/shape-pin.yaml: `source_repository:` is ... |
:812 (pin_source's named, used at :817, :822 and :824; unsafe-value is repo_shape.checked_value's, handed named as its what) |
check --root R, the pin's source_repository: an existing folder that is no repository, no-such-shape, and -a/b; exit 2 |
12 | 9 of 9 |
update-upstream-not-a-repo for a typed --upstream: --upstream <path> exists but is not a git repository (the flag's value, not the root) |
:699-700 (open_upstream) |
check --root <a plain folder> --upstream <a folder named as above that is no repository>, exit 2 |
4 | 3 of 3 |
For example, update-branch-exists's remedy over the ESC folder prints, with the ESC raw between wd- and [31mRED (the em dashes are written -- here):
Remediation: check out that branch first -- `git -C '<D>/wd-<ESC>[31mRED' checkout shape/someone-elses` -- if that is where ...
Read, not probed:
_index_by_hand's other two branches::3939(update-index --add --cacheinfo) and:3949,:3952(an unmerged path'supdate-index --force-removeand--index-info). Same function, same_by_hand(root, ...); reached only where an--addpath already has an index entry before the run, which no run of mine made._restore_by_hand'smkdir -p <directory> &&(:3598,shlex.quote(str(path.parent))): reached where a validator deleted the directory the file sat in.
Not a regression. Neither #1284 (136b38d12..86ab76db4) nor #1310 (86ab76db4..6b9a4ece5) touches any line above, except #1310's one line at :870, pin_rows_remediation, which is its deliberate spelling. Every line of update-shape.py that holds a _by_hand( call is the same text at 136b38d12, 86ab76db4 and main, and at 6b9a4ece5 but for that one; _by_hand and _index_by_hand are byte for byte the same function everywhere. The text around each other site (a window of the lines around its token) is the same at all four commits; only the line numbers move. The exceptions are the pin_source and open_upstream lines, which 136b38d12 lacks or words otherwise (main's #1203 reached #1284's branch by a merge) and which are identical at 86ab76db4, 6b9a4ece5 and main. The hunks of update-shape.py between 136b38d12 and 86ab76db4 (main's merges into #1284's branch, and #1284's own) are in the imports, open_upstream, check_pin's refusals, _is_block_header, prepare, Rollback.writing, the new _flush_stdout and the flushes of _rolled_back, _roll_back_before_raising and landing_failed; none is on a line above.
Out of scope, and why. REFUSED committing ... and REFUSED pushing ... also print (in <root>) and the command's own words raw: that is CommandFailed.loudly (scripts/shape_materialize.py:1271-1278), which #1213 (open, v1.2.1) lists for update-shape.py with the other tools. Rows that reach a line through a refused commit should hold the ROLLED BACK IN PART block, not the whole of stderr, until #1213 lands; the validator route has no such line.
Expected. No refusal code changes, and no word of any line but the root.
- A line that only names the root or a typed path (
check's header,update-root-missing,update-branch-not-utf8's text,open_upstream's--upstream {spec}) names it asshown_pathdoes: as it is, or asreprspells it where a character in it is not printable.pin_source's three refusals share one f-string,named(:812), so spelling its{pin_path}once coversupdate-upstream-not-a-repo,update-upstream-unresolvableandunsafe-value.update-shape.pytakesshown_pathfromrepo_shapeonce repo_shape.py, path_classify.py, bump-leg.py, validate-repository-naming.py, update-shape.py and the root's validate-manifest.py: not-a-mapping and wrong-kind refusals name the file asshown_pathdoes, so no U+202E, ESC or line feed is raw (#1279) #1284 lands (its head addsfrom repo_shape import shown_path,:191; main does not have it yet), so this is written for after repo_shape.py, path_classify.py, bump-leg.py, validate-repository-naming.py, update-shape.py and the root's validate-manifest.py: not-a-mapping and wrong-kind refusals name the file asshown_pathdoes, so no U+202E, ESC or line feed is raw (#1279) #1284, as bump-leg.py, family.py, update-shape.py and the roots' validate-manifest.py, bootstrap.py, siblings.py and validate-family.py: fourteen missing, unreadable and wrong-kind refusals and four ofcheck_pinname the path asshown_pathdoes (#1288) #1310 is. - A line meant to be pasted follows bump-leg.py, family.py, update-shape.py and the roots' validate-manifest.py, bootstrap.py, siblings.py and validate-family.py: fourteen missing, unreadable and wrong-kind refusals and four of
check_pinname the path asshown_pathdoes (#1288) #1310's rule forpin_rows_remediation: a printable root keeps its line byte for byte, and only a root that does not print is spelled, asshown_pathspells it, inside the command. That line cannot be pasted as the root it names, and no quoting could make it so (bump-leg.py, family.py, update-shape.py and the roots' validate-manifest.py, bootstrap.py, siblings.py and validate-family.py: fourteen missing, unreadable and wrong-kind refusals and four ofcheck_pinname the path asshown_pathdoes (#1288) #1310's own note); the remedy's other words stay. This covers every_by_handline, the redirect of:3598and:3602,apply_command,next_line's two lines andlanding_failed's. _by_handis the one quoter behind thirteen of the call sites at main (:870,:2819,:3116,:3590,:3601,:3792,:3800,:3801,:3807,:3932,:3939,:3949,:3952), so the rule that bump-leg.py, family.py, update-shape.py and the roots' validate-manifest.py, bootstrap.py, siblings.py and validate-family.py: fourteen missing, unreadable and wrong-kind refusals and four ofcheck_pinname the path asshown_pathdoes (#1288) #1310 writes inline inpin_rows_remediationcan live in it once; the lines that callshlexthemselves need it too. How is the writer's choice.update-shape.pyis not a pinned copy, so the skew rule does not apply. A printable root on Windows is quoted byshlexas_by_hand's docstring says, and stays so.
Acceptance. One row per site in both tables, and one per branch under Read, not probed once it is probed. Each row runs the real tool as the table says over a root whose folder holds U+202E, an ESC and a line feed (skipping by name where the filesystem cannot make the folder, as #1310's rows do), and holds: exit code as before; no raw U+202E or ESC on stdout or stderr; no forged line; the printable run byte for byte as now. Each row fails on main and passes with the fix. tests/test_update_shape_paste_lines.py, tests/test_update_shape_apply_lines_and_headers.py, tests/test_update_shape_partial_rollback.py, tests/test_update_shape_unreadable.py, tests/test_update_shape.py and tests/test_update_shape_add_ignored.py name these codes and lines for a printable root, and stay as they are.
Scope, for whoever takes this. The first table is what #1310 names. The second table and update-branch-not-utf8's REFUSED line were found while measuring and have the same cause (the typed root printed as typed), but they are a widening, and the second table could be filed apart. For the pasted lines, note that #766 (closed) named the holder through shown_path in family.py's refusals and left the lines a person pastes raw inside their shell quotes on purpose (scripts/family.py:1201, :1274, :10276, each citing #459; scripts/bump-leg.py:1759): #1310's pin_rows_remediation is the first place that spells such a line, so applying its rule to every pasted line of this tool is a decision to make, not a given.
Related, not overlapping. #1213 (open) is the CommandFailed.loudly lines above. #1294 (open) edits _land, _committed_pin and _accepted_in_the_pin and none of these; #1284 is the base of #1310.
Lane: openreposhape-5 (openRepoShape-5)
Activity
brettheap commentedon Nov 10, 2026
(lane openRepoShape-5) Kept on Brett Heap's word of 2026-11-10T21:48:51Z ("keep #1317 and #1318"). This issue waits for #1284 and #1310 to land.
Lane: openreposhape-5 (openRepoShape-5)
brettheap commentedon Nov 10, 2026
CLAIMED — lane openRepoShape-5, session 50cede29-ab82-4ca3-9f67-d98e1a58c8d2@Eagle, 2026-11-10T23:36:14Z, for #1318
Logged in
lanes/log/openRepoShape-5.mdat5f076f2bfb5b40ccd129158b64eb4eba598241b0.The three reads (lane-collision-protocol Rule 1):
test_update_shape_root_lines_shown.py: a relative typed `--upstream` …