Skip to content

Make upstream mocks prove real streaming and current provider/MCP contracts #231

Description

@ebursztein

Outcome

Consolidate #145, #146 and the residual coverage requirements of #150 into one mock-fidelity change. A test upstream must actually exercise the streaming behavior its routes advertise.

Current evidence

Inspected main at 914c72e: capsem-mock-server/src/main.rs still routes /chunked and /delayed-chunks through the same buffered response helper; /sse/model also uses a buffered response. The original #150 claim of only three tests is stale: src/tests.rs now covers static routes, provider JSON/stream terminators, MCP dispatch, token/path parsing and other shapes. Preserve those tests; fill remaining gaps rather than rebuilding them.

Required work

  • /chunked emits multiple body frames with genuine HTTP/1.1 chunked transfer, no fixed Content-Length. /delayed-chunks additionally exposes controllable gaps.
  • SSE/model streaming routes deliver incremental events rather than one completed buffered blob; preserve each provider's event/tool-call/terminator shape.
  • Streaming proof must observe the first frame before completion and exercise split events, cancellation and backpressure. Merely collecting the final body proves none of these.
  • Reconcile [triage:tooling-06-missing-tests-mock-http-routing-shapes] Mock server HTTP routing and response shapes are almost entirely untested #150 against existing tests: retain tool-call/no-tool-call branch coverage, MCP errors, fixture target extraction, request-log fields/header normalization, /log body omission and response-byte accounting. Add only missing behavior checks.
  • Verify existing MITM/parser tests consume the streaming path; no second mock server implementation.

Acceptance and cost

Use controlled channels, barriers or paused time to demonstrate delayed/incremental delivery; no seconds-long sleeps per case. Reuse existing public-path fixtures for affected streaming behavior. No new endurance lane. Report which original findings were already fixed and which this change resolves.

Original reports #145/#146/#150 remain provenance; closure as superseded is not a claim of implementation. This is test-infrastructure correctness, independent of product proxy extraction #206 and standalone features.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions