fix(fuzequality): cast the MF shared config so the frontend image type-checks - #707
Merged
Conversation
Regression from #701. Adding `singleton: true` to FuzeQuality's federation `shared` config broke the frontend image build: apps/web/vite.config.ts(30,18): error TS2322: Type '{ react: { singleton: true; requiredVersion: string; }; ... }' is not assignable to type 'Shared' Root cause, confirmed against the installed types: in @originjs/vite-plugin-federation@1.4.1, `SharedConfig.singleton` is COMMENTED OUT of types/index.d.ts (`// singleton?: boolean`) while `requiredVersion` is declared, so the object literal fails excess-property checking. The plugin honours `singleton` at runtime; only its types omit it. This is exactly why the host casts (frontend/vite.config.ts:187-188). Mirrored verbatim, including the `as any`, since the whole point of that block is to match the host's shared config EXACTLY — a mismatch means the remote loads its own React and dies on "Invalid hook call". Verified against the real 1.4.1 types: without the cast tsc reports TS2353 ("'singleton' does not exist in type 'SharedConfig'") on both entries; with the cast it is clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session-Id: 4b12627d-2bf2-43b5-be80-38cd5c2c3f6b
Contributor
Automated code review (gate-code-review)Credit balance is too low Report-only — this check never blocks merge. |
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.
Regression from #701 — my bug
Adding
singleton: trueto FuzeQuality's Module-Federationsharedconfig broke the frontend image build:Root cause
Confirmed against the installed types, not guessed. In
@originjs/vite-plugin-federation@1.4.1,SharedConfig.singletonis commented out oftypes/index.d.ts:So the object literal fails excess-property checking. The plugin honours
singletonat runtime; only its type declaration omits it.Fix
Mirror the host verbatim —
frontend/vite.config.ts:187-188already carries the identicalas anycast for the identical reason, on the identical plugin version. Keeping the two byte-compatible is the entire point of that block: a mismatch lets the remote load its own React and die on "Invalid hook call" in the browser.Verification
Compiled both forms against the real 1.4.1 type definitions:
TS2353: 'singleton' does not exist in type 'SharedConfig'— on both entriesWhy it matters
fuzequality-release.ymlis still failing, so the FuzeQuality image has never been rebuilt withbase: /apps/fuzequality/, andvalues-prodremains pinned at6da67c73185a. Prod is half-migrated: #701 switched the route to/apps/fuzequality/*, but the image behind it is still built withbase: '/', so its chunks resolve against the host shell's bundle. This unblocks the build.🤖 Generated with Claude Code