Skip to content

fix(v8): expose diagnostics and serialization surface#3428

Merged
proggeramlug merged 15 commits into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-v8-diagnostics-serialization
May 31, 2026
Merged

fix(v8): expose diagnostics and serialization surface#3428
proggeramlug merged 15 commits into
PerryTS:mainfrom
andrewtdiz:codex/node-compat-v8-diagnostics-serialization

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

Summary

  • Add the node:v8 namespace with serialize/deserialize, diagnostic heap/code/space statistic shapes, and cached-data version tag support.
  • Expose Serializer, DefaultSerializer, Deserializer, and DefaultDeserializer constructor/method surfaces through manifest, lowering, codegen, and runtime dispatch.
  • Extend the shared V8 structured-clone wire codec to round-trip Map and Set values, reusing it for top-level node:v8 APIs and class-based serialization.
  • Add a Node parity fixture covering namespace shape, stats shape, round trips, invalid inputs, and class method reads/calls.

Closes #3137. Closes #3138. Closes #3294.

Batching rationale

These three issues share the same node:v8 public namespace, native module registration path, runtime dispatch table, manifest entries, and V8 wire codec. Splitting them would duplicate the namespace and constructor plumbing while leaving the parity fixture artificially fragmented.

Tests

  • PATH=/home/github-runner/actions-runner/externals/node24/bin:$PATH ./run_parity_tests.sh --suite node-suite --module v8/diagnostics-serialization --filter first-slice
  • PATH=/home/github-runner/actions-runner/externals/node24/bin:$PATH ./run_parity_tests.sh --suite node-suite --module v8
  • RUSTC_WRAPPER= cargo check -p perry-runtime -p perry-hir -p perry-codegen -p perry-api-manifest -p perry
  • RUSTC_WRAPPER= cargo test -p perry-api-manifest
  • cargo fmt --all -- --check
  • git diff --check
  • ./scripts/check_file_size.sh
  • jq empty test-parity/known_failures.json

Known limitations / non-goals

  • Heap/code/space statistics are Perry-specific numeric values with Node-compatible shapes, not V8 heap telemetry.
  • Serializer primitive stream methods such as writeUint32/readUint32 are minimal surface implementations.
  • This does not implement promiseHooks, startup snapshots, heap snapshots, or CPU/heap profiling APIs tracked by adjacent node:v8 issues.

@andrewtdiz
Copy link
Copy Markdown
Contributor Author

Updated this branch for the latest mainline changes.

  • Merged origin/main and resolved the expr_new constructor conflict by keeping both the v8 Serializer/Deserializer lowering and main's worker_threads MessageChannel/BroadcastChannel lowering.
  • Added the shared cargo-test disk-pressure mitigation and the RegExpEscape stable-hash tag fix.
  • Regenerated API manifest docs after the merge.
  • Local checks passed: CARGO_TARGET_DIR=/root/perry/target cargo test -p perry-hir stable_hash::tests::expr_variant_stable_hash_tags_are_unique, cargo fmt --all -- --check, git diff --check HEAD~4..HEAD, git diff --check, scripts/check_file_size.sh, and workflow YAML parsing.

@andrewtdiz
Copy link
Copy Markdown
Contributor Author

Refreshed this branch again after mainline moved.

  • Merged the latest origin/main through bb1ab64.
  • Regenerated the API manifest docs for the combined branch when the generated docs conflicted.
  • Fixed the new stable-hash collision by moving ReflectIsExtensible to tag 12048.
  • Local checks passed after the final merge: CARGO_TARGET_DIR=/root/perry/target cargo test -p perry-hir stable_hash::tests::expr_variant_stable_hash_tags_are_unique, cargo fmt --all -- --check, git diff --check HEAD~3..HEAD, git diff --check, scripts/check_file_size.sh, and workflow YAML parsing.

# Conflicts:
#	docs/api/perry.d.ts
#	docs/src/api/reference.md
@andrewtdiz
Copy link
Copy Markdown
Contributor Author

Refreshed this branch for the latest mainline changes.

  • Merged current origin/main, including the util/sys manifest mirror fix that was failing cargo-test.
  • Resolved generated API doc conflicts by regenerating the manifest docs.
  • Kept the ReflectIsExtensible stable-hash tag correction required while current mainline still has the duplicate tag.
  • Local checks passed: CARGO_TARGET_DIR=/root/perry/target cargo test -p perry-api-manifest sys_alias_mirrors_util_manifest, CARGO_TARGET_DIR=/root/perry/target cargo test -p perry-hir stable_hash::tests::expr_variant_stable_hash_tags_are_unique, cargo fmt --all -- --check, git diff --check against the branch merge-base, git diff --check, scripts/check_file_size.sh, and workflow YAML parsing.

@andrewtdiz
Copy link
Copy Markdown
Contributor Author

Fixed the cargo-test manifest consistency failure on this branch.

  • Merged current origin/main, including the official stable-hash collision fix.
  • Added API manifest method rows for the v8 constructor dispatch entries while keeping the class exports.
  • Regenerated the API manifest docs.
  • Local checks passed: CARGO_TARGET_DIR=/root/perry/target cargo test -p perry-codegen --test manifest_consistency, CARGO_TARGET_DIR=/root/perry/target cargo test -p perry-hir stable_hash::tests::expr_variant_stable_hash_tags_are_unique, cargo fmt --all -- --check, git diff --check, and scripts/check_file_size.sh.

Ralph Küpper added 4 commits May 31, 2026 11:14
# Conflicts:
#	crates/perry-api-manifest/src/entries.rs
#	crates/perry-hir/src/destructuring/var_decl.rs
#	crates/perry-hir/src/lower/expr_member.rs
#	crates/perry-hir/src/lower/module_decl.rs
#	crates/perry-runtime/src/object/native_module.rs
#	docs/api/perry.d.ts
#	docs/src/api/reference.md
# Conflicts:
#	docs/api/perry.d.ts
#	docs/src/api/reference.md
@proggeramlug proggeramlug merged commit d2e6ab1 into PerryTS:main May 31, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node:v8: expose Serializer and Deserializer class APIs node:v8: expose heap statistics shape node:v8: expose serialize and deserialize round trips

2 participants