Skip to content

Conversation

@JSerFeng
Copy link
Contributor

Summary

I found some potential vulnerabilities of SplitChunksPlugin, this can make output inconsistent during incremental rebuild.

Related links

Checklist

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

Copilot AI review requested due to automatic review settings December 10, 2025 09:29
@github-actions github-actions bot added release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack. labels Dec 10, 2025
@netlify
Copy link

netlify bot commented Dec 10, 2025

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit c5ec153
🔍 Latest deploy log https://app.netlify.com/projects/rspack/deploys/693a42c22d55ce0008512a06
😎 Deploy Preview https://deploy-preview-12410--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 10, 2025

📝 Benchmark detail: Open

Name Base (2025-12-10 80c4537) Current Change
10000_big_production-mode_disable-minimize + exec 24.8 s ± 419 ms 24.9 s ± 523 ms +0.29 %
10000_development-mode + exec 1.26 s ± 34 ms 1.2 s ± 13 ms -4.76 %
10000_development-mode_hmr + exec 589 ms ± 3.4 ms 584 ms ± 11 ms -0.85 %
10000_development-mode_noop-loader + exec 2.2 s ± 24 ms 2.16 s ± 134 ms -1.63 %
10000_production-mode + exec 1.36 s ± 79 ms 1.3 s ± 21 ms -4.80 %
10000_production-mode_persistent-cold + exec 1.48 s ± 28 ms 1.48 s ± 136 ms +0.04 %
10000_production-mode_persistent-hot + exec 1.04 s ± 16 ms 1.01 s ± 12 ms -2.43 %
arco-pro_development-mode + exec 1.55 s ± 67 ms 1.42 s ± 37 ms -8.37 %
arco-pro_development-mode_hmr + exec 360 ms ± 1.3 ms 358 ms ± 1.1 ms -0.66 %
arco-pro_production-mode + exec 2.92 s ± 68 ms 3.01 s ± 106 ms +3.01 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 2.96 s ± 123 ms 3.1 s ± 43 ms +4.87 %
arco-pro_production-mode_persistent-cold + exec 3.01 s ± 122 ms 3.16 s ± 243 ms +4.87 %
arco-pro_production-mode_persistent-hot + exec 1.64 s ± 44 ms 2.08 s ± 37 ms +26.25 %
arco-pro_production-mode_traverse-chunk-modules + exec 2.92 s ± 107 ms 3.05 s ± 98 ms +4.56 %
large-dyn-imports_development-mode + exec 1.58 s ± 82 ms 1.5 s ± 29 ms -5.29 %
large-dyn-imports_production-mode + exec 1.61 s ± 48 ms 1.58 s ± 56 ms -1.74 %
threejs_development-mode_10x + exec 1.3 s ± 12 ms 1.31 s ± 32 ms +1.12 %
threejs_development-mode_10x_hmr + exec 920 ms ± 5.6 ms 942 ms ± 28 ms +2.47 %
threejs_production-mode_10x + exec 3.96 s ± 170 ms 3.97 s ± 246 ms +0.26 %
threejs_production-mode_10x_persistent-cold + exec 4.11 s ± 242 ms 4.1 s ± 284 ms -0.45 %
threejs_production-mode_10x_persistent-hot + exec 3.53 s ± 28 ms 3.51 s ± 27 ms -0.63 %
10000_big_production-mode_disable-minimize + rss memory 5372 MiB ± 150 MiB 5329 MiB ± 27.3 MiB -0.80 %
10000_development-mode + rss memory 564 MiB ± 19.3 MiB 574 MiB ± 24.5 MiB +1.86 %
10000_development-mode_hmr + rss memory 732 MiB ± 25.5 MiB 725 MiB ± 13.2 MiB -0.88 %
10000_development-mode_noop-loader + rss memory 854 MiB ± 19.5 MiB 871 MiB ± 23 MiB +1.97 %
10000_production-mode + rss memory 612 MiB ± 35 MiB 607 MiB ± 38.3 MiB -0.91 %
10000_production-mode_persistent-cold + rss memory 697 MiB ± 42.3 MiB 711 MiB ± 39.2 MiB +1.90 %
10000_production-mode_persistent-hot + rss memory 691 MiB ± 44.7 MiB 692 MiB ± 39.4 MiB +0.20 %
arco-pro_development-mode + rss memory 480 MiB ± 75 MiB 540 MiB ± 47.7 MiB +12.56 %
arco-pro_development-mode_hmr + rss memory 390 MiB ± 12.1 MiB 434 MiB ± 5.48 MiB +11.35 %
arco-pro_production-mode + rss memory 601 MiB ± 55.4 MiB 707 MiB ± 88.7 MiB +17.74 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 597 MiB ± 82.1 MiB 735 MiB ± 78.4 MiB +23.14 %
arco-pro_production-mode_persistent-cold + rss memory 645 MiB ± 44.1 MiB 769 MiB ± 53.7 MiB +19.17 %
arco-pro_production-mode_persistent-hot + rss memory 521 MiB ± 58.5 MiB 567 MiB ± 54 MiB +8.81 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 586 MiB ± 119 MiB 719 MiB ± 70.1 MiB +22.81 %
large-dyn-imports_development-mode + rss memory 584 MiB ± 6.95 MiB 593 MiB ± 8.89 MiB +1.60 %
large-dyn-imports_production-mode + rss memory 541 MiB ± 9.63 MiB 557 MiB ± 8.56 MiB +3.01 %
threejs_development-mode_10x + rss memory 522 MiB ± 24.7 MiB 526 MiB ± 12 MiB +0.76 %
threejs_development-mode_10x_hmr + rss memory 760 MiB ± 39.4 MiB 732 MiB ± 24.6 MiB -3.70 %
threejs_production-mode_10x + rss memory 682 MiB ± 128 MiB 680 MiB ± 116 MiB -0.33 %
threejs_production-mode_10x_persistent-cold + rss memory 757 MiB ± 76.6 MiB 746 MiB ± 80.5 MiB -1.44 %
threejs_production-mode_10x_persistent-hot + rss memory 596 MiB ± 63.7 MiB 595 MiB ± 50.4 MiB -0.19 %

