ReviewOS

home-lang/home

Native resolver: verify diagnostic and initialization parity across platforms

#525
Open chris opened this 9 days ago ·
9 days ago

Published Darwin checkpoint

Published 9b3a5c1ad on codex/runtime-port as Chris Breuer, sole author and committer, no coauthor trailers. Not merged to main.

#525 now uses canonical missing-module errors or typed resolver metadata. Runtime installer initialization validates the root directory before singleton allocation, returns and retains initialization failures, and propagates them through resolver/transpiler accessors. Native readable-file dispatch runs before cwd package scanning; custom loaders retain full preflight. The VM-side generic cwd/log reconstruction is removed.

Unchanged pinned suites:

  • tsconfig-override: 6 pass / 0 fail / 17 assertions, from published parent's 5/1.
  • resolver: 39 pass / 2 skips / 1 TODO / 0 failures / 59 assertions, from parent's 38 pass / 1 fail / 1 error; spawned file 9 passes / 1 TODO / 41 assertions. Pinned Bun matches. The unreadable-cwd test retains its original 5,000 ms deadline.
  • bun-run 291/291 / 416 assertions, native hard-link-PATH bunx 33 pass / 1 Windows-only skip / 0 fail / 161 assertions, workspaces 58/58 / 192 assertions, eval 33/33 / 70 assertions.

The expanded existing native registry fixture verifies actual 404s, native identity, CJS/ESM error codes and three repeated initialization failures for each implicit/explicit and absolute/relative entry scenario. Normal and VM-destruction/JSC-check runs pass; all four cwd controls and all 21 prior config controls match pinned Bun.

Build 17/17; units 1,820 pass / 19 skips / 0 failures (19/19 steps); regression commands 56/56, including 25 native files, full spawn and child-process. All 37 measured upstream source files match source pin 4982b91e3702094330f3be3883354c52b8c01323; regenerated tarball contents verified and pinned bytes restored. Declared resolver dependencies were installed with Home into an owned directory and linked without replacing existing empty corpus directories. No upstream assertion/workload/deadline changed. Scoped lint/format/whitespace pass.

Remaining failure: #526. EOF-delimited HTTP/1.0 registry 404s still trigger the pre-existing pending-task assertion after caught errors, including in this final candidate. Content-Length responses pass with both closing and persistent connections; pinned Bun handles the original EOF case. The assertion and failed evidence remain intact. Shared Darwin checkout only; unrelated compiler edits excluded. Other platforms, branch integration, skips/TODOs and full source ownership remain unverified. #66 is incomplete.

Evidence: zig-out/resolve-publication3.json, resolve-build3.{log,json}, resolve-build3-{binary,source-snapshot}.json, resolve-unit3.{log,json}, resolve-regression3s.json, resolve-wide-{parent-declared-deps,release-declared-deps,candidate3}.json, resolve-native-{candidate3,destruction}.json, resolve-cwd-{release-control,candidate3}.json, resolve-transport-matrix3.json, and resolve-source-integrity3.json. Earlier source-only diagnostics, missing dependency failures, startup timeout and inactive-union panic remain recorded.

Original diagnosis and scope

Follow-up to #66, #518 and #517. The unchanged cli/run/tsconfig-override.test.ts at Bun source pin 4982b91e3702094330f3be3883354c52b8c01323 exposes a native resolver diagnostic difference after registry auto-install returns 404.

The test should use custom tsconfig for path resolution first runs without the override and expects Cannot find module. Home instead reports GET https://registry.npmjs.org/@helpers%2fmath - 404 while resolving "@helpers/math". The assertion is unchanged and still fails.

Reproduced on Darwin with strict native execution:

RuntimePassingFailingAssertions
Published Home 3be72ca5b9a9bbc182ce746459f408ed295e48835114
#517 config candidate5114
Pinned Bun release 1.4.0-canary.1+4982b91e36017

This is pre-existing in the published installer checkpoint, not introduced by optional config scanning. One earlier candidate run happened to pass; repeated controlled runs retain the failure, so that isolated pass is not stable parity evidence.

