Skip to content

Rulvar API reference


Rulvar API reference / @rulvar/testing / runLiveSmoke

Function: runLiveSmoke()

ts
function runLiveSmoke(
   adapter, 
   req, 
options?): Promise<LiveSmokeOutcome>;

Defined in: packages/testing/src/live.ts:124

Drains adapter.stream(req) with a bounded retry policy and classifies the outcome instead of throwing:

  • 'ok': the stream ended on a single terminal finish (the events of the successful attempt are included for further assertions).
  • 'failed': a terminal error with retryable: false; never retried, diagnostics preserved.
  • 'exhausted': every attempt ended in a retryable: true error; the per-attempt errors are preserved in order.
  • 'no-terminal': the stream ended with neither finish nor error, which violates the provider SPI; never retried (spending again on a misbehaving adapter is wrong).
  • 'contract-violation': the stream carried more than one terminal event ('multiple-terminals', e.g. an error followed by a finish) or its single terminal was not the final event ('terminal-not-final'). Equally an SPI violation, equally never retried, and never reported as a pass.

Retries only ever follow a well-formed stream whose single final terminal is a typed retryable error, so a live smoke never converts a real adapter failure or a malformed stream into a pass and never spends more than attempts calls. Options are validated first: invalid attempts or baseDelayMs reject with ConfigError before any adapter call.

Parameters

ParameterType
adapterPick&lt;ProviderAdapter, "stream"&gt;
reqChatRequest
options?RunLiveSmokeOptions

Returns

Promise&lt;LiveSmokeOutcome&gt;