test(docker): skip comment lines in #4076 builder heap-ordering check (#5233)

The ordering assertion matched a builder-stage comment that mentions
'npm run build' (added with the v3.8.40 workspace-deps Docker fix), making it
false-fail even though the real RUN step correctly follows the NODE_OPTIONS
heap line. Match real ENV/RUN instructions only, ignoring '#' comment lines.
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-06-28 12:29:45 -03:00
committed by GitHub
parent 8da9e6ad3f
commit 051285a660
2 changed files with 14 additions and 7 deletions

View File

@@ -51,6 +51,7 @@ _In development — bullets added per PR; finalized at release._
### 📝 Maintenance
- **test(docker): de-brittle the #4076 builder-stage heap-ordering test (false-failing on a comment)**`dockerfile-build-heap-4076.test.ts` located the `npm run build` step via a raw `findIndex(/npm run build\b/)`, which matched a **comment line** in the builder stage (`# … npm run build fails with "Module not…"`, added with the v3.8.40 workspace-deps Docker fix) sitting before the `NODE_OPTIONS` heap line — making the test report the heap ceiling as set *after* the build and fail, even though the real `RUN … npm run build` correctly follows the `ENV NODE_OPTIONS` line. Instruction matching now skips Dockerfile comment lines (`# …`), so the ordering guard checks real `ENV`/`RUN` instructions only. The Dockerfile itself was already correct; this was a base-red blocking every PR into `release/v3.8.40`. ([#4076](https://github.com/diegosouzapw/OmniRoute/issues/4076))
- **test(combo): deterministic context-relay universal-handoff coverage** — covers the universal (provider-agnostic) session-handoff path in `context-relay` (`combo.ts:20992139`), which previously had only a definition-order assertion and a `TODO(phase-2)`. The test drives the real pipeline via session seams (`x-session-id``relayOptions.sessionId``maybeGenerateUniversalHandoff`) without live infrastructure. ([#5168](https://github.com/diegosouzapw/OmniRoute/pull/5168))
- **test(combo): end-to-end quota-share DRR routing-decision coverage (matrix parity)** — adds the missing E2E test for the `quota-share` strategy, driving the real `handleChat` → chatCore → `selectQuotaShareTarget` → executor pipeline via in-process seams and asserting which connection is dispatched. The DRR selector already had 29 unit tests; this closes the E2E gap and brings quota-share to parity with the 17-strategy public matrix. ([#5179](https://github.com/diegosouzapw/OmniRoute/pull/5179))
- **test(combo): deterministic context-relay codex quota-handoff coverage (closes last gap)** — covers the codex-specific handoff block of `context-relay` (`combo.ts:21432183`), which #5168 left documented-but-untested because it requires a `codex` connection. All seams (`fetchCodexQuota`, handoff generation, session relay) are mocked deterministically without live infra. ([#5195](https://github.com/diegosouzapw/OmniRoute/pull/5195))

View File

@@ -32,12 +32,20 @@ function builderStageRange(): { start: number; end: number } {
return { start, end };
}
/**
* Index of the first *instruction* line matching `re`, ignoring Dockerfile
* comment lines (those whose trimmed text starts with `#`). #4076: a comment in
* the builder stage that merely mentions `npm run build` must not be mistaken for
* the real `RUN … npm run build` step when checking instruction ordering.
*/
function findInstructionIndex(stage: string[], re: RegExp): number {
return stage.findIndex((l) => !l.trim().startsWith("#") && re.test(l));
}
test("#4076 builder stage raises the Node heap ceiling via NODE_OPTIONS", () => {
const { start, end } = builderStageRange();
const stage = lines.slice(start, end);
const heapLineIdx = stage.findIndex(
(l) => /NODE_OPTIONS/.test(l) && /--max-old-space-size/.test(l)
);
const heapLineIdx = findInstructionIndex(stage, /NODE_OPTIONS.*--max-old-space-size/);
assert.ok(
heapLineIdx >= 0,
"builder stage must set NODE_OPTIONS with --max-old-space-size to avoid the #4076 build OOM"
@@ -47,10 +55,8 @@ test("#4076 builder stage raises the Node heap ceiling via NODE_OPTIONS", () =>
test("#4076 the heap ceiling is set BEFORE `npm run build` so it reaches `next build`", () => {
const { start, end } = builderStageRange();
const stage = lines.slice(start, end);
const heapLineIdx = stage.findIndex(
(l) => /NODE_OPTIONS/.test(l) && /--max-old-space-size/.test(l)
);
const buildLineIdx = stage.findIndex((l) => /npm run build\b/.test(l));
const heapLineIdx = findInstructionIndex(stage, /NODE_OPTIONS.*--max-old-space-size/);
const buildLineIdx = findInstructionIndex(stage, /npm run build\b/);
assert.ok(buildLineIdx >= 0, "builder stage must run `npm run build`");
assert.ok(heapLineIdx >= 0, "builder stage must set the heap ceiling");
assert.ok(