Repository navigation
fix: report a file removed after startTime to a watcher attached later - #345
Conversation
🦋 Changeset detectedLatest commit: cc817ae The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughDirectoryWatcher now records timestamps for non-initial file removals and clears them when a path is observed again. When a watcher attaches and its target is missing, the check also compares the watcher’s start time with the recorded removal time. Added tests cover start times before and at the removal time. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to The reviewed removal-reporting behavior is consistent with the intended start-time handling and is ready to merge after normal checks. Pre-merge checks ·
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
21757378-395d-45d3-b716-1f6b2a14309a
📒 Files selected for processing (4)
.changeset/report-removal-after-start-time.mdlib/DirectoryWatcher.jstest/Watchpack.test.jstypes/DirectoryWatcher.d.ts
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.
Regression test for the watchpack fix (webpack/watchpack#345); it passes once watchpack is bumped to the release carrying it.
Merging this PR will not alter performance
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #345 +/- ##
==========================================
+ Coverage 92.19% 92.37% +0.18%
==========================================
Files 8 8
Lines 1307 1312 +5
Branches 385 388 +3
==========================================
+ Hits 1205 1212 +7
+ Misses 96 94 -2
Partials 6 6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Regression test for the watchpack fix (webpack/watchpack#345); it passes once watchpack is bumped to the release carrying it.
…22650) * docs(agents): fix a dependency's bug in the dependency, not with a workaround * fix(watch): rebuild when a file is removed while a build is running Regression test for the watchpack fix (webpack/watchpack#345); it passes once watchpack is bumped to the release carrying it.
Summary
A watcher attached with a
startTimeis told about files changed since then ("watch (outdated on attach)"), but not about files removed since then. webpack pauses its watcher during a build and attaches a new one with the build's start time afterwards, so a dependency deleted while a build runs never triggers a rebuild. This maderestored-commonjs-reexportflaky on macOS in webpack/webpack#22640, where FSEvents can deliver deletions after another change has started a build.DirectoryWatchernow records when a known file is removed, forgets it when the file reappears, and reportsinitial-missingon attach when the removal came afterstartTime. Paths watched as missing still ignore it, as before.What kind of change does this PR introduce?
fix
Did you add tests for your changes?
Yes, in
test/Watchpack.test.js: "should detect a past removal of a file (watched)" (times out without the fix) and "should not detect a removal before the start time (watched)". Both share one options object so they share one watcher pool, as webpack does.Does this PR introduce a breaking change?
No.
If relevant, what needs to be documented once your changes are merged or what have you already documented?
n/a
Use of AI
Claude Code traced the lost removal from webpack into
DirectoryWatcher.watch, wrote the fix and the tests, and ran the suite and lint. A maintainer asked for the fix to land here rather than as a webpack workaround.🤖 Generated with Claude Code
https://claude.ai/code/session_016ZdAw4de2GgWu4X7BMY8ys
Generated by Claude Code
Summary by CodeRabbit