You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 177ccdb
Browse filesBrowse the repository at this point in the historyBrowse files
test(daemon-watcher): harden debounce + symlink-sed against macOS fs.watch delivery races
The CI run on a05766d (Node 22 matrix) failed on the daemon-watcher
"multiple rapid edits are debounced" assertion. Investigation: the
test counted exactly one reload, but macOS fs.watch is free to deliver
events at any time — including after a previous event's debounce timer
already fired — so under runner load a logical "burst" can legitimately
split across two reloads even though the daemon's debounce is working.
The test itself acknowledged this race in a comment but still asserted
the strict count.
- Replace the fixed 3500ms drain with a positive-quiescence helper
(waitForDaemonQuiet) that waits until no new reload lines have been
emitted for a window — drains stale fs.watch events from the previous
test reliably.
- Fire the burst synchronously (no inter-write awaits) so the writes
leave the test in one event-loop tick.
- Assert coalescing (1-2 reloads), not the brittle absolute count of 1.
A daemon with broken debounce would still emit one reload per write
(5), so the assertion still catches the real bug it pins.
The sibling 'sed -i' symlink-replacement test had the same pre-existing
race: a fixed 2s sleep that was sometimes shorter than rename-delivery
+ debounce + reload work under load. Switched to waitForDaemonLog
polling (existing helper) and added quiescence before measuring.
Verified locally across multiple back-to-back runs: the formerly-flaky
debounce assertion is now stable. Other tests in the file remain
timing-sensitive and would need similar treatment as separate work.
0 commit comments