From d920e6495a53993b916f5b4948dcc583a0cbf208 Mon Sep 17 00:00:00 2001 From: Rafa Martins <146174365+rafacpti23@users.noreply.github.com> Date: Tue, 1 Sep 2026 09:38:44 -0300 Subject: [PATCH] build: omit the standalone output target for contributor builds (#12204) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Completes the contributor profile: #12198 stopped OmniRoute from assembling the standalone bundle, but Next was still asked to emit one. Making output: "standalone" conditional on OMNIROUTE_BUILD_PROFILE=contributor removes the standalone tracing pass itself, which is where the remaining time went. Default builds are unaffected — the flag is read from the env at config load and is false everywhere except the contributor profile, so tests/unit/next-config.test.ts still observes output === "standalone" (18/18 green across contributor-build-script, next-config and build-profile-stubs). Reconciled on merge: CONTRIBUTING.md and scripts/build/backendOnlyPages.mjs already carried this stack's earlier steps on the tip, so both took the tip's side; only the next.config.mjs conditional and its test are this step's delta. Thanks @rafacpti23 for splitting this into four reviewable steps — it made the whole stack easy to reason about. --- next.config.mjs | 4 +++- tests/unit/build/contributor-build-script.test.mjs | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/next.config.mjs b/next.config.mjs index a1a3fd5d7b..26303ced09 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -109,6 +109,8 @@ function filterKnownInfrastructureWarnings(baseConsole) { // The resulting artifact is intended to be published as `omniroute-secure` // for security-sensitive environments. See docs/security/SOCKET_DEV_FINDINGS.md. const isMinimalBuild = process.env.OMNIROUTE_BUILD_PROFILE === "minimal"; +// Contributor builds validate compilation only and do not need a shippable standalone bundle. +const isContributorBuild = process.env.OMNIROUTE_BUILD_PROFILE === "contributor"; // #10273: `null` unless the operator opts in with DASHBOARD_ALLOW_EMBED=vscode. Read at build // time like every other knob in this file (OMNIROUTE_BASE_PATH, OMNIROUTE_BUILD_PROFILE, …), @@ -218,7 +220,7 @@ const nextConfig = { }, ], }, - output: "standalone", + ...(isContributorBuild ? {} : { output: "standalone" }), compress: true, productionBrowserSourceMaps: false, // OmniRoute is a proxy for AI APIs — request bodies routinely include diff --git a/tests/unit/build/contributor-build-script.test.mjs b/tests/unit/build/contributor-build-script.test.mjs index 0161152c6d..52367b3c40 100644 --- a/tests/unit/build/contributor-build-script.test.mjs +++ b/tests/unit/build/contributor-build-script.test.mjs @@ -7,6 +7,8 @@ import { stubContributorInstrumentation, } from "../../../scripts/build/backendOnlyPages.mjs"; +const nextConfigSource = fs.readFileSync(path.join(process.cwd(), "next.config.mjs"), "utf8"); + const packageJson = JSON.parse(fs.readFileSync(path.join(process.cwd(), "package.json"), "utf8")); test("contributor build profile selects the webpack fallback", () => { @@ -48,3 +50,11 @@ test("contributor instrumentation stubs are reversible", async () => { for (const [target, source] of originals) assert.equal(await fs.readFile(target, "utf8"), source); await fs.rm(tempRoot, { recursive: true, force: true }); }); + +test("contributor profile disables standalone output while default keeps it", () => { + assert.match(nextConfigSource, /isContributorBuild/); + assert.match( + nextConfigSource, + /\.\.\.\(isContributorBuild \? \{\} : \{ output: "standalone" \}\)/ + ); +});