Investigate VirtualMachine.resolveMaybeNeedsTrailingSlash: Home uses a generic installer error as resolver_detail, while the pinned Rust path selects resolve-metadata diagnostics and otherwise formats the canonical ResolveMessage. Preserve typed filesystem/cwd failures and useful installer diagnostics; do not weaken the upstream assertion or disable real automatic installation to pass it. Add deterministic local-registry 404 coverage, including error code/message and native process identity, then rerun the complete unchanged file.

Evidence: zig-out/config-wide-{parent,candidate1,release-control}-declared-deps.json. Source identity: config-additional-source-integrity.json. Full logs retain the mismatch. React 18.3.1 was installed by Home into a task-owned directory and linked at the unchanged corpus manifest's declared local dependency path for the adjacent eval suite; no upstream source was modified. Linux/Windows and full installer parity remain unverified. #66 is incomplete.

9 days ago

The 404 diagnostic fix is under native verification. Wider unchanged resolver coverage identified another prerequisite in the same path: Home's native package preflight lists cwd before its readable-file fast path, preventing JavaScript from catching the auto-install initialization error when cwd is execute-only.

The complete js/bun/resolve/resolve.test.ts reproduces the original 5,000 ms timeout in published Home; pinned Bun passes the unreadable-cwd case. Four additional pinned controls pass for implicit/explicit run and absolute/relative readable entry paths, returning the catchable directory error with ERR_MODULE_NOT_FOUND and empty stderr. The Home parent exits before the script starts. The original timeout and failure logs are retained.

The suite's initially missing reflect-metadata 0.2.2 and tsyringe 4.8.0 dependencies have now been installed with Home in a task-owned directory and linked without replacing the pre-existing empty corpus dependency directories. Pinned Bun's full resolver file then passes 39 tests / 2 skips / 1 TODO / 0 failures / 59 assertions, plus its spawned file 9 passes / 1 TODO / 41 assertions. No upstream assertions or deadlines changed. The directory fast-path correction and preservation of typed cwd errors will be verified alongside the 404 correction before publication.

Evidence: zig-out/resolve-wide-{parent,release-control,release-declared-deps}.json, resolve-cwd-release-control.json, resolve-404-release-control-esm.json, resolve-native-parent-esm.json, and resolve-dependencies.json. These are intermediate findings, not a completion claim.

9 days ago

The unreadable-cwd case exposed a second missing runtime initialization layer after the native readable-file preflight was moved earlier: the old Zig package-manager initializer allocates its singleton before checking whether the directory-cache entry is an error, then reads the inactive entries union field. The unchanged upstream test still failed under its original 5,000 ms deadline; the full native diagnostic retained the union-panic trace.

The candidate now ports the pinned Rust initialization contract: read/validate root before singleton allocation, return and retain initialization errors through the existing once wrapper, propagate them through resolver/transpiler accessors, and attach typed resolver metadata. The generic VM-side cwd reconstruction is removed. The native fixture repeats the caught initialization failure three times in each implicit/explicit and relative/absolute entry scenario. Build and execution verification are in progress; no success is claimed yet.

The independent connection-closing 404 pending-task assertion remains tracked in #526, with published-parent and candidate failures plus a passing pinned Bun control. No assertion has been removed.

9 days ago

Published 9b3a5c1ad on codex/runtime-port as Chris Breuer, sole author and committer, no coauthor trailers. Not merged to main.

#525 now uses canonical missing-module errors or typed resolver metadata. Runtime installer initialization validates the root directory before singleton allocation, returns and retains initialization failures, and propagates them through resolver/transpiler accessors. Native readable-file dispatch runs before cwd package scanning; custom loaders retain full preflight. The VM-side generic cwd/log reconstruction is removed.

Unchanged pinned suites:

  • tsconfig-override: 6 pass / 0 fail / 17 assertions, from published parent's 5/1.
  • resolver: 39 pass / 2 skips / 1 TODO / 0 failures / 59 assertions, from parent's 38 pass / 1 fail / 1 error; spawned file 9 passes / 1 TODO / 41 assertions. Pinned Bun matches. The unreadable-cwd test retains its original 5,000 ms deadline.
  • bun-run 291/291 / 416 assertions, native hard-link-PATH bunx 33 pass / 1 Windows-only skip / 0 fail / 161 assertions, workspaces 58/58 / 192 assertions, eval 33/33 / 70 assertions.

The expanded existing native registry fixture verifies actual 404s, native identity, CJS/ESM error codes and three repeated initialization failures for each implicit/explicit and absolute/relative entry scenario. Normal and VM-destruction/JSC-check runs pass; all four cwd controls and all 21 prior config controls match pinned Bun.

Build 17/17; units 1,820 pass / 19 skips / 0 failures (19/19 steps); regression commands 56/56, including 25 native files, full spawn and child-process. All 37 measured upstream source files match source pin 4982b91e3702094330f3be3883354c52b8c01323; regenerated tarball contents verified and pinned bytes restored. Declared resolver dependencies were installed with Home into an owned directory and linked without replacing existing empty corpus directories. No upstream assertion/workload/deadline changed. Scoped lint/format/whitespace pass.

Remaining failure: #526. EOF-delimited HTTP/1.0 registry 404s still trigger the pre-existing pending-task assertion after caught errors, including in this final candidate. Content-Length responses pass with both closing and persistent connections; pinned Bun handles the original EOF case. The assertion and failed evidence remain intact. Shared Darwin checkout only; unrelated compiler edits excluded. Other platforms, branch integration, skips/TODOs and full source ownership remain unverified. #66 is incomplete.

Evidence: zig-out/resolve-publication3.json, resolve-build3.{log,json}, resolve-build3-{binary,source-snapshot}.json, resolve-unit3.{log,json}, resolve-regression3s.json, resolve-wide-{parent-declared-deps,release-declared-deps,candidate3}.json, resolve-native-{candidate3,destruction}.json, resolve-cwd-{release-control,candidate3}.json, resolve-transport-matrix3.json, and resolve-source-integrity3.json. Earlier source-only diagnostics, missing dependency failures, startup timeout and inactive-union panic remain recorded.

9 days ago

Published 373f561f9 directly to origin/main as Chris Breuer, sole author and committer, with no coauthor trailers.

The native run package-script preflight and the VM resolver share Home's legacy process-global DirInfo cache. The preflight previously populated the cwd/ancestor chain with load_tsconfig_json = false; when a bare explicit target was not a package script and fell through to the VM, the VM reused those entries and could not discover baseUrl, paths, or inherited compiler options. The preflight now records complete tsconfig metadata before any possible VM handoff while retaining Bun's precedence: implicit paths-collision.ts runs the file, and explicit run paths-collision.ts runs the same-named package script.

Verification on the pushed candidate:

  • required ReleaseFast JSC build: 46/46 steps, bounded peak 14,344 MB under the 15,360 MB ceiling;
  • expanded Home-native package dispatch regression: passed, covering direct and explicit-run path aliases through a three-level extends chain plus the package-script collision;
  • unchanged upstream tsconfig-extends-leak.test.ts: Home 1 pass / 1 upstream debug-only skip / 0 fail / 3 assertions, exactly matching pinned Bun 4982b91e3702094330f3be3883354c52b8c01323;
  • complete unchanged js/bun/resolve directory under native Home: 269 pass / 4 upstream skips / 4 upstream TODOs / 0 fail / 70,684 assertions (previously 268 pass / 1 fail).

The pinned release cannot serve as a complete directory aggregate on this Home checkout because it aborts import-meta.test.js while loading this checkout's bun:internal-for-testing; the directly relevant unchanged file is the exact pinned control above. No upstream assertion, fixture, deadline, skip, TODO, or expected result changed. #66 remains incomplete.

Sign in to comment on this issue.