Skip to content

Commit df41197

Browse files
mschmickingclaude
andcommitted
docs: record the known watch-test flakiness
Seen roughly once in ten to twenty full-suite runs and never when the file runs alone, which points at contention: node --test runs files concurrently, so many fake servers and chokidar watchers compete and a timer can slip. Documented rather than left for the next person to rediscover, with a note that the fix is more margin and never a looser assertion — the assertion guards against an infinite push loop. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 2eb5c28 commit df41197

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,3 +264,19 @@ returns `T`, but that type is a _claim_ about what the server should send, not a
264264
guarantee — so guards like `result?.rows ?? []` look redundant to the rule and are
265265
essential at runtime. Following it would trade a handled edge case for a crash against
266266
someone's house.
267+
268+
### Known flakiness in the watch tests
269+
270+
`test/commands-watch.test.ts` has failed roughly once in ten or twenty **full-suite**
271+
runs, and not at all when that file runs alone. `node --test` executes files
272+
concurrently, so a dozen fake servers, chokidar watchers and debounce timers compete
273+
for the same machine — under that load a timer can slip past its window.
274+
275+
Two mitigations are already in place: the shared debounce is 150 ms rather than 20 ms
276+
(chokidar can emit `add` and `change` for a single write, and at 20 ms that pair can
277+
straddle the window), and the coalescing test uses synchronous writes with a 1000 ms
278+
window so it measures the debounce rather than the disk.
279+
280+
If it recurs, that file is the suspect and the fix is more timing margin — **not**
281+
loosening an assertion. The thing being tested is the guard against an infinite push
282+
loop against someone's house.

0 commit comments

Comments
 (0)