test: assert that a burst is not reported until it goes quiet, not that it is reported once - #30
Merged
Merged
Conversation
…at it is reported once TestCoalescesBurst wrote 20 times and asserted a single report. That holds only if the filesystem delivers the burst's events in one clump; on a loaded CI runner they arrived in two clumps with a pause between, the watcher correctly reported twice, and the test failed for behaviour that is right — twice, at 20 ms and at 100 ms of debounce. The property the watcher guarantees is that nothing is reported while writes keep coming closer together than the debounce. The test now spreads twelve writes at a quarter of the debounce apart and fails if a report arrives before the last one, then expects a report after. It passes 20 of 20 runs under the race detector and fails against a watcher whose debounce is shorter than the write spacing. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KUYF9hXeZFML1s8r3i2RVX
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.
Summary
TestCoalescesBurstfailed again in CI (run 34019937414) after #28 raised the test debounce to 100 ms, this time taking 1.84 s — so the writes outrunning the window was not the whole story. The test wrote 20 times and asserted a single report, which holds only if the filesystem delivers the burst's events in one clump. On a loaded runner they can arrive in two clumps with a pause longer than the debounce between, and then the watcher correctly reports twice. A diagnostic workflow running the test 40 times on the same runner image did not reproduce it, so it is rare and load-dependent; it cannot be fixed by lengthening the window.The property the watcher actually guarantees is that nothing is reported while writes keep coming closer together than the debounce. The test now spreads twelve writes a quarter of the debounce apart, fails if any report arrives before the last write, and then expects a report. It says nothing about how many reports follow.
Checked both ways: 20 of 20 runs pass under the race detector; with the watcher's debounce set below the write spacing the test fails with "reported during the burst, after write 0". The watcher itself is unchanged.
Test plan
TMPDIR=/tmp go test -race -count=20 ./internal/watch -run 'TestCoalescesBurst$'passesgofmt -l .,go vet ./...clean🤖 Generated with Claude Code
https://claude.ai/code/session_01KUYF9hXeZFML1s8r3i2RVX