fix(watcher.node): Defer events during initial scan, track full event sequences, and harden watcher shutdown

This commit is contained in:
2025-12-11 02:39:38 +00:00
parent ea57de06dd
commit 6f6868f2ad
5 changed files with 207 additions and 97 deletions

View File

@@ -1,5 +1,16 @@
# Changelog
## 2025-12-11 - 6.2.2 - fix(watcher.node)
Defer events during initial scan, track full event sequences, and harden watcher shutdown
- Defer fs.watch events that arrive during the initial directory scan and process them after the scan completes to avoid race conditions where watchedFiles isn't populated.
- Debounce now tracks the full sequence of events per file (rename/change) instead of collapsing to the last event, preventing intermediate events from being lost.
- Detect delete+recreate via inode changes and emit unlink then add when appropriate; handle rapid create+delete sequences by emitting both events.
- During stop(), cancel pending debounced emits before flipping _isWatching and make handleFsEvent return early when watcher is stopped to prevent orphaned timeouts and post-stop emits.
- Add verbose logging of event sequences to aid debugging of complex fs event scenarios.
- Update tests to expect unlink + add for inode replacement scenarios.
- Version bump from 6.2.1 → 6.2.2
## 2025-12-10 - 6.2.1 - fix(watcher.node)
Handle fs.watch close without spurious restarts; add tests and improve test runner