Threshold exceeded: ["arco-pro_production-mode_persistent-hot + exec"]

ahabhgk
ahabhgk previously approved these changes Dec 10, 2025
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 pull request addresses potential instability issues in the SplitChunksPlugin that could cause inconsistent output during incremental rebuilds. The changes focus on ensuring deterministic behavior by introducing stable key generation, sorting collections before iteration, and using content-based hashing instead of potentially unstable identifiers.

Key changes:

  • Introduced stable chunk identifier computation based on chunk names and runtime information
  • Added sorting to all collection iterations to ensure deterministic processing order
  • Replaced local hash caching with shared, thread-safe caching using DashMap
  • Generated stable keys for module groups and chunk combinations using sorted, content-based hashing

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
crates/rspack_plugin_split_chunks/src/plugin/module_group.rs Added stable chunk ID mapping, stable key generation and caching, sorting of module groups and invalid group keys, and tie-breaker logic for deterministic module group selection
crates/rspack_plugin_split_chunks/src/plugin/mod.rs Added sorting of modules before processing to ensure deterministic order
crates/rspack_plugin_split_chunks/src/plugin/max_size.rs Introduced generate_stable_key method for deterministic group naming, updated sorting to use stable keys instead of first node's key
crates/rspack_ids/src/named_chunk_ids_plugin.rs Added sorting of name-to-items map before processing to ensure deterministic chunk ID assignment

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 10, 2025

Rsdoctor Bundle Diff Analysis

Found 5 project(s) in monorepo.

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

📌 Baseline Commit: a9e97cadd9 | PR: #12415

Metric Current Baseline Change
📊 Total Size 5.7 MB 5.7 MB 0 B (0.0%)
📄 JavaScript 5.7 MB 5.7 MB 0 B (0.0%)
🎨 CSS 21.0 B 21.0 B 0 B (0.0%)
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: react-10k Bundle Diff

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

📌 Baseline Commit: a9e97cadd9 | PR: #12415

Metric Current Baseline Change
📊 Total Size 823.6 KB 823.6 KB 0 B (0.0%)
📄 JavaScript 823.6 KB 823.6 KB 0 B (0.0%)
🎨 CSS 0 B 0 B N/A
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: react-1k Bundle Diff

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

📌 Baseline Commit: a9e97cadd9 | PR: #12415

Metric Current Baseline Change
📊 Total Size 2.7 MB 2.7 MB 0 B (0.0%)
📄 JavaScript 2.7 MB 2.7 MB 0 B (0.0%)
🎨 CSS 21.0 B 21.0 B 0 B (0.0%)
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: react-5k Bundle Diff

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

📌 Baseline Commit: a9e97cadd9 | PR: #12415

Metric Current Baseline Change
📊 Total Size 2.1 MB 2.1 MB 0 B (0.0%)
📄 JavaScript 2.0 MB 2.0 MB 0 B (0.0%)
🎨 CSS 83.0 KB 83.0 KB 0 B (0.0%)
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: ui-components Bundle Diff

📁 rome

Path: ../build-tools-performance/cases/rome/dist/rsdoctor-data.json

📌 Baseline Commit: a9e97cadd9 | PR: #12415

Metric Current Baseline Change
📊 Total Size 984.3 KB 984.3 KB 0 B (0.0%)
📄 JavaScript 984.3 KB 984.3 KB 0 B (0.0%)
🎨 CSS 0 B 0 B N/A
🌐 HTML 0 B 0 B N/A
📁 Other Assets 0 B 0 B N/A

📦 Download Diff Report: rome Bundle Diff

Generated by Rsdoctor GitHub Action

@github-actions
Copy link
Contributor

github-actions bot commented Dec 10, 2025

📦 Binary Size-limit

Comparing c5ec153 to refactor: change dependencies_diagnostics_artifact to use atomic_refcell (#12415) by hardfist

❌ Size increased by 27.00KB from 48.19MB to 48.21MB (⬆️0.05%)

@JSerFeng JSerFeng marked this pull request as draft December 10, 2025 09:55
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 10, 2025

CodSpeed Performance Report

Merging #12410 will not alter performance

Comparing fix/split-chunk-stable (c5ec153) with main (a9e97ca)

Summary

✅ 17 untouched

@JSerFeng JSerFeng force-pushed the fix/split-chunk-stable branch 3 times, most recently from b2f537b to c41c08c Compare December 10, 2025 16:36
@JSerFeng JSerFeng force-pushed the fix/split-chunk-stable branch from c41c08c to c5ec153 Compare December 11, 2025 04:04
@github-actions
Copy link
Contributor

github-actions bot commented Dec 11, 2025

📝 Benchmark detail: Open

Name Base (2025-12-11 06b0500) Current Change
10000_big_production-mode_disable-minimize + exec 24.9 s ± 737 ms 24.9 s ± 611 ms -0.12 %
10000_development-mode + exec 1.24 s ± 20 ms 1.21 s ± 16 ms -2.41 %
10000_development-mode_hmr + exec 592 ms ± 8.8 ms 587 ms ± 16 ms -0.91 %
10000_development-mode_noop-loader + exec 2.19 s ± 47 ms 2.12 s ± 52 ms -2.99 %
10000_production-mode + exec 1.34 s ± 23 ms 1.3 s ± 44 ms -3.00 %
10000_production-mode_persistent-cold + exec 1.49 s ± 56 ms 1.43 s ± 32 ms -3.80 %
10000_production-mode_persistent-hot + exec 1.05 s ± 41 ms 1.01 s ± 11 ms -3.84 %
arco-pro_development-mode + exec 1.57 s ± 111 ms 1.44 s ± 102 ms -8.71 %
arco-pro_development-mode_hmr + exec 360 ms ± 1.1 ms 361 ms ± 2.8 ms +0.24 %
arco-pro_production-mode + exec 2.92 s ± 83 ms 2.78 s ± 89 ms -4.75 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.04 s ± 140 ms 2.83 s ± 102 ms -7.03 %
arco-pro_production-mode_persistent-cold + exec 3.07 s ± 252 ms 2.86 s ± 57 ms -6.66 %
arco-pro_production-mode_persistent-hot + exec 1.66 s ± 59 ms 1.63 s ± 40 ms -1.76 %
arco-pro_production-mode_traverse-chunk-modules + exec 2.93 s ± 168 ms 2.82 s ± 79 ms -3.96 %
large-dyn-imports_development-mode + exec 1.55 s ± 22 ms 1.51 s ± 32 ms -2.80 %
large-dyn-imports_production-mode + exec 1.62 s ± 50 ms 1.61 s ± 102 ms -0.62 %
threejs_development-mode_10x + exec 1.3 s ± 30 ms 1.27 s ± 18 ms -2.56 %
threejs_development-mode_10x_hmr + exec 926 ms ± 17 ms 890 ms ± 11 ms -3.83 %
threejs_production-mode_10x + exec 3.93 s ± 39 ms 3.92 s ± 174 ms -0.39 %
threejs_production-mode_10x_persistent-cold + exec 4.06 s ± 28 ms 4.02 s ± 45 ms -0.76 %
threejs_production-mode_10x_persistent-hot + exec 3.53 s ± 47 ms 3.49 s ± 126 ms -1.16 %
10000_big_production-mode_disable-minimize + rss memory 5434 MiB ± 230 MiB 5345 MiB ± 81.4 MiB -1.65 %
10000_development-mode + rss memory 570 MiB ± 19.8 MiB 572 MiB ± 26.6 MiB +0.32 %
10000_development-mode_hmr + rss memory 735 MiB ± 16.3 MiB 726 MiB ± 14.8 MiB -1.22 %
10000_development-mode_noop-loader + rss memory 858 MiB ± 33.1 MiB 868 MiB ± 23.7 MiB +1.17 %
10000_production-mode + rss memory 603 MiB ± 32.9 MiB 612 MiB ± 44.8 MiB +1.51 %
10000_production-mode_persistent-cold + rss memory 707 MiB ± 54.9 MiB 686 MiB ± 36.3 MiB -2.89 %
10000_production-mode_persistent-hot + rss memory 692 MiB ± 39.8 MiB 694 MiB ± 21.7 MiB +0.30 %
arco-pro_development-mode + rss memory 461 MiB ± 44.6 MiB 512 MiB ± 21.1 MiB +10.98 %
arco-pro_development-mode_hmr + rss memory 380 MiB ± 14.2 MiB 422 MiB ± 2.68 MiB +11.07 %
arco-pro_production-mode + rss memory 594 MiB ± 23 MiB 603 MiB ± 34.4 MiB +1.39 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 615 MiB ± 64.7 MiB 632 MiB ± 48.5 MiB +2.71 %
arco-pro_production-mode_persistent-cold + rss memory 638 MiB ± 61.7 MiB 685 MiB ± 68.1 MiB +7.32 %
arco-pro_production-mode_persistent-hot + rss memory 485 MiB ± 64.1 MiB 497 MiB ± 76 MiB +2.49 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 587 MiB ± 75.8 MiB 608 MiB ± 46.6 MiB +3.67 %
large-dyn-imports_development-mode + rss memory 580 MiB ± 4.94 MiB 587 MiB ± 6.78 MiB +1.15 %
large-dyn-imports_production-mode + rss memory 545 MiB ± 4.96 MiB 545 MiB ± 12.6 MiB -0.08 %
threejs_development-mode_10x + rss memory 529 MiB ± 25 MiB 528 MiB ± 46.8 MiB -0.16 %
threejs_development-mode_10x_hmr + rss memory 772 MiB ± 15.6 MiB 723 MiB ± 34.3 MiB -6.33 %
threejs_production-mode_10x + rss memory 660 MiB ± 142 MiB 688 MiB ± 90.1 MiB +4.20 %
threejs_production-mode_10x_persistent-cold + rss memory 751 MiB ± 36.6 MiB 737 MiB ± 66.7 MiB -1.88 %
threejs_production-mode_10x_persistent-hot + rss memory 592 MiB ± 64.2 MiB 586 MiB ± 55.9 MiB -0.92 %

@JSerFeng JSerFeng marked this pull request as ready for review December 11, 2025 04:49
@JSerFeng JSerFeng enabled auto-merge (squash) December 11, 2025 04:49
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.

3 participants