Skip to content

Add Deno socket server support - #6724

Merged
tim-smart merged 2 commits into
mainfrom
agent/claude-engineer/d08accde
Jul 29, 2026
Merged

Add Deno socket server support#6724
tim-smart merged 2 commits into
mainfrom
agent/claude-engineer/d08accde

Conversation

@tim-smart

@tim-smart tim-smart commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Closes EFF-149

Summary

  • add native Deno TCP, Unix, and TLS socket server constructors and layers
  • supervise connection handlers and apply resilient accept-loop backoff
  • cover TCP/Unix integration and accept-loop edge cases

Testing

  • nix develop -c deno task test --run packages/platform-deno/test/DenoSocketServer.test.ts
  • nix develop -c deno check .
  • nix develop -c pnpm check
  • nix develop -c pnpm lint

Summary by CodeRabbit

  • New Features

    • Added native Deno SocketServer support for TCP, Unix, and TLS.
    • Provided scoped server constructors and Layer helpers for easy application integration.
    • Added listen option types for non-TLS and TLS configurations.
  • Bug Fixes

    • Improved accept-loop resilience with normalized open/accept errors, capped exponential backoff, and backoff reset after success.
    • Ensured connections and server fibers shut down cleanly, including interruption semantics and safe scope teardown.
  • Tests

    • Added a Deno socket server test suite covering TCP/Unix echo, interruption, cleanup behavior, retry/backoff logic, and connection lifecycle.

@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8b5f86b

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 29 packages
Name Type
@effect/platform-deno Patch
effect Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/vitest Patch
@effect/ai-anthropic Patch
@effect/ai-openai-compat Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch
@effect/atom-react Patch
@effect/atom-solid Patch
@effect/atom-vue Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-pglite Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/docgen Patch
@effect/openapi-generator Patch

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

@effect-slopcop effect-slopcop Bot added 4.0 enhancement New feature or request labels Jul 29, 2026
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3736c4d5-c4f6-499d-8a61-a87d3c4c7b66

📥 Commits

Reviewing files that changed from the base of the PR and between fef5c57 and 8b5f86b.

📒 Files selected for processing (3)
  • packages/platform-deno/src/DenoSocketServer.ts
  • packages/platform-deno/src/internal/denoSocketServer.ts
  • packages/platform-deno/test/DenoSocketServer.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/platform-deno/src/DenoSocketServer.ts
  • packages/platform-deno/test/DenoSocketServer.test.ts
  • packages/platform-deno/src/internal/denoSocketServer.ts

📝 Walkthrough

Walkthrough

Adds native Deno TCP, Unix, and TLS SocketServer adapters with scoped listener cleanup, connection handling, retry backoff, public exports, tests, and a patch changeset.

Changes

Deno SocketServer adapters

Layer / File(s) Summary
Listener and connection lifecycle
packages/platform-deno/src/internal/denoSocketServer.ts
Wraps Deno listeners as SocketServer services, manages connection scopes and cleanup, handles teardown errors, logs failures, and retries accepts with capped backoff.
Public constructors and layers
packages/platform-deno/src/DenoSocketServer.ts, packages/platform-deno/src/index.ts
Adds TCP, Unix, and TLS constructors and layers, normalizes listener-open errors, and exports the new module.
Behavioral tests and release metadata
packages/platform-deno/test/DenoSocketServer.test.ts, .changeset/add-deno-socket-server.md
Tests echo behavior, interruption, cleanup, accept failures, logging, and backoff behavior, and adds a patch release entry.

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

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant DenoSocketServer
  participant DenoListener
  participant SocketHandler
  Client->>DenoSocketServer: start server
  DenoSocketServer->>DenoListener: listen TCP, Unix, or TLS
  DenoListener-->>DenoSocketServer: listener
  Client->>DenoListener: connect
  DenoSocketServer->>DenoListener: accept connection
  DenoSocketServer->>SocketHandler: run handler with connection
  SocketHandler-->>Client: echo response
  DenoSocketServer->>DenoListener: close resources on scope release
Loading
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 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.

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

@github-actions

Copy link
Copy Markdown
Contributor

Bundle Size Analysis

