Skip to content

fix(javascript): retain distinct chunk registration callback metadata - #2737

Merged
morluto merged 1 commit into
morluto:mainfrom
chqcjq:fix/bundler-registration-callback-identity
Oct 13, 2026
Merged

morluto merged 1 commit into
morluto:mainfrom
chqcjq:fix/bundler-registration-callback-identity

Conversation

@chqcjq

@chqcjq chqcjq commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #2663.

Two literal Webpack/Rspack registrations with the same runtime, chunk IDs and factory bytes currently collapse even when their runtime callbacks name different entry modules or async chunks. The graph then loses the second callback's relationships. Include recovered callback metadata in the shared registration key used by both early collection and finalization: require name, cache status, entry/async keys and their unknown counts. Identical registrations still deduplicate; no downstream graph workaround or new schema is needed.

Regression coverage checks both source orders, standalone controls, identical repetitions, distinct chunk IDs, and differences in each callback field produced by the parser. Public compiled CLI and stdio MCP tests verify that both chunk observations retain their source locations and corresponding unresolved entry/async relationships. The analyzed fixtures are inert and never executed.

Validation on Windows x64 / Node 24.18.0:

  • Before: 9 new regressions fail; the distinct-chunk-ID control passes.
  • After: all 10 targeted tests pass, including CLI/MCP; all 1,186 JavaScript domain tests pass.
  • npm run check:ci, npm run docs:check, and npm run verify:test-discovery pass (1,046 files).

Local diff and affected consumers were reviewed manually. Automated local Codex review could not start because the local config has an invalid features value; no automated-review pass is claimed. No real bundler runtime or native provider was exercised, and no performance improvement is claimed.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T09:41:28.444442Z fc3a256 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issue was found in the changed code.

Summary

registrationKey now includes recovered callback facts. Registrations with identical factories but different callbacks stay separate, while identical registrations still deduplicate.

  • Chunk registrations stay separate when their callback facts differ.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Read registration and callback syntax] --> B[Recover callback facts]
  B --> C[registrationKey includes callback facts]
  C --> D[Deduplicate during collection]
  D --> E[Deduplicate during finalization]
  E --> F[Project retained registrations]
  F --> G[Shared chunk node with separate observations]
  F --> H[Entry and async relationships with source evidence]
Loading

Reviews (1) · Last reviewed commit: "fix(javascript): retain distinct chunk r..." · Reviewed by Greptile

@morluto
morluto merged commit 0cf224e into morluto:main Oct 13, 2026
20 checks passed
@chqcjq
chqcjq deleted the fix/bundler-registration-callback-identity branch October 13, 2026 12:49
@morluto morluto mentioned this pull request Oct 13, 2026
3 tasks done
@morluto morluto added bug Something isn't working area: domain Domain logic, errors, and pure functions labels Oct 14, 2026
@morluto

morluto commented Oct 20, 2026

Copy link
Copy Markdown
Owner

Really useful fix, @chqcjq: distinct Webpack/Rspack registration callbacks can carry different entry and async-chunk relationships even when their runtime, chunk IDs, and factory bytes match. Including the recovered callback facts in the shared identity keeps both observations in the graph.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(javascript): preserve callback metadata from repeated chunk registrations

2 participants