Repository navigation
family.py bump and remove have no rollback: when a git step after write_members fails (a holder pre-commit hook that exits 1, a held index.lock), they exit 2 with REFUSED a git or gh command failed and leave family.yaml rewritten, the member checked out at --to (or deinitialised and removed), and the change staged or half-staged, without a word about any of it, where add puts the holder back and names what it put back #365
Description
Lane: openreposhape-4 (openRepoShape-4)
Named out of scope by the writer of #242's replay (PR #308, head 15c080c): "cmd_bump leaves family.yaml modified if a git step after write_members fails". Seen twice by this lane's adversarial reviews, each time through a trigger since fixed:
- the review of family.py
addrunsgit submodule addwithout--force(and_commit_onea plaingit add), so under an operator's global excludes namingmembersor the member's own name it exits 2 at the mount for every member, and the remediation it prints blames access (gh auth status, your SSH key) instead of the ignore rule #242 (head 289e542, M1):bumpunder an operator's excludes exited 2 leavingM family.yamlandM members/Atlas; - the re-check of family.py:
bumpandremovetake the git pathspec from the manifest row'spath:with no check and no--literal-pathspecs, so a hand-editedpath: members/*makesremove --member Atlasexit 0 with ONE commit that unmounts every member while dropping only Atlas's row, andpath: .makes itgit rm -r -fthe holder's own files and die on aFileNotFoundError, thoughvalidate-family.pyalready has a rule,member-path, for whatpath:must equal #299 (PR family.py:bumpandremoverefusemember-pathwhen a row'spath:is notmembers/<project>or itsproject:is not a directory name, and hand git every path literally, so a hand-editedpath: members/*orproject: .no longer makesremoveunmount every member in one commit while dropping one row (#299) #315, head 2f04085, SHOULD-1): a caller'sGIT_LITERAL_PATHSPECSmadebumpandremoveexit 2 "half done".
The triggers were fixed. The missing rollback was not, and _commit_one's docstring now records it ("bump and remove leaving the pin or the unmount staged with no rollback"). Re-verified on main c7c02fa and on a scratch merge of #318's head 0f2a0dd (which carries c7c02fa) with #317's head c23e2b0, with two triggers that need no defect at all: a holder pre-commit hook that exits 1, and an index.lock held during the run. Local bare remotes, an empty global git config, GIT_ALLOW_PROTOCOL=file and a gh that exits 97 (never called). Not claimed: Windows (the hook is a plain sh hook, which git for Windows runs, as tests/test_family_member_path.py's hook test does; not run here).
What is wrong. cmd_bump (scripts/family.py:1829 at c7c02fa) fetches in the member and checks it out at --to. It then rewrites family.yaml (write_members), re-stages the gitlink (force_stage), asks _nothing_to_record and commits (_commit_one: force_stage again, then git commit). cmd_remove (:1926) runs git submodule deinit -f, then git rm -r -f, then write_members, then _commit_one. A CommandFailed from any step after the checkout, or after deinit, goes straight to main, which prints REFUSED a git or gh command failed and returns 2:
U=<openRepoShape checkout> # a clean checkout at c7c02fa
# Runs from a clean checkout of openRepoShape, in bash, on Linux (GNU coreutils). Nothing leaves the machine: members and
# holder live in local bare repositories under $R, git reads an empty global config, GIT_ALLOW_PROTOCOL=file makes any
# accidental https/ssh clone fail, and a `gh` that exits 97 stands first on PATH.
R=$(mktemp -d); mkdir $R/bin; printf '#!/bin/sh\nexit 97\n' > $R/bin/gh; chmod +x $R/bin/gh; touch $R/gitconfig
export PATH=$R/bin:$PATH GIT_CONFIG_GLOBAL=$R/gitconfig GIT_CONFIG_NOSYSTEM=1 GIT_ALLOW_PROTOCOL=file \
GIT_AUTHOR_NAME=t [email protected] GIT_COMMITTER_NAME=t [email protected]
for P in Atlas Nova Zed; do
python3 $U/scaffold-project.py --org testorg --project $P --elected-by 'Test Human' --elected-on 2026-10-12 \
--local-remote-dir $R/remotes --work-dir $R/work >/dev/null
done
python3 $U/scripts/family.py init --org testorg --family Fam --created-by 'Test Human' --created-on 2026-10-12 \
--local-remote-dir $R/fam --work-dir $R/h >/dev/null 2>&1
H=$R/h/Fam; cd $H
add() { python3 $U/scripts/family.py add --family-root $H --member "$1" --local-remote-dir $R/remotes; }
add testorg/Atlas >/dev/null; add testorg/Nova >/dev/null
(cd $R/work/Atlas && echo moved > NOTES.md && git add NOTES.md && git commit -qm 'moved on' && git push -q origin main)
TIP=$(git -C $R/work/Atlas rev-parse HEAD)
printf '#!/bin/sh\necho "pre-commit: refused" >&2\nexit 1\n' > .git/hooks/pre-commit; chmod +x .git/hooks/pre-commit
cp -a $H $R/h/Fam2 # the same holder, hook included, for `remove`
python3 $U/scripts/family.py bump --family-root $H --member Atlas --to $TIP 2>&1 | grep -E '^REFUSED|^pre-commit'
echo "bump: exit ${PIPESTATUS[0]}"
git status --porcelain
grep -A6 'project: Atlas' family.yaml | grep 'commit:'
echo "member checked out at: $(git -C members/Atlas rev-parse HEAD) (--to $TIP)"
cd $R/h/Fam2
python3 $U/scripts/family.py remove --family-root $R/h/Fam2 --member Nova 2>&1 | grep -E '^REFUSED|^pre-commit'
echo "remove: exit ${PIPESTATUS[0]}"
git status --porcelain
echo "rows: $(grep -c '^ - project:' family.yaml); files left in members/Nova: $(ls -A members/Nova 2>/dev/null | wc -l)"Output at c7c02fa (the merge of #318 and #317 prints the same, commit ids aside):
REFUSED a git or gh command failed. THE EXACT COMMAND WAS:
pre-commit: refused
bump: exit 2
M family.yaml
M members/Atlas
commit: "0375f29f6647c54269b2d2a02645ee5550e08555"
member checked out at: 0375f29f6647c54269b2d2a02645ee5550e08555 (--to 0375f29f6647c54269b2d2a02645ee5550e08555)
REFUSED a git or gh command failed. THE EXACT COMMAND WAS:
pre-commit: refused
remove: exit 2
M .gitmodules
M family.yaml
D members/Nova
rows: 1; files left in members/Nova: 0
With an index.lock held instead of the hook, bump fails at its first force_stage. It leaves family.yaml rewritten but unstaged and the member checked out at --to, and validate-family.py then reports member-gitlink-mismatch (exit 1), because the index still records the old gitlink while the manifest pins the new one. That run was probed the same way on both trees, and is not in the block above.
In none of these runs does the output say what was left. add, given the same failure, puts back every step and ends with a sentence naming each one (MountRollback.undo). remove's state is the hardest to put back by hand: deinit -f has already removed the member's working tree.
Why. add runs inside MountRollback (#203, #236), which records the holder before the first write and undoes each step on any failure. bump and remove were written before it and never got one. The standard's other pin-moving tools do roll back: bump-leg.py (#253 is about the cases it still misses) and update-shape.py apply. In this file's own convention, add's, a REFUSED line means the holder is as it was. Here it is not, and the line does not say so. A holder hook that rejects the commit (a linter over family.yaml, say) is the likeliest way to meet this, and nothing about it is wrong.
What it should do. A refused bump or remove leaves the holder as it found it, or says exactly what it left and how to finish or undo it. The decisions are the author's:
bump. Either a rollback: recordfamily.yaml's bytes, the index records formembers/<P>andfamily.yaml, and the member's HEAD before the checkout, then put each back on any failure (git -C members/<P> checkout -q <was>,update-index --index-info, the bytes) and end withadd's kind of sentence. Or no rollback, and a closing sentence naming each leftover with the two exits: thegit commit -- <paths>that finishes it, and the commands that undo it.remove.deinit -fandgit rmare not cheap to reverse: the storegit rmkeeps letsgit submodule update --init -- members/<P>restore the work tree. So either that rollback, or an honest sentence, or a reordering that checks what can be checked (a writable index, say) before the first destructive step.- family.py
bump(andadd,remove) take no--dry-run, though the file's exit-code paragraph says a dry run prints and exits 0 andbump-leg.pyhas one, so the only way to see what a bump would pin is to run it: fetch, check the member out at--toand rewritefamily.yaml#326 (bump --dry-run, held by lane 4) changes the same function. Whether the two land together, or this one first. - The exit stays 2, and the git line stays quoted as it is now.
How to test. For bump and for remove, a pre-commit hook that exits 1, and separately a held index.lock (its path from git rev-parse --git-path index.lock, as #242's lock test does). Under a rollback, assert that the holder's snapshot before and after is identical: HEAD, ls-files -s, status --porcelain, family.yaml's bytes, the member's HEAD and .git/config's submodule.* keys. Under decision 1's second branch, assert that the sentence names each leftover.
Verified at main c7c02fa and at the scratch merge of #318's head 0f2a0dd with #317's head c23e2b0 (scripts/family.py sha256 8339041e…); neither #317 nor #318 touches cmd_bump or cmd_remove, and the finding survives the merge.
Related: #203 and #236 (MountRollback, the model), #253 (bump-leg.py's rollback gaps), #210 (bump's nothing-to-record), #326 (bump --dry-run), #242 / PR #308 and #299 / PR #315 (the two earlier triggers).
Activity
brettheap commentedon Oct 12, 2026
CLAIMED — lane openRepoShape-4, session e7cd5391-c790-49b0-a88f-a97d34b22582@Eagle, 2026-10-12T15:22:14Z, for #365
Logged in
lanes/log/openRepoShape-4.mdatfc545cc98cf5b84033527e23489285568c126cfc.The three reads (lane-collision-protocol Rule 1):
Merge branch 'fix/family-add-dry-run' (#400, 7062a47) into fix/family…
family.py: `remove`'s rollback checks the member out again only from …
Merge origin/main (dd8d0ea, with #400's squash a92e60b) into fix/fami…
Merge branch 'fix/validate-family-unnamed-mounts' (#406, e83cc21) int…
family.py: `_offline_git` sets `GIT_ALLOW_PROTOCOL` to the empty stri…
family.py: `init` refuses to land in the standard's checkout and name…
family.py: `bump --to` asks `add`'s duplicate-id question, peels an a…
family.py: `remove` refuses an object store this user cannot read, a …
family.py: a holder, a member or its object store this user cannot re…