test-utils and not (target_os=unknown and WebAssembly) only.Expand description
Wire-sequence conformance scenarios for provider streaming pipelines.
The streaming sibling of rig-agent’s model_conformance: each scenario
drives raw wire bytes (SSE or NDJSON) through a provider’s complete
streaming path — bytes → decode → normalize → aggregated
StreamingCompletionResponse
— and asserts the StreamFinal contract
table documented on that type. Scenarios state the contract; a per-provider
ProviderWireFixture supplies the frames, since each wire format spells
the same event differently.
Every sequence family here pins a shipped bug from the #2257 review rounds
(rig-2257-code-review-findings-*.md); the per-scenario comments cite the
specific finding.
Suites are expanded per wire family by
streaming_conformance_suite!.
Scenarios a wire cannot spell return an explicit
ScenarioOutcome::Skipped that the macro cross-checks against the
suite’s declared SuiteCapabilities — a skip is always visible and can
never masquerade as a pass, so the executed count is exactly the declared
grid minus the named skips (#2258 review, F8 corpus honesty).
Modules§
- fixtures
- Per-provider wire fixtures for the shared scenario set.
Structs§
- Buffered
Body Driver - A buffered-body pipeline (the ChatGPT backend shape): the full SSE body is re-parsed after the fact and merged with the terminal response body.
- Drained
Stream - Everything the consumer observed from one full pipeline run: the yielded items in order, plus the aggregated choice and terminal record.
- Interleaved
Reasoning Fixture - The interleaving-boundary shape for a wire whose reasoning identity is a constant per-stream minted key: reasoning, an interleaved tool call, then more reasoning, which must aggregate as three ordered parts — never one merged item that misorders history on replay.
- Provider
Wire Fixture - Per-provider wire frames for the shared scenario set.
- Refusal
Fixture - Refusal frames and the text the pipeline must deliver for them.
- Scenario
Report - Outcome of a passing wire-conformance scenario.
- Suite
Capabilities - Streaming-relevant capability flags for one wire family’s conformance suite: which optional sequence shapes the wire can spell.
- Wire
Driver - One provider’s full streaming pipeline over scripted wire chunks.
Enums§
- Conformance
Error - Typed failure from a wire-conformance scenario.
- Scenario
Outcome - What a capability-gated scenario did: ran its assertions, or skipped because the wire family cannot spell the sequence shape.
- Wire
Input - One scripted wire input frame.
Constants§
- CANONICAL_
SCENARIOS - The canonical fixture-driven scenario set every wire-family suite must
expand — one named test each, compared against the macro’s emitted list by
its
suite_is_completetest (langchain’s anti-tamper precedent). - WIRE_
FAMILIES - Every streaming wire family in the workspace. The workspace registry test
(
all_wire_families_have_conformance_suites) fails CI when any family lacks astreaming_conformance_suite!invocation naming it.
Functions§
- assert_
valid_ event_ stream - Executable stream-lifecycle validator (#2258 C1).
- bare_
terminal_ after_ only_ unparseable_ frames_ fabricates_ nothing - A bare terminal signal after only-unparseable frames must not fabricate a successful terminal record: the parse errors were already surfaced, and a default-usage terminal would dress the failure up as success.
- check_
gated_ outcome - Enforce a capability-gated scenario’s outcome against the suite’s declared
capability flag and its
xfaillist. - check_
ungated_ outcome - Enforce an always-runnable scenario’s result against the
xfaillist. - defective_
known_ event_ surfaces_ err - A known event whose payload is schema-defective must surface as an
Erritem (and the stream keeps consuming to the genuine terminal). - delta_
less_ choice_ prelude_ is_ a_ noop - A delta-less choice (the Azure
prompt_filter_resultsprelude) must be a no-op — no error, no content, and the rest of the stream unaffected. - drain_
openai_ responses_ websocket_ events websocketand non-target_family=wasm - Drain one OpenAI Responses websocket turn’s server events into
everything a streaming consumer would observe, through the SAME decode
state machine the production session drives
(
RawChoiceAccumulator+normalize_responses_stream). - event_
frame - Build a typed-event fixture frame.
- interleaved_
constant_ id_ reasoning_ preserves_ order - On a constant-id wire (a boundary-minted per-stream reasoning id), other
output closes the open reasoning item: thought → tool call → thought must
aggregate as
[Reasoning(first), ToolCall, Reasoning(second)]— two items in arrival order, never one merged item that misorders history on replay. - interleaved_
reasoning_ aggregates_ to_ one_ item - Reasoning deltas interleaved with a tool call, then the item’s completed block, must aggregate to exactly one reasoning item carrying the block’s content.
- interleaved_
signed_ full_ reasoning_ does_ not_ erase_ prior_ thought - On a constant-id wire whose completed reasoning block arrives as a signed
full restatement (gemini
thoughtSignature), a full block after interleaved output must not replace-and-discard the thought accumulated before the boundary: the choice keeps[Reasoning(first), ToolCall, Reasoning(second, signed)]. - invalid_
xfail_ entries xfailentries that do not name a canonical scenario or carry no reason.- malformed_
frame_ surfaces_ err_ and_ terminal_ still_ completes - A malformed frame between valid content and the genuine terminal must
surface as an
Erritem while the stream keeps consuming, so the terminal still completes it. - multi_
part_ same_ id_ reasoning_ keeps_ every_ part - A reasoning item whose
output_item.donecarries several parts under one item id (summary parts, text, encrypted) must keep every part, in order — same-id sibling blocks append, they never replace each other. - ok_
chunks - Build the chunk list for an all-delivered frame sequence.
- reasoning_
summary_ deltas_ are_ superseded_ without_ duplication - Reasoning-summary deltas followed by the item’s full
output_item.doneblock must aggregate to the summary exactly once — the full block supersedes its own deltas, never duplicates them. - refusal_
frames_ deliver_ text_ without_ error - Refusal frames must deliver their text to the consumer without an error.
- terminal_
body_ content_ merges_ per_ kind - On the buffered-body pipeline (the ChatGPT backend), a terminal whose body carries text never seen as a delta must merge that text into the choice exactly once, and a body restating streamed deltas must not duplicate them.
- transport_
error_ after_ tool_ call_ yields_ err_ then_ end - A transport failure after a fully-delivered tool call must yield the tool
call, then the
Err, then end — with no terminal record after the error. - transport_
error_ chunk - A scripted mid-stream transport failure chunk.
- truncation_
preserves_ content_ without_ terminal - Truncation at every position — EOF before content, mid-text, mid-tool-args, after a fully-delivered tool call — must preserve delivered content and never produce a terminal record.
- unknown_
event_ is_ skipped - An event type the client does not know must be skipped without an error, and the stream must still complete.
- usage_
variants_ are_ reported_ or_ zero_ sentinel - The genuine terminal must report the provider’s usage; a terminal without usage metrics must complete with the documented zero-usage sentinel rather than being suppressed or invented.
- xfail_
reason - The sanctioned reason for an expected-failure scenario, from
xfailentries of the form"scenario_name: reason (finding reference)".
Type Aliases§
- Wire
Chunks - The wire frames a driver feeds into the provider’s pipeline. An
Errchunk models a mid-stream transport failure.