Repository navigation
test(tts): release a refused stream whose error body is cut, and note cut billing - #281
Merged
Merged
Conversation
… cut billing Carries forward #278, which targeted the squash-merged #277 branch and could not be retargeted without dropping the WebSocket client. Two tests pin that a refused stream releases its connection even when the error body fails mid-read, and the billed_characters docstring covers the two client-side cuts (session_expired, audio_backlog). Version 1.8.2. Co-Authored-By: Aleksandar Mitov <140423361+aleks-mitov@users.noreply.github.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
ccampbell-aai
approved these changes
Oct 23, 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.
Carries forward #278 by @aleks-mitov. That PR targeted the
ben/tts-http-clientbranch, which was squash-merged in #277, and its head predated the WebSocket client (#279), so it could not be retargeted to master without dropping those files. Same content, rebased onto master.stream()releases its connection when the error body is cut mid-read (sync and async). Without thefinallyin_open, only these two tests fail; the existing refused-stream test still passes because httpx closes a fully read body itself.billed_charactersdocstring covers the two client-side cuts: asession_expiredcut (the API's 600-second limit) bills only the text whose audio had been generated, anaudio_backlogcut bills every character. Wording matches the billing table inapi_tts/README.md.Out of scope, noted for a follow-up: a refused stream whose error body is cut still surfaces as a raw
httpx.ReadError(status, request id and retry-after are lost), which these tests lock in rather than change.🤖 Generated with Claude Code