test: expand Node VM parity coverage#6473
Conversation
📝 WalkthroughWalkthroughExpanded Node ChangesNode VM parity
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test-parity/node_suite_baseline.json`:
- Around line 210-211: Update the top-level overall baseline metrics in
node_suite_baseline.json to include the vm increases: add 3 passes and 31 total
tests to the existing overall counts, then recalculate the overall percentage
from the resulting values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a47e2d4e-78b6-4bf1-850f-ca5fa731e0ef
📒 Files selected for processing (34)
test-parity/node-suite/vm/README.mdtest-parity/node-suite/vm/api/descriptors.tstest-parity/node-suite/vm/api/exports-and-constants.tstest-parity/node-suite/vm/compile-function/arguments-and-receiver.tstest-parity/node-suite/vm/compile-function/context-extensions.tstest-parity/node-suite/vm/compile-function/validation.tstest-parity/node-suite/vm/context/code-generation-strings.tstest-parity/node-suite/vm/context/create-context-array.tstest-parity/node-suite/vm/context/create-context-shapes.tstest-parity/node-suite/vm/context/dont-contextify.tstest-parity/node-suite/vm/context/microtask-mode.tstest-parity/node-suite/vm/context/options-validation.tstest-parity/node-suite/vm/cross-context/builtin-identity.tstest-parity/node-suite/vm/cross-context/descriptors.tstest-parity/node-suite/vm/cross-context/promises.tstest-parity/node-suite/vm/cross-context/structured-values.tstest-parity/node-suite/vm/execution/context-lexicals.tstest-parity/node-suite/vm/execution/create-script-alias.tstest-parity/node-suite/vm/execution/function-receiver.tstest-parity/node-suite/vm/execution/run-in-context-mutations.tstest-parity/node-suite/vm/execution/run-in-new-isolation.tstest-parity/node-suite/vm/execution/run-in-this-bindings.tstest-parity/node-suite/vm/execution/script-run-methods.tstest-parity/node-suite/vm/modules/constructor-validation.tstest-parity/node-suite/vm/modules/context-and-namespace.tstest-parity/node-suite/vm/modules/lifecycle.tstest-parity/node-suite/vm/script/constructor-validation.tstest-parity/node-suite/vm/script/display-errors.tstest-parity/node-suite/vm/script/error-metadata.tstest-parity/node-suite/vm/script/run-options-validation.tstest-parity/node-suite/vm/validation/code-and-options.tstest-parity/node-suite/vm/validation/create-context.tstest-parity/node-suite/vm/validation/is-context.tstest-parity/node_suite_baseline.json
💤 Files with no reviewable changes (1)
- test-parity/node-suite/vm/modules/lifecycle.ts
…arity # Conflicts: # test-parity/node_suite_baseline.json
Summary
node:vmsuite from 8 to 64 fixturescompileFunction, cross-context values, and gated VM modulesUpstream basis
Reviewed against:
bebd1b8d92bf4cc917844d6335ed1ecf9c2a75fb):test/parallel/test-vm-*, VM ES-module tests, sequential VM tests, anddoc/api/vm.mdc99e6904d8e297712ba859a64bbe848532d8f90f):tests/unit_node/vm_test.ts,tests/specs/node/vm_*, andext/node/polyfills/vm.js0ecd508247c7e99477717389a6cad44552cac023): custom VM tests, the vendored Node VM selection, andsrc/js/node/vm.tsEach added contract was first checked on exact Node 26.5.0. The follow-up batches were repeated three times with identical output. The upstream
compileFunction().toString()contract was also confirmed locally with Deno 2.9.2 and Bun 1.2.18.Diagnostic results
The focused granular harness completes all 64 cases with no compile failures, crashes, timeouts, or skips:
The independent baseline runner reports 21/64 passes and 43 diffs. The runner normalizes outputs differently from the focused shell harness; the committed floor uses only its measured result.
Stable mismatches expose:
definePropertyforwardingcompileFunction()extensions, arguments, receiver, syntax classification, source representation, and option validationcontext/code-generation-strings.tsandcontext/run-new-code-generation.tsare isolated as deliberate runtime-generatedeval/new FunctionAOT exclusions. Direct static-source context, Script, andcompileFunctionmismatches remain genuine claimed-surface gaps.Verification
Exclusions and stopping evidence
The suite stops before dynamic import callbacks/loaders, network imports, inspector/debug breaks, signals, timeout races and infinite loops, escaped-promise timeout cases, WebAssembly code-generation execution, exact memory/cache bytes, GC/weakref/leak/stress cases, and engine-specific raw stack/message formatting. Context name/origin acceptance and validation are covered; their inspector-facing effects remain with inspector integration work.
A Node/Bun-derived Proxy-backed sandbox probe passes Node 26.5.0 but makes Perry exit with
SIGSEGV; it is excluded from this deterministic print-and-diff suite and belongs in separate runtime crash coverage. Node 26.5.0 also aborts on the invalidcompileFunction('', ['a-b'])parameter-name probe on the tested macOS build, so that unsafe oracle case is excluded while surrounding type validation remains covered.Summary by CodeRabbit
vmexecution modes,Script/compileFunctionbehavior, cross-context value handling (including promises/structured values), and descriptor/export/introspection details.DONT_CONTEXTIFY, cached-data and code-generation controls.