Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
26 changes: 21 additions & 5 deletions docs/adr-002-streaming-requests-and-shared-message-assembly.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,10 @@ Wireframe will make budget failures explicit and deterministic so protocol
implementers can rely on the behaviour across crates:

- **Soft budget pressure (back-pressure):** when inbound buffering approaches
the per-connection in-flight cap, Wireframe MUST stop reading further packets
from the socket until buffered bytes fall below the cap. For streaming bodies
backed by bounded queues, this naturally suspends the reader when the queue
is full.
the per-connection in-flight cap, Wireframe MUST pace further reads by
applying short per-iteration pauses before polling the next packet. For
streaming bodies backed by bounded queues, this naturally suspends the reader
when the queue is full.
- **Hard cap exceeded during assembly (pre-handler):** if accepting a fragment
or continuation packet would exceed the configured per-message or per-
connection cap, Wireframe MUST:
Expand Down Expand Up @@ -313,7 +313,23 @@ Precedence is:
routed through the existing `DeserFailureTracker` as `InvalidData`.
- Budget enforcement helpers are extracted to `src/message_assembler/budget.rs`
to keep `state.rs` under the 400-line file limit.
- Back-pressure (`8.3.3`) and derived defaults (`8.3.5`) remain future work.
- At this point, back-pressure (`8.3.3`) and derived defaults (`8.3.5`)
remained future work.

#### Implementation decisions (2026-02-23)

- Roadmap item `8.3.3` now implements soft-limit back-pressure in the inbound
read loop (`src/app/inbound_handler.rs`) by pausing briefly before polling
the next frame when buffered assembly bytes are under pressure.
- Soft pressure is computed from assembly-state buffered bytes versus the
smaller aggregate cap (`min(bytes_per_connection, bytes_in_flight)`), with a
threshold of 80% to engage pacing before hard-cap rejection.
- The soft-limit policy is implemented in
`src/app/frame_handling/backpressure.rs` to keep `inbound_handler.rs` and
`state.rs` within the repository file-size constraint.
- Under sustained pressure, pacing is applied as short per-iteration pauses
rather than an indefinite read stop, so in-flight assemblies can continue to
make progress.
Comment thread
coderabbitai[bot] marked this conversation as resolved.

#### Budget enforcement

Expand Down
Loading
Loading