Repository navigation
fix(imageRegistry): split data from flag-gated logic to avoid client bundle leak (#10692) - #15791
Merged
diegosouzapw merged 1 commit intoOct 8, 2026
Conversation
…/v3.8.52 Keep the data module out of the client flag path, and carry the tip's Codex gpt-image entries with it. Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
diegosouzapw
force-pushed
the
fix/client-bundle-image-registry-flag
branch
from
October 8, 2026 12:57
6f21036 to
9e8356a
Compare
diegosouzapw
merged commit Oct 8, 2026
238803e
into
diegosouzapw:release/v3.8.52
8 of 9 checks passed
Owner
|
Thanks @Junior-HJ — the image catalog now lives in its own module so the client bundle does not pull the flag-gated registry. I rebased the branch onto the current release tip and kept that split. The resolution commit is on your branch, co-authored. This is in the upcoming release. |
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.
Summary
Fixes client bundle leak introduced in #15423 where
open-sse/config/imageRegistry.tsstatically importedisFeatureFlagEnabledfrom@/shared/utils/featureFlags.ts. BecauseimageRegistry.tsis in the static import graph of"use client"pages (MediaPageClient.tsx,mediaServiceKinds.tsviaserviceKindIndex), Turbopack/Next.js attempted to bundle server-only database code (src/lib/db/core.ts) into the browser bundle, violating the invariant guarded bytests/unit/client-bundle-no-server-only-10692.test.ts.Changes
IMAGE_PROVIDERS,IMAGE_MODEL_ALIASES,XAI_*, interfaces) into client-safeopen-sse/config/imageRegistryData.ts(documented per base-red: production build fails — 28 Node-builtin resolution errors from server-only code reaching the client bundle (dashboard/providers page → db/core) #10692 pattern: never import featureFlags/db here).open-sse/config/imageRegistry.tsretains all logic functions, re-exports data types/constants for full backward compatibility, and keepsisGrokSubscriptionImagesEnabledconnected to the fullisFeatureFlagEnabledresolver (DB > env > default).MediaPageClient.tsx,mediaServiceKinds.ts) toimageRegistryData.ts.Verification
tests/unit/client-bundle-no-server-only-10692.test.ts: passes ("no client entry point statically reaches server-only code"). Fails onorigin/release/v3.8.52before this fix with the exactMediaPageClient → imageRegistry → featureFlags → db/coretrail.grok-subscription-images-flag-off.test.ts: passes (2/2).image-xai-subscription.test.ts: passes (4/4).registry-direct-exports.test.ts: passes (20/20).