Skip to content

Add Deno cluster socket support - #6728

Merged
tim-smart merged 1 commit into
mainfrom
agent/codex-engineer/6b5300e7
Jul 29, 2026
Merged

Add Deno cluster socket support#6728
tim-smart merged 1 commit into
mainfrom
agent/codex-engineer/6b5300e7

Conversation

@tim-smart

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

Copy link
Copy Markdown
Contributor

Summary

  • add native Deno client and server layers for Effect Cluster socket runners
  • compose storage, serialization, runner health, and Kubernetes HTTP layers without Node compatibility modules
  • mirror the Node cluster socket regression coverage under the Deno runtime
  • accept Deno's standards-compatible HeadersInit type in the shared fetch client

Validation

  • pnpm lint
  • pnpm check
  • pnpm --filter @effect/platform-deno check
  • deno run -A npm:vitest --run test/cluster/SocketRunner.test.ts

Closes EFF-155

Summary by CodeRabbit

  • New Features

    • Added native Deno socket support for Effect Cluster runners.
    • Added configurable client and server runner layers with local, SQL, or custom storage options.
    • Added NDJSON and MessagePack serialization choices.
    • Added optional Kubernetes-based runner health checks and HTTP client support.
    • Exported the new Deno Cluster Socket functionality publicly.
  • Bug Fixes

    • Improved request header handling for fetch-based HTTP requests.
    • Isolated serialization failures to the affected request without disrupting concurrent requests.

@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0bd061b

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

📝 Walkthrough

Walkthrough

Native Deno socket layers were added for Effect Cluster runners, including configurable transport, storage, health, serialization, and Kubernetes HTTP support. Public exports and live tests were added, while Fetch request header merging received a type-cast adjustment.

Changes

Deno Cluster Socket Integration

Layer / File(s) Summary
Socket transport primitives
packages/platform-deno/src/DenoClusterSocket.ts
Adds native Deno TCP client protocol and socket server layers using sharding runner addresses.
Cluster layer composition
packages/platform-deno/src/DenoClusterSocket.ts
Adds configurable client-only/server transport, storage, runner health, serialization, sharding configuration, and Kubernetes HTTP client layers.
Public API and runner validation
packages/platform-deno/src/index.ts, packages/platform-deno/test/cluster/SocketRunner.test.ts, .changeset/eff-155-deno-cluster-socket.md
Exports the new module, adds live tests for BigDecimal payloads and reply-failure isolation, and records a patch release.
Fetch header merge
packages/effect/src/unstable/http/FetchHttpClient.ts
Casts request options headers to Headers.Input during header merging.

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

Sequence Diagram(s)

sequenceDiagram
  participant ClientRunner
  participant DenoClusterSocket
  participant SocketServer
  participant EntityRunner
  ClientRunner->>DenoClusterSocket: create client-only cluster layer
  DenoClusterSocket->>SocketServer: connect through native TCP socket
  SocketServer->>EntityRunner: dispatch entity RPC
  EntityRunner-->>ClientRunner: return serialized reply
Loading

Possibly related PRs

🚥 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/src/DenoClusterSocket.ts (1)

170-194: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

CA-cert read failures are swallowed indiscriminately, masking real misconfiguration.

Effect.option treats any failure from fs.readFileString (permission errors, I/O errors, etc.) the same as "file not found," silently falling back to globalThis.fetch without the cluster CA. In a real permission-denied scenario this converts an actionable "can't read CA file" error into an opaque downstream TLS verification failure against the k8s API server, making misconfigurations harder to diagnose.

Consider narrowing the swallowed error to the "not found" case only, and letting other I/O errors propagate/die so misconfigurations surface clearly.

♻️ Sketch of a narrower catch
-          const caCertOption = yield* fs.readFileString("/var/run/secrets/kubernetes.io/serviceaccount/ca.crt").pipe(
-            Effect.option
-          )
+          const caCertOption = yield* fs.readFileString("/var/run/secrets/kubernetes.io/serviceaccount/ca.crt").pipe(
+            Effect.catchIf((e) => e.reason === "NotFound", () => Effect.succeed(undefined)),
+            Effect.map(Option.fromNullable)
+          )

Since this depends on the exact shape of PlatformError/SystemError exposed by effect/FileSystem, please confirm the correct discriminator (e.g. reason: "NotFound") before applying.

🤖 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/src/DenoClusterSocket.ts` around lines 170 - 194,
Update the CA-certificate read flow in the Fetch effect provided by
layerK8sHttpClient to fall back to globalThis.fetch only when fs.readFileString
reports the filesystem’s explicit not-found error discriminator (confirm the
PlatformError/SystemError shape, such as reason: "NotFound"). Let permission,
I/O, and other read failures propagate instead of converting them to
Option.none; preserve the existing certificate-backed client and resource
cleanup behavior.
🤖 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/src/DenoClusterSocket.ts`:
- Around line 170-194: Update the CA-certificate read flow in the Fetch effect
provided by layerK8sHttpClient to fall back to globalThis.fetch only when
fs.readFileString reports the filesystem’s explicit not-found error
discriminator (confirm the PlatformError/SystemError shape, such as reason:
"NotFound"). Let permission, I/O, and other read failures propagate instead of
converting them to Option.none; preserve the existing certificate-backed client
and resource cleanup behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8134a2f4-a714-43b1-90fe-30803a597ff8

📥 Commits

Reviewing files that changed from the base of the PR and between 955eb69 and 0bd061b.

📒 Files selected for processing (5)
  • .changeset/eff-155-deno-cluster-socket.md
  • packages/effect/src/unstable/http/FetchHttpClient.ts
  • packages/platform-deno/src/DenoClusterSocket.ts
  • packages/platform-deno/src/index.ts
  • packages/platform-deno/test/cluster/SocketRunner.test.ts

@tim-smart
tim-smart merged commit e0426da into main Jul 29, 2026
15 checks passed
@tim-smart
tim-smart deleted the agent/codex-engineer/6b5300e7 branch July 29, 2026 03:45
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