From 16190b4c4e3c8bfa2e5bbed0c91ddebe7afbbdfa Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Sat, 3 Oct 2026 15:08:52 +0000 Subject: [PATCH] fix: apply CodeRabbit auto-fixes Fixed 3 file(s) based on 1 failed pre-merge check. Co-authored-by: CodeRabbit --- tests/codegen-deno/deno_scripting.harness.mjs | 9 +++++++++ tests/codegen-deno/deno_scripting_part2.harness.mjs | 4 ++++ tools/run_codegen_bun_tests.sh | 2 ++ 3 files changed, 15 insertions(+) diff --git a/tests/codegen-deno/deno_scripting.harness.mjs b/tests/codegen-deno/deno_scripting.harness.mjs index 4c3ae753..82728e12 100644 --- a/tests/codegen-deno/deno_scripting.harness.mjs +++ b/tests/codegen-deno/deno_scripting.harness.mjs @@ -27,6 +27,7 @@ const fs = { }; const fsStub = { + /** Returns the in-memory `fs` entries for `path` as Dirent-like objects, or throws ENOENT. */ readdirSync: (path) => { const entries = fs[path]; if (!entries) { @@ -40,10 +41,15 @@ const fsStub = { isDirectory: () => e.isDirectory, })); }, + /** No-op stand-in; this corpus never asserts on directory creation. */ mkdirSync: () => {}, + /** No-op stand-in; this corpus never asserts on file writes. */ writeFileSync: () => {}, + /** No-op stand-in; this corpus never asserts on file removal. */ rmSync: () => {}, + /** Returns an empty buffer; this corpus never asserts on file contents. */ readFileSync: () => new Uint8Array(), + /** Always throws ENOENT; this corpus never exercises a successful stat. */ statSync: (path) => { const err = new Error(`stub: no such path ${path}`); err.code = "ENOENT"; @@ -51,6 +57,8 @@ const fsStub = { }, }; +// Intercepts the Bun-ESM prelude's lazy `node:fs` resolution so `fsStub` +// backs the emitted FS calls; delegates any other builtin to the real host. const realGetBuiltinModule = process.getBuiltinModule?.bind(process); process.getBuiltinModule = (name) => { if (name === "node:fs") return fsStub; @@ -65,6 +73,7 @@ process.getBuiltinModule = (name) => { const realArgv = process.argv; process.argv = ["node", "deno_scripting.harness.mjs", "alpha", "beta", "gamma"]; let lastExit = null; +/** Captures the exit code instead of terminating the harness process. */ process.exit = (code) => { lastExit = code; }; // Capture stderr writes from consoleError. diff --git a/tests/codegen-deno/deno_scripting_part2.harness.mjs b/tests/codegen-deno/deno_scripting_part2.harness.mjs index 63545653..3cb7a5c1 100644 --- a/tests/codegen-deno/deno_scripting_part2.harness.mjs +++ b/tests/codegen-deno/deno_scripting_part2.harness.mjs @@ -18,6 +18,7 @@ const files = { }; const fsStub = { + /** Returns size/isFile/isDirectory for a known path, or throws ENOENT. */ statSync: (path) => { const e = files[path]; if (!e) { @@ -31,6 +32,7 @@ const fsStub = { isDirectory: () => e.kind === "dir", }; }, + /** Returns the stubbed bytes for a known file path, or throws ENOENT. */ readFileSync: (path) => { const e = files[path]; if (!e || e.kind !== "file") { @@ -42,6 +44,8 @@ const fsStub = { }, }; +// Intercepts the Bun-ESM prelude's lazy `node:fs` resolution so `fsStub` +// backs the emitted FS calls; delegates any other builtin to the real host. const realGetBuiltinModule = process.getBuiltinModule?.bind(process); process.getBuiltinModule = (name) => { if (name === "node:fs") return fsStub; diff --git a/tools/run_codegen_bun_tests.sh b/tools/run_codegen_bun_tests.sh index 5e5aa36a..df95adac 100755 --- a/tools/run_codegen_bun_tests.sh +++ b/tools/run_codegen_bun_tests.sh @@ -24,6 +24,8 @@ if ! command -v bun >/dev/null 2>&1; then fi failures=() +# Records a check failure and echoes it as a `::error::` annotation, without +# aborting the script, so later checks still run (fail-late). fail() { failures+=("$1") echo "::error::$1" >&2