ReviewOS

home-lang/home

Runtime: implement real JSC realm isolation for pragmatic node:vm

#454
Open chris opened this 10 days ago ·
10 days ago

Parent tracker: #66.

The strict Home full VM passes the unchanged core querystring fixture. The pragmatic JSC realm path still throws ENOSYS from vm.runInNewContext, and createContext currently only returns its argument.

Reproduction after 828809d: HOME_NATIVE_RUN=1 with a process.execPath guard confirming home-debug fails when requiring packages/runtime/test/bun-corpus/js/node/test/parallel/test-querystring.js at its foreign-realm object case. HOME_NATIVE_VM=1 runs that exact fixture successfully. Five other exact Buffer/querystring fixtures and direct core/edge assertions pass in the pragmatic realm.

Acceptance:

  • Implement real separate JSC realms and contextified globals with managed realm/value lifetimes; do not substitute same-realm eval.
  • Implement the relevant createContext/runInContext/runInNewContext/Script APIs on that foundation.
  • Prove distinct intrinsics/prototypes, no cross-context global leakage, context reuse, cleanup, and returned/thrown value behavior.
  • Run the unchanged core querystring fixture under guarded pragmatic Home execution, then expand exact upstream node:vm coverage.
  • Keep #66 linked and updated with native evidence.
10 days ago

Fresh Debug evidence from the unmodified upstream js/node/vm/vm-sourceUrl.test.ts:\n\n- 1 pass, 2 fail\n- both failures report generated column 28 where Bun expects 24\n\nThe reduced corpus currently contains source-specific rewriteVmSourceUrlCorpus handling. Adjusting that heuristic or shifting the snapshot by four columns would be a workaround, so I left it untouched. These failures should be closed by the real realm/source-origin implementation tracked here.

Sign in to comment on this issue.