LIFECYCLE: permanent — a deterministic, advisory structural protocol test for the LLM gateway's OpenAI-compatible streaming path. Run it with:
npm run test:replay-llm-streaming-wire-fidelityThe oracle starts a loopback-only OpenAI-compatible fake upstream that sends
synthetic SSE frames across deliberately fragmented HTTP chunks. It drives the
real gateway router, resolver, executor,
OpenAICompatibleChatCompletionProvider.stream_chat_completion, and
StreamingResponse. A test-only dependency override selects the loopback
provider; production routing, provider construction, retries, schemas, and
deployment configuration remain unchanged.
The oracle proves only that:
- the provider request selects streaming and terminal usage;
- the gateway responds with
text/event-stream; - fragmented upstream SSE produces nonterminal client data frame(s), then one
terminal usage/finish frame, then exactly one
[DONE]; and - an inbound
upstream_urlis rejected before the provider path, within a bounded local deadline and with non-loopback socket egress denied.
This is not provider conformance, production endpoint behavior, client compatibility, traffic capture/replay, a release gate, LC3 or timing qualification, or Phase 0B. It neither changes nor replaces the Listen Pusher or Sync Cloud Tasks gauntlets, and it makes no real provider calls.
The fake parses request and SSE envelopes only long enough to assert protocol shape. It retains and prints only endpoint/frame labels and ordering, schema-key sets, status/error classes, a timing bucket, and request count. It never logs or persists prompt/completion/token values, SSE payloads, headers, credentials, identifiers, or provider bodies.