Files
PaperClipAI/server
Priya RamanandPaperclip b773f0f2e2 test(plugin-worker): remove wall-clock race from duplex buffered-replay tests
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>
2026-09-03 23:59:39 +00:00
..