feat(I204/P3): child-side streamFrame routing → server-stream handler #2
No reviewers
Labels
No labels
Kind/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
h-dv/ixt-sdk-go!2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/i204-p3-go-streamframe-routing"
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?
Mission I204 / P3 (#182) — wires the Go child IPC loop to receive server-streams from the runtime. Pairs with the runtime side (ixt P0–P1.5:
streamFrame @9IPC type + Process relay + demuxing IPC).ixt-public117319c→a1ee954(addsstreamFrame @9toIpcEnvelope.MessageType);sync-schemas.shregeneratessdk/ipc/ipc.capnp.go(idempotent).serialization.go:MessageTypeStreamFrame = 9(+ String/Parse/capnp maps). Also fixed a latent preexisting bug —kvChangeNotificationwas missing from the capnp↔Go MessageType maps (inbound kvChange envelopes mis-mapped toHandle).module.go:connWriteMu(serializes main-loop responses with concurrent stream-handler writes), per-child stream tablemap[string]*StreamHandle, opt-inServerStreamHandler(mirrorsKvChangeHandler),sendRaw()funnel; read loop gains astreamFramecase (continue, no unary reply).stream_dispatch.go(new):ServerStreamHandler { OnServerStream(*StreamHandle) error };handleStreamFramedecodes via the I203DecodeStreamFramecodec → Open →AcceptStream(decodes embeddedInvocationContext) → register + spawn handler goroutine; Data/Credit →Feed; Close/Cancel/Error →Feed+ drop. Open with no handler → terminalErrStreamingUnsupported(no hang). OutboundstreamFrameSinkmirrors frames asstreamFrameenvelopes (samerequestId).Callee/server-stream ONLY — no module-initiated open. Reuses the I203
streaming.gowire codec + types.Test plan
go build ./...+go test ./...green — 32 (+2): echo server-stream overnet.Pipe(Open→3 ordered Data→mirrored echo→clean Close + table cleanup) + no-handler rejectiongo test -race ./...clean (handler goroutine + main loop share the conn)go vet+gofmtclean;sync-schemas.shidempotentLockstep: superproject pin bumps after merge. (Other SDKs stay at
117319c— they don't participate in I204 Process streaming; the additivestreamFrame @9is harmless to them.)🤖 Generated with Claude Code
Wire the Go module child IPC read-loop to receive server-streams over IPC (callee-side only). The runtime delivers a server-stream as streamFrame envelopes (IpcEnvelope.messageType == streamFrame @9, requestId == StreamId, payload == ipc_streaming.capnp StreamFrame); the module mirrors reply frames back the same way. serialization.go: - add MessageTypeStreamFrame = 9 (+ String / ParseMessageType / to/fromCapnpMessageType). Also fill in the previously-missing kvChangeNotification cases in to/fromCapnpMessageType (inbound kvChange envelopes were silently mapped to Handle). module.go: - ModuleRunner gains a connWriteMu (serialises main-loop responses with concurrent stream-handler writes), a per-child stream table (map[StreamID.String()]*StreamHandle guarded by streamsMu), and an optional streamHandler wired via the ServerStreamHandler opt-in (mirrors the KvChangeHandler pattern). - new sendRaw() funnels every conn write through connWriteMu; sendResponse and SendServiceRequest now use it. - read loop gains a streamFrame case that routes to handleStreamFrame and continues (NOT request/response, so no unary reply). stream_dispatch.go (new): - ServerStreamHandler interface: OnServerStream(*StreamHandle) error. - streamFrameSink: FrameSink that wraps encoded StreamFrames in a streamFrame envelope with requestId == stream id and writes via sendRaw. - handleStreamFrame decodes the frame (reusing the I203 DecodeStreamFrame codec) and routes: Open -> AcceptStream + register + spawn handler; Data/Credit -> handle.Feed (ordered, single read loop); terminal (Close/Cancel/Error) -> Feed + drop table entry. Open with no registered handler is rejected with a terminal StreamingUnsupported error so callers do not hang. stream_dispatch_test.go (new): drives the child loop over a net.Pipe without the real runtime — echo server-stream (Open -> 3 ordered Data -> mirrored Data in order -> Close -> mirrored clean Close + table cleanup), plus a no-handler rejection test. Race-clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>