-
-
Notifications
You must be signed in to change notification settings - Fork 757
refactor: differentiate snapshot strategies by dependency type #12805
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.
|
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 snapshot strategy system to differentiate between different types of dependencies (file, context, missing, and build dependencies) and apply appropriate hashing strategies for each type.
Changes:
- Introduced
SnapshotTypeenum to distinguish between FILE, CONTEXT, MISSING, and BUILD dependency types - Split hash calculation into separate
file_hash()anddir_hash()methods with dedicated caches for each - Renamed
Strategy::PathHashtoStrategy::FileHashand added newStrategy::ContextHashandStrategy::Failedvariants - Added
updated_files()method toFileCounterto track files that were removed then re-added
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/rspack_core/src/utils/file_counter/mod.rs | Added updated_files() method to expose updated file tracking from IncrementalInfo |
| crates/rspack_core/src/compilation/mod.rs | Extended dependency methods to return updated files iterator in addition to added and removed |
| crates/rspack_core/src/cache/persistent/snapshot/strategy/mod.rs | Refactored Strategy enum with FileHash, ContextHash, and Failed variants; renamed test from validate_path_hash to validate_file_hash |
| crates/rspack_core/src/cache/persistent/snapshot/strategy/hash_helper.rs | Split content hashing into file_hash and dir_hash methods with separate caching, supporting different validation strategies |
| crates/rspack_core/src/cache/persistent/snapshot/mod.rs | Added SnapshotType enum and updated add() method to accept snapshot type for appropriate strategy selection |
| crates/rspack_core/src/cache/persistent/mod.rs | Updated after_compile to track file dependencies, context dependencies, and missing dependencies with appropriate snapshot types |
| crates/rspack_core/src/cache/persistent/build_dependencies/mod.rs | Updated to use SnapshotType::BUILD when adding build dependencies |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
crates/rspack_core/src/cache/persistent/snapshot/strategy/mod.rs
Outdated
Show resolved
Hide resolved
Rsdoctor Bundle Diff AnalysisFound 5 projects in monorepo, 0 projects with changes. 📊 Quick Summary
Generated by Rsdoctor GitHub Action |
📦 Binary Size-limit
❌ Size increased by 3.00KB from 48.01MB to 48.01MB (⬆️0.01%) |
Merging this PR will not alter performance
Comparing Footnotes
|
c19b7bc to
0c9c3be
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
* refactor: differentiate snapshot strategies by dependency type * fix: ci * feat: independent snapshot scope for different dependency types
* refactor: differentiate snapshot strategies by dependency type * fix: ci * feat: independent snapshot scope for different dependency types
* refactor: differentiate snapshot strategies by dependency type * fix: ci * feat: independent snapshot scope for different dependency types
Summary
Snapshot strategies should distinguish between file_dependencies and context_dependencies. For example, a directory in a file dependency simply means that the directory should exist, while a directory in a context dependency means that it should monitor all its child files.
This PR will add corresponding strategies for different dependency types.
Related links
Checklist