test: test streamed chat happy path - #8
ZsomborTothAxem wants to merge 2 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4e1763652a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| request | ||
| .stream_options | ||
| .get_or_insert(ChatCompletionStreamOptions { | ||
| include_usage: None, | ||
| include_obfuscation: None, | ||
| }); | ||
| } | ||
| }) | ||
| .include_usage = Some(true); |
There was a problem hiding this comment.
Respect explicit opt-out from usage chunks
When a streaming caller sends stream_options.include_usage: false, this assignment overwrites the explicit preference before proxying the request. The upstream can therefore emit a terminal usage-only chunk with empty choices, which the forwarding loop passes directly to the caller; clients that deliberately disabled such chunks may then fail on an unexpected event shape. Preserve the original client preference and, if usage must still be requested for accounting, record but suppress that chunk unless the caller opted in.
Useful? React with 👍 / 👎.
Signed-off-by: ZsomborTothAxem <zsombor.toth@axem.dev>
Signed-off-by: ZsomborTothAxem <zsombor.toth@axem.dev>
4e17636 to
09964aa
Compare
Type of change
Related issue
Closes: SHD-1002
Description
Adds the streamed chat happy-path integration test using the real HTTP router, temporary SQLite database, and fake SSE upstream.
The test verifies ordered content chunks, final usage data, [DONE] termination, and usage accounting for the correct user and model. The server now always requests upstream usage data for reliable accounting.
Validation
cargo fmt --checkcargo clippy --all-targets --all-features -- -D warningscargo build --verbose --all-featurescargo test --verbose --all-featuresAdditional validation details:
cargo test -p shaide --test streamed_chat- passedDeployment and compatibility
None. No migrations, configuration changes, or breaking API changes.
Documentation
No documentation changes are needed; the existing integration-test harness documentation covers this test pattern.
Checklist
Signed-off-bytrailer (git commit -s).