-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(windows): fix directory cache regression "expected to end with a trailing slash" #9144
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
❌ @Jarred-Sumner 2 files with test failures on linux-x64-baseline:
|
❌ @Jarred-Sumner 1 files with test failures on linux-x64:
|
❌🪟 @Jarred-Sumner, there are 21 test regressions on Windows x86_64
|
❌ @Jarred-Sumner 2 files with test failures on bun-darwin-aarch64:
|
✅ test failures on bun-darwin-x64 have been resolved. |
|
paperdave
force-pushed
the
dave/win/fix-dir-cache-finale
branch
from
February 28, 2024 19:43
4454a7d
to
e94baca
Compare
this was introduced a couple of commits ago in my random fixes, where i put the wrong fix to another directory caching bug. i still stand by the assertion in place despite it causing many people issues. it's precense will prevent subtle module resolutions failures.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes passing the wrong path type to
bustDirCache
for real this time. In doing so, fixes a lot of other dubious uses of the dir_cache.I still stand by the aggressive assertion in
bustDirCache
, despite it's recent issues. It, when properly called, is essential for making sure module resolution is reliable when filesystem races happen. This PR calls that assertion in more places. What I found out from this is we are very inconsistent in weather there is a trailing slash in our cache keys.A lot of existing code was uncertain on weather it took a trailing slash or not, and it doesnt seem to be documented. For example: this paradox.
To fix this, I am removing all cases where we keep the trailing slash on the key for
dir_cache
's hash table. This was easier than requiring trailing slashes because as fixed old cases, new ones came up that were increasingly harder to get a trailing slash on without copying the entire path into a new buffer.In favor of making it easy to get a cache key, the normalization will remove it. See
Resolver.assertValidCacheKey
for details on the assertion. I left a very long comment here, as this fix took much longer than it should.How did you verify your code works?
vite
no longer regressesbustDirCache
is indeed correct.