Skip to content

fix(node): tighten EventEmitter core semantics#4424

Merged
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-events-emitter-semantics-20260604
Jun 4, 2026
Merged

fix(node): tighten EventEmitter core semantics#4424
proggeramlug merged 1 commit into
PerryTS:mainfrom
andrewtdiz:codex/node-events-emitter-semantics-20260604

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

Closes #4417.

Summary

  • Decode EventEmitter event names from raw JS value bits in perry-ext-events, including symbol-backed names and coerced names on the same instance-method path.
  • Deliver full variadic emit() args with the correct this, resolve events.once() with the emitted args array, and route captureRejections listener promise failures to error.
  • Treat small native EventEmitter handles as terminal in instanceof before probing stream objects, avoiding heap-object dereferences for raw handle payloads.

Validation

  • cargo fmt --check
  • cargo check -p perry-ext-events -p perry-runtime
  • cargo test -p perry-ext-events
  • cargo build -p perry-ext-events --release
  • cargo build -p perry-runtime --release
  • git diff --check
  • ./scripts/check_file_size.sh
  • jq empty test-parity/known_failures.json
  • Direct Node oracle runs for selected fixtures: events/emitter/emit-multiple-args.ts, event-names-symbols.ts, instanceof.ts, capture-rejections.ts, events/imports/default-import.ts, named-imports.ts
  • Direct Perry runs with branch-local optimized runtime/stdlib and branch libperry_ext_events.a: selected fixture output matches Node; event-names-symbols, instanceof, capture-rejections, default-import, and named-imports exit 0; emit-multiple-args prints matching output but remains alive until the 8s timeout.

@proggeramlug proggeramlug merged commit e03a68b into PerryTS:main Jun 4, 2026
13 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:events: EventEmitter import shape and emitter semantics parity tail

2 participants