Juggernaut.Store.Layout (Juggernaut v0.4.0)

Copy Markdown View Source

The layout of _build/juggernaut/ and its version (design notes §7).

ensure/1 creates the directory and its LAYOUT file. A directory with another layout version (or with content but no LAYOUT) is moved aside to a sibling juggernaut-old-<UTC timestamp> and a fresh one is started; old data is never read with the wrong layout and never deleted. A store moved aside within the same second as an earlier one gets a numbered name (-2, ...). Failures are infrastructure errors (exit 3).

ensure/2 comes first: a run calls it once, before anything else touches the store. The writers (Store.Lock.acquire/3, Store.History.append/2, Store.Runs.write/2) call check/1 and refuse a root without the current LAYOUT, because a later ensure/2 would move such a store, and everything just written into it, aside.

Summary

Functions

cache/results/: the per-mutant result cache, sharded by file (Juggernaut.Cache.Shard).

:ok when root is a store of the current layout (ensure/2 has run); otherwise an infrastructure error. The store writers check this before writing.

coverage/index.etf: the coverage index.

Makes root a store of the current layout: {:ok, :created}, {:ok, :current}, or {:ok, {:moved, old_path}} when an incompatible store was moved aside.

runs/<run_id>/events.ndjson: the NDJSON event stream.

runs/<run_id>/harness.log: worker stderr and diagnostics.

history/runs.ndjson: one summary line per finished run.

LAYOUT: the layout version.

lock: the checkout lock.

runs/<run_id>/mutation.json: the mutation-testing-elements export.

runs/<run_id>/mutants.ndjson: one {mutant, result} per line.

report/index.html: the last dashboard.

runs/<run_id>/.

runs/<run_id>/run.json: the run without mutants and results.

runs/: one directory per run.

sandbox/: the persistent project mirror.

server/: the warm server's address and token.

The layout version this Juggernaut writes.

Functions

cache_file(root)

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

cache/results/: the per-mutant result cache, sharded by file (Juggernaut.Cache.Shard).

check(root)

@spec check(Path.t()) :: :ok | {:error, Juggernaut.Error.t()}

:ok when root is a store of the current layout (ensure/2 has run); otherwise an infrastructure error. The store writers check this before writing.

coverage_index_file(root)

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

coverage/index.etf: the coverage index.

ensure(root, now \\ DateTime.utc_now())

@spec ensure(Path.t(), DateTime.t()) ::
  {:ok, :created | :current | {:moved, Path.t()}}
  | {:error, Juggernaut.Error.t()}

Makes root a store of the current layout: {:ok, :created}, {:ok, :current}, or {:ok, {:moved, old_path}} when an incompatible store was moved aside.

events_file(root, run_id)

@spec events_file(Path.t(), String.t()) :: Path.t()

runs/<run_id>/events.ndjson: the NDJSON event stream.

harness_log(root, run_id)

@spec harness_log(Path.t(), String.t()) :: Path.t()

runs/<run_id>/harness.log: worker stderr and diagnostics.

history_file(root)

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

history/runs.ndjson: one summary line per finished run.

layout_file(root)

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

LAYOUT: the layout version.

lock_file(root)

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

lock: the checkout lock.

mte_file(root, run_id)

@spec mte_file(Path.t(), String.t()) :: Path.t()

runs/<run_id>/mutation.json: the mutation-testing-elements export.

mutants_file(root, run_id)

@spec mutants_file(Path.t(), String.t()) :: Path.t()

runs/<run_id>/mutants.ndjson: one {mutant, result} per line.

report_file(root)

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

report/index.html: the last dashboard.

run_dir(root, run_id)

@spec run_dir(Path.t(), String.t()) :: Path.t()

runs/<run_id>/.

run_file(root, run_id)

@spec run_file(Path.t(), String.t()) :: Path.t()

runs/<run_id>/run.json: the run without mutants and results.

runs_dir(root)

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

runs/: one directory per run.

sandbox_dir(root)

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

sandbox/: the persistent project mirror.

server_dir(root)

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

server/: the warm server's address and token.

version()

@spec version() :: String.t()

The layout version this Juggernaut writes.