Skip to content

test: assert that a burst is not reported until it goes quiet, not that it is reported once - #30

Merged
hidekingerz merged 1 commit into
mainfrom
claude/watch-test-quiet
Sep 6, 2026
Merged

test: assert that a burst is not reported until it goes quiet, not that it is reported once#30
hidekingerz merged 1 commit into
mainfrom
claude/watch-test-quiet

Conversation

@hidekingerz

Copy link
Copy Markdown
Owner

Summary

TestCoalescesBurst failed 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$' passes
  • Mutation check: a watcher with debounce/8 fails the test
  • gofmt -l ., go vet ./... clean

🤖 Generated with Claude Code

https://claude.ai/code/session_01KUYF9hXeZFML1s8r3i2RVX

…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
@hidekingerz
hidekingerz merged commit b6c0c32 into main Sep 6, 2026
3 checks passed
@hidekingerz
hidekingerz deleted the claude/watch-test-quiet branch September 6, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant