Skip to content

fix(runtime): preserve resolved provider identity during cache cleanup - #5060

Open
2heal1 wants to merge 2 commits into
feat/mf-ssr-clear-cachefrom
fix/ssr-provider-identity
Open

fix(runtime): preserve resolved provider identity during cache cleanup#5060
2heal1 wants to merge 2 commits into
feat/mf-ssr-clear-cachefrom
fix/ssr-provider-identity

Conversation

@2heal1

@2heal1 2heal1 commented Sep 11, 2026

Copy link
Copy Markdown
Member

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

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

@changeset-bot

changeset-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 41203bc

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 48 packages
Name Type
@module-federation/sdk Patch
@module-federation/runtime-core Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/devtools Patch
@module-federation/cli Patch
@module-federation/dts-plugin Patch
@module-federation/enhanced Patch
@module-federation/esbuild Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/metro Patch
@module-federation/modern-js-v3 Patch
@module-federation/modern-js Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/observability-plugin Patch
@module-federation/retry-plugin Patch
@module-federation/rsbuild-plugin Patch
@module-federation/rspack Patch
@module-federation/rspress-plugin Patch
@module-federation/rstest Patch
@module-federation/runtime Patch
@module-federation/storybook-addon Patch
@module-federation/utilities Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
@module-federation/runtime-tools Patch
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
@module-federation/metro-plugin-rnc-cli Patch
@module-federation/metro-plugin-rnef Patch
@module-federation/metro-plugin-rock Patch
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
node-dynamic-remote-new-version Patch
node-dynamic-remote Patch
@module-federation/playground Patch
remote5 Patch
remote6 Patch
website-new Patch
@module-federation/inject-external-runtime-core-plugin Patch
create-module-federation Patch
@module-federation/error-codes Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/treeshake-frontend Patch
@module-federation/treeshake-server Patch
@module-federation/bridge-shared Patch

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 11, 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-09-11T08:37:16.808719Z 18ddc2e 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.

@pkg-pr-new

pkg-pr-new Bot commented Sep 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@module-federation/devtools

pnpm add https://pkg.pr.new/@module-federation/devtools@41203bc

@module-federation/cli

pnpm add https://pkg.pr.new/@module-federation/cli@41203bc

create-module-federation

pnpm add https://pkg.pr.new/create-module-federation@41203bc

@module-federation/dts-plugin

pnpm add https://pkg.pr.new/@module-federation/dts-plugin@41203bc

@module-federation/enhanced

pnpm add https://pkg.pr.new/@module-federation/enhanced@41203bc

@module-federation/error-codes

pnpm add https://pkg.pr.new/@module-federation/error-codes@41203bc

@module-federation/esbuild

pnpm add https://pkg.pr.new/@module-federation/esbuild@41203bc

@module-federation/managers

pnpm add https://pkg.pr.new/@module-federation/managers@41203bc

@module-federation/manifest

pnpm add https://pkg.pr.new/@module-federation/manifest@41203bc

@module-federation/metro

pnpm add https://pkg.pr.new/@module-federation/metro@41203bc

@module-federation/metro-plugin-rnc-cli

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnc-cli@41203bc

@module-federation/metro-plugin-rnef

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rnef@41203bc

@module-federation/metro-plugin-rock

pnpm add https://pkg.pr.new/@module-federation/metro-plugin-rock@41203bc

@module-federation/modern-js

pnpm add https://pkg.pr.new/@module-federation/modern-js@41203bc

@module-federation/modern-js-v3

pnpm add https://pkg.pr.new/@module-federation/modern-js-v3@41203bc

@module-federation/native-federation-tests

pnpm add https://pkg.pr.new/@module-federation/native-federation-tests@41203bc

@module-federation/native-federation-typescript

pnpm add https://pkg.pr.new/@module-federation/native-federation-typescript@41203bc

@module-federation/nextjs-mf

pnpm add https://pkg.pr.new/@module-federation/nextjs-mf@41203bc

@module-federation/node

pnpm add https://pkg.pr.new/@module-federation/node@41203bc

@module-federation/observability-plugin

pnpm add https://pkg.pr.new/@module-federation/observability-plugin@41203bc

@module-federation/playground

pnpm add https://pkg.pr.new/@module-federation/playground@41203bc

@module-federation/retry-plugin

pnpm add https://pkg.pr.new/@module-federation/retry-plugin@41203bc

@module-federation/rsbuild-plugin

pnpm add https://pkg.pr.new/@module-federation/rsbuild-plugin@41203bc

@module-federation/rspack

pnpm add https://pkg.pr.new/@module-federation/rspack@41203bc

@module-federation/rspress-plugin

pnpm add https://pkg.pr.new/@module-federation/rspress-plugin@41203bc

@module-federation/rstest

pnpm add https://pkg.pr.new/@module-federation/rstest@41203bc

@module-federation/runtime

pnpm add https://pkg.pr.new/@module-federation/runtime@41203bc

@module-federation/runtime-core

pnpm add https://pkg.pr.new/@module-federation/runtime-core@41203bc

@module-federation/runtime-tools

pnpm add https://pkg.pr.new/@module-federation/runtime-tools@41203bc

@module-federation/sdk

pnpm add https://pkg.pr.new/@module-federation/sdk@41203bc

@module-federation/storybook-addon

pnpm add https://pkg.pr.new/@module-federation/storybook-addon@41203bc

@module-federation/third-party-dts-extractor

pnpm add https://pkg.pr.new/@module-federation/third-party-dts-extractor@41203bc

@module-federation/treeshake-frontend

pnpm add https://pkg.pr.new/@module-federation/treeshake-frontend@41203bc

@module-federation/treeshake-server

pnpm add https://pkg.pr.new/@module-federation/treeshake-server@41203bc

@module-federation/typescript

pnpm add https://pkg.pr.new/@module-federation/typescript@41203bc

@module-federation/utilities

pnpm add https://pkg.pr.new/@module-federation/utilities@41203bc

@module-federation/webpack-bundler-runtime

pnpm add https://pkg.pr.new/@module-federation/webpack-bundler-runtime@41203bc

@module-federation/bridge-react

pnpm add https://pkg.pr.new/@module-federation/bridge-react@41203bc

@module-federation/bridge-react-webpack-plugin

pnpm add https://pkg.pr.new/@module-federation/bridge-react-webpack-plugin@41203bc

@module-federation/bridge-shared

pnpm add https://pkg.pr.new/@module-federation/bridge-shared@41203bc

@module-federation/bridge-vue3

pnpm add https://pkg.pr.new/@module-federation/bridge-vue3@41203bc

@module-federation/inject-external-runtime-core-plugin

pnpm add https://pkg.pr.new/@module-federation/inject-external-runtime-core-plugin@41203bc

commit: 41203bc

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines 428 to 430
// Resolved manifest metadata supersedes the registration's default global.
remoteInfos = remoteInfos.filter((info) => info.name !== remoteName);
remoteInfos.push(loaded.remoteInfo as RemoteInfoLike);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant