Skip to content

Conversation

@jerrykingxyz
Copy link
Contributor

@jerrykingxyz jerrykingxyz commented Jan 21, 2026

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

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings January 21, 2026 09:28
@netlify
Copy link

netlify bot commented Jan 21, 2026

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit 0c9c3be
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/6970b07661338800086ac6bf

@github-actions github-actions bot added release: refactor team The issue/pr is created by the member of Rspack. labels Jan 21, 2026
Copy link
Contributor

Copilot AI left a 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 SnapshotType enum to distinguish between FILE, CONTEXT, MISSING, and BUILD dependency types
  • Split hash calculation into separate file_hash() and dir_hash() methods with dedicated caches for each
  • Renamed Strategy::PathHash to Strategy::FileHash and added new Strategy::ContextHash and Strategy::Failed variants
  • Added updated_files() method to FileCounter to 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.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 21, 2026

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Change
react-10k 5.7 MB 0
react-1k 825.4 KB 0
react-5k 2.7 MB 0
rome 984.2 KB 0
ui-components 2.1 MB 0

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Contributor

github-actions bot commented Jan 21, 2026

📦 Binary Size-limit

Comparing 02e71b4 to test: hideSkippedTestFiles (#12812) by 9aoy

❌ Size increased by 3.00KB from 48.01MB to 48.01MB (⬆️0.01%)

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 21, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing jerry/fix (02e71b4) with main (6a174db)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 21, 2026

Deploying rspack-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 02e71b4
Status:🚫  Build failed.

View logs

Copy link
Contributor

Copilot AI left a 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.

@jerrykingxyz jerrykingxyz merged commit 29e0a7f into main Jan 22, 2026
99 of 104 checks passed
@jerrykingxyz jerrykingxyz deleted the jerry/fix branch January 22, 2026 06:32
LingyuCoder pushed a commit that referenced this pull request Jan 22, 2026
* refactor: differentiate snapshot strategies by dependency type

* fix: ci

* feat: independent snapshot scope for different dependency types
@github-actions github-actions bot mentioned this pull request Jan 22, 2026
2 tasks
LingyuCoder pushed a commit that referenced this pull request Jan 22, 2026
* refactor: differentiate snapshot strategies by dependency type

* fix: ci

* feat: independent snapshot scope for different dependency types
hardfist pushed a commit that referenced this pull request Jan 22, 2026
* refactor: differentiate snapshot strategies by dependency type

* fix: ci

* feat: independent snapshot scope for different dependency types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: refactor team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants