fix(runtime): preserve resolved provider identity during cache cleanup - #5060
fix(runtime): preserve resolved provider identity during cache cleanup#50602heal1 wants to merge 2 commits into
Conversation
🦋 Changeset detectedLatest commit: 41203bc The changes in this PR will be included in the next version bump. This PR includes changesets to release 48 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
@module-federation/devtools
@module-federation/cli
create-module-federation
@module-federation/dts-plugin
@module-federation/enhanced
@module-federation/error-codes
@module-federation/esbuild
@module-federation/managers
@module-federation/manifest
@module-federation/metro
@module-federation/metro-plugin-rnc-cli
@module-federation/metro-plugin-rnef
@module-federation/metro-plugin-rock
@module-federation/modern-js
@module-federation/modern-js-v3
@module-federation/native-federation-tests
@module-federation/native-federation-typescript
@module-federation/nextjs-mf
@module-federation/node
@module-federation/observability-plugin
@module-federation/playground
@module-federation/retry-plugin
@module-federation/rsbuild-plugin
@module-federation/rspack
@module-federation/rspress-plugin
@module-federation/rstest
@module-federation/runtime
@module-federation/runtime-core
@module-federation/runtime-tools
@module-federation/sdk
@module-federation/storybook-addon
@module-federation/third-party-dts-extractor
@module-federation/treeshake-frontend
@module-federation/treeshake-server
@module-federation/typescript
@module-federation/utilities
@module-federation/webpack-bundler-runtime
@module-federation/bridge-react
@module-federation/bridge-react-webpack-plugin
@module-federation/bridge-shared
@module-federation/bridge-vue3
@module-federation/inject-external-runtime-core-plugin
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 18ddc2ec40
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Resolved manifest metadata supersedes the registration's default global. | ||
| remoteInfos = remoteInfos.filter((info) => info.name !== remoteName); | ||
| remoteInfos.push(loaded.remoteInfo as RemoteInfoLike); |
There was a problem hiding this comment.
Preserve resolved info across earlier remove hooks
When a user-supplied removeRemote hook deletes moduleCache before the bundler hook runs—which is supported by the hook model and possible because init.ts appends the cache plugin after existing plugins—the lookup here loses the only resolved provider/container identity. Cleanup then falls back to the configured registration global, deleting a registration-named business global while leaving the actual resolved container and its cache intact. Persist or pass the resolved remoteInfo independently of moduleCache before executing the hook chain.
Useful? React with 👍 / 👎.
Description
A dynamically registered manifest remote can have three different names: the host registration, the provider's runtime name, and its container global. Cache invalidation previously lost the manifest provider name and could clear live shared factories. It could also delete unrelated business globals whose names matched the registration.
Retain the manifest provider identity through SDK snapshots and resolved runtime metadata. Use it for shared-provider retention, and let resolved container metadata replace the registration's default global when cleaning caches. This repairs the SSR update foundation before R4; it does not implement the static planner or change Shared.from.
Validation: SDK 69 passed (one existing disabled DOM test), runtime-core 143 passed, bundler-runtime 127 passed, all six runtime-tools build tasks passed, and native Rspack/Modern baseline 23/23 passed. The new regressions fail against the merged cleanup code (5 bundler and 4 runtime-core failures). Repository-wide Prettier, diff whitespace checks and Changesets validation passed. Full browser/E2E matrices were not rerun for this focused repair. Exact commands and limitations are recorded in tools/ssr-cache/VALIDATION.md.
Related Issue
Follow-up to #5053 on feat/mf-ssr-clear-cache. No separate issue.
Types of changes
Checklist