Repository navigation
port(omniroute): #6908 - ship head-response-guard.cjs in the standalone CLI bundle - #286
Merged
Merged
Conversation
bloodf
pushed a commit
that referenced
this pull request
Aug 7, 2026
This was referenced Sep 4, 2026
Closed
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
custom-server.js, which lives OUTSIDE Next.js's standalone trace — nothing guaranteed a sidecar would travel with it, so the standalone CLI bundle could boot-crash withMODULE_NOT_FOUND. The guard is extracted into root sidecarhead-response-guard.cjs(identical runtime semantics: body bytes dropped, status/headers preserved, realendinvoked with exactly one callback, noConnection: closeadded);custom-server.jsnowrequire()s it. Newcli/scripts/standaloneSidecars.jsownsSTANDALONE_SIDECARS+copyRequiredStandaloneSidecars()which copies each root sidecar into the CLI bundle and FAILS HARD when one is missing.cli/scripts/build-cli.js(step 3a) andscripts/build-app.mjscopy the sidecar into the bundle /.next/standalone.Type
fix:— bug fixBreaking changes
Testing
require("./…")incustom-server.js— excluding generatedserver.jsand thesrc/+open-sse/trees — is present inSTANDALONE_SIDECARS), the extracted guard's runtime semantics, and the mitm runtime lifecycle (assertion follows the helper call).cd tests && node node_modules/vitest/vitest.mjs run unit/standalone-sidecars-6908.test.js unit/mitm-runtime-lifecycle.test.js unit/api-hardening.test.js;npm run lint;npm run build;npm pack --dry-run --jsonagainst a temp CLI app dir staged by the helper.head-response-guard.cjsfromSTANDALONE_SIDECARSfails 3 tests; restored → 71/71 green. Artifact proof: tarball containedapp/custom-server.js+app/head-response-guard.cjs(2722 bytes). Lint exit 0, build exit 0 with.next/standalone/head-response-guard.cjs+custom-server.jsverified present. Fulltest:ciwas blocked by a host-level environment defect (better-sqlite3 resolves to the main-repo-root ABI-137/Node-24 binary →ERR_DLOPEN_FAILEDunder pinned Node 20; a stale ABI-137 binding already existed so.omc/gate.sh's existence guard skipped copy/rebuild; 3 of the 4 collection-failed suites also fail on cleanorigin/dev) — relying on CI's clean VM as the authoritative gate.Checklist
port(omniroute):— commitlint-registered type)docs/ports/omniroute-6908.md(port-log doc artifact)Existing PRs
Searched open+closed PRs for
6908,head-response-guard,standalone sidecar— no duplicate or prior attempt found.Source
diegosouzapw/OmniRoute#6908 — upstream sibling-fork PR being ported.
Disclosure
omp --version)