Deliver authority-bound WebSocket Main ingress #116
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "delivery/websocket-main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds generic persistent WebSocket transport with owner-scoped connections/listeners, Decision/Basic routing, socket-only Dispatcher events and bound real Main ingress via Core capability. Missing/revoked/uncertain Main adapters fail closed without chat fallback. Tests13/13 PASS. Core counterpart harness/core delivery/websocket-main.
Kakashi review — head
d7fa41e752c19f1b0a1b95481c60463f6d691e24, basef8ea0eb278519bf51fa97aa76c0e06ec45536b49review_clear
P2 [confirmed] F1: websocket/service.mjs:85-86: Remote socket closure neither aborts the controller nor marks the row closed, so a pending Decision can still dispatch work after disconnect; reconnecting clients can also send an old frame's delayed reply through the replacement socket.
websocket/service.mjs:84-86 handles socket closure only by conditionally deleting the connection map entry; it neither sets row.closed nor aborts row.controller. In contrast, explicit close does both at service.mjs:150. A pending gate decision can therefore finish after remote disconnect and pass the abort check before routing in websocket/ingress.mjs:53-58, including invoking Dispatcher at websocket/index.mjs:29-34. For reconnecting clients, service.mjs:35-38 replaces row.socket while retaining the same row, controller and ID. The send callback captured for an old frame (service.mjs:78) resolves the connection by that ID and uses its current socket (service.mjs:134-143), so a delayed reply can be sent through the replacement connection. packet.target_changes is empty, so no target-side change alters these paths.
P2 [confirmed] F2: websocket/service.mjs:83: Delivery failure only calls socket.close() and resolves the queue tail, so already-queued frames continue into route adapters after an earlier frame fails, potentially admitting additional Dispatcher work on a failed connection.
websocket/service.mjs:70-83 chains received frames through row.tail, but its catch handler only calls socket.close(1011, 'Event delivery failed'); it consumes the rejection without setting row.closed or aborting row.controller. Consequently, the next queued callback can pass the row.closed/this.stopped guard at service.mjs:71 and invoke ingress processing at service.mjs:76-80. Even if the socket close event has already occurred, service.mjs:84-86 only removes the map entry, leaving these guards unchanged. The subsequent frame can therefore reach a route adapter, including binding.dispatch at websocket/index.mjs:29-34, after the earlier delivery failed; removal from the connection map prevents sends but does not prevent dispatch admission. packet.target_changes is empty, so the merged-result code retains this behavior.