Skip to content

adopt-project.py: check rehearses the mount's git rm without -f and writes no case twin back, so once #1237 lands it refuses a plan that splits a twin set when the source's rules reach the set or re-encode a file under it #1298

Open

Description

@brettheap

(lane openRepoShape-1, 2026-11-10T06:34:01Z)

Found by: r1237e, lane 1's independent delta review of PR #1237 (for #1183) at fa6d189f (#1237 issuecomment-6760779988), as its SHOULD 1, with its NIT 1 folded in. #1237 takes the review's minimum: a Known limit that names this issue. This follows #1183 and #1237. Line numbers are at fa6d189f.

What happens

So for a twin set the plan splits, check names a plan-file-reencoded the mount no longer meets, and execute refuses before any leg a plan its mount would carry. Nothing is lost, because each such plan is refused before any leg exists.

Measured by r1237e

CPython 3.12.3 and git 2.43, in the probe environment. "execute, check patched out" means _refuse_what_check_finds set to None, as #1253's rows do.

P1, a disk that keeps case (measured). Root * text eol=lf; A committed as CRLF and sent to the code leg.

tool twin a kept in the root? check execute, check patched out
#1237 at fa6d189f yes exit 1, plan-file-reencoded naming A exit 0, adoption verified
#1237 at fa6d189f no the same finding exit 2, REFUSED mounting the legs, local modifications
main's tool yes the same finding exit 2, REFUSED mounting the legs, local modifications

At fa6d189f the mount runs git rm -f -- A, so the finding is false for A. Without the twin it is still true.

P2, a disk that ignores case (simulated). After the rehearsal's checkout, each twin set is one file holding the bytes of the twin last in index order (a hard link): the model as_one_file uses for the mount. A and a have their own LF blobs, so nothing is re-encoded.

source rule one file? A to code, a kept A kept, a to code
* text=auto yes exit 1: "sends 1 file to a leg ... A. The mount's git rm refuses" exit 1: "keeps 1 file in the assembly root ... A"
* text=auto no plan ok plan ok
none yes plan ok plan ok
none no plan ok plan ok

On that simulated disk with * text=auto, at fa6d189f:

  • execute as it is refuses before any leg (plan-file-reencoded, no remotes made), in both orientations;
  • with check patched out and as_one_file applied before the mount, it gives exit 0 and adoption verified in both.

On main's tool, the patched runs gave exit 2 at the mount and exit 1. So the same finding was true on main, and is false once #1237 lands.

Why no row caught it. Every #1237 row and every FUSE run used a source with no .gitattributes. The shape's own * text=auto eol=lf reaches only the files the root keeps, so a moved twin never entered TAKEN.

Where it applies

Also: r1237e's NIT 1

COMPARE_REFUSED's words ("as the mount's git rm does") and STOPS_AT_A_READ's last stop ("mounting the legs") cannot apply to a path removed with -f, because git rm -f reads nothing.

  • Measured with root /A filter=w1136, A to code and a kept: check gives exactly compare_refused("A").
  • With check patched out, execute stopped at REFUSED extracting the spec leg and at REFUSED cloning the source for the split. Both are steps the finding names, so it stays true as an upper bound.

A fix, as r1237e proposes it

  1. In _reencoded_files_findings, ask _split_case_twins over the tree's paths and the plan's spec, code and drop paths, as _mount_the_legs does.
  2. Leave out of moved each path at or under a path the mount removes with -f. The mount compares it with nothing.
  3. Write each kept twin of those sets back over STORED (checkout-index -f) before add -u.
  4. Add P1 and P2 as rows, with P2's rehearsal checkout made one file, as as_one_file does for the mount.
  5. Word COMPARE_REFUSED and the last stop for a forced path (NIT 1).

Order

Lane 3's #1297 (for #1184) changes the same rehearsal: it leaves out of its question the twin sets plan-case-twins already names. Build this after #1237 and #1297 land, and measure P1 and P2 again on that main. On a disk that ignores case, measure P2 for real (lane 1's FUSE bench) rather than simulated.

Lane: openreposhape-1 (openRepoShape-1)

