Repository navigation
test: remove the remote secondmate e2e fixture with fm_test_remove_tree - #7752
Conversation
The EXIT trap removed the fixture root with a plain rm -rf. When the run stops early, for example when the watcher auto-relaunch leg fails, the fixture still holds the read-only state/<id>.git-hooks strip folder, so cleanup prints "Permission denied" for each hook, leaves the fixture root behind and exits non-zero. Use the shared fm_test_remove_tree, which makes read-only fixture directories writable before it removes them. Refs kunchenguid#7629
|
Speaking as Kun's firstmate: thank you @c6aw. This is a tidy fix for the leftover What I checked: head Contract-class: restore. This is test-only. Fixture cleanup is meant to leave nothing behind, and this makes it do that on the early-stop path; no product default changes. VISION.md: One captain aligns (no captain-facing change) · Authority aligns · Scripts aligns (reuses the exact shared helper) · Restart aligns · Delegation aligns (cleaner regression coverage) · Vendor aligns · Scope aligns (repo discipline: field flakes become cleaner tests). Where it stands: waiting on CI only, so there's nothing more you need to do. If the required checks come back green and it stays mergeable, it can merge without waiting on Kun. |
|
Speaking as Kun's firstmate: this is merged. Thank you @c6aw — really appreciate you taking the time on this. |
Intent
Refs #7629. Test-only.
tests/fm-remote-secondmate-lifecycle-e2e.test.shremoves its fixture root in the EXIT trap with a plainrm -rf. When the run stops early, for example when the watcher auto-relaunch leg fails, the fixture still holds the read-onlystate/<id>.git-hooksstrip folder, so cleanup prints "Permission denied" for each hook, leaves the fixture root behind and exits non-zero. The CI logs discussed in #7629 show these lines after the failing leg.This change makes the cleanup use the shared
fm_test_remove_tree, which makes read-only fixture directories writable before it removes them. The watcher auto-relaunch wait itself is left as main has it.Evidence: on main, a copy of the test that stops right after the watcher leg leaks the hooks folder; with this change it leaves nothing behind, a forced failure of the leg also leaves nothing behind, and the full file passes;
bin/fm-test-run.sh --check-coverageunchanged.What Changed
cleanupintests/fm-remote-secondmate-lifecycle-e2e.test.shnow removes the fixture root with the sharedfm_test_remove_treehelper instead of a plainrm -rf. The helper makes read-only fixture directories writable before it deletes them. One example is thestate/<id>.git-hooksstrip folder that is left behind when a run stops early. Before this change, cleanup in that case printed "Permission denied", left the fixture root on disk and exited non-zero.Refs #7629
🤖 Generated with Claude Code
Risk Assessment
✅ Low: A one-line, test-only change swaps the EXIT-trap
rm -rffor the sharedfm_test_remove_treehelper (tests/lib.sh:300), which first makes fixture directories writable (it skips symlinked roots) and then removes the tree; TMP_ROOT is an absolute path that was resolved earlier, and the change matches the stated intent exactly.Testing
I ran four variants of the e2e test in parallel, each with its own TMPDIR. The variants were the base cleanup stopped after the watcher leg, the new cleanup stopped at the same point, the new cleanup with a forced watcher-leg failure, and the full file. On base, cleanup printed 15 "Permission denied" lines, exited 1, and left the fixture root with remote-home/state/parent-route/ios.git-hooks. With the change, both early-stop runs and the full run left no fixture root and printed no "Permission denied" lines. The early-stop and full runs exited 0, the forced-failure run exited 1 from its own failing assertion, and the full file printed ALL TESTS PASSED. The temporary variant files and TMPDIRs are removed, and the worktree is clean.
Evidence: Base cleanup, early stop: Permission denied, ios.git-hooks leaked, exit=1
Source: Base cleanup, early stop: Permission denied, ios.git-hooks leaked, exit=1
Evidence: New cleanup, early stop after watcher leg: clean, exit=0
Source: New cleanup, early stop after watcher leg: clean, exit=0
Evidence: New cleanup, forced watcher-leg failure: no Permission denied, no leftover root
Source: New cleanup, forced watcher-leg failure: no Permission denied, no leftover root
Evidence: Full file with change: ALL TESTS PASSED, exit=0
Source: Full file with change: ALL TESTS PASSED, exit=0
Evidence: Leftover listing after each run
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
tests/fm-remote-secondmate-lifecycle-e2e.test.sh:53- Every run, base and changed, leaves three small lib.sh registry files (.fm-test-cleanup/procevent/watcher.<pid>.*) in TMPDIR. This test's own EXIT trap replaces the lib.sh trap that would remove them. The behaviour exists on base too and is outside this change's scope, which is the fixture root.TMPDIR=<isolated> bash tests/zz-ev-base-stop.test.sh: the base cleanup (rm -rf --) on a copy that exits right after the watcher leg passesTMPDIR=<isolated> bash tests/zz-ev-head-stop.test.sh: the change's cleanup on the same truncated copyTMPDIR=<isolated> bash tests/zz-ev-head-fail.test.sh: a forcedfailinserted right after the watcher auto-relaunch legTMPDIR=<isolated> bash tests/fm-remote-secondmate-lifecycle-e2e.test.sh: the full filefind <TMPDIR>after each run, to list what was left and any*.git-hooksfolder✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.