Skip to content

fix: unsafe cache cannot watch symlink#12885

Merged
SyMind merged 1 commit intomainfrom
fix-unsafe-cache-for-persisent-cache
Jan 29, 2026
Merged

fix: unsafe cache cannot watch symlink#12885
SyMind merged 1 commit intomainfrom
fix-unsafe-cache-for-persisent-cache

Conversation

@SyMind
Copy link
Copy Markdown
Member

@SyMind SyMind commented Jan 29, 2026

Summary

This PR addresses issues with watching symlinked node_modules when using unsafe/persistent cache and ensures the module graph records correct file dependencies so changes are detected.

Fix #12875

Related links

Checklist

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

@SyMind SyMind requested a review from LingyuCoder as a code owner January 29, 2026 09:31
Copilot AI review requested due to automatic review settings January 29, 2026 09:31
@github-actions github-actions bot added team The issue/pr is created by the member of Rspack. release: bug fix release: bug related release(mr only) labels Jan 29, 2026
Copy link
Copy Markdown
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 addresses issues with watching symlinked node_modules when using unsafe/persistent cache and ensures the module graph records correct file dependencies so changes are detected.

Changes:

  • Add a new watch test case for symlinked node_modules under unsafe cache, including configuration and filter.
  • Enhance the legacy copyDiff helper to correctly copy and update symlinks instead of treating them as regular files/directories.
  • Update the Rust factorization repair path to propagate file_dependencies when creating/factorizing modules.

Reviewed changes

Copilot reviewed 5 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/rspack-test/watchCases/cache/unsafe-cache-node-modules-symlink/test.filter.js Controls when the new symlink/unsafe-cache watch test runs based on nativeWatcher experiment.
tests/rspack-test/watchCases/cache/unsafe-cache-node-modules-symlink/rspack.config.js Configures a development build with unsafeCache on node_modules for the new test.
tests/rspack-test/watchCases/cache/unsafe-cache-node-modules-symlink/0/index.js Adds the watch assertion verifying that symlinked node_modules changes are observed across watch steps.
packages/rspack-test-tools/src/helper/legacy/copyDiff.js Adjusts the test helper to handle symlinks correctly when copying fixtures, ensuring watch tests see correct filesystem state.
crates/rspack_core/src/compilation/build_module_graph/graph_updater/repair/factorize.rs Ensures factorization repair reuses create_data.file_dependencies instead of a default, so file dependencies are tracked properly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown
Contributor

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.5 KB 0
react-5k 2.7 MB 0
rome 984.2 KB 0
ui-components 2.3 MB 0

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 86019ed to fix: fix used exports for global entry that inject to async entrypoints (#12883) by Gengkun

🎉 Size decreased by 256bytes from 48.31MB to 48.31MB (⬇️0.00%)

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Jan 29, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing fix-unsafe-cache-for-persisent-cache (86019ed) with main (a5d5ed2)

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 29, 2026

📝 Benchmark detail: Open

Name Base (2026-01-29 855d938) Current Change
10000_big_production-mode_disable-minimize + exec 23.1 s ± 326 ms 23.1 s ± 392 ms +0.02 %
10000_development-mode + exec 1.3 s ± 16 ms 1.23 s ± 48 ms -5.46 %
10000_development-mode_hmr + stats 237 ms ± 5.7 ms 236 ms ± 5.7 ms -0.64 %
10000_development-mode_noop-loader + exec 2.25 s ± 61 ms 2.26 s ± 50 ms +0.26 %
10000_production-mode + exec 1.35 s ± 20 ms 1.33 s ± 16 ms -1.97 %
10000_production-mode_persistent-cold + exec 1.52 s ± 20 ms 1.51 s ± 40 ms -0.84 %
10000_production-mode_persistent-hot + exec 1.05 s ± 16 ms 1.08 s ± 43 ms +3.05 %
arco-pro_development-mode + exec 1.5 s ± 78 ms 1.49 s ± 39 ms -0.92 %
arco-pro_development-mode_hmr + stats 40 ms ± 1.3 ms 41 ms ± 0.85 ms +1.18 %
arco-pro_production-mode + exec 2.94 s ± 77 ms 2.91 s ± 139 ms -0.95 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.01 s ± 170 ms 2.95 s ± 132 ms -2.01 %
arco-pro_production-mode_persistent-cold + exec 3.13 s ± 314 ms 3.01 s ± 135 ms -3.98 %
arco-pro_production-mode_persistent-hot + exec 1.76 s ± 66 ms 1.73 s ± 15 ms -1.69 %
arco-pro_production-mode_traverse-chunk-modules + exec 2.98 s ± 74 ms 2.9 s ± 86 ms -2.60 %
large-dyn-imports_development-mode + exec 1.59 s ± 51 ms 1.51 s ± 41 ms -5.27 %
large-dyn-imports_production-mode + exec 1.72 s ± 25 ms 1.62 s ± 66 ms -6.30 %
threejs_development-mode_10x + exec 1.28 s ± 18 ms 1.27 s ± 20 ms -0.53 %
threejs_development-mode_10x_hmr + stats 209 ms ± 4.7 ms 202 ms ± 2.6 ms -3.18 %
threejs_production-mode_10x + exec 4.06 s ± 28 ms 3.98 s ± 64 ms -1.82 %
threejs_production-mode_10x_persistent-cold + exec 4.2 s ± 29 ms 4.13 s ± 39 ms -1.77 %
threejs_production-mode_10x_persistent-hot + exec 3.59 s ± 20 ms 3.56 s ± 60 ms -0.84 %
10000_big_production-mode_disable-minimize + rss memory 5743 MiB ± 300 MiB 5669 MiB ± 85.3 MiB -1.28 %
10000_development-mode + rss memory 619 MiB ± 23.7 MiB 647 MiB ± 44.7 MiB +4.54 %
10000_development-mode_hmr + rss memory 789 MiB ± 38.3 MiB 816 MiB ± 16 MiB +3.44 %
10000_development-mode_noop-loader + rss memory 910 MiB ± 33.1 MiB 939 MiB ± 43.1 MiB +3.20 %
10000_production-mode + rss memory 648 MiB ± 52.4 MiB 636 MiB ± 34 MiB -1.79 %
10000_production-mode_persistent-cold + rss memory 779 MiB ± 42.4 MiB 796 MiB ± 29.3 MiB +2.19 %
10000_production-mode_persistent-hot + rss memory 766 MiB ± 27.2 MiB 759 MiB ± 55.4 MiB -0.94 %
arco-pro_development-mode + rss memory 592 MiB ± 61.9 MiB 602 MiB ± 42.2 MiB +1.61 %
arco-pro_development-mode_hmr + rss memory 498 MiB ± 14.6 MiB 510 MiB ± 14.1 MiB +2.40 %
arco-pro_production-mode + rss memory 742 MiB ± 26.1 MiB 716 MiB ± 38.3 MiB -3.41 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 745 MiB ± 35.6 MiB 717 MiB ± 43.9 MiB -3.76 %
arco-pro_production-mode_persistent-cold + rss memory 786 MiB ± 60.6 MiB 821 MiB ± 73 MiB +4.42 %
arco-pro_production-mode_persistent-hot + rss memory 585 MiB ± 36.8 MiB 562 MiB ± 68.4 MiB -3.87 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 710 MiB ± 59.7 MiB 703 MiB ± 94.1 MiB -1.00 %
large-dyn-imports_development-mode + rss memory 652 MiB ± 4.98 MiB 674 MiB ± 8.49 MiB +3.41 %
large-dyn-imports_production-mode + rss memory 562 MiB ± 14.2 MiB 558 MiB ± 7.92 MiB -0.75 %
threejs_development-mode_10x + rss memory 585 MiB ± 14.4 MiB 589 MiB ± 29.7 MiB +0.66 %
threejs_development-mode_10x_hmr + rss memory 887 MiB ± 20.5 MiB 874 MiB ± 16.7 MiB -1.49 %
threejs_production-mode_10x + rss memory 736 MiB ± 91.7 MiB 740 MiB ± 81.3 MiB +0.60 %
threejs_production-mode_10x_persistent-cold + rss memory 816 MiB ± 47.3 MiB 780 MiB ± 16 MiB -4.41 %
threejs_production-mode_10x_persistent-hot + rss memory 704 MiB ± 24.7 MiB 683 MiB ± 77.9 MiB -3.07 %

@SyMind SyMind merged commit 27a1911 into main Jan 29, 2026
88 of 91 checks passed
@SyMind SyMind deleted the fix-unsafe-cache-for-persisent-cache branch January 29, 2026 11:35
SyMind added a commit that referenced this pull request Jan 29, 2026
SyMind added a commit that referenced this pull request Jan 29, 2026
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]: Rspack fails to invalidate cache when upgrading major version in pnpm workspace

3 participants