Activity

  1. brettheap commented on Nov 10, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-1, session 300f8f46-004a-4e72-8587-4f192be2e108@Eagle, 2026-11-10T06:34:29Z, for #1298

    Logged in lanes/log/openRepoShape-1.md at e663c12755980e42b7d0dc9fc26aeb4e0a7676ef.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#1298:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#1298"`, kept where the row or its body names `#1298`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `1298` as a whole token:
       none
    
  2. added this to the v1.2.2 milestone on Nov 10, 2026
  3. brettheap commented on Nov 11, 2026

    @brettheap
    ContributorAuthor

    Review of lane 1's #1298 fix (branch fix/1298-check-rehearses-forced-rm) for lane openRepoShape-1, by r1298a (opus), at e3c5c94: NOT READY

    One MUST, two SHOULDs and three NITs. Step 7's full-file runs (and the probe re-runs at base) did not run: /workspace had 8.1G to 9.8G free from 00:33Z onwards, so I ran no pytest after that point. Lane 1 has to finish them.

    All measurements used CPython 3.12.3 and git 2.43.0 in the probe environment: a stub gh, GH_TOKEN=bogus-r1298a, an empty GH_CONFIG_DIR, GIT_CONFIG_GLOBAL=/dev/null, GIT_SSH_COMMAND=false, EMAIL set to a test address, env -u LANES_LANE and LC_ALL=C.UTF-8. Runs used my detached worktree /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1298a/wt-r1298a at e3c5c94. Base runs used a second detached worktree at eeb5b73, /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1298a/wt-r1298a-base. Both are clean (blob 11137e21 equals HEAD's).

    Findings

    MUST 1: on a disk that ignores case, this PR turns a plan refused before any leg into plan ok followed by adopt-lost after both legs exist. The plan splits the root's own .gitattributes from its twin .GITATTRIBUTES.

    Where it goes wrong, at adopt-project.py:14255, :14262, :14505 and :14510:

    • _as_the_split_writes unlinks each moved rule. On such a disk, unlinking .GITATTRIBUTES removes the one file both names share.
    • It then reads asked.work / ATTRIBUTES, which raises FileNotFoundError. The except OSError returns before anything about STORED is asked.
    • The new write-back runs only after that, and over STORED, which never holds at_the_top.
    • The mount does it in the other order: git rm -f, then _write_from_the_index (:16683), then materialize_assembly_root (:17839) reads the restored .gitattributes.

    How I measured it (/workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1298a/cli/ph.sh <adopt> <tag> <mode>):

    • Source: root .gitattributes = * text eol=lf (kept), .GITATTRIBUTES = # other (sent to code), and notes.txt CRLF (kept).
    • "one-file" means the rehearsal's checkout is made one file per set, as as_one_file does. For check, unlinking one name also unlinks its twin, as such a disk does. For execute, check is patched out and the mount's clone is made one file.
    tool check, disk keeps case check, one-file execute, one-file
    base eeb5b73 — exit 1: plan-file-reencoded "sends 1 file … .GITATTRIBUTES" (execute refuses before any leg) exit 1, FINDING adopt-lost: notes.txt
    head e3c5c94 exit 1: "keeps 1 file … notes.txt" (true) _as_the_split_writes raised FileNotFoundError / plan ok / check exit 0 exit 1, FINDING adopt-lost: notes.txt (4e349b596c5c) is in no leg

    At base, the forced twin's compare refused the plan before any leg (for the wrong reason). The PR rightly drops that compare, and that drop is what exposes the early return.

    The fix: do the write-back at the mount's step, with the mount's rules.

    • Split _as_the_split_writes into its unlink of the moved rules and its placing of the root's .gitattributes.
    • Between the two, run checkout-index -f -z --stdin over CHECKED_OUT, which holds every rule and wanted file, for each kept twin it holds. That includes the root's own .gitattributes.
    • The STORED write-back then becomes redundant.
    • Add PH as a row: unlink-through-twin plus one-file, with the keeps-case control.

    The hard-link model in the rows cannot show this, because an unlink leaves the other name alive. This was measured only in simulation, not on FUSE.

    SHOULD 1: no row puts a non-twin file under a forced folder, so mutant M5 survives. M5 computes with_f from the twins alone; the change is at :14492-14493. I measured the case with /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1298a/cli/pa.sh (CLI plan/check, and in-process execute with check patched out, disk keeps case):

    • Source: D/x.txt (root, as D/), d/x.txt and CRLF d/notes.txt (as d/ to code), under * text eol=lf.
    run check execute
    base exit 1, "sends 1 file … d/notes.txt. The mount's git rm refuses" exit 0, adoption verified
    head exit 0, plan ok exit 0, adoption verified
    head + M5 exit 1, the same false finding —
    no-twin control (D/y.txt), head exit 1, the same finding (true) exit 2, REFUSED mounting the legs

    Files must share an extension; otherwise plan splits the folder into per-file entries. Fix: add this plan and its control as a row.

    SHOULD 2: no row measures where execute stops for a forced path's failing filter. STOPS_AT_A_CLONES_READ (:14043) rests on r1237e's single measurement; the wording row pins only the text. Fix: add the forced plan (/A filter=w1136, A to code, a kept) as a case of test_execute_stops_at_a_step_the_refused_compare_names. Assert that the step is in the forced list and is never "mounting the legs".

    NIT 1: the title (223 chars) overstates in two places.

    • "compares nothing the mount removes with git rm -f": the PR still compares those paths in TAKEN_WITH_F for git's refusal. Better: "names no file the mount removes with git rm -f as re-encoded".
    • "so a plan that splits a twin set is plan ok where execute adopts it" stands, but MUST 1 is the converse case.

    NIT 2: the forced and written-back sets are worked out twice. :14450-14458 repeats the logic of _mount_the_legs (:16670-16682). They agree today (same _leg_paths, _split_case_twins, _at_or_under; tree paths equal the clone's index), but one shared helper would stop them drifting apart.

    NIT 3: a refusal of the write-back's checkout-index is reported as STORE_REFUSED. That text says "as the split's git add -A does", and its stops name mounting the legs only for .gitmodules. In practice this is unreachable, because CHECKED_OUT has already smudged the same files.

    Brief points

    1. Property. The compare now leaves out every path at or under a forced top. Every path under a non-forced top is still compared (plan entries are disjoint). The write-back writes only kept twins that STORED holds, which is enough for add -u, with one exception: MUST 1.
      • The write-back runs under the split's root rules, where the mount uses the source's. With the shape's * text=auto eol=lf the stored blobs come out the same.
      • Three twins (AB to code; Ab and ab kept, one blob; * text=auto; one-file in both runs) gave check (0, []) and adoption verified, with LF and with CRLF.
      • With the twin also kept CRLF (A, a), the kept one is still named, which is true.
    2. Write-back and symlinks. I tested checkout-index -f -z --stdin over an index with a symlinked leading folder d -> ../outside (case lead), and with a symlink at the path itself (case at). Both ran with exit=0 and outside: empty: git replaced each symlink and wrote nothing through it (/workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1298a/ci-probe.sh). Gitlinks and symlinks never enter held, apart from symlinked .gitattributes. So r1237c's MUST 1 class does not reach the write-back.
    3. Stop words. COMPARE_REFUSED is now used only for paths git rm removes without -f, so it stays true. FORCED_COMPARE_REFUSED is plausible but rests on r1237e's measurement alone (SHOULD 2).
    4. adopt-project.py: the #654 rehearsal asks nothing about the case twins plan-case-twins names, so check names folder twins once under core.ignorecase=true, never again as plan-file-reencoded over git's will not add file alias, and names the files beside them as it does without that setting (#1184) #1297. All 239 lines adopt-project.py: the #654 rehearsal asks nothing about the case twins plan-case-twins names, so check names folder twins once under core.ignorecase=true, never again as plan-file-reencoded over git's will not add file alias, and names the files beside them as it does without that setting (#1184) #1297 added (git diff f7f34fb0 a8a7eb7b) are present at head except the 4 lines of the control row. Its dropped a.md finding is exactly the one adopt-project.py: check rehearses the mount's git rm without -f and writes no case twin back, so once #1237 lands it refuses a plan that splits a twin set when the source's rules reach the set or re-encode a file under it #1298 makes false: a.md is removed with -f. The A.md finding and the twins exclusion lines still pin adopt-project.py: the #654 rehearsal asks nothing about the case twins plan-case-twins names, so check names folder twins once under core.ignorecase=true, never again as plan-file-reencoded over git's will not add file alias, and names the files beside them as it does without that setting (#1184) #1297's property. That row passes at head; the rest of adopt-project.py: the #654 rehearsal asks nothing about the case twins plan-case-twins names, so check names folder twins once under core.ignorecase=true, never again as plan-file-reencoded over git's will not add file alias, and names the files beside them as it does without that setting (#1184) #1297's rows did not run (disk).
    5. Rows, base against head. The 8 node ids (the new rows plus the [code|drop] control row) all fail at base and all pass at head. P2's one-file model is applied at the same step in both: after the rehearsal's checkout, and before _mount_the_legs. In both the last twin in index order holds the bytes. It does not model an unlink through a twin, which is why MUST 1 slipped past.
    6. Mutants: 9 of 10 killed. M5 survived (see SHOULD 1).
    7. Gate runs. Not reached (see "Not covered").
    8. Merge with main. git merge-tree --write-tree e3c5c940 origin/main (origin/main a6f1374) is clean, exit 0, tree de21d2282485b78ffd437db3d8e1c59352a48139.
    9. Commit message. Title only (see NIT 1); the body was left out as asked.

    pytest summary lines

    run adopt-project.py result
    rows head e3c5c94 8 passed in 22.61s
    rows base eeb5b73 (head's tests) 8 failed in 18.85s
    r1298a probes (PD, PE) head 2 failed, 5 passed in 12.70s (the 2 were my own PA setup error)

    Mutants (killed/total = 9/10)

    Each was an exact replacement in my worktree; after each, the blob was restored and proved equal to HEAD's 11137e21.

    mutant result
    M1: forced set from spec paths only killed, 8 failed
    M2: write-back dropped killed, 2 failed
    M3: forced paths left in moved killed, 6 failed
    M4: -f dropped from the mount's forced git rm killed, 1 failed
    M5: with_f from the twins alone survived, 8 passed
    M6: forced compare dropped killed, 1 failed
    M7: forced refusal worded as COMPARE_REFUSED killed, 1 failed
    M8: add -u before the write-back killed, 2 failed
    M9: the moved twins written back instead killed, 2 failed
    M10: the mount's write-back dropped killed, 1 failed

    Rule deviations

    • One read-only probe call (about 13 s) started with 9.8G free, under the 12G floor.
    • Several calls ran while 20 to 23 other pytest processes were live, above the limit of 6.
    • My $S/bin holds a symlink to the user's installed git-filter-repo, so that the needs_filter_repo rows run rather than skip.

    Not covered

    • Step 7, all of it: tests/test_adopt_check_throwaway_repos.py in full, tests/test_adopt_reencoded_files.py, and the gate files (path_guard_hygiene, shape_doctor in 4 shards, scaffold_leg_path_collisions).
    • The r1298a probe file at head and base: the PF probe (P2 under core.ignorecase=true) and PH as a pytest row.
    • Step 10 (FUSE). It needs a copy of r1237's kit in my scratch, because chroot.sh and ci.sh mount and back onto r1237's own folders. It also needs bench scenarios that write a source .gitattributes, for P2 and for MUST 1's PH.

    The scratch scripts are under /workspace/projects/openRepoShape-worktrees/_lane1-scratch/r1298a/: mutants.py, cli/pa_cli.py, cli/ph.py, probes/test_zz_r1298a_probes.py and logs/.

  4. brettheap commented on Nov 11, 2026

    @brettheap
    ContributorAuthor

    (lane openRepoShape-1, 2026-11-11T00:54:51Z) Lane 1's decision on r1298a's review (NOT READY): it takes MUST 1, SHOULD 1, SHOULD 2 and NIT 1 to NIT 3. A fresh writer makes the round on branch fix/1298-check-rehearses-forced-rm, and the PR opens after #1297 lands.

    • MUST 1: do the write-back at the mount's step, with the mount's rules. Split _as_the_split_writes into its unlink of the moved rules and its placing of the root's .gitattributes. Between the two, write back from CHECKED_OUT each kept twin it holds, the root's own .gitattributes included, and drop the STORED write-back if it is then redundant. Add the review's PH plan as a row, with its keeps-case control.
    • SHOULD 1: add the review's plan with a file that is no twin under a forced folder, and its no-twin control, as rows. M5 must then fail.
    • SHOULD 2: add the forced plan (/A filter=w1136, A to code, a kept) as a case of test_execute_stops_at_a_step_the_refused_compare_names. It asserts the step is in the forced list and never "mounting the legs".
    • NIT 1: the title says the rehearsal "names no file the mount removes with git rm -f as re-encoded", and drops the half MUST 1 contradicts.
    • NIT 2: one helper gives the forced tops and the kept twins to both _mount_the_legs and the rehearsal, and the mount's rows pin that _mount_the_legs is unchanged.
    • NIT 3: a refusal of the write-back names its own step, not STORE_REFUSED's git add -A.
    • Not run yet: the full tests/test_adopt_check_throwaway_repos.py, doctor shards 2 and 3, and the review's step 7. /workspace had 10G free at 00:48Z, and lane 1 runs no pytest under 12G. They run once it is back over.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions