fix(test): wait for the second interrupt instead of sleeping - #40
Merged
Conversation
The repeated-interrupt assertion slept 100ms and then required exactly two recorded interrupts, so a slower runner failed it: PR #37 went red on Node 24 while Node 22 passed on the same commit, and a rerun went green. waitForInterrupt now takes an expected count and polls to the harness deadline, so the test waits on the event it asserts. The equality check still pins exactly two, so an extra interrupt remains a failure. Verified by running the file three times in a row after the change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Problem
real tmux interrupt cancels a running verified fake-agent turn and repeats on the same generationslept a fixed 100ms after sending the second interrupt, then asserted that exactly two interrupts had been recorded.That is a timing race, and it fired for real: PR #37 failed on Node 24 while Node 22 passed on the same commit, and a plain rerun went green. The change under test was unrelated to interrupt handling.
Fix
waitForInterrupttakes an expected count and polls to the harness deadline, so the test waits on the exact event it asserts instead of guessing how long tmux needs.The
assert.equal(..., 2)stays, so an extra interrupt is still a failure — the wait only removes the "too early" failure mode.Note
The
delay(1_100)above it is left alone on purpose: it backs a negative assertion (noturn_completedmay appear), and there is no event to wait for when asserting absence.Verification
File run three times consecutively, 10/10 passing each time.