ReviewOS

home-lang/home

native-napi-bootstrap-safety: corpus runner treats a missing bunfig.toml as fatal in a synthetic tree

#712
Closed glennmichael123 opened this 9 days ago ·
9 days ago

tests/runtime/native-napi-bootstrap-safety.test.mjs fails consistently:

open: ENOENT
while reading config "<tmp>/packages/runtime/test/bunfig.toml"
...
reason: no-tests-observed

The assertion that trips is assert.match(reduced.output, /tests unsupported: 1/) — the corpus process exits 1 before running anything.

Why

The test builds a synthetic tree (native-napi-bootstrap-safety.test.mjs:57-59):

const corpus = join(directory, 'packages/runtime/test/test')
mkdirSync(corpus, { recursive: true })

It creates packages/runtime/test/test/ and a fixture, and never creates packages/runtime/test/bunfig.toml. The runner then resolves a config at that path and fails.

Arguments.loadBunfig (packages/runtime/src/runtime/cli/Arguments.zig:290-301) tolerates a missing file only when the path was auto-discovered:

.err => |err| {
    if (auto_loaded) return;
    Output.prettyErrorln("{f}\nwhile reading config \"{s}\"", .{ err, config_path });
    Global.exit(1);
},

So something on the corpus-runner path is supplying this as an explicit config rather than an auto-discovered one. That is the bug: a synthetic corpus tree has no reason to carry a bunfig, and Bun's own auto-discovery would skip it.

Likely related to 65f306518 ("fix(test): restore Bun checkout topology"), which introduced packages/runtime/test/bunfig.toml and set root = "test".

What it is NOT

Not caused by 98984a8cd (request-target normalization) — verified by stashing that change, rebuilding, and re-running: it fails identically without it. All three tracked bunfig files (bunfig.toml, packages/runtime/test/bunfig.toml, packages/runtime/test/test/bunfig.toml) are present and unmodified in the working tree.

I could not identify what flipped it. It passed in a runtime-regression.sh run earlier the same session on the same committed source (68 ok / 1 failed), and fails now (67 ok / 2 failed) on that same source, so the trigger appears to be environmental rather than a code change. Recording it rather than leaving it unexplained.

Suggested fix

Either have the corpus runner treat its bunfig as auto-discovered (so absence is tolerated), or have the test create the file its synthetic tree now requires. The former matches Bun.

Refs #66

9 days ago

Completed on origin/main in ee7a9dcad.

The corpus runner now distinguishes a missing discovered config from an explicit/config-access failure. It probes bunfig.toml or bunfig.node-test.toml, omits --config only for FileNotFound, preserves the explicit checked-in config whenever present, and propagates every other access error. The synthetic tree therefore follows normal config discovery instead of failing before execution.

The first successful launch also exposed that the old MJS “reduced mode” branch had become stale when the corpus runner became native-only: it now correctly routes every JavaScript corpus child through Home's full runtime. The safety contract was retained rather than deleted. A focused Zig/JSC regression calls the actual reduced-adapter Node-API callback with a nonexistent module and verifies the specific unsupported result, proving rejection occurs before dlopen. The native MJS acceptance now verifies config-free corpus routing and explicit full-VM routing with real modern and legacy addons and constructor markers.

Fresh verification:

  • ReleaseFast native build: 46/46 steps succeeded.
  • Focused home-harness target: 23/23 build steps, 2/2 filtered tests passed.
  • native-napi-bootstrap-safety.test.mjs: pass across both addon ABIs and both routing modes.
  • native-patch-lifecycle.test.mjs: pass as an adjacent corpus/config regression.
  • Zig format/AST checks, targeted Pickier and git diff --check: pass.

No original Bun corpus source, assertion, skip, deadline or expected result changed. Refs #66.

Sign in to comment on this issue.