test: expand worker_threads parity coverage#6450
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR expands ChangesWorker Threads Parity
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 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.
🧹 Nitpick comments (2)
test-parity/node-suite/worker_threads/environment-data/worker-snapshot.ts (1)
1-2: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsolidate imports from
node:worker_threads.The imports from
node:worker_threadscan 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 valueSimplify with optional chaining.
Instead of checking the
typeofproperty with anifblock—which may not narrow the base object types in TypeScript and could cause "Object is possibly 'undefined'" errors depending on yourtsconfig—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
📒 Files selected for processing (39)
test-parity/node-suite/worker_threads/README.mdtest-parity/node-suite/worker_threads/broadcast-channel/close-and-ref-idempotence.tstest-parity/node-suite/worker_threads/broadcast-channel/constructor-and-name.tstest-parity/node-suite/worker_threads/broadcast-channel/listener-once.tstest-parity/node-suite/worker_threads/direct-message/validation.tstest-parity/node-suite/worker_threads/environment-data/value-identity.tstest-parity/node-suite/worker_threads/environment-data/worker-snapshot-worker.cjstest-parity/node-suite/worker_threads/environment-data/worker-snapshot.tstest-parity/node-suite/worker_threads/main-thread/export-surface.tstest-parity/node-suite/worker_threads/main-thread/prototype-surface.tstest-parity/node-suite/worker_threads/message-channel/constructor-options.tstest-parity/node-suite/worker_threads/message-port/clone-error-rollback.tstest-parity/node-suite/worker_threads/message-port/duplicate-transfer.tstest-parity/node-suite/worker_threads/message-port/listener-removal-once.tstest-parity/node-suite/worker_threads/message-port/messageevent-constructor.tstest-parity/node-suite/worker_threads/message-port/method-receivers.tstest-parity/node-suite/worker_threads/message-port/onmessage-replacement.tstest-parity/node-suite/worker_threads/message-port/self-and-closed-transfer.tstest-parity/node-suite/worker_threads/transfer-markers/uncloneable-port-transfer.tstest-parity/node-suite/worker_threads/web-locks/web-locks-callback-settlement.tstest-parity/node-suite/worker_threads/web-locks/web-locks-independent-names.tstest-parity/node-suite/worker_threads/worker-lifecycle/argv-options.tstest-parity/node-suite/worker_threads/worker-lifecycle/argv-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/env-options.tstest-parity/node-suite/worker_threads/worker-lifecycle/env-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/eventemitter-listeners.tstest-parity/node-suite/worker_threads/worker-lifecycle/eventemitter-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/method-receivers.tstest-parity/node-suite/worker_threads/worker-lifecycle/postmessage-errors-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/postmessage-errors.tstest-parity/node-suite/worker_threads/worker-lifecycle/share-env-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/share-env.tstest-parity/node-suite/worker_threads/worker-lifecycle/terminate-idempotent.tstest-parity/node-suite/worker_threads/worker-lifecycle/thread-metadata-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/thread-metadata.tstest-parity/node-suite/worker_threads/worker-lifecycle/unsupported-paths.tstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-shared-array-buffer-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-shared-array-buffer.tstest-parity/node_suite_baseline.json
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/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
📒 Files selected for processing (41)
test-parity/node-suite/worker_threads/README.mdtest-parity/node-suite/worker_threads/environment-data/builtin-snapshot-worker.cjstest-parity/node-suite/worker_threads/environment-data/builtin-snapshot.tstest-parity/node-suite/worker_threads/environment-data/environment-clean-worker.cjstest-parity/node-suite/worker_threads/environment-data/nested-inheritance-worker.cjstest-parity/node-suite/worker_threads/environment-data/nested-inheritance.tstest-parity/node-suite/worker_threads/environment-data/nested-leaf-worker.cjstest-parity/node-suite/worker_threads/environment-data/uncloneable-construction.tstest-parity/node-suite/worker_threads/environment-data/worker-snapshot.tstest-parity/node-suite/worker_threads/message-port/close-dispatch-flush.tstest-parity/node-suite/worker_threads/message-port/listener-validation.tstest-parity/node-suite/worker_threads/message-port/messageevent-iterables.tstest-parity/node-suite/worker_threads/message-port/node-event-target-surface.tstest-parity/node-suite/worker_threads/message-port/transfer-iterables.tstest-parity/node-suite/worker_threads/transfer-markers/marker-privacy.tstest-parity/node-suite/worker_threads/worker-lifecycle/captured-output-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/captured-output.tstest-parity/node-suite/worker_threads/worker-lifecycle/eval-basic.tstest-parity/node-suite/worker_threads/worker-lifecycle/eval-error.tstest-parity/node-suite/worker_threads/worker-lifecycle/execargv-options.tstest-parity/node-suite/worker_threads/worker-lifecycle/execargv-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/exit-code-explicit.tstest-parity/node-suite/worker_threads/worker-lifecycle/exit-code-property.tstest-parity/node-suite/worker_threads/worker-lifecycle/exit-codes-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/file-url-unicode.tstest-parity/node-suite/worker_threads/worker-lifecycle/listener-validation.tstest-parity/node-suite/worker_threads/worker-lifecycle/multiple-worker-ids.tstest-parity/node-suite/worker_threads/worker-lifecycle/parent-port-onmessage-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/parent-port-onmessage.tstest-parity/node-suite/worker_threads/worker-lifecycle/parent-port-ref-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/parent-port-ref.tstest-parity/node-suite/worker_threads/worker-lifecycle/postmessage-shared-array-buffer-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/postmessage-shared-array-buffer.tstest-parity/node-suite/worker_threads/worker-lifecycle/process-unsupported-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/process-unsupported.tstest-parity/node-suite/worker_threads/worker-lifecycle/queued-port-receive-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/queued-port-receive.tstest-parity/node-suite/worker_threads/worker-lifecycle/unreferenced-arraybuffer-transfer.tstest-parity/node-suite/worker_threads/worker-lifecycle/url-π-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/worker-eventemitter-surface.tstest-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
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/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
📒 Files selected for processing (19)
test-parity/node-suite/worker_threads/README.mdtest-parity/node-suite/worker_threads/direct-message/handler-error-worker.cjstest-parity/node-suite/worker_threads/direct-message/handler-error.tstest-parity/node-suite/worker_threads/environment-data/uncloneable-construction.tstest-parity/node-suite/worker_threads/main-thread/process-worker-event.tstest-parity/node-suite/worker_threads/message-port/close-callback-order.tstest-parity/node-suite/worker_threads/message-port/listener-first-registration.tstest-parity/node-suite/worker_threads/message-port/listener-scope.tstest-parity/node-suite/worker_threads/message-port/off-pending-once.tstest-parity/node-suite/worker_threads/message-port/tampered-listener-registry.tstest-parity/node-suite/worker_threads/message-port/transfer-target.tstest-parity/node-suite/worker_threads/worker-lifecycle/eval-stack-getter-error.tstest-parity/node-suite/worker_threads/worker-lifecycle/eval-unserializable-error.tstest-parity/node-suite/worker_threads/worker-lifecycle/post-exit-safe-methods.tstest-parity/node-suite/worker_threads/worker-lifecycle/share-env-sibling-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/share-env-siblings.tstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-surface-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-surface.tstest-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
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test-parity/node-suite/worker_threads/worker-lifecycle/global-postmessage-override.ts (1)
3-4: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid 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 anENOENTerror 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
📒 Files selected for processing (60)
test-parity/node-suite/worker_threads/README.mdtest-parity/node-suite/worker_threads/broadcast-channel/constructor-coercion-edges.tstest-parity/node-suite/worker_threads/broadcast-channel/error-precedence.tstest-parity/node-suite/worker_threads/broadcast-channel/method-receivers.tstest-parity/node-suite/worker_threads/broadcast-channel/onmessage-replacement.tstest-parity/node-suite/worker_threads/broadcast-channel/post-message-missing.tstest-parity/node-suite/worker_threads/direct-message/handler-error-worker.cjstest-parity/node-suite/worker_threads/direct-message/handler-error.tstest-parity/node-suite/worker_threads/environment-data/uncloneable-construction.tstest-parity/node-suite/worker_threads/main-thread/process-worker-event-late-emit.tstest-parity/node-suite/worker_threads/main-thread/process-worker-event.tstest-parity/node-suite/worker_threads/message-channel/globals.tstest-parity/node-suite/worker_threads/message-channel/move-closed-validation.tstest-parity/node-suite/worker_threads/message-port/close-callback-order.tstest-parity/node-suite/worker_threads/message-port/custom-event-emit.tstest-parity/node-suite/worker_threads/message-port/frozen-eventtarget-prototype.tstest-parity/node-suite/worker_threads/message-port/listener-first-registration.tstest-parity/node-suite/worker_threads/message-port/listener-scope.tstest-parity/node-suite/worker_threads/message-port/max-listeners-remove-all.tstest-parity/node-suite/worker_threads/message-port/messageevent-defaults-coercion.tstest-parity/node-suite/worker_threads/message-port/off-pending-once.tstest-parity/node-suite/worker_threads/message-port/once-registry-after-fire.tstest-parity/node-suite/worker_threads/message-port/onmessage-nonfunction.tstest-parity/node-suite/worker_threads/message-port/post-message-missing.tstest-parity/node-suite/worker_threads/message-port/post-message-validation.tstest-parity/node-suite/worker_threads/message-port/ref-after-peer-close.tstest-parity/node-suite/worker_threads/message-port/tampered-listener-registry.tstest-parity/node-suite/worker_threads/message-port/transfer-during-close-flush.tstest-parity/node-suite/worker_threads/message-port/transfer-iterator-error.tstest-parity/node-suite/worker_threads/message-port/transfer-iterator-shapes.tstest-parity/node-suite/worker_threads/message-port/transfer-optional-forms.tstest-parity/node-suite/worker_threads/message-port/transfer-target.tstest-parity/node-suite/worker_threads/structured-clone/detached-retransfer.tstest-parity/node-suite/worker_threads/structured-clone/multiple-shared-arraybuffers.tstest-parity/node-suite/worker_threads/structured-clone/url-rejection.tstest-parity/node-suite/worker_threads/worker-lifecycle/eval-stack-getter-error.tstest-parity/node-suite/worker_threads/worker-lifecycle/eval-syntax-error.tstest-parity/node-suite/worker_threads/worker-lifecycle/eval-unserializable-error.tstest-parity/node-suite/worker_threads/worker-lifecycle/execargv-options.tstest-parity/node-suite/worker_threads/worker-lifecycle/exit-listener-error.tstest-parity/node-suite/worker_threads/worker-lifecycle/global-postmessage-override.tstest-parity/node-suite/worker_threads/worker-lifecycle/global-postmessage-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/inheritance-brands-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/inheritance-brands.tstest-parity/node-suite/worker_threads/worker-lifecycle/node-options-env-validation.tstest-parity/node-suite/worker_threads/worker-lifecycle/post-exit-safe-methods.tstest-parity/node-suite/worker_threads/worker-lifecycle/postmessage-missing.tstest-parity/node-suite/worker_threads/worker-lifecycle/postmessage-url-rejection.tstest-parity/node-suite/worker_threads/worker-lifecycle/share-env-indexed-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/share-env-indexed.tstest-parity/node-suite/worker_threads/worker-lifecycle/share-env-sibling-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/share-env-siblings.tstest-parity/node-suite/worker_threads/worker-lifecycle/unsupported-paths.tstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-alias-view-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-alias-view.tstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-cycle-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-cycle.tstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-surface-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-surface.tstest-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
There was a problem hiding this comment.
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
📒 Files selected for processing (11)
test-parity/node-suite/worker_threads/README.mdtest-parity/node-suite/worker_threads/environment-data/graph-snapshot-worker.cjstest-parity/node-suite/worker_threads/environment-data/graph-snapshot.tstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-multiple-ports-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-multiple-ports.tstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-alias-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-alias.tstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-container-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-map.tstest-parity/node-suite/worker_threads/worker-lifecycle/workerdata-port-set.tstest-parity/node_suite_baseline.json
|
@coderabbitai review |
✅ Action performedReview finished.
|
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/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
📒 Files selected for processing (41)
test-parity/node-suite/worker_threads/README.mdtest-parity/node-suite/worker_threads/message-channel/constructor-call-rules.tstest-parity/node-suite/worker_threads/message-channel/move-context-filehandle-error.tstest-parity/node-suite/worker_threads/message-port/closed-transfer-error-brand.tstest-parity/node-suite/worker_threads/message-port/distinct-listener-order.tstest-parity/node-suite/worker_threads/message-port/listeners-while-closing.tstest-parity/node-suite/worker_threads/message-port/on-listener-dedup.tstest-parity/node-suite/worker_threads/message-port/on-listener-event-scope.tstest-parity/node-suite/worker_threads/message-port/prototype-own-surface.tstest-parity/node-suite/worker_threads/message-port/queued-before-peer-close.tstest-parity/node-suite/worker_threads/message-port/receive-after-start.tstest-parity/node-suite/worker_threads/message-port/unread-transferred-port-close.tstest-parity/node-suite/worker_threads/message-port/unref-delivery.tstest-parity/node-suite/worker_threads/structured-clone/filehandle-transfer.tstest-parity/node-suite/worker_threads/worker-lifecycle/filehandle-construction-rollback.tstest-parity/node-suite/worker_threads/worker-lifecycle/filehandle-name-validation.tstest-parity/node-suite/worker_threads/worker-lifecycle/filehandle-orphan-rollback.tstest-parity/node-suite/worker_threads/worker-lifecycle/filehandle-orphan-transfer.tstest-parity/node-suite/worker_threads/worker-lifecycle/filehandle-workerdata-alias-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/filehandle-workerdata-alias.tstest-parity/node-suite/worker_threads/worker-lifecycle/filename-validation.tstest-parity/node-suite/worker_threads/worker-lifecycle/internal-thread-flag.tstest-parity/node-suite/worker_threads/worker-lifecycle/internal-thread-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/option-validation-precedence.tstest-parity/node-suite/worker_threads/worker-lifecycle/process-env-option-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/process-env-option.tstest-parity/node-suite/worker_threads/worker-lifecycle/process-unsupported-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/process-unsupported.tstest-parity/node-suite/worker_threads/worker-lifecycle/resource-limits-metadata-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/resource-limits-metadata.tstest-parity/node-suite/worker_threads/worker-lifecycle/share-env-founder-a-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/share-env-founder-b-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/share-env-founder.tstest-parity/node-suite/worker_threads/worker-lifecycle/share-env-tree-a-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/share-env-tree-b-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/share-env-tree-c-worker.cjstest-parity/node-suite/worker_threads/worker-lifecycle/share-env-tree.tstest-parity/node-suite/worker_threads/worker-lifecycle/thread-name-defaults.tstest-parity/node-suite/worker_threads/worker-lifecycle/unsupported-paths.tstest-parity/node-suite/worker_threads/worker-lifecycle/url-eval-validation.tstest-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
|
@coderabbitai review |
✅ Action performedReview finished.
|
…er-threads-parity # Conflicts: # test-parity/node_suite_baseline.json
Summary
Expand the granular
node:worker_threadsparity 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
Symbol.asyncDisposeisInternalThread, URL/eval and competing-option validation, ordered/unrefed port delivery, closed-transfer exception branding, moved-context FileHandlemessageerror, and orphaned FileHandle ownership/rollbackprocess.exit()cf882a79042c, Deno68d51a1fc8f3, and Bunaca54d5c2b87: 148 Nodetest-worker-*files, 48 Deno unit cases plus fixtures, and 82 Bunworker_threads/*.test.tsdeclarationsRelated issue
N/A — granular parity-suite expansion delegated from the ongoing Node compatibility audit.
Test plan
deno fmt --check/deno fmton the changed suite files and README — passedcargo fmt --all -- --check— passed./scripts/check_file_size.sh— passedgit diff --check— passedNODE_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 timeoutstest-parity/node-suite/globals/atomics-*.ts— 6/6 for the original expansionStable diagnostic differences
messageerror; transfer markers, BroadcastChannel MessageEvent metadata/custom inspection/cloning/validation, and Web Locks rejection cleanup expose additional stable gapsTwenty-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.emitworker 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
Summary by CodeRabbit
Tests
Documentation
Chores