Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/multi-packet-and-streaming-responses-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,18 @@ not hang.
| Error Handling | A WireframeError::Protocol error yielded from a stream correctly triggers the handle_error protocol callback without terminating the connection. | An integration test confirms that a protocol-level error is correctly formatted and sent to the client, while the connection remains open. |

<!-- markdownlint-enable MD013 -->

## 9. Design Decisions
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated

- Multi-packet channels are driven inside the existing connection actor
`select!` loop rather than by a detached task. This keeps a single locus for
back-pressure, aligns with the production resilience guidance on avoiding
orphaned tasks, and ensures orderly shutdown propagates to streaming work.
- The actor captures the request's `correlation_id` before iterating the
channel and stamps it onto every serialised frame. This preserves protocol
invariants without requiring handlers to mutate frames post-creation and
mirrors the message attribution strategy outlined in the capability roadmap.
- When the receiver reports closure, the actor emits the configured
end-of-stream marker via the normal send path and then triggers the protocol
lifecycle hooks. This guarantees downstream clean-up and observability cues
stay consistent with other stream completions.
Comment thread
leynos marked this conversation as resolved.
19 changes: 19 additions & 0 deletions docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,30 @@ stream.

- [ ] Modify the `Connection` actor: upon receiving `Response::MultiPacket`,
it should consume messages from the receiver and send each one as a `Frame`.
- [ ] Extend the outbound `select!` loop to own the receiver so
multi-packet responses share the same back-pressure and shutdown handling
as other frame sources.
- [ ] Convert each received `Message` into a `Frame` via the existing
serialization helpers rather than bypassing protocol hooks or metrics.
Comment thread
leynos marked this conversation as resolved.
- [ ] Emit tracing and metrics for each forwarded frame so streaming
traffic remains visible to observability pipelines.

- [ ] Each sent frame must carry the correct `correlation_id` from the
initial request.
- [ ] Capture the originating request's `correlation_id` before handing
control to the multi-packet dispatcher.
- [ ] Stamp the stored `correlation_id` onto every frame emitted from the
channel before it is queued for transmission.
- [ ] Guard against accidental omission by asserting in debug builds and
covering the behaviour with targeted tests.

- [ ] When the channel closes, send the end-of-stream marker frame.
- [ ] Detect channel closure (`None` from `recv`) and log the termination
reason for operational insight.
- [ ] Send the designated end-of-stream marker frame through the same
send path, reusing the request's `correlation_id`.
- [ ] Notify protocol lifecycle hooks so higher layers can tidy any
per-request state when a stream drains naturally.

- [ ] **Ergonomics & API:**

Expand Down
Loading