Skip to content

node:worker_threads: worker and messaging parity cut #2507

Closed as not planned
Closed as not planned

Description

@andrewtdiz

Summary

Use this issue as the parent tracker for practical node:worker_threads compatibility work. Perry has some environment-data and synthetic parentPort support, plus main-thread shape rows for isMainThread, threadId, and resourceLimits, but the Node-compatible Worker, messaging, diagnostics, Web Locks, and advanced option surfaces still need focused implementation cuts.

Concrete PR Cuts

Child Issues

Intended PR Boundary

Implement worker_threads in coherent medium slices:

This keeps worker_threads as medium PRs while avoiding broad scheduler/runtime rewrites.

Node Behavior

Node's worker_threads module can spawn JavaScript workers, expose per-thread module state, exchange structured-clone messages through parentPort, route direct postMessageToThread messages, create in-process message channels, synchronously receive queued port messages, broadcast across same-name channels, mark values as non-transferable or non-cloneable, expose Worker stdio/diagnostic APIs, and manage experimental Web Locks.

Perry Behavior

docs/runtime-parity-gaps.md lists about 60 remaining node:worker_threads gaps. test-files/test_parity_worker_threads.ts mostly type-probes the missing surfaces, while test-parity/node-suite/worker_threads/environment-data/basic.ts now covers the implemented environment-data slice. crates/perry-stdlib/src/worker_threads.rs implements environment data, workerData from PERRY_WORKER_DATA, a synthetic parentPort, JSON-over-stdin/stdout parentPort.postMessage, and parentPort.on('message'|'close'). crates/perry-api-manifest/src/entries.rs exposes the implemented environment-data and main-thread shape rows plus generic postMessage wiring, but source search found no Node-compatible Worker constructor, MessageChannel/BroadcastChannel transport, direct thread messaging, Web Locks, diagnostics, or stdio option implementation.

Non-goals

  • Replacing Perry's perry/thread APIs or changing their public semantics.
  • Broad scheduler/runtime rewrites unrelated to Node-observable worker_threads behavior.
  • Treating Worker diagnostics, Web Locks, or stdio option support as required for the first Worker execution PR; those have separate child issues above.

Acceptance

Activity

  1. changed the title [-]node:worker_threads: implement Worker and message channel surfaces[/-] [+]node:worker_threads: worker and messaging parity cut[/+] on May 30, 2026
  2. proggeramlug commented on May 30, 2026

    @proggeramlug
    Contributor

    Closing this "parity cut" umbrella tracker as superseded by its granular child issues.

    Perry tracks Node/TypeScript parity gaps as granular, per-gap issues (the ones listed under Child Issues above) — that is the workable backlog the maintainer prefers, rather than umbrella roll-ups. Each child issue carries its own Node-vs-Perry evidence, source pointers, and test surface, and remains open and independently tracked; closing this umbrella loses no work, only the duplicate roll-up framing.

    The child issues continue to be addressed by focused PRs (each PR auto-closes the specific leaf issues it fixes). If a consolidated tracker is still wanted for this module, feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions