Skip to content

test: add a second, non-Python SSE client to CI (#134) - #136

Merged
solderzzc merged 1 commit into
mainfrom
claude/node-sse-client
Aug 8, 2026
Merged

test: add a second, non-Python SSE client to CI (#134)#136
solderzzc merged 1 commit into
mainfrom
claude/node-sse-client

Conversation

@solderzzc

Copy link
Copy Markdown
Member

Fixes #134.

Why

Removing the opencode CLI in #131 was the right call — the runner OOM-killed it after the server had already answered correctly, and its assertions were a two-string grep that would have passed even if opencode never reached the server. But it left every SSE assertion in CI going through Python httpx (the OpenAI SDK, in both test-opencode.sh and test-contract.sh).

That matters concretely: SwiftLM frames SSE with \r\n\r\n rather than the spec's \n\n. httpx tolerates it. Whether a different parser does is precisely the kind of thing only a second, independent implementation establishes — and there was no longer one in CI.

What this adds

tests/test-sse-node.js — Node's built-in fetch plus a manual event split. No npm install; node is preinstalled on macos-15, so this reintroduces none of the memory pressure that motivated #131.

Asserts:

  • the framing is parseable by a non-Python client (and reports which framing the server used)
  • exactly one [DONE] terminator
  • every data: payload is valid JSON carrying a choices array
  • a finish_reason is reported
  • content accumulates
  • the terminal usage chunk with an empty choices array does not break accumulation

Invoked from test-contract.sh against the already-running server, and skipped rather than failed where node is absent.

Result

[node-sse] Results: 7 passed, 0 failed
[contract]  Results: 8 passed, 0 failed, 2 skipped, 10 total

It confirms empirically that the server emits \r\n\r\n — previously an implementation detail that nothing asserted in either direction.

🤖 Generated with Claude Code

Removing the opencode CLI in #131 was right — the runner OOM-killed it after
the server had already answered, and its assertions were a two-string grep —
but it left every SSE assertion in CI going through Python httpx.

That matters because SwiftLM frames SSE with \r\n\r\n rather than the spec's
\n\n. httpx tolerates it; whether a different parser does is exactly what a
second implementation establishes, and there was no longer one.

tests/test-sse-node.js uses Node's built-in fetch and a manual event split —
no npm install, node is preinstalled on macos-15, so it reintroduces none of
the memory pressure that motivated #131. It asserts the framing is parseable,
there is exactly one [DONE] terminator, every payload is valid JSON with a
choices array, a finish_reason is reported, content accumulates, and the
terminal usage chunk with an empty choices array does not break accumulation.

Run from test-contract.sh against the already-running server, and skipped
rather than failed where node is absent.

Local run: 7 passed, 0 failed. It confirms empirically that the server emits
\r\n\r\n, which was previously only an implementation detail nothing asserted.

Fixes #134.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@solderzzc
solderzzc merged commit b465017 into main Aug 8, 2026
13 checks passed
@solderzzc
solderzzc deleted the claude/node-sse-client branch August 8, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI has no second SSE client implementation after the opencode CLI was removed

1 participant