Skip to content

Conversation

@SyMind
Copy link
Member

@SyMind SyMind commented Jan 27, 2026

Summary

This PR ensures that accessing Stats instances from stale compilations in watch mode no longer causes panics, while still returning a valid stats JSON shape.

Changes:

  • Guard Stats JSON generation against stale compilations by returning safe, empty JsStatsCompilation objects instead of calling into freed Rust-side structures.
  • Short-circuit error and warning extraction in the stats factory when the given compilation is not the compiler’s _lastCompilation, returning empty collections for stale compilations.
  • Add a dedicated watchCases/compilation/access-stale-stats test to verify that stats.toJson() and stats.toJson({ all: true }) on stale stats remain shape-compatible and do not crash.

Related links

Checklist

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

Copilot AI review requested due to automatic review settings January 27, 2026 03:29
@github-actions github-actions bot added the release: bug fix release: bug related release(mr only) label Jan 27, 2026
@SyMind SyMind changed the title fix: should not panic when access slate stats fix: should not panic when access slate stats for Rspack 1.x Jan 27, 2026
@SyMind SyMind changed the base branch from main to v1.x January 27, 2026 03:30
@cloudflare-workers-and-pages
Copy link

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

Deploying rspack with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9fa2a8f
Status: ✅  Deploy successful!
Preview URL: https://6025f579.rspack-v2.pages.dev
Branch Preview URL: https://fix-access-outdate-stats-v1.rspack-v2.pages.dev

View logs

@hardfist hardfist enabled auto-merge (squash) January 27, 2026 03:37
@SyMind SyMind force-pushed the fix-access-outdate-stats-v1 branch from c38ec30 to 9fa2a8f Compare January 27, 2026 03:39
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.

@github-actions
Copy link
Contributor

📦 Binary Size-limit

Comparing 9fa2a8f to fix(mf): prevent entry-specific chunks from polluting manifest assets and refactor manifest generation (#12836) by Hanric

🎉 Size decreased by 336.25KB from 48.34MB to 48.01MB (⬇️0.68%)

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 27, 2026

Merging this PR will not alter performance

✅ 16 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing fix-access-outdate-stats-v1 (9fa2a8f) with main (3d548a8)2

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.

  2. No successful run was found on v1.x (2415a21) during the generation of this report, so main (3d548a8) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@hardfist hardfist merged commit 8eb2e07 into v1.x Jan 27, 2026
49 of 50 checks passed
@hardfist hardfist deleted the fix-access-outdate-stats-v1 branch January 27, 2026 04:05
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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants