ReviewOS

home-lang/home

Port mock.module live re-export bindings from Bun corpus

#124
Closed chris opened this 10 days ago ·
10 days ago

Scope

Port the byte-identical Bun corpus slice under js/bun/test/mock/6879:

  • 6879.test.ts
  • first.ts
  • second.ts
  • third.ts

This extends #122 from resolved/cached sibling modules to the ESM semantic requirement that existing imported bindings remain live when mock.module replaces a dependency.

Baseline

The exact file is currently converted into one native todo:

  • 0 pass
  • 0 fail
  • 0 unsupported
  • 1 todo

Acceptance

  • Preserve byte identity with the upstream Bun files.
  • Run both original tests as real tests with no native todo.
  • Model live named imports/re-exports rather than snapshotting destructured values.
  • Add a permanent shared-runtime regression.
  • Pass the exact file and the full home_test gate.
  • Commit and push as Chris Breuer with no coauthors.
  • Link the completed work back to #66.
10 days ago

Implemented and pushed in efdb8bb.

All four mock/6879 files remain byte-identical to the upstream Bun corpus. Home now keeps a stable namespace per resolved module and forwards every property read to the current module value, while mock.module replacement invalidates the lazy factory cache. The original first/second/third TypeScript graph is represented directly, including the re-export getter, and live imported reads observe the replacement instead of a destructured snapshot.

Validation:

  • exact 6879.test.ts: 2 pass, 0 fail, 0 todo, 0 unsupported
  • permanent regression runs the unchanged upstream file and asserts both original tests
  • zig formatting and diff checks pass
  • full home_test gate passes with no failures

The commit is authored and committed as Chris Breuer with no coauthors. This extends #122 and advances #66.

Sign in to comment on this issue.