Respect zero Node socket open timeouts - #7243
Conversation
🦋 Changeset detectedLatest commit: b6d2619 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
There was a problem hiding this comment.
Pull request overview
Fixes Node NodeSocket.fromDuplex open-timeout handling so that openTimeout: 0 is treated as an explicitly configured timeout (rather than being ignored due to falsy-check logic), aligning behavior with the Deno socket implementation and preventing indefinitely-suspended acquisitions.
Changes:
- Treat
openTimeoutas configured whenever it is notundefined(so0is respected). - Add a regression test asserting
openTimeout: 0fails withSocketOpenErrorof kindTimeout. - Add a changeset for a patch release of
@effect/platform-node-shared.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/platform/node-shared/src/NodeSocket.ts | Fixes the open-timeout guard to respect zero-duration values by checking !== undefined. |
| packages/platform/node/test/NodeSocket.test.ts | Adds a regression test ensuring openTimeout: 0 triggers a SocketOpenError(Timeout) rather than hanging. |
| .changeset/zero-node-socket-timeout.md | Declares a patch changeset documenting the behavior fix. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
What
NodeSocket.fromDuplexignoredopenTimeout: 0, so an acquisition that never completed remained suspended instead of immediately failing with a socket open timeout.Fix
Treat the timeout as configured whenever it is not
undefined. This preserves zero-duration inputs and matches the handling used by the sibling Deno socket implementation.Tests
SocketOpenErrorwith theTimeoutkind.pnpm lint-fixpnpm test --run packages/platform/node/test/NodeSocket.test.tspnpm check