Skip to content

test(rspack-plugin): cover unstored roots on the loader's unproven path - #1994

Merged
trueadm merged 2 commits into
mainfrom
test/rspack-unstored-void-root
Oct 11, 2026
Merged

trueadm merged 2 commits into
mainfrom
test/rspack-unstored-void-root

Conversation

@trueadm

@trueadm trueadm commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Why

  • perf: omit unused root error reporting for default roots #1966 (merged as 2fe1f9f) rewrote "keeps production roots generic when the loader cannot prove resolved module output". Its fixture changed from createRoot(document.body).render(Main) to a stored root with unmount. The unstored factory(...).render(...) form is exactly the shape a void-root rewrite targets, and no other rspack test covered it on the unproven path.
  • When the loader cannot prove the imported module's final output, it must keep the reusable root (__createRootDefaultOptions(container).render(Main)), because a later loader can replace the component with one that returns a value.

Changes

  • packages/rspack-plugin-octane/tests/loader.integration.test.ts: new case keeps unstored production roots off the void contract when the loader cannot prove resolved module output, placed right after the stored-root case and using the same helpers (write, transform, evaluateCompiledFixtureCode, join).
  • No changeset, because the change is test-only (CONTRIBUTING.md: skip changesets for test-only work).

Validation

  • pnpm format:check: not run repo-wide. pnpm format:files:check on the changed file passes.
  • pnpm typecheck: not run repo-wide. pnpm typecheck:files packages/rspack-plugin-octane/tests/loader.integration.test.ts passes.
  • pnpm test: not run, per this machine's local-test policy. CI covers it.
  • targeted tests: pnpm vitest run --project rspack-plugin packages/rspack-plugin-octane/tests/loader.integration.test.ts passes 20/20.
  • Discrimination check: I temporarily changed packages/rspack-plugin-octane/src/loader.js to pass isVoidComponentImport: () => true, which forces the unproven path onto the void root helper. Both root cases then failed with expected '' to be 'replacement value', because the void root drops the returned value. I reverted the change before committing. (A mutation inside collectRootEdits in slot-hooks.js does not reach this path: without isVoidComponentImport, canSpecializeRoot is false and no candidates are collected.)
  • pnpm sync: no generated changes.
  • perf-review: not applicable (test-only).
  • concise-code: src +0 −0 (runtime +0 −0). No new files or exports; the test file gains +28 lines. Alternative considered: an it.each table shared with the stored-root case, at about the same size. Rejected because the stored case returns and asserts unmount cleanup, so a table would need a per-row branch. Bytes: not applicable.

Risk / follow-ups

  • None. The change is test-only.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

Low Risk
Test-only change with no production code or loader logic modifications.

Overview
Adds an rspack loader integration test for unstored production roots (createRoot(container).render(Main)) when the loader cannot prove the imported component’s output, complementing the existing stored-root + unmount case from octane#1966.

The test asserts the transform does not add a hard dependency on Main.tsrx and that compiled output still uses a generic root so a later loader can substitute a component that returns a value (replacement value in the DOM). Test-only; no runtime or loader behavior changes.

Reviewed by Cursor Bugbot for commit 6036fb6. Bugbot is set up for automated code reviews on this repo. Configure here.

#1966 rewrote the only rspack loader case that rendered a fire-and-forget
`createRoot(container).render(Main)` root without a void-component proof,
switching it to a stored root with `unmount`. The unstored shape is the one
a void-root rewrite targets, so restore it as its own case: the loader must
keep `__createRootDefaultOptions` and render a value returned by a
replacement component.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent test PR: tests only labels Oct 11, 2026
@trueadm
trueadm marked this pull request as ready for review October 11, 2026 11:48
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website 6036fb6 Commit Preview URL

Branch Preview URL
Oct 11 2026, 12:07 PM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website-mcp 6036fb6 Commit Preview URL

Branch Preview URL
Oct 11 2026, 12:08 PM

@github-actions

Copy link
Copy Markdown
Contributor

Benchmark report

🟢 No byte growth, no added work, and no timing changes beyond ±3%.

Compares 4bc1eaaa2, the merge commit's first parent with 482c60ab5 on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 2.450 2.417 ±0.0% −1.9% … +0.0% ⚪ within noise
octane-tsrx replace 5.283 5.192 ±0.0% −4.5% … +4.8% ⚪ within noise
octane-tsrx add 2.233 2.225 ±0.0% −2.1% … +2.2% ⚪ within noise
octane-tsrx update 0.125 0.126 +0.7% −0.9% … +1.8% ⚪ within noise
octane-tsrx select 0.005 0.005 −0.8% −1.9% … +0.0% ⚪ within noise
octane-tsrx swap 0.016 0.016 −0.3% −2.7% … +2.2% ⚪ within noise
octane-tsrx remove 0.013 0.013 −0.9% −2.4% … +1.0% ⚪ within noise
octane-tsrx runlots 22.750 22.767 −2.4% −4.0% … +2.4% ⚪ within noise
octane-tsrx select_lots 0.006 0.006 +0.3% −0.0% … +1.6% ⚪ within noise
octane-tsrx clear 41.125 40.367 −1.5% −2.7% … +0.0% ⚪ within noise
octane-jsx run 3.158 3.158 −0.0% −4.3% … ±0.0% ⚪ within noise
octane-jsx replace 5.908 5.742 +1.6% −2.5% … +6.0% ⚪ within noise
octane-jsx add 3.008 3.008 ±0.0% ±0.0% … +3.4% ⚪ within noise
octane-jsx update 0.240 0.231 −1.7% −3.2% … +0.3% ⚪ within noise
octane-jsx select 0.123 0.123 +3.6% +0.9% … +4.7% ⚪ within noise
octane-jsx swap 0.161 0.161 +2.0% −0.0% … +5.4% ⚪ within noise
octane-jsx remove 0.158 0.160 +0.6% −0.6% … +2.2% ⚪ within noise
octane-jsx runlots 27.883 26.267 −2.0% −3.6% … +1.6% ⚪ within noise
octane-jsx select_lots 1.473 1.419 −3.1% −4.5% … −0.9% ⚪ within noise
octane-jsx clear 42.525 40.925 −3.1% −6.4% … −0.5% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

No changes across 60 measured values.

Public-import reachability bundles (bytes)

No changes across 111 measured values.

@trueadm
trueadm merged commit 4b6ece7 into main Oct 11, 2026
32 checks passed
@trueadm
trueadm deleted the test/rspack-unstored-void-root branch October 11, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent test PR: tests only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant