mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-09-13 18:32:12 +03:00
Validado em lote numa worktree combinada com os 14 PRs desta campanha de error-boundary sobre o tip de `release/v3.8.51`: `typecheck:core` limpo e **120/120** nos 23 arquivos de teste que os PRs trazem. Um ponto que só apareceu no tree combinado: **#12465 e #12466 criam o mesmo arquivo novo** `open-sse/utils/streamReadiness.ts` (que não existe no tip) com desenhos divergentes de cancelamento — `cancelled` + `releaseLock` imediato num, `readInFlight`/`cancelRequested` com `cancelReader` fire-and-forget no outro. Adotei a versão do #12466, que difere e defere o release do lock para quando a leitura em voo termina, e validei a escolha rodando as suítes dos **dois** PRs contra ela: 21/21 no readiness compartilhado e 22/22 incluindo o boundary do Perplexity.
74 lines
1.7 KiB
TypeScript
74 lines
1.7 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { spawnSync } from "node:child_process";
|
|
import { fileURLToPath } from "node:url";
|
|
import test from "node:test";
|
|
|
|
const REPO_ROOT = fileURLToPath(new URL("../..", import.meta.url));
|
|
const FIXTURE = fileURLToPath(
|
|
new URL("../fixtures/codex-response-failed-boundary.fixture.ts", import.meta.url)
|
|
);
|
|
|
|
const CHILD_RUNTIME_ENV_KEYS = [
|
|
"PATH",
|
|
"TMPDIR",
|
|
"TMP",
|
|
"TEMP",
|
|
"SystemRoot",
|
|
"ComSpec",
|
|
"PATHEXT",
|
|
"LANG",
|
|
"LC_ALL",
|
|
"TZ",
|
|
] as const;
|
|
|
|
function buildFixtureEnv(): NodeJS.ProcessEnv {
|
|
const env: NodeJS.ProcessEnv = {
|
|
NODE_ENV: "test",
|
|
APP_LOG_TO_FILE: "false",
|
|
API_KEY_SECRET: "codex-boundary-fixture-api-key-secret-20260902",
|
|
DISABLE_SQLITE_AUTO_BACKUP: "true",
|
|
};
|
|
|
|
for (const key of CHILD_RUNTIME_ENV_KEYS) {
|
|
const value = process.env[key];
|
|
if (value !== undefined) env[key] = value;
|
|
}
|
|
|
|
// A nested test runner must receive its own context instead of inheriting the parent's.
|
|
delete env.NODE_TEST_CONTEXT;
|
|
return env;
|
|
}
|
|
|
|
test("Codex public failure boundaries pass in an isolated process", () => {
|
|
const result = spawnSync(
|
|
process.execPath,
|
|
[
|
|
"--import",
|
|
"tsx/esm",
|
|
"--import",
|
|
"./open-sse/utils/setupPolyfill.ts",
|
|
"--test",
|
|
"--test-force-exit",
|
|
FIXTURE,
|
|
],
|
|
{
|
|
cwd: REPO_ROOT,
|
|
encoding: "utf8",
|
|
env: buildFixtureEnv(),
|
|
timeout: 60_000,
|
|
}
|
|
);
|
|
|
|
assert.ifError(result.error);
|
|
assert.equal(
|
|
result.signal,
|
|
null,
|
|
`isolated Codex boundary fixture terminated by ${result.signal}\n${result.stdout}\n${result.stderr}`
|
|
);
|
|
assert.equal(
|
|
result.status,
|
|
0,
|
|
`isolated Codex boundary fixture failed\n${result.stdout}\n${result.stderr}`
|
|
);
|
|
});
|