Add Deno cluster socket support - #6728
Conversation
🦋 Changeset detectedLatest commit: 0bd061b The changes in this PR will be included in the next version bump. This PR includes changesets to release 29 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 |
📝 WalkthroughWalkthroughNative 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. ChangesDeno Cluster Socket Integration
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
Possibly related PRs
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Comment |
Bundle Size Analysis
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/platform-deno/src/DenoClusterSocket.ts (1)
170-194: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winCA-cert read failures are swallowed indiscriminately, masking real misconfiguration.
Effect.optiontreats any failure fromfs.readFileString(permission errors, I/O errors, etc.) the same as "file not found," silently falling back toglobalThis.fetchwithout 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/SystemErrorexposed byeffect/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
📒 Files selected for processing (5)
.changeset/eff-155-deno-cluster-socket.mdpackages/effect/src/unstable/http/FetchHttpClient.tspackages/platform-deno/src/DenoClusterSocket.tspackages/platform-deno/src/index.tspackages/platform-deno/test/cluster/SocketRunner.test.ts
Summary
HeadersInittype in the shared fetch clientValidation
pnpm lintpnpm checkpnpm --filter @effect/platform-deno checkdeno run -A npm:vitest --run test/cluster/SocketRunner.test.tsCloses EFF-155
Summary by CodeRabbit
New Features
Bug Fixes