Skip to content

Live e2e tests for dual-era stateless proxy behavior (local, k8s, CI) #5837

Closed

Description

@jhrozek

Part of #5755. Design: arch doc §Test plan (branch stateless-transport-proxies-design, PR #5808).

Live, end-to-end tests for dual-era (Legacy 2025-11-25 + Modern 2026-07-28) proxy behavior — runnable locally, in Kubernetes, and in CI. Unit/integration coverage in #5829/#5830/#5831 is necessary but not sufficient: this path is concurrency-sensitive and a confidentiality boundary, so it needs live tests that drive real traffic through the proxies.

Harness / fixtures — division of labor

  • go-sdk v1.7, out of process — fidelity legs. A real go-sdk v1.7 client (and/or a Stateless: true go-sdk backend) drives the functional and dual-era negotiation tiers with real spec behavior; as an independent implementation of the spec it catches misreadings a hand-rolled client would share with the proxy code. Modern traffic requires both peers on v1.7 + stateless (else the SDK negotiates down to 2025-11-25).
    • Do NOT import go-sdk v1.7 into ToolHive's Go module. ToolHive consumes MCP via toolhive-core's mcpcompat (pinned go-sdk v1.6.1); a direct test-only import would make MVS bump the whole module to v1.7 and drag the production shim along, forcing Adopt go-sdk v1.7 for MCP 2026-07-28 stateless support #5754 as a side effect. Run the SDK peers as separate binaries (own go.mod / tools submodule, or a container) talking to ToolHive over the wire — exactly how the Add MCP conformance CI job for thv run proxy #5806 conformance job runs its reference server and npx tool out of process. The e2e test drives ToolHive as a black box.
  • Hand-rolled raw HTTP client, in-repo — adversarial/concurrency tier. A conforming SDK won't emit spoofed/foreign Mcp-Session-Id, colliding JSON-RPC ids, malformed _meta, header/body mismatches, or Modern batches — exactly the traffic the security-critical tests need. Byte-level control, no go-sdk dependency.
  • Upstream conformance suite — a third fidelity source once a 2026-07-28-capable version exists (deferred).
  • Fault-injecting backend: a minimal in-repo backend where a test needs to inject faults or malformed responses.

Test tiers

  1. Functional: both eras through both proxies — Modern unary round-trips, no Mcp-Session-Id for Modern, server/discover reachable through authz, Legacy unchanged. (go-sdk driver.)
  2. Adversarial + concurrency (security-critical, raw client): cross-delivery stress test (many concurrent clients, colliding JSON-RPC ids, under -race, looped — no client receives another's response); hostile inputs (foreign session id, spoofed/malformed _meta, header/body mismatch → -32020, unsupported version → -32022, oversized/truncated bodies, batch/client-response smuggling); dual-era concurrent mixing on one backend sharing a session store.
  3. Resilience: no session/goroutine accumulation under sustained Modern load; fault injection (backend crash/restart mid-request, k8s pod eviction, Redis unavailable) — Legacy recovers, Modern degrades cleanly.

Standing gates: Legacy behavior byte-for-byte unchanged and the #5806 conformance job stays green; Modern spans carry per-request mcp.client.name/mcp.protocol.version.

Environments

  • Local (task test-e2e): extend test/e2e/stateless_proxy_test.go — thv run a stdio backend (streamable proxy) and an HTTP backend (transparent proxy).
  • Kubernetes (kind + operator): MCPServer CRD, multi-replica streamable-http backend — assert any-pod routing (no pod-pinning/reinit), mixed Legacy+Modern with Redis + SessionAffinity: None, ping-free health readiness, pod-eviction faults.
  • CI (e2e-tests.yml): local e2e per-PR job, k8s e2e kind job; extend Add MCP conformance CI job for thv run proxy #5806 conformance to a Modern/stdio config once a 2026-07-28-capable upstream version exists.

Deferred-streaming tests (land with the streaming work)

Slow-client backpressure (one slow consumer must not stall others), mid-stream disconnect → assert upstream cancellation, and stream/goroutine-leak checks under subscription churn.

Dependencies

Behavior to assert against comes from #5829 (foundation), #5830 (streamable), #5831 (transparent) — the harness/fixtures can scaffold in parallel, but tier assertions land as those implement. Each of #5829/#5830/#5831 also adds its own live-e2e assertion using this harness.

Activity

  1. added
    needs-triage
    on Jul 16, 2026
  2. added
    enhancement
    and removed
    needs-triage
    on Jul 17, 2026
  3. self-assigned this
    on Jul 21, 2026
  4. jhrozek commented on Jul 22, 2026

    @jhrozek
    ContributorAuthor

    Tracking the yardstick-side work this issue calls out (the go-sdk v1.7 out-of-process
    fidelity peer and the fault-injecting backend) over in StacklokLabs/yardstick#138:
    fault-injection modes (barrier/hang/crash) on yardstick-server, a go-sdk v1.7.0-pre.3
    bump for Modern (2026-07-28) support, a --stateless flag, and matching client/e2e
    coverage. Implementation is ready; PR incoming against that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions