Repository navigation
test: separate subject startup from asserted intervals in two load-sensitive tests - #7632
Conversation
…nsitive tests test_signal_catchup_without_running_watcher now starts each run's deadline only after the launched watcher holds its singleton lock, through a bounded wait_for_watcher_lock helper that still fails and stops a watcher that never takes its lock. The remaining run (one poll cycle plus the fixed signal grace) gets a finite bound sized from contention measurements; with heartbeat and checks disabled, a watcher that misses the catch-up never exits, so it still fails. test_owner_mutex_contention_preserves_failure_episode_reset now ends its reset-boundary wait on the arm handshake or the hook's own exit, failing at once with the hook's status and output when it dies before the boundary, and keeps a generous finite bound for a hook that stalls. All behavioral assertions are unchanged; no production file changes. Fixes kunchenguid#6678
|
Speaking as Kun's firstmate: thank you @nmmanas for picking up #6678. It's a careful, test-only fix. Checked head Contract-class: restore (test-only; product behavior unchanged). VISION.md: one captain aligns (fewer false-red CI runs to triage) · authority n/a · scripts aligns (deterministic sync on a real startup event instead of a wall-clock guess) · restart n/a · delegation aligns (keeps validation trustworthy) · vendor aligns (portable fixtures) · scope aligns ("field incidents become regression coverage"). The attestation binds this head and live validation is go (3 of 5). The two load-loop and mutation-probe scenarios are cited from an earlier turn rather than re-run, which I'm fine with for a test-only change. The diff touches no workflow, network or credential surface, so I approved the first-time fork runs on this head (CI 39726363179; no-mistakes 39726363216, 39726635199). CI: everything is green except two known flakes. Behavior portable serial 6 failed in the remote-secondmate lifecycle e2e ("watcher did not exit on its auto-relaunch wake"), which is #7629 and also red on main. Behavior portable serial 2 was cancelled at the 30-minute ceiling (#7255). Neither shard runs the two tests you changed, and those passed in serials 1, 4 and 5. I've re-run the failed jobs once. Nothing needed from you right now. This is waiting on CI. If it comes back green and stays mergeable, it's eligible to land. |
|
Speaking as Kun's firstmate: this is merged. Thank you @nmmanas — really appreciate you taking the time on this. (Before merging I also ran both changed test files on current main |
Intent
Open ONE PR fixing #6678 ("Investigate load-sensitive startup deadlines in queue and Claude Stop-hook tests"): in tests/fm-wake-queue.test.sh
test_signal_catchup_without_running_watcherand tests/fm-claude-stop-autoarm.test.shtest_owner_mutex_contention_preserves_failure_episode_reset, separate subject startup from the asserted interval with deterministic fixture synchronization, keep every behavioral assertion and a finite failure bound, test-only, per the issue acceptance list and the latest triage comment. Validate by looping both tests under load (before/after pass rates).Context from the issue: the queue test's first
wait_for_exit "$!" 40allows 40 x 0.1s polls from watcher launch and fails under host contention, including on unchanged baseline; the second signal wait is near line 84. The Stop-hook test waits 50 x 0.05s forarm-waitingand fails with "healthy owner never reached the reset boundary" (near line 742) under heavy load. Acceptance list: reproduce each failing startup boundary with portable, isolated fixtures under controlled contention; distinguish subject startup from the behavioral interval without hiding a genuinely stalled watcher or failed owner reset; preserve finite failure bounds and all queue acknowledgement, singleton, generation, and failure-episode assertions; verify on a quiet host and under contention, including the portable macOS lane. Latest triage (Kun's firstmate, 2026-10-20, main 9d76aa8): still open and not fixed, no PR addresses it, #6500 touches neither file, contract-class restore (test-only), the runtime does not change.What Changed
tests/wake-helpers.sh: addswait_for_watcher_lock <pid> <state> [limit]. It waits until.watch.lock/pidnames the launched watcher, or until the watcher has already exited. The default bound is 300 × 0.1s polls. If the watcher never takes the lock, the helper stops it throughwait_for_exitand returns 1.tests/fm-wake-queue.test.sh(test_signal_catchup_without_running_watcher): for both the first and the second signal run, the test now waits for the watcher to hold its singleton lock before the exit deadline starts. The exit bound goes from 40 to 150 polls (a fixed number of 0.1s polls, so it can still fail). All the signal output, drain, and queue assertions stay the same.tests/fm-claude-stop-autoarm.test.sh(test_owner_mutex_contention_preserves_failure_episode_reset): the wait forarm-waitingnow fails at once, with the hook's exit status and output, if the hook exits or becomes a zombie before it reaches the boundary. The poll bound goes from 50 to 600 × 0.05s. The failure-episode assertions are unchanged.Fixes #6678. Test-only: no runtime code changes.
🤖 Generated with Claude Code
Risk Assessment
✅ Low: The change only touches tests. It starts each timed wait after a real startup event: the watcher's lock pid matches
$!(bin/fm-watch.sh:3273writes${BASHPID:-$$}), or the hook writesarm-waitingor exits. Every wait still has a finite limit. A hook that dies or a watcher that never takes the lock still fails, and every assertion on the queue, singleton, generation and failure episode is unchanged.Testing
I deleted the previous turn's 12 scratch probes, so only commit dbc2457 is under test. On this host, both changed suites passed in full, including the two re-synchronized tests (the wake-queue signal catch-up test and the Stop-hook owner-mutex reset test). ShellCheck passed on the three changed files. Plain fm-lint stopped on its workflow check because actionlint is not installed. This change touches only tests and has no UI, so there is no visual evidence. Per operator guidance, I did not re-run the before/after load-contention loops in this turn and cite the numbers recorded earlier instead.
bash tests/fm-wake-queue.test.shrc=0; log line 'ok - signal written while no watcher runs is caught on next run' (fm-wake-queue.log)bash tests/fm-claude-stop-autoarm.test.shrc=0; log line 'ok - auto-arm: owner-mutex contention preserves successor episode state' (fm-claude-stop-autoarm.log)bin/fm-lint.sh tests/fm-wake-queue.test.sh tests/fm-claude-stop-autoarm.test.sh tests/wake-helpers.shrc=0 (fm-lint-changed-files.log)Evidence: fm-wake-queue suite transcript
Source: fm-wake-queue suite transcript
Evidence: fm-claude-stop-autoarm suite transcript
Source: fm-claude-stop-autoarm suite transcript
Evidence: fm-lint on changed files
Source: fm-lint on changed files
Evidence: fm-lint default run (actionlint missing)
Source: fm-lint default run (actionlint missing)
Evidence: Previously recorded load evidence (operator-supplied, not re-run)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
git -C ~/.no-mistakes/worktrees/71dfae40363e/01M5GXWWJCNN6TN4R9BD6WB7JK statusandgit -C ~/.no-mistakes/worktrees/71dfae40363e/01M5GXWWJCNN6TN4R9BD6WB7JK diff). Respond with fix to validate it, or abort.🔧 No changes applied.
1 info still open:
bin/fm-lint.shexits 1 because actionlint is not on PATH. The cause is the local environment, not this change, which touches no workflow files. ShellCheck on the changed files passes. CI runs the workflow lint.bash tests/fm-wake-queue.test.shrc=0; log line 'ok - signal written while no watcher runs is caught on next run' (fm-wake-queue.log)bash tests/fm-claude-stop-autoarm.test.shrc=0; log line 'ok - auto-arm: owner-mutex contention preserves successor episode state' (fm-claude-stop-autoarm.log)bin/fm-lint.sh tests/fm-wake-queue.test.sh tests/fm-claude-stop-autoarm.test.sh tests/wake-helpers.shrc=0 (fm-lint-changed-files.log)rm -f tests/.delay-*.sh tests/.loop-*.sh tests/.mut-*.sh tests/.trace-stop.sh(12 previous-turn scratch probes;git status --shortis empty afterwards)bash tests/fm-wake-queue.test.sh(rc=0, 68 ok, 3m13s)bash tests/fm-claude-stop-autoarm.test.sh(rc=0, 63 ok, 1m04s)bin/fm-lint.sh(rc=1: actionlint is not on PATH, so the workflow check stopped the run)bin/fm-lint.sh tests/fm-wake-queue.test.sh tests/fm-claude-stop-autoarm.test.sh tests/wake-helpers.sh(rc=0, full ShellCheck 0.11.0 analysis)✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.