ReviewOS

home-lang/home

Native CLI: propagate dotenv and bunfig options into module and eval execution

#506
Closed chris opened this 9 days ago ·
9 days ago

Follow-up to #66, discovered while implementing native package-script dispatch in #497.

The unchanged packages/runtime/test/bun-corpus/cli/run/no-envfile.test.ts reports 1 pass / 8 fail / 28 assertions under HOME_NATIVE_VM=1 HOME_CORPUS_FULL_VM=1. The same eight failures reproduce with the previously published 8157bde43c9649afa9276af708463ed5fb28117d binary, so they are not introduced by the package-script changes.

The native VM entrypoint constructs fresh default TransformOptions and does not carry the complete CLI/bunfig environment settings through to module/eval execution. Failures cover --no-env-file with .env, .env.local, .env.development.local, production mode and eval; bunfig env=false / env.file=false; and combining --no-env-file with an explicit --env-file.

Integrate real parsed configuration into the native VM path. Preserve explicit environment files, override precedence, relative paths, eval behavior, and existing preload/conditions handling. Verify the unchanged file and adjacent CLI/env corpus; do not suppress environment output or special-case fixture names.

Evidence retained locally: zig-out/package-focused-no-envfile.stderr, zig-out/package-no-envfile-baseline.stderr, zig-out/package-diagnostics.json. Source pin: 4982b91e3702094330f3be3883354c52b8c01323. This is a separate open compatibility gap; #497 passing does not complete #66.

9 days ago

Published source checkpoint: 06a212514 on codex/runtime-port. This follow-up remains unresolved; the passing package-script checkpoint does not complete its acceptance criteria. Verification and related gaps are linked in #497 and #66.

9 days ago

Published native context propagation in bfdb5f3188e6a6b8f0bea7070131144f5813c046 on codex/runtime-port, authored and committed as Chris Breuer with no coauthors.

The native VM now keeps real CLI/bunfig TransformOptions and global Command context. Package lookup passes that context through to module execution, so relative --cwd is applied once. Eval parses leading runtime flags without reinterpreting source or trailing script arguments. Preloads, defines, loaders, env files, conditions, symlink and resolver/runtime settings reach their existing native consumers; console depth and DCE settings are no longer reset to defaults.

Complete unchanged files, compared with parent 06a212514bfd7f8b5a17778543642f7aeb36598d:

FileBeforeAfter
cli/run/no-envfile.test.ts1 pass / 8 fail9 pass / 0 fail / 36 assertions
cli/run/env.test.ts64 pass / 15 fail76 pass / 3 fail / 89 assertions; 2 skips, 2 TODOs excluded
config/bunfig/preload.test.ts6 pass / 12 fail18 pass / 0 fail / 52 assertions, 2 snapshots; 2 skips, 1 TODO excluded
cli/console-depth.test.ts3 pass / 6 fail9 pass / 0 fail / 25 assertions, 9 snapshots
cli/install/bun-run.test.ts258 pass / 33 fail259 pass / 32 fail / 381 assertions

These comparisons resolve 39 failing test names with no new failing names. The remaining env failures predate this change and now have their own parser follow-up, #510. Remaining broader CLI failures stay in #508.

All 49 regression commands pass, including all 23 native files, full spawn (126 pass / 5,484 assertions; 5 skips excluded) and full child-process (32 pass / 72 assertions; 1 skip and 1 TODO excluded). Expanded package/eval controls also pass with VM destruction enabled: relative cwd, explicit env files, bunfig/CLI precedence, preload execution count, trailing argv, loaders, and ESM/CommonJS condition handling. The parent binary fails the new configuration controls. The original 1,000-iteration spawn workload is unchanged; owned unreferenced descendants are cleaned only after the tested parent exits.

Native build and cached rebuild: 17/17 steps. Focused Pickier, Zig formatting and whitespace checks pass. Five measured corpus files plus 33 preload fixtures match pin 4982b91e3702094330f3be3883354c52b8c01323 byte-for-byte. Final binary SHA256: 90c7f2e869f968a186eafbe0142e893d41e8630c641df77610a98d3d94f661c0.

Evidence: zig-out/cli-context-{baseline,build1,comparison,final-regressions,destruction,corpus-integrity,final-binary}.json, adjacent comparisons, and cli-context-wide-comparison.json. This is Darwin verification on the published branch, not main/platform integration or complete suite parity. Keeping #506 open for integration/platform verification; #66 remains unfinished.

9 days ago

The parser follow-up #510 is published in 7592a69bf4d268c5e50796e72ef86c8470026733. The complete unchanged env file has improved from the context checkpoint's 76 pass / 3 fail to 79 pass / 0 fail / 89 assertions (2 skips and 2 TODOs excluded). The no-env-file, preload and console-depth checks remain green in the final 54-command regression set. Broader stream/unit work is tracked in #512; this does not complete integration, platform verification or #66.

9 days ago

Closing as implemented and integrated on current origin/main 373f561f9. The implementation commits bfdb5f318 and parser follow-up 7592a69bf are ancestors of main. The unchanged current cli/run/no-envfile.test.ts was revalidated under HOME_NATIVE_VM=1: 9 pass / 0 fail / 36 assertions. The later complete env result remains 79 pass / 0 fail / 89 assertions, with the two upstream skips and two TODOs excluded from pass credit. Broader platform and full-suite parity remain tracked in #66.

Sign in to comment on this issue.