Skip to content

fix(streaming): add non-negative validation constraints to RealTimeTr… - #255

Merged
ccampbell-aai merged 3 commits into
AssemblyAI:masterfrom
shobhitagnihotri69:fix/streaming-options-boundary-validation
Sep 29, 2026
Merged

ccampbell-aai merged 3 commits into
AssemblyAI:masterfrom
shobhitagnihotri69:fix/streaming-options-boundary-validation

Conversation

@shobhitagnihotri69

Copy link
Copy Markdown
Contributor

…anscriberOptions

Enforce ge=0 boundary validation via Field constraints on:

  • connect_timeout (timeout waiting for WebSocket handshake)
  • max_connection_retries (retry attempts after handshake failure)
  • connection_retry_delay (delay in seconds between retry attempts)
  • terminate_timeout (timeout waiting for server TerminationEvent)

Previously, negative values were accepted without error, leading to empty retry loops or unexpected immediate socket disconnections. Added unit tests covering negative rejections and zero boundary acceptance.

…anscriberOptions

Enforce ge=0 boundary validation via Field constraints on:
- connect_timeout (timeout waiting for WebSocket handshake)
- max_connection_retries (retry attempts after handshake failure)
- connection_retry_delay (delay in seconds between retry attempts)
- terminate_timeout (timeout waiting for server TerminationEvent)

Previously, negative values were accepted without error, leading to
empty retry loops or unexpected immediate socket disconnections.
Added unit tests covering negative rejections and zero boundary acceptance.
Comment thread assemblyai/streaming/v3/models.py

@ccampbell-aai ccampbell-aai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @shobhitagnihotri69 thanks for flagging this! One minor change requested in-line, and please include a patch version bump as well.

Comment thread assemblyai/streaming/v3/models.py Outdated
….5.6

Per maintainer review by @ccampbell-aai:
- Update connect_timeout Field constraint to gt=0 as zero is an invalid timeout
- Update test cases to reject zero connect_timeout
- Bump version to 1.5.6
@shobhitagnihotri69

Copy link
Copy Markdown
Contributor Author

Thanks @ccampbell-aai! I have updated the connect_timeout Field constraint to gt=0 so that zero is properly rejected as an invalid timeout, updated the test suite to verify non-positive values are rejected, and bumped the patch version to 1.5.6 in commit d89dc4a. All 84 unit tests in test_streaming.py are passing.

# Conflicts:
#	assemblyai/__version__.py
@ccampbell-aai
ccampbell-aai merged commit 5aea9b7 into AssemblyAI:master Sep 29, 2026
8 checks passed
@ccampbell-aai

Copy link
Copy Markdown
Contributor

Hey @shobhitagnihotri69 , thanks for fixing those changes and apologies this got lost on my end for a bit. I went ahead and fixed the version conflict that came up and merged your changes in. Thanks for your contribution!

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