From cd4ef1e8d305dc054c8a0e3f8b528048db031128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mehmet=20Karao=C4=9Flu?= Date: Fri, 4 Dec 2026 00:21:15 +0300 Subject: [PATCH] Remove external project references from ADR-004 --- docs/decisions/ADR-004-streaming-sse-design.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/decisions/ADR-004-streaming-sse-design.md b/docs/decisions/ADR-004-streaming-sse-design.md index 48fc1a3..0230416 100644 --- a/docs/decisions/ADR-004-streaming-sse-design.md +++ b/docs/decisions/ADR-004-streaming-sse-design.md @@ -23,11 +23,11 @@ Three SSE parsing approaches were evaluated: ## Decision -**Use an inline SSE parser module, matching the pattern established by anthropic-sdk-python and openai-python.** +**Use an inline SSE parser module.** ### Evidence -Both reference SDKs (anthropic-sdk-python, openai-python) initially adopted httpx-sse, then replaced it with inline parsers (~100 lines each). Their reasons apply to us: +Of the three approaches listed above, manual line-by-line parsing (option 3) was eliminated early: it scatters SSE logic across every method, making reconnection and event routing untestable in isolation. The choice reduces to httpx-sse (option 1) vs an inline parser (option 2): | Factor | httpx-sse | Inline parser | |---|---|---| @@ -174,7 +174,7 @@ def drain(self, session: str, *, after_event_id: str | None = None) -> list[Chan - Zero new runtime dependencies (inline parser, no httpx-sse). - Full control over reconnection, which is critical for Trigger.dev's `Last-Event-ID` resume pattern. -- Matches the established pattern from both reference SDKs (anthropic, openai). +- Full control over SSE event routing, enabling Trigger.dev-specific control records and typed event dispatch. - Reuses existing retry infrastructure (`_retry.py`) for reconnection backoff. - Reuses existing httpx2 client for connection pooling. - Clear module separation: wire format (`_streaming.py`) vs transport (`_channels.py`). @@ -182,7 +182,7 @@ def drain(self, session: str, *, after_event_id: str | None = None) -> list[Chan ### Negative - ~100 lines of SSE parsing code to maintain. Mitigated by the SSE spec being stable (W3C, unchanged since 2015). -- Reconnection logic adds complexity beyond what reference SDKs implement. Justified by Trigger.dev's explicit support for `Last-Event-ID` resume. +- Reconnection logic adds complexity beyond a basic SSE client. Justified by Trigger.dev's explicit support for `Last-Event-ID` resume. ### Neutral