Repository navigation
fix: give a path watched with other casing the time info of its file on case-insensitive file systems - #358
Conversation
…on case-insensitive file systems
…ib (temporary)
🦋 Changeset detectedLatest commit: 1be3435 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 |
Merging this PR will not alter performance
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #358 +/- ##
==========================================
+ Coverage 92.58% 92.65% +0.06%
==========================================
Files 8 8
Lines 1363 1389 +26
Branches 405 416 +11
==========================================
+ Hits 1262 1287 +25
- Misses 95 96 +1
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:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughDirectoryWatcher now tracks whether its directory is case-sensitive. When a watched path is absent from the timestamp map, it checks whether a differently cased tracked path identifies the same file. If the filesystem is case-insensitive, it uses that path’s time-info entry. Tests cover timestamp updates on case-insensitive filesystems, missing paths on case-sensitive filesystems, and deferred detection after a stat error. The change also adds type declarations and a patch changeset. Priority: ➖ Normal Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
5d7acb11-4235-43fc-916a-09be09662114
📒 Files selected for processing: 4
.changeset/case-insensitive-time-info.mdlib/DirectoryWatcher.jstest/Casing.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.
Fixes #228. Supersedes #229.
On macOS and Windows,
import B from "./B"resolves when the file isb.js, and webpack watches.../B.js. watchpack already sends change events to that watcher, because watchers are keyed without case. ButcollectTimeInfoEntriesonly matches exact case, soB.jsgetsnull("missing"). webpack stores thatnullin the module's snapshot, and on the next editnull === nulllooks unchanged. The first edit rebuilds and later ones don't.Fix: a watched path that is missing from
files, but matches a file there apart from case, gets that file's entry. This happens only on a case-insensitive file system. Whether the directory ignores case is learned once, the first time such a mismatch occurs:lstatboth names and compare inode and device. On Linux the other-case name fails tolstat, so it staysnull. Missing dependencies (resolution candidates) are therefore never reported as existing, which is the problem with #229's unconditional lowercase match.Behaviour change: after a case-only rename (
hello.txt→hEllO.txt), a watcher forhello.txtnow gets the renamed file's entry instead ofnull. On a case-insensitive file system that name still opens the file. Reportingnullcaused the same stale-snapshot bug. The existing casing test is updated to match.Verified in CI (temporary jobs, since removed)
webpack in watch mode, importing
./Bforb.jsand editing it 3 times:mainwebpack's
WatchTestCases,WatchCacheUnaffectedTestCasesand watch unit tests with this lib: 5,232 passed on Linux, passed on Windows, 5,231 passed on macOS. The single macOS failure,NodeWatchFileSystem › shares one watcher pool between equal options(expects 1 directory watcher, gets 8), fails the same way with the published watchpack 2.6.1. It comes from macOS watching parent directories, and webpack runs its unit tests on Linux only.Tests
Awhileaexists getsa's entry, and the entry follows edits.Astaysnull.🤖 Generated with Claude Code
https://claude.ai/code/session_017TkBWTk3wcyUcJYDp5ZhaP
Summary by CodeRabbit