File Name Current Size Previous Size Difference
basic.ts 6.63 KB 6.63 KB 0.00 KB (0.00%)
batching.ts 9.42 KB 9.42 KB 0.00 KB (0.00%)
brand.ts 6.31 KB 6.31 KB 0.00 KB (0.00%)
cache.ts 10.12 KB 10.12 KB 0.00 KB (0.00%)
config.ts 19.90 KB 19.90 KB 0.00 KB (0.00%)
differ.ts 20.03 KB 20.03 KB 0.00 KB (0.00%)
http-client.ts 20.94 KB 20.94 KB 0.00 KB (0.00%)
logger.ts 10.28 KB 10.28 KB 0.00 KB (0.00%)
metric.ts 8.55 KB 8.55 KB 0.00 KB (0.00%)
optic.ts 7.46 KB 7.46 KB 0.00 KB (0.00%)
pubsub.ts 14.26 KB 14.26 KB 0.00 KB (0.00%)
queue.ts 11.09 KB 11.09 KB 0.00 KB (0.00%)
schedule.ts 10.27 KB 10.27 KB 0.00 KB (0.00%)
schema-class.ts 18.86 KB 18.86 KB 0.00 KB (0.00%)
schema-fromJsonSchemaDocument.ts 28.78 KB 28.78 KB 0.00 KB (0.00%)
schema-representation-roundtrip.ts 25.09 KB 25.09 KB 0.00 KB (0.00%)
schema-string-transformation.ts 12.95 KB 12.95 KB 0.00 KB (0.00%)
schema-string.ts 10.65 KB 10.65 KB 0.00 KB (0.00%)
schema-template-literal.ts 14.85 KB 14.85 KB 0.00 KB (0.00%)
schema-toArbitraryLazy.ts 21.66 KB 21.66 KB 0.00 KB (0.00%)
schema-toCodeDocument.ts 24.10 KB 24.10 KB 0.00 KB (0.00%)
schema-toCodecJson.ts 19.00 KB 19.00 KB 0.00 KB (0.00%)
schema-toEquivalence.ts 18.73 KB 18.73 KB 0.00 KB (0.00%)
schema-toFormatter.ts 18.59 KB 18.59 KB 0.00 KB (0.00%)
schema-toJsonSchemaDocument.ts 22.23 KB 22.23 KB 0.00 KB (0.00%)
schema-toRepresentation.ts 19.27 KB 19.27 KB 0.00 KB (0.00%)
schema.ts 18.12 KB 18.12 KB 0.00 KB (0.00%)
stm.ts 12.05 KB 12.05 KB 0.00 KB (0.00%)
stream.ts 9.37 KB 9.37 KB 0.00 KB (0.00%)

@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)
packages/platform-deno/test/DenoSocketServer.test.ts (1)

23-38: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for connection cleanup after a handler completes.

None of the tests assert that the underlying Deno.Conn is closed once the handler finishes. Given the cleanup path relies on Context.omit(Scope.Scope) plus an (unverified) implicit scope from Effect.runForkWith in denoSocketServer.ts, a test using makeTestConn that tracks whether close() was called after a successful run handler would directly validate that path.

🤖 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 `@packages/platform-deno/test/DenoSocketServer.test.ts` around lines 23 - 38,
The Deno socket tests lack coverage verifying connection cleanup after a handler
completes. Extend makeTestConn to track close() invocation, then add a test that
runs a successful handler through the socket server and asserts the underlying
Deno.Conn was closed after completion, covering the cleanup path involving
Context.omit(Scope.Scope) and Effect.runForkWith.
🤖 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 `@packages/platform-deno/test/DenoSocketServer.test.ts`:
- Around line 23-38: The Deno socket tests lack coverage verifying connection
cleanup after a handler completes. Extend makeTestConn to track close()
invocation, then add a test that runs a successful handler through the socket
server and asserts the underlying Deno.Conn was closed after completion,
covering the cleanup path involving Context.omit(Scope.Scope) and
Effect.runForkWith.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: cdbe3312-ede9-413f-989d-3fa31aec1c00

📥 Commits

Reviewing files that changed from the base of the PR and between 20b9660 and fef5c57.

📒 Files selected for processing (5)
  • .changeset/add-deno-socket-server.md
  • packages/platform-deno/src/DenoSocketServer.ts
  • packages/platform-deno/src/index.ts
  • packages/platform-deno/src/internal/denoSocketServer.ts
  • packages/platform-deno/test/DenoSocketServer.test.ts

Comment thread packages/platform-deno/src/DenoSocketServer.ts Outdated
@tim-smart
tim-smart merged commit 7870557 into main Jul 29, 2026
15 checks passed
@tim-smart
tim-smart deleted the agent/claude-engineer/d08accde branch July 29, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.0 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant