Skip to content

test: expand worker_threads parity coverage#6450

Open
TheHypnoo wants to merge 25 commits into
mainfrom
test/expand-node-worker-threads-parity
Open

test: expand worker_threads parity coverage#6450
TheHypnoo wants to merge 25 commits into
mainfrom
test/expand-node-worker-threads-parity

Conversation

@TheHypnoo

@TheHypnoo TheHypnoo commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

Expand the granular node:worker_threads parity suite from 17 to 205 cases. The 188 additions cover namespace/prototype surface, environment data, structured clone and transfer semantics, MessageChannel/MessagePort, Worker construction/data/lifecycle, transfer markers, direct messaging, BroadcastChannel, and deterministic Web Locks.

Changes

  • add controlled fixtures for ArrayBuffer detachment/retransfer, typed-array backing identity, MessagePort transfer ownership, clone rollback, MessageEvent defaults/validation, and frozen EventTarget prototype resilience
  • broaden Worker coverage for workerData built-ins and object graphs, transferred ports, SharedArrayBuffers, constructor/options, argv/execArgv/env/SHARE_ENV, lifecycle ordering, error routing, termination, stdio, process restrictions, and Symbol.asyncDispose
  • broaden MessagePort and BroadcastChannel lifecycle, receiver, listener, ref/unref, close, ordering, iterable transfer, coercion, custom inspection, queued-close suppression, and dispatch-time channel creation
  • add direct-message ArrayBuffer/MessagePort graph transfer with observable detachment and remote ownership
  • add construction rollback, default environment isolation, normalized file/eval argv shape, synchronous-drain event suppression, and VM-context cross-realm branding
  • add invalid Worker filename types, MessagePort/MessageChannel call rules, same-reference listener deduplication, receive-after-start, queued/orphaned peer-close behavior, exact Event brands, explicit process.env, and resource-limit metadata/reset
  • add controlled FileHandle clone/transfer ownership, construction rollback, workerData alias identity, default/falsy thread names, and the complete worker-disabled process surface; de-duplicate path and filename validation
  • add listener safety while MessagePorts close and deterministic SHARE_ENV spawning-tree isolation/founder contracts without nested-message scheduling
  • add worker-side isInternalThread, URL/eval and competing-option validation, ordered/unrefed port delivery, closed-transfer exception branding, moved-context FileHandle messageerror, and orphaned FileHandle ownership/rollback
  • add reverse worker-created buffer and MessagePort lifetime, process.env descriptors, post-exit diagnostics, CPU-usage validation, BroadcastChannel MessageEvent metadata, Map/Set-nested FileHandles, and the hard boundary after worker process.exit()
  • refresh the primary-source inventory against Node cf882a79042c, Deno 68d51a1fc8f3, and Bun aca54d5c2b87: 148 Node test-worker-* files, 48 Deno unit cases plus fixtures, and 82 Bun worker_threads/*.test.ts declarations
  • ratchet the measured worker_threads floor from 17/17 to 38/205 and recompute aggregate baseline metadata directly from module floors
  • document concrete exclusions for scheduler/resource/loader/GC categories and candidates that are not valid Node-oracle diagnostics

Related issue

N/A — granular parity-suite expansion delegated from the ongoing Node compatibility audit.

Test plan

  • direct Node 26.5.0, Perry, Deno 2.9.2, and Bun 1.2.18 execution of the latest eight additions plus the strengthened workerData case: 27/27 stable repeated runs per runtime
  • all latest retained cases completed without an external comparison timeout; Bun 1.2.18 emitted its stable expected not-implemented warning for Worker performance
  • deno fmt --check / deno fmt on the changed suite files and README — passed
  • cargo fmt --all -- --check — passed
  • ./scripts/check_file_size.sh — passed
  • git diff --check — passed
  • baseline JSON and module-floor aggregate invariant — 2822/3051 (92.5%) exactly equals the committed module sum
  • NODE_BIN=<node-26.5.0> PERRY_RUNTIME_DIR="$PWD/target/perry-dev" python3 scripts/node_suite_run.py "$PWD/target/perry-dev/perry" "$PWD" worker_threads — 38/205 (18.5%), 167 stable diffs, 0 compile failures, 0 timeouts
  • differential loop over test-parity/node-suite/globals/atomics-*.ts — 6/6 for the original expansion

Stable diagnostic differences

  • namespace/prototype completeness and process-level worker-event scheduling/late emit lookup differ
  • environment data differs for built-in cloning, nested inheritance, worker snapshot isolation, and rejection of non-cloneable state
  • structured clone differs for ArrayBuffer/typed-array and built-in brands, cycles/aliases, SharedArrayBuffer, multiple views, detachment/retransfer, transfer rollback, invalid entries, and FileHandle clone/transfer ownership
  • MessagePort differs in NodeEventTarget/custom-inspection surface, listener deduplication/counting/removal, listener aliases after closure, exact Event brands, max-listener controls, custom-event bridging, non-function handlers, pending synchronous receive, ordered/unrefed delivery, queued/orphaned peer close, closed-transfer DOMException branding, iterable transfer/error propagation, MessageEvent semantics, dispatch-time close flushing, transfer ownership/state validation, overload validation, and ref tracking
  • Worker differs for reverse-created buffer/port lifetime, process.env descriptors, post-exit diagnostics, Map/Set FileHandle traversal, worker process.exit isolation, async disposal, filename/constructor rollback/validation, default environment isolation, file/eval argv shape, resource-limit reset, clone/transfer validation, FileHandle rollback/aliasing, default/falsy thread names, eval/error routing, execArgv, SHARE_ENV spawning-tree isolation, worker-side internal-thread state, URL/eval and competing-option validation, FileHandle orphan/name ownership, global postMessage replacement, workerData graphs/ports/SharedArrayBuffer, metadata, handlers/ref state, the complete disabled process surface, stdio, repeated termination, and ordered error/exit handling
  • direct messaging resolves but Perry neither transfers/detaches the ArrayBuffer nor delivers the transferred MessagePort payload
  • VM-context moved ports retain the main-realm MessagePort brand in Perry and deliver transferred FileHandles as plain objects instead of emitting messageerror; transfer markers, BroadcastChannel MessageEvent metadata/custom inspection/cloning/validation, and Web Locks rejection cleanup expose additional stable gaps

Twenty-one additions pass. CPU-usage argument validation is the latest passing contract. Explicit-env SHARE_ENV founder preservation is the latest passing contract; explicit process.env construction also passes. The latest refresh adds a passing receiveMessageOnPort contract proving synchronously drained data is not later emitted as an event. The prior refresh added passing BroadcastChannel contracts for creating a channel during dispatch and suppressing already queued delivery after close. Earlier passing additions cover basic eval, environment-data identity, MessagePort listener/transfer forms, Worker receiver/ref state, SHARE_ENV, BroadcastChannel fanout/listeners, deterministic termination, and deterministic Web Locks behavior.

Upstream coverage and exclusions

The original snapshots and refreshed current heads are linked in the suite README. Cases are mapped by observable contract rather than copied one-for-one.

Remaining separate slow/risky or runtime-feature categories are resource-limit enforcement (metadata/reset is covered), stdio backpressure/large-write timing, profiling and heap snapshots, data-URL/ESM/custom loaders and preload chains, signals/inspector/source maps, deep nesting stress, GC/finalization, FileHandle in-use/recycling races (referenced, orphaned, and Map/Set-nested ownership/rollback are covered), scheduler-sensitive termination races, cross-agent Atomics wait/notify, and in-flight/cross-agent Web Locks.

Rejected candidates are documented with evidence. A WebAssembly.Module worker-post probe matched Node 26.5.0, Deno 2.9.2, and Bun 1.2.18 but exceeded Perry's 120-second compile threshold. Bun's non-function process.emit worker recovery test was rejected because Node 26.5.0 exits fatally before establishing Bun's recovery contract. A controlled nested direct-message candidate completed in Node and Deno but timed out waiting for Perry nested-worker readiness. Using an original moved-from port crashed Node 26.5.0, and invalid-path transfer rollback was vacuous behind Perry's static target resolver. Bun peer-close-in-transit, Deno cross-worker unref liveness, and Bun prototype-tampering formulations were also excluded because missing Perry events leave no non-timing completion barrier. Earlier rejected cross-worker BroadcastChannel, live-cwd, and Blob-marker candidates lacked deterministic Perry cleanup or exceeded the granular compile threshold.

Checklist

  • Tests use controlled fixtures and explicit completion barriers
  • No arbitrary sleeps or timing-only assertions were added
  • Workers, ports, and channels are cleaned up deterministically
  • Focused suite, formatting, file-size, and baseline invariant checks pass
  • PR is ready for review

Summary by CodeRabbit

  • Tests

    • Expanded worker-thread parity coverage across messaging, structured cloning, transfers, broadcast channels, worker lifecycle, environment data, Web Locks, and direct messaging, including new ordering/validation scripts.
    • Updated measured focused results to 38/205 (diff 167).
  • Documentation

    • Refreshed parity documentation for contract-based case selection, reviewed coverage inventory, async fixture completion constraints, and updated intentional omissions.
  • Chores

    • Updated baseline/oracle metrics to overall: 2822/3051 and worker_threads floor: 38/205, keeping pinned Node 26.5.0 as the executable oracle.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR expands node:worker_threads parity coverage across messaging, structured cloning, transfer markers, Web Locks, environment data, worker lifecycle behavior, runtime surfaces, and direct messaging. It documents selection and completion boundaries and updates the Node 26.5.0 baseline to 38 passing cases out of 205.

Changes

Worker Threads Parity

Layer / File(s) Summary
Coverage documentation and baseline
test-parity/node-suite/worker_threads/README.md, test-parity/node_suite_baseline.json
Documents upstream selection, coverage boundaries, async completion rules, diagnostics, measurement commands, and updated 38/205 worker-thread baseline metrics.
Runtime surfaces, environment data, direct messaging, and Web Locks
test-parity/node-suite/worker_threads/main-thread/*, environment-data/*, direct-message/*, web-locks/*, message-channel/*
Adds probes for exports, prototypes, environment snapshots and inheritance, direct-message validation and transfers, channel construction and realm behavior, and Web Locks behavior.
Structured cloning and transfer markers
test-parity/node-suite/worker_threads/structured-clone/*, transfer-markers/*
Adds coverage for built-in types, cycles, aliases, buffers, shared memory, rollback, iterables, detached transfers, file handles, and clone/transfer markers.
MessagePort and BroadcastChannel behavior
test-parity/node-suite/worker_threads/message-port/*, broadcast-channel/*
Adds queue, listener, reference, close-ordering, transfer, constructor, fanout, cloning, handler, inspection, and closure cases.
Worker lifecycle and constructor behavior
test-parity/node-suite/worker_threads/worker-lifecycle/*
Adds fixtures for worker options, data cloning, environment sharing, lifecycle events, errors, termination, metadata, output capture, ports, shared memory, file handles, disposal, diagnostics, and post-exit methods.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

  • PerryTS/perry#5097: Updates worker-thread baseline metrics and related parity validation.
  • PerryTS/perry#5166: Updates shared node-suite baseline metadata and module floors.
  • PerryTS/perry#6367: Coordinates the pinned Node 26.5.0 oracle used by the parity documentation and baseline.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: expanding worker_threads parity coverage.
Description check ✅ Passed The description includes the required Summary, Changes, Related issue, Test plan, and Checklist sections, with substantial implementation and verification detail.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/expand-node-worker-threads-parity

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
test-parity/node-suite/worker_threads/environment-data/worker-snapshot.ts (1)

1-2: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consolidate imports from node:worker_threads.

The imports from node:worker_threads can be combined into a single statement for cleaner code.

♻️ Proposed refactor
-import { Worker } from "node:worker_threads";
-import { getEnvironmentData, setEnvironmentData } from "node:worker_threads";
+import { Worker, getEnvironmentData, setEnvironmentData } from "node:worker_threads";
🤖 Prompt for 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.

In `@test-parity/node-suite/worker_threads/environment-data/worker-snapshot.ts`
around lines 1 - 2, Consolidate the separate node:worker_threads imports in
worker-snapshot.ts into one import statement containing Worker,
getEnvironmentData, and setEnvironmentData.
test-parity/node-suite/worker_threads/transfer-markers/uncloneable-port-transfer.ts (1)

20-22: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Simplify with optional chaining.

Instead of checking the typeof property with an if block—which may not narrow the base object types in TypeScript and could cause "Object is possibly 'undefined'" errors depending on your tsconfig—you can safely execute the method directly using optional chaining.

♻️ Proposed refactor
-if (typeof packet?.message?.port?.postMessage === "function") {
-  packet.message.port.postMessage("through-transfer");
-}
+packet?.message?.port?.postMessage?.("through-transfer");
🤖 Prompt for 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.

In
`@test-parity/node-suite/worker_threads/transfer-markers/uncloneable-port-transfer.ts`
around lines 20 - 22, Replace the typeof guard around
packet.message.port.postMessage with optional-chaining invocation so the method
is called only when packet, message, port, and postMessage are available. Update
the transfer-marker logic without changing the "through-transfer" argument.
🤖 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.

Nitpick comments:
In `@test-parity/node-suite/worker_threads/environment-data/worker-snapshot.ts`:
- Around line 1-2: Consolidate the separate node:worker_threads imports in
worker-snapshot.ts into one import statement containing Worker,
getEnvironmentData, and setEnvironmentData.

In
`@test-parity/node-suite/worker_threads/transfer-markers/uncloneable-port-transfer.ts`:
- Around line 20-22: Replace the typeof guard around
packet.message.port.postMessage with optional-chaining invocation so the method
is called only when packet, message, port, and postMessage are available. Update
the transfer-marker logic without changing the "through-transfer" argument.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a7980f83-78f9-4513-a576-7b3470e6c052

📥 Commits

Reviewing files that changed from the base of the PR and between 1497eb5 and c8c7d60.

📒 Files selected for processing (39)
  • test-parity/node-suite/worker_threads/README.md
  • test-parity/node-suite/worker_threads/broadcast-channel/close-and-ref-idempotence.ts
  • test-parity/node-suite/worker_threads/broadcast-channel/constructor-and-name.ts
  • test-parity/node-suite/worker_threads/broadcast-channel/listener-once.ts
  • test-parity/node-suite/worker_threads/direct-message/validation.ts
  • test-parity/node-suite/worker_threads/environment-data/value-identity.ts
  • test-parity/node-suite/worker_threads/environment-data/worker-snapshot-worker.cjs
  • test-parity/node-suite/worker_threads/environment-data/worker-snapshot.ts
  • test-parity/node-suite/worker_threads/main-thread/export-surface.ts
  • test-parity/node-suite/worker_threads/main-thread/prototype-surface.ts
  • test-parity/node-suite/worker_threads/message-channel/constructor-options.ts
  • test-parity/node-suite/worker_threads/message-port/clone-error-rollback.ts
  • test-parity/node-suite/worker_threads/message-port/duplicate-transfer.ts
  • test-parity/node-suite/worker_threads/message-port/listener-removal-once.ts
  • test-parity/node-suite/worker_threads/message-port/messageevent-constructor.ts
  • test-parity/node-suite/worker_threads/message-port/method-receivers.ts
  • test-parity/node-suite/worker_threads/message-port/onmessage-replacement.ts
  • test-parity/node-suite/worker_threads/message-port/self-and-closed-transfer.ts
  • test-parity/node-suite/worker_threads/transfer-markers/uncloneable-port-transfer.ts
  • test-parity/node-suite/worker_threads/web-locks/web-locks-callback-settlement.ts
  • test-parity/node-suite/worker_threads/web-locks/web-locks-independent-names.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/argv-options.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/argv-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/env-options.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/env-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/eventemitter-listeners.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/eventemitter-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/method-receivers.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/postmessage-errors-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/postmessage-errors.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/terminate-idempotent.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/thread-metadata-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/thread-metadata.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/unsupported-paths.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-shared-array-buffer-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-shared-array-buffer.ts
  • test-parity/node_suite_baseline.json

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/worker_threads/environment-data/uncloneable-construction.ts`:
- Around line 5-11: Move the setEnvironmentData call inside the existing try
block so its synchronous DataCloneError is captured by the catch handler,
preserving the current logging behavior for both construction and setup
failures.
🪄 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: 8b0f4424-edc5-4024-91d4-087f749320a5

📥 Commits

Reviewing files that changed from the base of the PR and between c8c7d60 and b8f3209.

📒 Files selected for processing (41)
  • test-parity/node-suite/worker_threads/README.md
  • test-parity/node-suite/worker_threads/environment-data/builtin-snapshot-worker.cjs
  • test-parity/node-suite/worker_threads/environment-data/builtin-snapshot.ts
  • test-parity/node-suite/worker_threads/environment-data/environment-clean-worker.cjs
  • test-parity/node-suite/worker_threads/environment-data/nested-inheritance-worker.cjs
  • test-parity/node-suite/worker_threads/environment-data/nested-inheritance.ts
  • test-parity/node-suite/worker_threads/environment-data/nested-leaf-worker.cjs
  • test-parity/node-suite/worker_threads/environment-data/uncloneable-construction.ts
  • test-parity/node-suite/worker_threads/environment-data/worker-snapshot.ts
  • test-parity/node-suite/worker_threads/message-port/close-dispatch-flush.ts
  • test-parity/node-suite/worker_threads/message-port/listener-validation.ts
  • test-parity/node-suite/worker_threads/message-port/messageevent-iterables.ts
  • test-parity/node-suite/worker_threads/message-port/node-event-target-surface.ts
  • test-parity/node-suite/worker_threads/message-port/transfer-iterables.ts
  • test-parity/node-suite/worker_threads/transfer-markers/marker-privacy.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/captured-output-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/captured-output.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/eval-basic.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/eval-error.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/execargv-options.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/execargv-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/exit-code-explicit.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/exit-code-property.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/exit-codes-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/file-url-unicode.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/listener-validation.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/multiple-worker-ids.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/parent-port-onmessage-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/parent-port-onmessage.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/parent-port-ref-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/parent-port-ref.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/postmessage-shared-array-buffer-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/postmessage-shared-array-buffer.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/process-unsupported-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/process-unsupported.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/queued-port-receive-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/queued-port-receive.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/unreferenced-arraybuffer-transfer.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/url-π-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/worker-eventemitter-surface.ts
  • test-parity/node_suite_baseline.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • test-parity/node-suite/worker_threads/environment-data/worker-snapshot.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/worker_threads/message-port/tampered-listener-registry.ts`:
- Around line 39-55: Move the MessageChannel cleanup out of the successful try
path and into a finally block so port1 and port2 are always closed, including
when the registry checks throw after listener registration. Keep the existing
registry logging and catch behavior unchanged, and ensure the finally cleanup
safely closes both ports.
🪄 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: 3a32eae7-7010-44b6-9b2e-38b1334504cb

📥 Commits

Reviewing files that changed from the base of the PR and between b8f3209 and 430f48e.

📒 Files selected for processing (19)
  • test-parity/node-suite/worker_threads/README.md
  • test-parity/node-suite/worker_threads/direct-message/handler-error-worker.cjs
  • test-parity/node-suite/worker_threads/direct-message/handler-error.ts
  • test-parity/node-suite/worker_threads/environment-data/uncloneable-construction.ts
  • test-parity/node-suite/worker_threads/main-thread/process-worker-event.ts
  • test-parity/node-suite/worker_threads/message-port/close-callback-order.ts
  • test-parity/node-suite/worker_threads/message-port/listener-first-registration.ts
  • test-parity/node-suite/worker_threads/message-port/listener-scope.ts
  • test-parity/node-suite/worker_threads/message-port/off-pending-once.ts
  • test-parity/node-suite/worker_threads/message-port/tampered-listener-registry.ts
  • test-parity/node-suite/worker_threads/message-port/transfer-target.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/eval-stack-getter-error.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/eval-unserializable-error.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/post-exit-safe-methods.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-sibling-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-siblings.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-surface-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-surface.ts
  • test-parity/node_suite_baseline.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • test-parity/node-suite/worker_threads/environment-data/uncloneable-construction.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
test-parity/node-suite/worker_threads/worker-lifecycle/global-postmessage-override.ts (1)

3-4: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid mutating the working directory with hardcoded relative paths.

Using process.chdir() with a path relative to the repository root makes the test fragile. It will throw an ENOENT error if the script is executed from any other working directory (e.g., executing the test while already inside its directory). Resolving the worker script relative to the current module ensures robust resolution.

♻️ Proposed refactor
-process.chdir("test-parity/node-suite/worker_threads/worker-lifecycle");
-const worker = new Worker("./global-postmessage-worker.cjs");
+const worker = new Worker(new URL("./global-postmessage-worker.cjs", import.meta.url));
🤖 Prompt for 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.

In
`@test-parity/node-suite/worker_threads/worker-lifecycle/global-postmessage-override.ts`
around lines 3 - 4, Remove the process.chdir call and update the Worker
construction in the worker lifecycle test to resolve
global-postmessage-worker.cjs relative to the current module, preserving the
existing worker target without depending on the caller’s working directory.
🤖 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.

Nitpick comments:
In
`@test-parity/node-suite/worker_threads/worker-lifecycle/global-postmessage-override.ts`:
- Around line 3-4: Remove the process.chdir call and update the Worker
construction in the worker lifecycle test to resolve
global-postmessage-worker.cjs relative to the current module, preserving the
existing worker target without depending on the caller’s working directory.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d47295bd-59f1-4222-bbde-0e7179609d5d

📥 Commits

Reviewing files that changed from the base of the PR and between b8f3209 and 67a3da0.

📒 Files selected for processing (60)
  • test-parity/node-suite/worker_threads/README.md
  • test-parity/node-suite/worker_threads/broadcast-channel/constructor-coercion-edges.ts
  • test-parity/node-suite/worker_threads/broadcast-channel/error-precedence.ts
  • test-parity/node-suite/worker_threads/broadcast-channel/method-receivers.ts
  • test-parity/node-suite/worker_threads/broadcast-channel/onmessage-replacement.ts
  • test-parity/node-suite/worker_threads/broadcast-channel/post-message-missing.ts
  • test-parity/node-suite/worker_threads/direct-message/handler-error-worker.cjs
  • test-parity/node-suite/worker_threads/direct-message/handler-error.ts
  • test-parity/node-suite/worker_threads/environment-data/uncloneable-construction.ts
  • test-parity/node-suite/worker_threads/main-thread/process-worker-event-late-emit.ts
  • test-parity/node-suite/worker_threads/main-thread/process-worker-event.ts
  • test-parity/node-suite/worker_threads/message-channel/globals.ts
  • test-parity/node-suite/worker_threads/message-channel/move-closed-validation.ts
  • test-parity/node-suite/worker_threads/message-port/close-callback-order.ts
  • test-parity/node-suite/worker_threads/message-port/custom-event-emit.ts
  • test-parity/node-suite/worker_threads/message-port/frozen-eventtarget-prototype.ts
  • test-parity/node-suite/worker_threads/message-port/listener-first-registration.ts
  • test-parity/node-suite/worker_threads/message-port/listener-scope.ts
  • test-parity/node-suite/worker_threads/message-port/max-listeners-remove-all.ts
  • test-parity/node-suite/worker_threads/message-port/messageevent-defaults-coercion.ts
  • test-parity/node-suite/worker_threads/message-port/off-pending-once.ts
  • test-parity/node-suite/worker_threads/message-port/once-registry-after-fire.ts
  • test-parity/node-suite/worker_threads/message-port/onmessage-nonfunction.ts
  • test-parity/node-suite/worker_threads/message-port/post-message-missing.ts
  • test-parity/node-suite/worker_threads/message-port/post-message-validation.ts
  • test-parity/node-suite/worker_threads/message-port/ref-after-peer-close.ts
  • test-parity/node-suite/worker_threads/message-port/tampered-listener-registry.ts
  • test-parity/node-suite/worker_threads/message-port/transfer-during-close-flush.ts
  • test-parity/node-suite/worker_threads/message-port/transfer-iterator-error.ts
  • test-parity/node-suite/worker_threads/message-port/transfer-iterator-shapes.ts
  • test-parity/node-suite/worker_threads/message-port/transfer-optional-forms.ts
  • test-parity/node-suite/worker_threads/message-port/transfer-target.ts
  • test-parity/node-suite/worker_threads/structured-clone/detached-retransfer.ts
  • test-parity/node-suite/worker_threads/structured-clone/multiple-shared-arraybuffers.ts
  • test-parity/node-suite/worker_threads/structured-clone/url-rejection.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/eval-stack-getter-error.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/eval-syntax-error.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/eval-unserializable-error.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/execargv-options.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/exit-listener-error.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/global-postmessage-override.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/global-postmessage-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/inheritance-brands-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/inheritance-brands.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/node-options-env-validation.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/post-exit-safe-methods.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/postmessage-missing.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/postmessage-url-rejection.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-indexed-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-indexed.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-sibling-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-siblings.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/unsupported-paths.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-alias-view-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-alias-view.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-cycle-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-cycle.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-surface-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-surface.ts
  • test-parity/node_suite_baseline.json
🚧 Files skipped from review as they are similar to previous changes (19)
  • test-parity/node-suite/worker_threads/worker-lifecycle/eval-stack-getter-error.ts
  • test-parity/node-suite/worker_threads/main-thread/process-worker-event.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/eval-unserializable-error.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-sibling-worker.cjs
  • test-parity/node-suite/worker_threads/message-port/transfer-target.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/unsupported-paths.ts
  • test-parity/node-suite/worker_threads/message-port/off-pending-once.ts
  • test-parity/node-suite/worker_threads/environment-data/uncloneable-construction.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/post-exit-safe-methods.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-surface-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-surface.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/execargv-options.ts
  • test-parity/node-suite/worker_threads/message-port/listener-scope.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-siblings.ts
  • test-parity/node-suite/worker_threads/direct-message/handler-error.ts
  • test-parity/node-suite/worker_threads/message-port/tampered-listener-registry.ts
  • test-parity/node-suite/worker_threads/message-port/listener-first-registration.ts
  • test-parity/node-suite/worker_threads/message-port/close-callback-order.ts
  • test-parity/node-suite/worker_threads/message-port/post-message-validation.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 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/worker_threads/environment-data/graph-snapshot-worker.cjs`:
- Around line 7-11: Update the cycle field in the graph-snapshot worker’s
parentPort.postMessage payload to require graph to be defined before comparing
graph.self with graph. Preserve the existing alias, value, and cycle behavior
when graph is present, while reporting cycle as false when getEnvironmentData
returns undefined.

In
`@test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-multiple-ports-worker.cjs`:
- Around line 10-17: Ensure the worker lifecycle flow waits until both peer
ports have delivered their messages before signaling completion via
parentPort.postMessage. Add explicit acknowledgements or equivalent
synchronization around the first and second MessagePort messages, then publish
the result only after both are confirmed, preserving the existing branding and
distinctness fields.
🪄 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: 8f87b74f-be86-4a23-9271-8dfe6518c2f7

📥 Commits

Reviewing files that changed from the base of the PR and between 67a3da0 and 5217fb9.

📒 Files selected for processing (11)
  • test-parity/node-suite/worker_threads/README.md
  • test-parity/node-suite/worker_threads/environment-data/graph-snapshot-worker.cjs
  • test-parity/node-suite/worker_threads/environment-data/graph-snapshot.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-multiple-ports-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-multiple-ports.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-alias-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-alias.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-container-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-map.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-set.ts
  • test-parity/node_suite_baseline.json

@TheHypnoo

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/worker_threads/message-port/listeners-while-closing.ts`:
- Around line 25-29: Update the port1.close flow in the listeners-while-closing
test to register a "close" event listener for the validation logic instead of
passing a callback to port1.close(). Keep the existing exercise(port1),
exercise(port2), and port2.close() operations inside that listener, and invoke
port1.close() without arguments.
🪄 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: 01ca04bd-61fd-4ba5-9400-083add8a18b4

📥 Commits

Reviewing files that changed from the base of the PR and between 1301b19 and 42d4f53.

📒 Files selected for processing (41)
  • test-parity/node-suite/worker_threads/README.md
  • test-parity/node-suite/worker_threads/message-channel/constructor-call-rules.ts
  • test-parity/node-suite/worker_threads/message-channel/move-context-filehandle-error.ts
  • test-parity/node-suite/worker_threads/message-port/closed-transfer-error-brand.ts
  • test-parity/node-suite/worker_threads/message-port/distinct-listener-order.ts
  • test-parity/node-suite/worker_threads/message-port/listeners-while-closing.ts
  • test-parity/node-suite/worker_threads/message-port/on-listener-dedup.ts
  • test-parity/node-suite/worker_threads/message-port/on-listener-event-scope.ts
  • test-parity/node-suite/worker_threads/message-port/prototype-own-surface.ts
  • test-parity/node-suite/worker_threads/message-port/queued-before-peer-close.ts
  • test-parity/node-suite/worker_threads/message-port/receive-after-start.ts
  • test-parity/node-suite/worker_threads/message-port/unread-transferred-port-close.ts
  • test-parity/node-suite/worker_threads/message-port/unref-delivery.ts
  • test-parity/node-suite/worker_threads/structured-clone/filehandle-transfer.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/filehandle-construction-rollback.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/filehandle-name-validation.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/filehandle-orphan-rollback.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/filehandle-orphan-transfer.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/filehandle-workerdata-alias-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/filehandle-workerdata-alias.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/filename-validation.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/internal-thread-flag.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/internal-thread-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/option-validation-precedence.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/process-env-option-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/process-env-option.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/process-unsupported-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/process-unsupported.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/resource-limits-metadata-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/resource-limits-metadata.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-founder-a-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-founder-b-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-founder.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-tree-a-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-tree-b-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-tree-c-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/share-env-tree.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/thread-name-defaults.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/unsupported-paths.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/url-eval-validation.ts
  • test-parity/node_suite_baseline.json
🚧 Files skipped from review as they are similar to previous changes (8)
  • test-parity/node-suite/worker_threads/worker-lifecycle/resource-limits-metadata-worker.cjs
  • test-parity/node-suite/worker_threads/worker-lifecycle/process-env-option-worker.cjs
  • test-parity/node-suite/worker_threads/message-channel/constructor-call-rules.ts
  • test-parity/node-suite/worker_threads/message-port/on-listener-dedup.ts
  • test-parity/node-suite/worker_threads/message-port/prototype-own-surface.ts
  • test-parity/node-suite/worker_threads/worker-lifecycle/resource-limits-metadata.ts
  • test-parity/node-suite/worker_threads/message-port/queued-before-peer-close.ts
  • test-parity/node-suite/worker_threads/message-port/receive-after-start.ts

@TheHypnoo

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

…er-threads-parity

# Conflicts:
#	test-parity/node_suite_baseline.json
@proggeramlug proggeramlug added the ready PR triaged: CodeRabbit feedback + conflicts addressed label Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready PR triaged: CodeRabbit feedback + conflicts addressed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants