Repository navigation
Test real stream use cases and fix native reader iteration and size validation - #111
Merged
Merged
Conversation
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.
Native streams were missing the async iterator protocol, so ordinary JSON Lines consumers using
async for line in readerfailed. Negativereadexactly(n)sizes also raised a synchronous OverflowError instead of an awaited ValueError.This PR follows a test-first sequence on master
3ff820a:A third test-only commit forces the oversized prefix to fail before the peer sends the newline. This covers recovery without assuming that a single TCP write arrives in one read. Final expanded matrix: 60/60 passed locally across all three backends.
Scenarios cover UTF-8 JSON Lines with multiple write sizes and optional final newline; repeated iterator exhaustion; pipelined length-prefixed messages with empty/large bodies; truncated-body exception attributes; TCP half-close replies; oversized-line recovery; iteration cancellation and reuse; invalid sizes and EOF boundaries.
Tests use events and peer acknowledgements, propagate peer-task failures, check task leaks and loop exceptions, and assert native readers on both rsloop endpoints. They do not assume TCP packet boundaries or require external services. The existing matrix discovers them automatically; optional uvloop cases skip where unavailable. Development docs explain the contracts and test design.
Validation actually executed locally on Linux:
Local full suites are not claimed green. Windows/macOS and full all-feature Rust execution are delegated to CI. Final-head CI (
caf4e80) completed successfully: Tests run 38043612494 and MkDocs run 38043612373. This covers the full OS/Python matrix (including free-threaded builds), default/all-feature Rust suites, Clippy, Miri, profiling/hotpath, typing, tooling, AnyIO and Redis/hiredis. No final CI failures remain. Windows/macOS validation was performed by GitHub Actions, not locally.