Repository navigation
feat: Support restart and server-directed-shutdown-request in SSE contract test services - #82
Open
kinyoklion wants to merge 1 commit into
Open
kinyoklion wants to merge 1 commit into
kinyoklion wants to merge 1 commit into
Conversation
Two capabilities the client already supports were not usable by the SSE contract test suite, in both the sync and async test services: - server-directed-shutdown-request: the library halts on a 204 by default, but the services' error_strategy override continued on every error, defeating it. The services now FAIL on HTTPStatusError with status 204 and CONTINUE otherwise (as before). - restart: the services returned 400 for the harness's restart command despite the client having interrupt(). The command now calls interrupt(), and the error that surfaces on the read path as a result is suppressed (same precedent as okhttp's service suppressing StreamClosedByCallerException). Verified: full contract test suite passes against both services, including the newly unlocked "204 halts re-connection attempts" and "caller can trigger a restart" tests. Generated-by: termag
kinyoklion
marked this pull request as ready for review
October 30, 2026 23:24
This branch has not been deployed
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.
What
Updates both contract-test services (sync
service.py/stream_entity.pyand asyncasync_service.py/async_stream_entity.py):server-directed-shutdown-request(newly advertised): the library halts on a 204 by default (http.pyraisesHTTPStatusError; the default error strategy fails on it), but the services overrode the error strategy to CONTINUE on everything, defeating it. The services now FAIL onHTTPStatusErrorwith status 204 and CONTINUE otherwise (unchanged for all other errors).restart(newly advertised): the services returned 400 for the harness'srestartcommand despite the client havinginterrupt(). The command now callsinterrupt(), and the error that surfaces on the read path as a result is suppressed — the same precedent as okhttp's service suppressingStreamClosedByCallerException.Why
A capability audit of the SSE contract-test services (write-up) found both features supported by the client but unwired/unadvertised in the service, so
reconnection/caller can trigger a restartandHTTP behavior/204 halts re-connection attemptswere silently skipping.How verified
Ran the full sse-contract-tests harness locally against both services (linux/arm64, python 3.13): all released-suite tests pass, including both newly unlocked ones. (Two failures appear only against an unmerged audit-branch test group for two already-known python client issues — id-latching on data-less events and case-sensitive Content-Type matching — unrelated to this change.)
Draft for review of approach.
Opened from termag
SDK-3420
Note
Overview
Both sync and async SSE contract-test services now advertise
restartandserver-directed-shutdown-request, so the harness can run scenarios that were previously skipped.Server-directed shutdown: Stream entities no longer treat every error as recoverable. Their custom
ErrorStrategystill CONTINUEs on most failures, but FAILs when the error is anHTTPStatusErrorwith status 204, matching the client’s default halt-on-204 behavior that the old “always continue” override blocked.Restart: The harness
restartcommand is handled by callinginterrupt()on the active SSE client. The resulting read-path fault is suppressed once (via_suppress_next_fault) so it is not reported to the harness as an error, consistent with other SDK contract services.Reviewed by Cursor Bugbot for commit 607b43d. Bugbot is set up for automated code reviews on this repo. Configure here.