Raxol. Harness. Fixture. Session
(Raxol v2.6.1)
View Source
A fully-loaded fixture: header + the ordered, upcasted envelope list.
Helpers here are read-only projections over that list — the real
journal-fold projection (T7) is a separate, not-yet-built module; these
helpers exist so tests (and the bless task) don't hand-roll Enum
pipelines over envelopes everywhere.
Two axes — never conflate them
Every envelope carries two orthogonal positions:
body.id— the event's monotonic per-session id, i.e. the journal offset. This is the seek/identity axis:attach/seekcommands, replay identity, and dedup/ordering semantics all key off it. Query it withby_id/2.offset— the 1-based physical line in the fixture file. This is the diagnostic axis: where in the recorded stream a thing sits, what aDecodeErrorpoints at, whatpathologies/1indexes. Query it withfrom_offset/2/range/3.
In a well-formed stream they move in lockstep; in an adversarial one they deliberately diverge — id-reorder and duplicate-id corruptions are detectable precisely because the two axes disagree. A test that treats one as the other destroys that signal.
Summary
Functions
Envelopes whose body.id (journal offset — the seek/identity axis)
equals id. Returns a list: in a well-formed stream it has at most
one element, but adversarial streams carry duplicate ids on purpose,
and surfacing both is exactly how a dedup test sees the corruption.
Envelopes at or after the given 1-based line offset (inclusive).
The fixture's machine-readable corruption index (adversarial fixtures
only; [] otherwise): a list of %{class: String.t(), offset: pos_integer()}
read from the header's pathologies field. Downstream tests seek
named corruptions instead of hardcoding line numbers
Envelopes within the inclusive physical-line window
from..until (the diagnostic axis — see the moduledoc).
Types
@type t() :: %Raxol.Harness.Fixture.Session{ envelopes: [Raxol.Harness.Fixture.Envelope.t()], header: Raxol.Harness.Fixture.Header.t(), path: Path.t() }
Functions
@spec by_family(t(), Raxol.Harness.Fixture.Event.family()) :: [ Raxol.Harness.Fixture.Envelope.t() ]
@spec by_id(t(), non_neg_integer()) :: [Raxol.Harness.Fixture.Envelope.t()]
Envelopes whose body.id (journal offset — the seek/identity axis)
equals id. Returns a list: in a well-formed stream it has at most
one element, but adversarial streams carry duplicate ids on purpose,
and surfacing both is exactly how a dedup test sees the corruption.
@spec by_type(t(), atom()) :: [Raxol.Harness.Fixture.Envelope.t()]
@spec durable(t()) :: [Raxol.Harness.Fixture.Envelope.t()]
@spec ephemeral(t()) :: [Raxol.Harness.Fixture.Envelope.t()]
@spec from_offset(t(), pos_integer()) :: [Raxol.Harness.Fixture.Envelope.t()]
Envelopes at or after the given 1-based line offset (inclusive).
@spec pathologies(t()) :: [Raxol.Harness.Fixture.Header.pathology()]
The fixture's machine-readable corruption index (adversarial fixtures
only; [] otherwise): a list of %{class: String.t(), offset: pos_integer()}
read from the header's pathologies field. Downstream tests seek
named corruptions instead of hardcoding line numbers:
offset = Session.pathologies(session)
|> Enum.find(&(&1.class == "late_delta_after_seal")).offset
@spec range(t(), pos_integer(), pos_integer()) :: [Raxol.Harness.Fixture.Envelope.t()]
Envelopes within the inclusive physical-line window
from..until (the diagnostic axis — see the moduledoc).