Skip to content

feat: Support restart command and 204-halt in SSE contract test service - #635

Open
kinyoklion wants to merge 1 commit into
mainfrom
rlamb/sse-service-restart-204
Open

kinyoklion wants to merge 1 commit into
mainfrom
rlamb/sse-service-restart-204

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

What

Fixes the SSE contract test service (contract-tests/sse-contract-tests) capability wiring:

  1. restart: the service advertised "reconnection", which is not a capability name the harness knows (the real name is restart), and the service had no command endpoint at all, so a harness command would have 404'd. This adds the protocol's POST /entity/<id> command route and maps "restart" to the client's existing async_restart(). The error a caller-triggered restart surfaces on the read path (the canceled read looks like a body-timeout) is suppressed via a per-entity flag — the same precedent as the okhttp service suppressing StreamClosedByCallerException.
  2. server-directed-shutdown-request (newly advertised): the client already treats 204 as an unrecoverable error with no backoff, so the suite's 204 halts re-connection attempts test now runs against this implementation.

Why

A capability audit of the SSE contract-test services (write-up) found the misnamed/dead capability and the unwired 204 support; both tests were silently skipping on this implementation.

How verified

Ran the full sse-contract-tests harness locally against the rebuilt service (linux/arm64, g++ 13, system boost 1.83): all released-suite tests pass, including the newly unlocked restart and 204 tests.

Notes / follow-ups from the audit (not in this PR)

  • The service still can't support last-event-id: both backends erase a preset Last-Event-Id header before the first connect (client.cpp:216-220, curl_client.cpp:103-108). That needs a client change.
  • BOM stripping doesn't exist in the parser (parser.hpp) — a latent client gap shared by most implementations (only rust and Dart strip today).

Draft for review of approach.

Opened from termag

SDK-3420


Note

Overview
Fixes SSE contract test service wiring so harness tests for restart and server-directed shutdown (204) actually run instead of being skipped.

The service now advertises restart (replacing the incorrect reconnection name) and server-directed-shutdown-request, and implements POST /entity/<id> with JSON command, routing restart to async_restart() on the entity’s SSE client.

Restart sets a per-entity suppress-next-error flag so the expected read-path error from a caller-triggered cancel is not reported to the harness (same pattern as other contract test implementations). Entity storage moves from pair to tuple to hold client, outbox, and that flag; destroy is updated accordingly.

Reviewed by Cursor Bugbot for commit 2c37097. Bugbot is set up for automated code reviews on this repo. Configure here.

The service advertised "reconnection", which is not a capability the SSE
contract test harness knows (the name is "restart"), and it had no command
endpoint at all, so harness commands would have 404'd. Meanwhile the client
has supported both behaviors for some time:

- restart: adds the POST /entity/<id> command route from the protocol,
  mapping "restart" to the client's async_restart(). The error that a
  caller-triggered restart surfaces on the read path (the canceled read
  looks like a body timeout) is suppressed via a per-entity flag -- the
  same precedent as the okhttp service suppressing StreamClosedByCallerException.
- server-directed-shutdown-request: the client already treats 204 as an
  unrecoverable error with no backoff, so it is now advertised and the
  suite's 204-halt test runs (and passes).

Verified: full contract test suite passes locally (linux/arm64) including
the newly unlocked "caller can trigger a restart" and "204 halts
re-connection attempts" tests.

Generated-by: termag
@kinyoklion
kinyoklion marked this pull request as ready for review October 30, 2026 23:24
@kinyoklion
kinyoklion requested a review from a team as a code owner October 30, 2026 23:24

This branch has not been deployed

No deployments
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.

1 participant