Description
The SSE buffer boundary flush test ("size threshold: flushes at \\n\\n boundary when bufferBytes exceeded") only checks expect(enqueue.mock.calls.length).toBeGreaterThanOrEqual(1) — it doesn't verify:
- The flushed chunk ends at a
\n\n boundary
- The unflushed remainder (partial event) is retained for the next flush
The boundary scan (stream-buffer.ts:57-63) scans backwards for \n\n. This is a critical correctness path — flushing mid-event would corrupt the SSE stream.
Location
tests/stream-buffer.test.ts:36-48
Suggested Fix
Assert:
- Flushed chunk ends with
\n\n
- Next flush contains the retained remainder
Description
The SSE buffer boundary flush test (
"size threshold: flushes at \\n\\n boundary when bufferBytes exceeded") only checksexpect(enqueue.mock.calls.length).toBeGreaterThanOrEqual(1)— it doesn't verify:\n\nboundaryThe boundary scan (
stream-buffer.ts:57-63) scans backwards for\n\n. This is a critical correctness path — flushing mid-event would corrupt the SSE stream.Location
tests/stream-buffer.test.ts:36-48Suggested Fix
Assert:
\n\n