/claim #9810

Summary

Fix ZStream.buffer(n) prefetch semantics so it doesn’t run more than n elements ahead.

  • For n > 1, internal queue capacity is adjusted to n - 1 to account for the single in-flight element downstream.
  • For n == 1, use a synchronous handoff (ack per element) so the upstream cannot advance beyond one element.

Proof

Tests

sbt "streamsTestsJVM/testOnly zio.stream.ZStreamSpec -- -t buffer"

Includes new regression tests:

  • buffer(1) does not run more than one element ahead
  • buffer(2) does not run more than two elements ahead

Claim

Total prize pool $250
Total paid $0
Status Pending
Submitted February 08, 2026
Last updated February 08, 2026

Contributors

TH

thecafetron-ctrl

@thecafetron-ctrl

100%

Sponsors

ZI

ZIO

@ZIO

$250