fix: persistent cache watch missing dependencies changes#12228
fix: persistent cache watch missing dependencies changes#12228jerrykingxyz merged 3 commits intomainfrom
Conversation
✅ Deploy Preview for rspack canceled.
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes persistent cache handling of missing dependencies by introducing a new Missing strategy and updating the cache tracking mechanism. The key change replaces the time-based CompileTime strategy with a more accurate Missing strategy that properly detects when previously non-existent files become available.
Key Changes
- Introduced
Missingstrategy to track files that don't exist and detect when they become available - Replaced
CompileTimestrategy withmtime-based tracking inPathHashfor more accurate file change detection - Updated cache to track
missing_dependenciesalongside file and context dependencies - Removed pre-existence checks before adding paths to snapshot, allowing missing files to be tracked
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
crates/rspack_core/src/cache/persistent/snapshot/strategy.rs |
Removed CompileTime strategy, added Missing strategy, updated PathHash to use mtime instead of compile_time, and updated corresponding tests |
crates/rspack_core/src/cache/persistent/snapshot/mod.rs |
Removed existence check when adding paths to snapshot and unused imports |
crates/rspack_core/src/cache/persistent/mod.rs |
Added tracking for missing_added and missing_removed dependencies in cache invalidation logic |
tests/rspack-test/cacheCases/snapshot/missing_dependencies/rspack.config.js |
Added test configuration with alias array to test missing file resolution |
tests/rspack-test/cacheCases/snapshot/missing_dependencies/index.js |
Added test case validating cache behavior when missing file becomes available |
tests/rspack-test/cacheCases/snapshot/missing_dependencies/file1.js |
Test file that starts missing and is created during test execution |
tests/rspack-test/cacheCases/snapshot/missing_dependencies/file2.js |
Fallback test file that exists from the start |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📦 Binary Size-limit
❌ Size increased by 3.38KB from 47.48MB to 47.48MB (⬆️0.01%) |
|
📝 Benchmark detail: Open
|
CodSpeed Performance ReportMerging #12228 will not alter performanceComparing Summary
|
Summary
Adjust the persistent cache strategy, remove
CompileTime, and useMissingas a fallback to indicate that the current file does not exist.The
PathHashstrategy stores the modification time of the current file.pub enum Strategy { - PathHash { compile_time: u64, hash: u64 }, + PathHash { mtime: u64, hash: u64 }, }Related links
Checklist