mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-08 11:13:44 +02:00
The two buffered-replay tests used a fixed 60 ms sleep as a barrier before they attached the data listener. The barrier raced the subprocess start and the stdio latency. Under load the three data frames did not always buffer within 60 ms, so the synchronous drain saw a partial buffer and the synchronous assertion failed. Replace the fixed sleep with a deterministic barrier. Each test now scripts an exit after the three data frames. The host reads the worker stdout line by line, so it buffers every data frame before it reads the exit. The exit settles the wait, so `await session.wait()` proves the host holds all pre-bind frames before any listener attaches. The test then attaches the listener and the drain delivers every buffered chunk. Both tests keep the non-batch setImmediate buffer-then-drain path and lose no coverage. Co-authored-by: Paperclip <noreply@paperclip.ing>