Skip to content

test(tts): release a refused stream whose error body is cut, and note cut billing - #281

Merged
ccampbell-aai merged 1 commit into
masterfrom
ben/tts-refused-stream-release-tests
Oct 23, 2026
Merged

ccampbell-aai merged 1 commit into
masterfrom
ben/tts-refused-stream-release-tests

Conversation

@bgotthold-aai

Copy link
Copy Markdown
Contributor

Carries forward #278 by @aleks-mitov. That PR targeted the ben/tts-http-client branch, 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.

  • Two tests pin that a refused stream() releases its connection when the error body is cut mid-read (sync and async). Without the finally in _open, only these two tests fail; the existing refused-stream test still passes because httpx closes a fully read body itself.
  • The billed_characters docstring covers the two client-side cuts: a session_expired cut (the API's 600-second limit) bills only the text whose audio had been generated, an audio_backlog cut bills every character. Wording matches the billing table in api_tts/README.md.
  • Version 1.8.2.

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

… 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
ccampbell-aai marked this pull request as ready for review October 23, 2026 20:59
@ccampbell-aai
ccampbell-aai merged commit 47f49a7 into master Oct 23, 2026
8 checks passed
@ccampbell-aai
ccampbell-aai deleted the ben/tts-refused-stream-release-tests branch October 23, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants