test: add a second, non-Python SSE client to CI (#134) - #136
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 bothtest-opencode.shandtest-contract.sh).That matters concretely: SwiftLM frames SSE with
\r\n\r\nrather than the spec's\n\n.httpxtolerates 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-infetchplus a manual event split. No npm install;nodeis preinstalled onmacos-15, so this reintroduces none of the memory pressure that motivated #131.Asserts:
[DONE]terminatordata:payload is valid JSON carrying achoicesarrayfinish_reasonis reportedchoicesarray does not break accumulationInvoked from
test-contract.shagainst the already-running server, andskipped rather than failed wherenodeis absent.Result
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