Raxol. Harness. Fixture
(Raxol v2.8.0)
View Source
Loader + decode shim for versioned JSONL harness fixtures.
A fixture is the recorded bus stream (both tiers — ephemeral
item_delta traffic included), not the durable journal.
Line 1 is a header record; every subsequent line is one serialized
%Envelope{}.
decode/1 is the stand-in for the real agent-lane codec (which does not
exist in code yet; Raxol.Agent.Contract is the
shipped v0 slice). It is loud-reject: a structurally invalid line
produces a typed Raxol.Harness.Fixture.DecodeError, never a
best-effort partial parse. load/1 upcasts every envelope on read via
Raxol.Harness.Fixture.Upcast.
Summary
Functions
Decode one raw JSONL line into a Header or an Envelope.
Load a fixture file: decode every line, upcast each envelope's body to
the current schema, and assemble a Session. The header must be line 1
and unique; any envelope line failing decode/1 halts the load loud
(the offset in the resulting error is the 1-based line number).
Types
@type decoded() :: Raxol.Harness.Fixture.Header.t() | Raxol.Harness.Fixture.Envelope.t()
Functions
@spec decode(String.t()) :: {:ok, decoded()} | {:error, Raxol.Harness.Fixture.DecodeError.t()}
Decode one raw JSONL line into a Header or an Envelope.
Validates shape strictly: the top-level Event.type is checked against
the known family-scoped vocabulary (an unknown top-level type is a
version mismatch — a loud error per protocol §6). Vocabulary within a
known event (e.g. an unrecognized item_type inside a payload) is
deliberately NOT validated here — that is a projection-level, graceful-
opaque-render concern (unknown vocabulary renders as an opaque block),
out of scope for the decode seam.
@spec load(Path.t()) :: {:ok, Raxol.Harness.Fixture.Session.t()} | {:error, Raxol.Harness.Fixture.DecodeError.t()}
Load a fixture file: decode every line, upcast each envelope's body to
the current schema, and assemble a Session. The header must be line 1
and unique; any envelope line failing decode/1 halts the load loud
(the offset in the resulting error is the 1-based line number).
Offset integrity: interior blank lines are a :blank_line error (they
would desync offset from the physical line number); a trailing final
newline is tolerated.