Skip to content

blackbull.client.scenario

blackbull.client.scenario

Deprecation shim — moved to blackbull.fault_injection.

Groups the HTTP/1.1 client-side scenario model and the HTTP/2 server-side fault-injection surface under blackbull.fault_injection. Import from there going forward::

from blackbull.fault_injection import Scenario, H1CSendRawBytes  # ...

This shim re-exports the names that used to live here (BBD003).

Abort dataclass

Hard-close the connection (transport.abort → RST on Linux).

Terminal: later steps do not run.

ReadResponse dataclass

Read one message: an HTTP/1.1 response, or one HTTP/2 frame.

On timeout the scenario ends with timed_out set and the step uncounted. End of stream sets peer_closed and the scenario goes on.

Scenario dataclass

A sequence of steps the executor walks against one connection.

from_bytes(raw) classmethod

Decode every byte string into a runnable fuzz scenario, including empty input.

Truncated input returns the completed steps. Abort discards remaining bytes; SEND payload lengths are uint16. This decoder must not raise on arbitrary input.

from_json(src) classmethod

Parse what to_json wrote.

to_json()

Serialise to JSON Lines (see docs/guide/fault_injection.md).

well_formed(raw_request, *, response_timeout=5.0) classmethod

Wrap a complete raw HTTP/1.1 request as a one-shot scenario.

Equivalent to "send these bytes, then read one response". Used by the Hypothesis well_formed_scenario_strategy in the HTTP/1.1 differential suite.

ScenarioResult dataclass

Collect scenario outcomes; fields are not mutually exclusive.

A timeout may precede a later response; response is newest, received holds all.

SendBytes dataclass

Send arbitrary bytes, for anything a typed step will not build.

byte_interval > 0 sends one byte at a time with that delay.

Sleep dataclass

Idle for duration seconds without reading or writing.

StepOp

Bases: str, Enum

The v1 JSON tags, still read until v1 reading is removed.