Add SSE tests for model shared between streaming and non-streaming responses - #5116
Merged
iscai-msft merged 2 commits intoAug 3, 2026
Merged
Conversation
…sponses Add test coverage for the scenario where a model is used both as a regular HTTP response body and as an SSE event payload (e.g. Search's KnowledgeBaseRetrievalResponse used in both /retrieve 200 and as the response.completed terminal SSE event in /retrieveStream). Verifies that usage flags (Output | Json) and serialization options are correctly propagated from both code paths. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1d859399-8e9f-4ed4-b596-37fa32575c31
commit: |
Contributor
|
No changes needing a change description found. |
iscai-msft
enabled auto-merge
July 30, 2026 15:50
Contributor
|
You can try these changes here
|
catalinaperalta
approved these changes
Aug 3, 2026
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.
Summary
Adds test coverage for the scenario where a model is used both as a regular HTTP response body and as an SSE event payload — mirroring the Azure Search pattern where
KnowledgeBaseRetrievalResponseis used in both:POST /retrieve→ 200 response bodyresponse.completedterminal SSE event inPOST /retrieveStream→SSEStream<KnowledgeBaseRetrievalStreamEvents>What's tested
Two new test cases in
test/methods/sse.test.tsunder"sse model shared with non-streaming response (search-like scenario)":Terminal SSE event + regular response: A model used as both a 200 response body and a
@terminalEventSSE event correctly getsOutput | Jsonusage from both paths, with proper serialization options.Non-terminal SSE event + regular response: A model used as both a regular GET response and a named SSE event (non-terminal) also gets correct combined usage.
Both tests verify:
Output | Json) are correctly propagated from both the regular response and SSE event pathsserializationOptions.jsonis set on all modelseventType,isTerminalEvent,type,contentType) is correctInput | JsonContext
See Azure/azure-rest-api-specs#44399 for the Search spec that motivated this test coverage.