Tests 3, 4, 5 previously returned synthetic pane PIDs (99999/99998/99997) from their fake list-panes shims but did not set MOSAIC_HEARTBEAT_RUN_DIR, causing the launcher to fall back to the real ~/.config/mosaic/fleet/run and potentially spawn a background sidecar against an arbitrary host PID. Fix: - list-panes in tests 3/4/5 now returns empty string → PANE_PID stays unset → no sidecar is spawned for tests where heartbeat is not under test. - MOSAIC_HEARTBEAT_RUN_DIR is exported to a per-test mktemp dir in each fake-tmux test (3, 4, 5) as defence-in-depth so even if the sidecar code path changes, it can never write to the real fleet run dir. - New temp dirs are registered in CLEANUP_DIRS so they are removed by the existing EXIT trap. - Tests 6 and 7 (the dedicated heartbeat tests) are unchanged: test 6 uses a real tmux pane PID + its own HB_RUN_DIR, test 7 intercepts via a fake setsid shim that captures args and exits immediately. - All 7 tests pass; verify-sanitized.sh passes; no stray sidecar processes or unexpected .hb files are written to ~/.config/mosaic/fleet/run. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RMoEx7hfdFGjUiCHuN1RRi
12 KiB
Executable File
12 KiB
Executable File