refactor: one <CITATIONS> stream splitter for both chat transports

↗ view on GitHub · Eli Ziff · 2026-07-27 · 5fe26171

The marker-detection/tail-buffer algorithm that separates visible
prose from the hidden citations payload existed twice - once in
runLLMStream (cloud path), once in streamAnonymousChat (local path) -
the exact class of silent-drift duplication that has bitten before.
Both now consume createVisibleStreamSplitter, covered by boundary
tests (marker straddling chunks, <CIT...RUS> false-positive
reconstruction, per-iteration reset). Bridge backoff test gets a
bounded 30s wait + 45s test timeout; its detached write can starve
longer than 10s when suite workers saturate the CPU.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QUsMXzBsEJ27DjJVPSfW5o
Repository eliziff/Beaver
Author Eli Ziff <eliasziff@gmail.com>
Authored
Parents d947dc6d
Stats 5 files changed , +173 , -98
Part of SourceDoc / DOCX engine: redlines, tracked changes, editing benchmark

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-5fe26171.md from inside the repo you want the change in.

⬇ Download capture-commit-5fe26171.md