Fix WebSocket handler service requirements - #6664
Conversation
🦋 Changeset detectedLatest commit: eb38642 The changes in this PR will be included in the next version bump. This PR includes changesets to release 28 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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesWebSocket handler environment
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
Comment |
Type
Description
Socket.fromWebSocketprovides the activeSocket.WebSocketservice while message handlers run, but its returnedSockettype previously left that service in each handler effect's external requirements.This change returns a refined
Socket.WebSocketSocketfromSocket.fromWebSocketandSocket.makeWebSocket. Itsrun,runString, andrunRawmethods exclude the internally provided WebSocket service while preserving every unrelated handler requirement. The baseSocketandSocket.makecontracts remain unchanged for implementations that do not provide this service.Runtime coverage verifies that handlers receive the exact acquired WebSocket for text and binary messages and that interruption still releases it. Type tests cover both WebSocket constructors, all three handler methods, generic handler effects, unrelated requirements, and custom sockets.
Validation
corepack pnpm checkcorepack pnpm test-types Socket.tst.tscorepack pnpm --filter effect test --run test/unstable/socket/Socket.test.tscorepack pnpm --filter @effect/platform-node test --run test/NodeSocket.test.ts -t "messages"corepack pnpm --filter @effect/platform-node test --run test/NodeSocket.test.ts -t "close codes are errors by default"corepack pnpm jsdocscorepack pnpm exec oxlint -f unixcorepack pnpm exec dprint checkRelated
Summary by CodeRabbit