test(core): cover send / execute / sendStream (close TS↔Python coverage gap) - #52
Closed
AndreLFSMartins wants to merge 7 commits into
Closed
AndreLFSMartins wants to merge 7 commits into
AndreLFSMartins wants to merge 7 commits into
Conversation
…vent, http-error); todo+FIXME for malformed drift codespar#51
codespar#51 regression-guard tripwire (replaces it.todo)
… green tripwire), characterize tool_result wrapper drift codespar#53, drop duplicate send test
…ot green char-test; tighten codespar#51 throw to /malformed SSE payload/
codespar#51 + codespar#53(tool_result,done); happy test covers only flat events
…sult/done/malformed tripwires; codespar#51/codespar#53 fully deferred to parser-alignment PR
Contributor
Author
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.
What
Adds Vitest coverage for
session.send,session.execute, andsession.sendStreamin@codespar/sdk. These surfaces were untested on the TS side while the Python package already covers them. Test-only — no production source changed.Coverage added
src/__tests__/send-stream.test.ts— SSE parsed end to end through the realparseSseStream(mockfetchreturning a realReadableStream<Uint8Array>):/v1/sessions/:id/send,Authorization,Accept: text/event-stream, serialized{message}bodyassistant_textandtool_useerroreventsendStreamthrowssendStream failed: <status>on a non-ok responsesrc/__tests__/send-execute.test.ts:execute(/execute,{tool,input}) andsend(/send,Accept: application/json,{message}), incl. auth/content-type headersexecutereturnsToolResulton success; soft-fails (success:false, status-prefixederror) on non-oksendreturnsSendResultwithtool_calls; throwssend failed: <status> <body>on non-okScope note — two TS↔Python drifts escalated, deliberately out of scope here
Porting the Python streaming tests surfaced one systemic
parseSseChunkdrift, escalated as separate issues:data:is silently dropped (TS returns null) while Python raisesStreamError.tool_resultanddoneenvelopes are not unwrapped (TS assigns the wholedata), diverging from Python.The parser fix and the real Python-parity assertions for
tool_result/done/ malformed handling land together in the parser-alignment PR (those changes are a public-contract behavior change). This PR stays strictly test-only and drift-free; it does not ship tests that pin the current defective behavior.Verification
packages/core:npx vitest run→ 45 passingnpx tsc --noEmit→ no errors