feat(runtime): reject incompatible runtime image reuse - #5096
Open
ScriptedAlchemy wants to merge 18 commits into
Open
ScriptedAlchemy wants to merge 18 commits into
ScriptedAlchemy wants to merge 18 commits into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
@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: |
ScriptedAlchemy
force-pushed
the
rfc5036/03-runtime-selectors
branch
from
September 18, 2026 15:40
dbe2d5a to
2d4f5e6
Compare
ScriptedAlchemy
force-pushed
the
rfc5036/04-runtime-image-cache
branch
from
September 18, 2026 15:50
2d87526 to
92b0669
Compare
🦋 Changeset detectedLatest commit: f32aae6 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 |
ScriptedAlchemy
force-pushed
the
rfc5036/03-runtime-selectors
branch
from
September 18, 2026 16:09
2d4f5e6 to
1b84bc8
Compare
Attach runtime-image metadata before instances enter global state. Reject known family, target, capability, loader, and URL-policy mismatches before reuse. Keep legacy callers compatible and preserve the remote-entry cache key.
ScriptedAlchemy
force-pushed
the
rfc5036/04-runtime-image-cache
branch
from
September 18, 2026 16:10
92b0669 to
c919e89
Compare
The selector checks only need the program result. Production minification did not finish before the test runner reached its limit, so the assertion never ran.
Compare remote-entry cache identity only when both the cached entry and the caller carry a runtime image. Drop the URL policy from the identity so retry plugins can change it between attempts, and stop storing the closure in global state. Compare separately built instances by family only, and run that check before the constructor runs beforeInit hooks, global plugins, and registerShared. Remove the global default-instance pointer and the constructor-level image so loadRemote, getInstance, and the debug constructor behave as on main.
Publish the external core again for the same name and version, warn only when a different provider is already published, and stop warning when no runtime image exists. Drop the unread entryLoadingIdentity field.
…mage-cache # Conflicts: # packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts
Reusing a no-shared runtime for an image that can load shared modules passed, while the reverse order failed. The current image must now provide every capability the next image can use.
This was referenced Sep 25, 2026
This was referenced Sep 25, 2026
ScriptedAlchemy
force-pushed
the
rfc5036/03-runtime-selectors
branch
from
September 26, 2026 04:59
5ca5c45 to
9fb0f2f
Compare
ScriptedAlchemy
force-pushed
the
rfc5036/04-runtime-image-cache
branch
from
September 26, 2026 04:59
2d3ecfc to
f32aae6
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of RFC #5036. An alternate proposal is open at #5128 with its own stack. This PR stays open until the decision on #5036 is made.
Stack: 4 of 7. Base: #5095 (
rfc5036/03-runtime-selectors). Next: #5097.Landing order: #5093 → #5094 → #5095 → #5096 → #5097 → #5098 → #5107.
What changes
Builds without
module-federation:*conditions behave exactly asmain. They register instances, reuse cached remote entries, and publish the external core with no new check or warning. A family that uses package conditions can no longer reuse a runtime instance, the external runtime-core, or a cached remote entry that was created for a different family, target, capability set, or entry loader. The remote-entry cache key that hooks see does not change.createInstanceattaches aRuntimeImageDescriptorV1to each instance. Enhanced writes the descriptor only for families that use package conditions, and every check is inert without it. Rspack stays in legacy mode.beforeInithooks, global plugins, orregisterSharedrun.init()on an existing instance compares the full image before it merges options. The existing image must provide every capability the new image can use and must not expose one it forbids, so the result does not depend on load order.Deduplication, rejection cleanup, and the old rejection guard stay. Resetting a remote, or all federation state, removes the cache metadata.
Verification
The branch history was rewritten on 2026-09-26 to remove attribution trailers from commit messages only. Every tree and patch is identical to the verified head;
f32aae69bis the rewritten tip.Runtime-core passed 137 tests, runtime 97, and the retry plugin 20. The external provider passed 4 ESM and CommonJS tests.
Prettier and
git diff --checkpass.CI at
f32aae69bpassed 20 checks, cancelled 4, and skipped 13.The 4 cancelled checks are
checkout-installandnode20-compatin Build Affected Packages,lint-depsin Lint Dependencies, andpublish-previewin pkg.pr.new Preview. Those three workflows each ran twice on this commit. They setcancel-in-progress: trueper PR, so the second run cancelled the first about a second after it started. The second run of each workflow passed on the same commit. The cancelled runs were not rerun.12 skipped checks are the jobs of the cancelled Build Affected Packages run, which wait on
checkout-install.e2e-treeshakewas skipped in the second run becausetools/scripts/ci-is-affected.mjsdid not select it.The shipped
runtime-toolsfamily declares"mode": "legacy-defines", so default builds write no descriptor. No end-to-end build exercises the mismatch paths.Deviations from the RFC
None noted.
Overlaps with open PRs
File overlaps with 16 other open PRs
packages/runtime-core/src/utils/load.ts. This PR does not include that change.packages/runtime-core/__tests__/load.spec.ts,packages/runtime-core/src/global.ts, andpackages/runtime-core/src/remote/index.ts. This PR does not include those changes.packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts. This PR does not include that change.packages/runtime-core/src/utils/load.ts. This PR does not include that change.packages/runtime/src/index.ts. This PR does not include that change.packages/runtime-core/src/remote/index.ts. This PR does not include that change.packages/runtime-core/__tests__/load.spec.ts,packages/runtime-core/src/type/config.ts, andpackages/runtime-core/src/utils/load.ts. This PR does not include those changes.packages/runtime-core/src/core.ts,packages/runtime-core/src/remote/index.ts,packages/runtime-core/src/type/config.ts, andpackages/runtime/src/index.ts. This PR does not include those changes.packages/runtime-core/src/type/config.ts. This PR does not include that change.packages/runtime-core/src/core.ts,packages/runtime-core/src/remote/index.ts,packages/runtime-core/src/type/config.ts, andpackages/runtime/src/index.ts. This PR does not include those changes.packages/runtime-core/src/remote/index.ts. This PR does not include that change.packages/runtime-core/src/core.ts,packages/runtime-core/src/index.ts,packages/runtime-core/src/remote/index.ts,packages/runtime-core/src/type/config.ts, andpackages/runtime/src/index.ts. This PR does not include those changes.packages/runtime-core/src/core.ts,packages/runtime-core/src/remote/index.ts,packages/runtime-core/src/type/config.ts, andpackages/runtime/src/index.ts. This PR does not include those changes.packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts. This PR does not include that change.packages/enhanced/src/lib/container/runtime/FederationRuntimePlugin.ts. This PR does not include that change.packages/runtime-core/src/core.tsandpackages/runtime/src/index.ts. This PR does not include those changes.