Repository navigation
Conversation
…les only The test_interrupted_snapshot_leaves_no_temp_files assertion was overbroad: it required TMPDIR to be entirely empty after an interrupted snapshot. On hosts lacking timeout or perl (used internally by fm-fleet-snapshot.sh), the fm-timeout-lib.sh bash fallback creates transient temp files directly in TMPDIR (pattern fm-bash-timeout-command.*) that may survive an interrupt — these are cleaned up by the timeout wrapper itself but are not snapshot cleanup residue. Narrow the assertion to check only for snapshot-owned temp files (fm-fleet-snapshot.* directory and its contents), which is the real invariant. Add a complementary test that exercises the bash fallback path when timeout/perl are unavailable.
… fallback path - The snapshot_files find was unreachable at -mindepth 2: both branches could only match paths beneath fm-fleet-snapshot.* which the preceding snapshot_dir check already fails on. Restated as a maxdepth-1 check for stray snapshot-named files in TMPDIR. - test_bash_timeout_fallback_cleanliness used a conditional skip whenever timeout/perl are on PATH, which is true on virtually every CI host. Replaced with FM_TIMEOUT_MECHANISM_OVERRIDE=bash to force the bash fallback deterministically so the test exercises the path everywhere.
This was referenced Nov 16, 2026
Owner
Author
|
Closed per fork PR classification: superseded or abandoned; branch kept. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Fix overbroad assertion in test_interrupted_snapshot_leaves_no_temp_files that required TMPDIR to be entirely empty after an interrupted fm-fleet-snapshot.sh run. On hosts lacking timeout/perl, the fm-timeout-lib.sh bash fallback creates transient temp files directly in TMPDIR (fm-bash-timeout-command.) that may survive an interrupt. Narrowed the assertion to check only for snapshot-owned temp files (fm-fleet-snapshot. directory and its contents). Added test_bash_timeout_fallback_cleanliness to exercise the bash fallback path when timeout/perl are unavailable.
What Changed
test_interrupted_snapshot_leaves_no_temp_filesno longer requiresTMPDIRto be entirely empty after an interruptedfm-fleet-snapshot.shrun; it now asserts specifically that nofm-fleet-snapshot.*directory or files under it survive, so unrelated residue from thefm-timeout-lib.shbash fallback no longer fails the test.test_bash_timeout_fallback_cleanliness, which runs a snapshot over a 500-entry synthetic backlog and asserts nofm-bash-timeout-command.*files remain inTMPDIR; it passes as a skip whentimeout,gtimeout, orperlis available since the bash fallback path is not exercised there.Risk Assessment
✅ Low: Test-only change that correctly narrows an overbroad assertion without weakening its regression coverage; the added test is inert on most hosts but harmless.
Testing
Ran the targeted suite
tests/fm-fleet-snapshot-view.test.sh— all cases pass; on this host (timeout and perl both present) the new bash-fallback case reports its skip branch, as the author designed. Because a green skip proves nothing on its own, I additionally reproduced the scenario manually end-to-end: forcing the fm-timeout-lib.sh bash mechanism and interrupting a bounded call leavesfm-bash-timeout-command.*directly in TMPDIR, which the previous "TMPDIR entirely empty" assertion would have reported as a snapshot cleanup bug, while the narrowed snapshot-owned assertion correctly passes. Interrupting a realfm-fleet-snapshot.sh --jsonrun after itsfm-fleet-snapshot.*tmpdir was observed shows the directory is fully cleaned, and a planted-residue negative control confirms the narrowed assertion still fails on genuine snapshot leftovers, so it was not weakened into a no-op. No UI surface is involved, so the evidence is a CLI transcript rather than a screenshot. Worktree left clean; evidence files written only to the evidence directory.Evidence: Interrupt / bash-fallback reproduction transcript (old vs new assertion + negative control)
Source: Interrupt / bash-fallback reproduction transcript (old vs new assertion + negative control)
== Part A: bash timeout fallback interrupted mid-flight == mechanism: bash TMPDIR after interrupt: $TMPDIR/fm-bash-timeout-command.YpVOyC OLD (TMPDIR entirely empty): FAIL - 'interrupted snapshot left temp files behind:' $TMPDIR/fm-bash-timeout-command.YpVOyC NEW (snapshot-owned only): PASS - no fm-fleet-snapshot.* residue == Part B: real fm-fleet-snapshot.sh interrupted mid-run == snapshot tmpdir observed while running: 1 TMPDIR after interrupt: NEW (snapshot-owned only): PASS - no fm-fleet-snapshot.* residue == Part C: negative control - plant fm-fleet-snapshot.* residue == NEW (snapshot-owned only): FAIL - left directory behind: $TMPDIR/fm-fleet-snapshot.CONTROLEvidence: Reproduction script used to produce the transcript
Source: Reproduction script used to produce the transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
tests/fm-fleet-snapshot-view.test.sh:597- test_bash_timeout_fallback_cleanliness skips (and reports pass) whenever timeout, gtimeout, or perl is on PATH, which is true on virtually every CI host and dev machine, so the new coverage never executes. fm-timeout-lib.sh:31 already supports FM_TIMEOUT_MECHANISM_OVERRIDE=bash, which forces fm_run_bash_timeout deterministically; exporting it alongside TMPDIR/FM_HOME on the $SNAPSHOT invocation would exercise the fallback everywhere and remove the skip branch. As written the test also never asserts that the fallback ran, so even on a host without timeout/perl a green result proves nothing.tests/fm-fleet-snapshot-view.test.sh:580- The snapshot_files find is unreachable: with -mindepth 2, both branches (-name 'fm-fleet-snapshot.' and -path '/fm-fleet-snapshot./') can only match paths beneath a surviving fm-fleet-snapshot.* directory, and the snapshot_dir check on the preceding line already fails in that case. Drop it, or restate it as a maxdepth-1 check for stray snapshot-named files directly in TMPDIR.✅ **Test** - passed
✅ No issues found.
bash tests/fm-fleet-snapshot-view.test.sh(whole file, includestest_interrupted_snapshot_leaves_no_temp_filesand the newtest_bash_timeout_fallback_cleanliness)Manual repro: interruptedfm_run_timedwithFM_TIMEOUT_MECHANISM_OVERRIDE=bashand applied the old vs new assertion to the same TMPDIRManual repro: SIGTERM'd a realbin/fm-fleet-snapshot.sh --jsonrun mid-flight and inspected TMPDIRNegative control: plantedfm-fleet-snapshot.CONTROL/residue and re-ran the narrowed assertion✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.