conformance/src/scenarios/server
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Satoshi Ito c5af5673ba
fix: send HTTP DELETE to terminate server sessions after each scenario (#316)
* fix: send HTTP DELETE to terminate server sessions after each scenario

The conformance test harness opened sessions against servers under test but never issued an HTTP DELETE to terminate them, leaving a dangling session on the server after each scenario.
This violates the "hermetic" expectation called out in the Streamable HTTP transport spec.

- `connection/sdk-client.connectToServer` now calls `transport.terminateSession()` before `client.close()`. A 405 response (DELETE not supported) is tolerated because the spec allows the server to refuse.
- A new `terminateSessionRaw` helper handles scenarios that bypass the SDK client and open sessions via raw `fetch` (`lifecycle.ts`, `http-standard-headers.ts`).
- `sse-polling.ts` and `sse-multiple-streams.ts`, which manage their own transport, now terminate the session in their existing `finally` block before closing the client.
- `lifecycle.test.ts` gains two cases asserting that DELETE is sent with the issued session ID and that no DELETE is sent when the server did not assign one.

Verified manually against `examples/servers/typescript/everything-server.ts` that running a server scenario now causes the server to log `Received session termination request for session <id>`.

Fixes #79

Signed-off-by: Satoshi Ito <satoshi.ito.tf@hitachi.com>

* Use negotiated protocol version for teardown DELETE and bound it

Review follow-ups on the session-termination change:

- terminateSessionRaw: abort the DELETE after 5s so a wedged server
  cannot stall suite teardown.
- terminateSessionBestEffort: shared SDK-path teardown helper that
  delegates to terminateSessionRaw with the transport's negotiated
  protocol version, so the socket is truly released at the bound and
  the version-mismatch 400 on strict servers (the failure mode of
  issue #79) goes away. Used by connectToServer close() and both SSE
  scenarios, replacing their inline try/catch blocks.
- lifecycle.ts: the raw session-id probe and its teardown DELETE now
  use ctx.specVersion instead of a hardcoded 2025-11-25, matching the
  negotiated-version convention from #415/#416.
- Add sdk-client.test.ts regression tests asserting close() sends a
  DELETE with the issued session ID (and none without one), so a bad
  future merge cannot silently drop the fix.

---------

Signed-off-by: Satoshi Ito <satoshi.ito.tf@hitachi.com>
Co-authored-by: Paul Carleton <paulc@anthropic.com>
2026-07-31 17:24:13 +01:00
..
tasks fix: fail checks whose prerequisite is missing instead of skipping them (#372) 2026-06-30 11:42:01 +01:00
all-scenarios.test.ts feat: version-aware Connection abstraction for server scenarios (#318) 2026-06-01 17:09:13 +01:00
caching.ts fix: update the draft wire version to 2026-07-28 (#331) 2026-06-08 16:47:17 +01:00
dns-rebinding.ts feat: version-aware Connection abstraction for server scenarios (#318) 2026-06-01 17:09:13 +01:00
elicitation-defaults.ts Validate all wire messages against the per-version spec JSON schema (#399) 2026-07-27 15:58:43 +01:00
elicitation-enums.ts Validate all wire messages against the per-version spec JSON schema (#399) 2026-07-27 15:58:43 +01:00
http-standard-headers.test.ts Validate all wire messages against the per-version spec JSON schema (#399) 2026-07-27 15:58:43 +01:00
http-standard-headers.ts fix: fail checks whose prerequisite is missing instead of skipping them (#372) 2026-06-30 11:42:01 +01:00
input-required-result-helpers.ts Validate all wire messages against the per-version spec JSON schema (#399) 2026-07-27 15:58:43 +01:00
input-required-result.ts Validate all wire messages against the per-version spec JSON schema (#399) 2026-07-27 15:58:43 +01:00
json-schema-2020-12.ts feat: version-aware Connection abstraction for server scenarios (#318) 2026-06-01 17:09:13 +01:00
lifecycle.test.ts fix: send HTTP DELETE to terminate server sessions after each scenario (#316) 2026-07-31 17:24:13 +01:00
lifecycle.ts fix: send HTTP DELETE to terminate server sessions after each scenario (#316) 2026-07-31 17:24:13 +01:00
negative-mrtr.test.ts Validate all wire messages against the per-version spec JSON schema (#399) 2026-07-27 15:58:43 +01:00
negative.test.ts Validate all wire messages against the per-version spec JSON schema (#399) 2026-07-27 15:58:43 +01:00
prompts.ts feat: version-aware Connection abstraction for server scenarios (#318) 2026-06-01 17:09:13 +01:00
resources.ts feat: version-aware Connection abstraction for server scenarios (#318) 2026-06-01 17:09:13 +01:00
sse-multiple-streams.test.ts fix: use negotiated protocol version in sse-multiple-streams raw POSTs (#415) 2026-07-27 11:59:17 +01:00
sse-multiple-streams.ts fix: send HTTP DELETE to terminate server sessions after each scenario (#316) 2026-07-31 17:24:13 +01:00
sse-polling.test.ts fix: use negotiated protocol version in server-sse-polling raw requests (#416) 2026-07-27 13:21:11 +01:00
sse-polling.ts fix: send HTTP DELETE to terminate server sessions after each scenario (#316) 2026-07-31 17:24:13 +01:00
stateless.test.ts fix(server-stateless): declare the elicitation capability on the streaming-probe request (#383) 2026-07-27 10:45:48 +00:00
stateless.ts fix(server-stateless): declare the elicitation capability on the streaming-probe request (#383) 2026-07-27 10:45:48 +00:00
tools.test.ts feat: Tool name format checks (SEP-986) (#240) 2026-04-24 11:57:36 +01:00
tools.ts Validate all wire messages against the per-version spec JSON schema (#399) 2026-07-27 15:58:43 +01:00
utils.ts feat: version-aware Connection abstraction for server scenarios (#318) 2026-06-01 17:09:13 +01:00