-
-
Notifications
You must be signed in to change notification settings - Fork 746
fix: persistent cache watch context dependencies changes #12309
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
Conversation
✅ Deploy Preview for rspack canceled.
|
|
📝 Benchmark detail: Open
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR refactors the persistent cache snapshot strategy system by extracting helper functionality into dedicated modules (hash_helper.rs and package_helper.rs) and adds a new test case for context dependencies. The refactoring encapsulates cache management within helper classes, addressing issues with cache invalidation when watching context dependency changes.
Key changes:
- Extracted content hash computation logic into a dedicated
HashHelpermodule - Extracted package version resolution logic into a dedicated
PackageHelpermodule - Added comprehensive test coverage for the new helper modules
- Added new test case for snapshot context dependencies behavior
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
crates/rspack_core/src/cache/persistent/snapshot/strategy/mod.rs |
Refactored to use new helper modules, simplified by delegating to PackageHelper and HashHelper |
crates/rspack_core/src/cache/persistent/snapshot/strategy/hash_helper.rs |
New module for computing content hashes with caching and support for both files and directories |
crates/rspack_core/src/cache/persistent/snapshot/strategy/package_helper.rs |
New module for finding package.json versions with directory traversal and caching |
tests/rspack-test/cacheCases/snapshot/context-dependencies/index.js |
Test case for context dependencies cache invalidation behavior |
tests/rspack-test/cacheCases/snapshot/context-dependencies/rspack.config.js |
Configuration for context dependencies test |
tests/rspack-test/cacheCases/snapshot/context-dependencies/loader.js |
Loader that adds context dependencies |
tests/rspack-test/cacheCases/snapshot/context-dependencies/file.js |
Test fixture with multiple versions |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crates/rspack_core/src/cache/persistent/snapshot/strategy/hash_helper.rs
Outdated
Show resolved
Hide resolved
crates/rspack_core/src/cache/persistent/snapshot/strategy/hash_helper.rs
Outdated
Show resolved
Hide resolved
tests/rspack-test/cacheCases/snapshot/context-dependencies/index.js
Outdated
Show resolved
Hide resolved
6845d6f to
97e673f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
crates/rspack_core/src/cache/persistent/snapshot/strategy/mod.rs:60
- [nitpick] The
fsArc is cloned three times here. Consider cloning once and reusing the cloned value, or pass references to the helpers if feasible. While Arc::clone is relatively cheap, this pattern could be optimized.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/rspack-test/cacheCases/snapshot/context-dependencies/index.js
Outdated
Show resolved
Hide resolved
tests/rspack-test/cacheCases/snapshot/context-dependencies/index.js
Outdated
Show resolved
Hide resolved
tests/rspack-test/cacheCases/snapshot/context-dependencies/index.js
Outdated
Show resolved
Hide resolved
tests/rspack-test/cacheCases/snapshot/context-dependencies/rspack.config.js
Outdated
Show resolved
Hide resolved
crates/rspack_core/src/cache/persistent/snapshot/strategy/hash_helper.rs
Outdated
Show resolved
Hide resolved
97e673f to
5dbcedb
Compare
📦 Binary Size-limit
❌ Size increased by 3.50KB from 47.68MB to 47.68MB (⬆️0.01%) |
CodSpeed Performance ReportMerging #12309 will not alter performanceComparing Summary
|
Summary
Related links
Checklist