Raxol.Harness.Fixture.Bless (Raxol v2.6.1)

View Source

Regenerates <name>.blocks.json snapshots by running a pluggable projector over each golden fixture session in a directory.

Mirrors the RATE precedent (priv/rate/golden.refs + mix raxol.rate --gen + assert RATE.run() == RATE.run(), 06-projection §7 open question 6) at the fixture/session level rather than the pixel-hash level. Adversarial fixtures are skipped — they are authored to be semantically pathological for a projection consumer, not blessed as golden output.

Two modes: the default writes snapshots; check: true diffs the on-disk snapshot against a fresh projection without writing anything and reports {:error, {:drift, names}} when any golden fixture's snapshot is stale or missing — the CI-facing half of the drift tripwire.

Summary

Types

result()

@type result() :: %{
  name: String.t(),
  path: Path.t(),
  blocks_path: Path.t() | nil,
  count: non_neg_integer() | nil,
  status: status()
}

status()

@type status() :: :written | :current | :drift | :skipped

Functions

default_dir()

@spec default_dir() :: Path.t()

run(opts \\ [])

@spec run(keyword()) :: {:ok, [result()]} | {:error, term()}

Run the bless pass.

Options:

  • :dir — directory containing *.jsonl fixtures (default test/fixtures/harness/sessions)
  • :projector — module implementing Raxol.Harness.Fixture.Projector (default Raxol.Harness.Fixture.Projectors.Identity)
  • :names — explicit fixture base names (without .jsonl) to bless; defaults to every fixture found in :dir
  • :check — when true, write nothing; compare each on-disk snapshot to a fresh projection and return {:error, {:drift, names}} if any differ or are missing