Repository navigation
Add stream cancellation and JSON-RPC streaming request ID lifecycle tests - #153
Merged
MisterVVP merged 1 commit intoJul 16, 2026
Conversation
MisterVVP
merged commit Jul 16, 2026
d71f968
into
dev-add-sse-streaming-support-to-clients
15 checks passed
MisterVVP
added a commit
that referenced
this pull request
Jul 19, 2026
…ests (#153) ### Motivation - Prove libcurl-backed SSE streams can be cancelled promptly by the client cancellation callback without relying on server closure. - Ensure JSON-RPC SSE streams use unique request IDs and that cross-stream response IDs are rejected exactly once. - Verify no observer callbacks occur after a `StreamHandle` has been destroyed and returned. ### Description - Add a deterministic loopback SSE server and cancellable invocation helper, and test that flipping the `is_cancelled` callback stops `a2a::http::Client::StreamRequest()` promptly and prevents delivery of later chunks (`tests/unit/http_client_test.cpp`). - Add controlled JSON-RPC streaming harness that captures request envelopes, generates sequential request IDs, verifies distinct IDs per stream, rejects cross-stream responses with a single protocol error, and accepts matching responses (`tests/unit/json_rpc_transport_test.cpp`). - Add a late-callback requester and a test that destroys an active `StreamHandle` then lets the requester attempt a late event to confirm no observer callbacks happen after destruction returns (`tests/unit/stream_handle_lifecycle_test.cpp`). - Use bounded waits and synchronization primitives (`std::condition_variable`, `std::atomic`, `std::future`) instead of sleeps, and tidy up small return/value style issues to satisfy linters.
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.
Motivation
StreamHandlehas been destroyed and returned.Description
is_cancelledcallback stopsa2a::http::Client::StreamRequest()promptly and prevents delivery of later chunks (tests/unit/http_client_test.cpp).tests/unit/json_rpc_transport_test.cpp).StreamHandlethen lets the requester attempt a late event to confirm no observer callbacks happen after destruction returns (tests/unit/stream_handle_lifecycle_test.cpp).std::condition_variable,std::atomic,std::future) instead of sleeps, and tidy up small return/value style issues to satisfy linters.