From 16d2b0ae7f83b0f4e09592a94947a4cdab895eb0 Mon Sep 17 00:00:00 2001 From: JUN Date: Mon, 19 Oct 2026 17:11:12 +0900 Subject: [PATCH] test(launcher): assert the scoped env and versioned bundled runtime in source oracles #7362 changed the bundled-runtime return and the spawn env line that two source-invariant oracles pinned literally (dev test 4/4, run 39218333499). Assert the new lines; the scoped inheritedEnv must sit inside the spawn call. --- tests/cli/ocx-launcher-source.test.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/cli/ocx-launcher-source.test.ts b/tests/cli/ocx-launcher-source.test.ts index 2938f1c165e..1dce864c01c 100644 --- a/tests/cli/ocx-launcher-source.test.ts +++ b/tests/cli/ocx-launcher-source.test.ts @@ -67,7 +67,7 @@ describe("ocx.mjs package launcher (source invariants)", () => { // Path and source come from one resolution, so the marker cannot describe another binary. expect(source).toContain("const bunRuntime = resolveBun({ allowInstall: !codexCliUpdateInspection });"); expect(source).toContain("const bun = bunRuntime.path;"); - expect(source).toContain('return { path: bin, source: "bundled" };'); + expect(source).toContain('return { path: bin, source: "bundled", version: bundledBunVersion(bunDir) };'); // The launcher's literal name must match the TypeScript constant it mirrors. expect(runtimeSource).toContain('export const BUN_RUNTIME_SOURCE_ENV = "OCX_BUN_RUNTIME_SOURCE";'); @@ -138,7 +138,8 @@ describe("ocx.mjs package launcher (source invariants)", () => { */ test("the inspection child does not inherit a duplicate copy of the snapshotted values", () => { expect(source).toContain("const inheritedEnv = { ...process.env };"); - expect(source).toContain("...inheritedEnv,"); + // The de-duplicated environment reaches the child; only its transpiler cache is scoped (#7362). + expect(source).toContain("...scopeTranspilerCacheToRuntime(inheritedEnv, bunRuntime.version, join),"); // Windows spells the variable `Path` in practice, so an upper-case-only delete would // leave the duplicate behind. The match must be on the lowercase form of every key. expect(source).toContain("if (snapshotted.has(name.toLowerCase())) delete inheritedEnv[name];"); @@ -153,6 +154,8 @@ describe("ocx.mjs package launcher (source invariants)", () => { const spawnStart = source.indexOf("const child = spawn(bun, [cliPath,"); expect(spawnStart).toBeGreaterThan(-1); expect(source.slice(spawnStart)).not.toContain("...process.env,"); + expect(source.slice(spawnStart, source.indexOf("});", spawnStart))) + .toContain("...scopeTranspilerCacheToRuntime(inheritedEnv, bunRuntime.version, join),"); }); /**