Keep a live stream responsive under a slow client
one move: bound in-flight work
Open the code pane immediately, then use the Spec tab, optional design question, tests, and artifact when you want them.
Finish each move before carrying the artifact forward.
Streaming systems need bounded buffers, cancellation, and backpressure; otherwise one slow consumer turns token generation into an outage.
Deliverable: State the system invariant in one sentence.Simulate producer chunks and consumer capacity, returning delivered chunks, dropped or cancelled work, and peak buffer depth.
Deliverable: Type the deterministic core.The buffer never exceeds capacity, cancellation stops future delivery, and every dropped chunk has a reason.
Deliverable: Record a normal case and a boundary case.Slow the consumer, cancel mid-stream, and compare bounded versus unbounded buffering.
Deliverable: Name the failure signal and its guard.A streaming trace with buffer SLO, cancellation evidence, and recovery policy.
Deliverable: Save the contract, evidence, and handoff note.The buffer never exceeds capacity, cancellation stops future delivery, and every dropped chunk has a reason.
Slow the consumer, cancel mid-stream, and compare bounded versus unbounded buffering.
A streaming trace with buffer SLO, cancellation evidence, and recovery policy.
Deriva-authored extension beyond the supplied PDF. The five moves are Deriva’s implementation contract for this project.