Skip to content

fix(fuzequality): cast the MF shared config so the frontend image type-checks - #707

Merged
izzywdev merged 1 commit into
masterfrom
claude/fix-fq-shared-type
Aug 26, 2026
Merged

fix(fuzequality): cast the MF shared config so the frontend image type-checks#707
izzywdev merged 1 commit into
masterfrom
claude/fix-fq-shared-type

Conversation

@izzywdev

Copy link
Copy Markdown
Owner

Regression from #701 — my bug

Adding singleton: true to FuzeQuality's Module-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 | undefined'.

Root cause

Confirmed against the installed types, not guessed. In @originjs/vite-plugin-federation@1.4.1, SharedConfig.singleton is commented out of types/index.d.ts:

declare interface SharedConfig {
  requiredVersion?: string | false
  // singleton?: boolean      <-- declared only in a comment
}

So the object literal fails excess-property checking. The plugin honours singleton at runtime; only its type declaration omits it.

Fix

Mirror the host verbatim — frontend/vite.config.ts:187-188 already carries the identical as any cast 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:

form result
without cast TS2353: 'singleton' does not exist in type 'SharedConfig' — on both entries
with cast clean

Why it matters

fuzequality-release.yml is still failing, so the FuzeQuality image has never been rebuilt with base: /apps/fuzequality/, and values-prod remains pinned at 6da67c73185a. Prod is half-migrated: #701 switched the route to /apps/fuzequality/*, but the image behind it is still built with base: '/', so its chunks resolve against the host shell's bundle. This unblocks the build.

🤖 Generated with Claude Code

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
@github-actions
github-actions Bot enabled auto-merge (squash) August 17, 2026 21:47
@github-actions

Copy link
Copy Markdown
Contributor

Automated code review (gate-code-review)

Credit balance is too low

Report-only — this check never blocks merge.

@izzywdev
izzywdev merged commit 97a3cbf into master Aug 26, 2026
50 checks passed
@izzywdev
izzywdev deleted the claude/fix-fq-shared-type branch August 26, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant