Skip to content

fix: persistent cache watch missing dependencies changes#12228

Merged
jerrykingxyz merged 3 commits intomainfrom
jerry/pc
Nov 19, 2025
Merged

fix: persistent cache watch missing dependencies changes#12228
jerrykingxyz merged 3 commits intomainfrom
jerry/pc

Conversation

@jerrykingxyz
Copy link
Contributor

@jerrykingxyz jerrykingxyz commented Nov 18, 2025

Summary

  • Adjust the persistent cache strategy, remove CompileTime, and use Missing as a fallback to indicate that the current file does not exist.

  • The PathHash strategy 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

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

Copilot AI review requested due to automatic review settings November 18, 2025 07:14
@github-actions github-actions bot added the release: bug fix release: bug related release(mr only) label Nov 18, 2025
@netlify
Copy link

netlify bot commented Nov 18, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit d24fae9
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/691c1f34ab11c20008c89d9d

@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Nov 18, 2025
@jerrykingxyz jerrykingxyz linked an issue Nov 18, 2025 that may be closed by this pull request
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 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 Missing strategy to track files that don't exist and detect when they become available
  • Replaced CompileTime strategy with mtime-based tracking in PathHash for more accurate file change detection
  • Updated cache to track missing_dependencies alongside 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.

@github-actions
Copy link
Contributor

📦 Binary Size-limit

Comparing d24fae9 to fix: swc-loader should not respect .swcrc (#12222) by CPunisher

❌ Size increased by 3.38KB from 47.48MB to 47.48MB (⬆️0.01%)

@github-actions
Copy link
Contributor

github-actions bot commented Nov 18, 2025

📝 Benchmark detail: Open

Name Base (2025-11-18 0853cbf) Current Change
10000_big_production-mode_disable-minimize + exec 24.8 s ± 213 ms 25 s ± 539 ms +0.87 %
10000_development-mode + exec 1.28 s ± 38 ms 1.27 s ± 23 ms -0.33 %
10000_development-mode_hmr + exec 609 ms ± 8.1 ms 600 ms ± 6.4 ms -1.42 %
10000_development-mode_noop-loader + exec 2.2 s ± 24 ms 2.19 s ± 30 ms -0.54 %
10000_production-mode + exec 1.35 s ± 58 ms 1.32 s ± 9.6 ms -2.19 %
10000_production-mode_persistent-cold + exec 1.49 s ± 26 ms 1.46 s ± 38 ms -1.53 %
10000_production-mode_persistent-hot + exec 1.03 s ± 10 ms 1.03 s ± 23 ms -0.52 %
arco-pro_development-mode + exec 1.55 s ± 80 ms 1.6 s ± 55 ms +3.53 %
arco-pro_development-mode_hmr + exec 358 ms ± 2.1 ms 357 ms ± 1.5 ms -0.28 %
arco-pro_production-mode + exec 2.88 s ± 114 ms 2.85 s ± 94 ms -1.01 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 2.89 s ± 69 ms 2.95 s ± 89 ms +1.98 %
arco-pro_production-mode_persistent-cold + exec 3.05 s ± 306 ms 2.98 s ± 169 ms -2.39 %
arco-pro_production-mode_persistent-hot + exec 1.62 s ± 16 ms 1.65 s ± 18 ms +1.59 %
arco-pro_production-mode_traverse-chunk-modules + exec 2.93 s ± 181 ms 2.87 s ± 57 ms -1.83 %
large-dyn-imports_development-mode + exec 1.58 s ± 79 ms 1.56 s ± 80 ms -1.49 %
large-dyn-imports_production-mode + exec 1.6 s ± 20 ms 1.59 s ± 27 ms -0.96 %
threejs_development-mode_10x + exec 1.28 s ± 40 ms 1.27 s ± 45 ms -0.33 %
threejs_development-mode_10x_hmr + exec 900 ms ± 5.1 ms 905 ms ± 15 ms +0.54 %
threejs_production-mode_10x + exec 3.92 s ± 151 ms 3.91 s ± 211 ms -0.42 %
threejs_production-mode_10x_persistent-cold + exec 4 s ± 32 ms 4.04 s ± 238 ms +0.95 %
threejs_production-mode_10x_persistent-hot + exec 3.48 s ± 29 ms 3.47 s ± 35 ms -0.25 %
10000_big_production-mode_disable-minimize + rss memory 5358 MiB ± 49 MiB 5358 MiB ± 170 MiB -0.02 %
10000_development-mode + rss memory 591 MiB ± 13.8 MiB 585 MiB ± 40.3 MiB -0.94 %
10000_development-mode_hmr + rss memory 746 MiB ± 20.7 MiB 743 MiB ± 31.6 MiB -0.36 %
10000_development-mode_noop-loader + rss memory 885 MiB ± 31.8 MiB 870 MiB ± 30.1 MiB -1.65 %
10000_production-mode + rss memory 599 MiB ± 27.1 MiB 610 MiB ± 23.3 MiB +1.77 %
10000_production-mode_persistent-cold + rss memory 703 MiB ± 23.7 MiB 692 MiB ± 35.9 MiB -1.52 %
10000_production-mode_persistent-hot + rss memory 680 MiB ± 18.2 MiB 684 MiB ± 29.2 MiB +0.51 %
arco-pro_development-mode + rss memory 450 MiB ± 58.5 MiB 479 MiB ± 22 MiB +6.35 %
arco-pro_development-mode_hmr + rss memory 382 MiB ± 17.2 MiB 398 MiB ± 16.4 MiB +4.18 %
arco-pro_production-mode + rss memory 604 MiB ± 29.1 MiB 649 MiB ± 25.4 MiB +7.52 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 585 MiB ± 67 MiB 616 MiB ± 58.8 MiB +5.37 %
arco-pro_production-mode_persistent-cold + rss memory 666 MiB ± 98.4 MiB 696 MiB ± 39.9 MiB +4.59 %
arco-pro_production-mode_persistent-hot + rss memory 487 MiB ± 61.7 MiB 529 MiB ± 97.1 MiB +8.64 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 566 MiB ± 38.6 MiB 594 MiB ± 68.8 MiB +4.82 %
large-dyn-imports_development-mode + rss memory 611 MiB ± 6.88 MiB 621 MiB ± 6.57 MiB +1.70 %
large-dyn-imports_production-mode + rss memory 546 MiB ± 2.39 MiB 555 MiB ± 9.17 MiB +1.69 %
threejs_development-mode_10x + rss memory 533 MiB ± 28 MiB 547 MiB ± 22.7 MiB +2.70 %
threejs_development-mode_10x_hmr + rss memory 720 MiB ± 32.8 MiB 742 MiB ± 57.9 MiB +2.96 %
threejs_production-mode_10x + rss memory 688 MiB ± 111 MiB 670 MiB ± 109 MiB -2.64 %
threejs_production-mode_10x_persistent-cold + rss memory 749 MiB ± 46.3 MiB 760 MiB ± 82.1 MiB +1.38 %
threejs_production-mode_10x_persistent-hot + rss memory 622 MiB ± 90.9 MiB 597 MiB ± 47.6 MiB -4.11 %

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 18, 2025

CodSpeed Performance Report

Merging #12228 will not alter performance

Comparing jerry/pc (d24fae9) with main (2f78a97)

Summary

✅ 17 untouched

@jerrykingxyz jerrykingxyz merged commit 510e054 into main Nov 19, 2025
75 of 77 checks passed
@jerrykingxyz jerrykingxyz deleted the jerry/pc branch November 19, 2025 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: persistent cache should tracing missing dependencies

3 participants