Repository navigation
fix(build): restore the production build on release/v3.8.53 - #18596
Closed
magnum8237 wants to merge 1 commit into
Closed
magnum8237 wants to merge 1 commit into
magnum8237 wants to merge 1 commit into
Conversation
A "use client" page reaches src/lib/db/core.ts through grok47MaxEffort.ts, which statically imports @/shared/utils/featureFlags instead of the cheaper-inference#10692 resolver bridge. The browser chunk then has to resolve fs, child_process and module, and npm run build fails with 5 Module not found errors. Route the flag through featureFlagResolverBridge, the way open-sse/config/imageRegistry.ts already does. Server behavior is unchanged: featureFlags.ts registers isFeatureFlagEnabled as the resolver and @/lib/db/core loads it, so DB override > env > default still applies. In a client bundle the bridge falls back to the env var, which yields this flag's documented false default - the same value its previous catch returned. Also in this change: - add the missing title frontmatter to docs/providers/GITHUB-COPILOT.md and docs/providers/grok-cli-media.md, which stop the build before it reaches the errors above; a scan of docs/**/*.md confirms these are the only two - normalize paths in the client-bundle guard: resolveSpecifier() and walk() returned backslashes on Windows while every literal in the file uses forward slashes, so SERVER_ONLY.has() silently never matched and the pinned cheaper-inference#10692 chain was unguarded there - declare src/i18n/global-error-messages/*.json as text eol=lf, following the *.sh precedent already in .gitattributes: the build regenerates those catalogs with LF, so core.autocrlf=true marks all 67 modified after every build with zero lines changed tests/unit/client-bundle-no-server-only-10692.test.ts fails on the base tip naming this exact chain, and passes with this change.
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.
npm run buildfails on therelease/v3.8.53tip. A clean checkout of the branchcannot produce a production build, which also makes
tests/unit/client-bundle-no-server-only-10692.test.tsfail — one of the unit-shard failures reported on the base.
1. A client bundle reaches
src/lib/db/core.ts(5 webpack errors, one root cause)The browser chunk then has to resolve
fs,child_processandmodule:grok47MaxEffort.ts(added in #17386) statically imports@/shared/utils/featureFlags.That is exactly what the #10692 bridge exists to prevent —
featureFlagResolverBridge.tsstates the invariant in its own header: client-reachable modules "must never statically
import
@/shared/utils/featureFlags— that module reads the SQLite override table through@/lib/db/core".The fix routes the flag through that bridge, the same way
open-sse/config/imageRegistry.tsalready does. Behavior is unchanged on the server:
featureFlags.tsregistersisFeatureFlagEnabledas the resolver (and@/lib/db/coreloads it), so DB override > env >default still applies. In a client bundle the bridge falls back to the env var alone, which
yields this flag's documented
falsedefault — the same value its previouscatchreturned.2. Two docs pages have no frontmatter
docs/providers/GITHUB-COPILOT.md(#12833) anddocs/providers/grok-cli-media.md(#15305)ship without a
title, so the fumadocs-mdx collection rejects them and the build stops beforereaching the errors above:
A scan of
docs/**/*.mdconfirms these two are the only ones.3. The guard's
SERVER_ONLYpin never matched on WindowsresolveSpecifier()andwalk()returnedpath.relative()output, which uses\on Windows,while every literal in the file (
SERVER_ONLY,EXTRA_ENTRIES, the resolver assertions) iswritten with
/. SoSERVER_ONLY.has(file)silently never matched there and the pinned #10692chain was unguarded — and the
dynamic import specifierstest failed on Windows for the samereason. Both paths now normalize through one helper.
4. The build dirties 67 tracked files on Windows
npm run buildregeneratessrc/i18n/global-error-messages/*.jsonthroughscripts/i18n/generate-global-error-messages.mjs, which writes plain\n. Withcore.autocrlf=truegit expects CRLF in the working tree, so all 67 files show as modifiedafter every build with zero lines changed (blobs are byte-identical). The
.gitattributesentry follows the
*.sh text eol=lfprecedent already in that file.Validation
Hard Rule #18 — failing-then-passing test.
tests/unit/client-bundle-no-server-only-10692.test.tson the base tip, before any change:
After the change: 4/4 pass. The flag's own coverage is also green —
cursor-grok-47-context-17386.test.ts,cursor-grok-effort-aliases.test.tsandfeature-flag-resolver-bridge.test.ts: 12/12, including "loading featureFlags registers theDB-aware resolver (DB override wins over env)".
Also verified end to end outside CI:
npm run buildcompletes on this branch and the resultingproduction server answers
/api/monitoring/healthwith{"status":"healthy","setupComplete":true}.