What a run takes from earlier work and leaves for later runs (design notes §7.3, §7.4):
triage claims and the per-mutant result cache, as Juggernaut.Engine uses them.
start/2, when the run starts: the cache mode of the lane and request (Juggernaut.Cache.mode/3), the triage file, and whether this run may write the cache: the gate lane with the cache on, a commit, and a tree clean underpaths, the test paths,config/,priv/,mix.lockand the data files ofcache_inputs(the clean-HEAD rule). Only such a run measures footprints. The digest of the data files (data_files/2) joins the cache's globals;triage/3, before compile: the mutants whose claim applies becomeequivalentresults and are not compiled; every claim on a mutant of the run is surfaced;lookup/5, after the probe: the cache is loaded under the run's globals, the tests are checked for weakening since each entry's commit, and the jobs whose entry stands become reused results instead of jobs ([:juggernaut, :cache, :lookup]);record/4, once the run is recorded: the new results of the jobs that ran are written to the cache, only if the tree is still clean at the same commit, so the hashes recorded are those of the code that was tested.
Summary
Functions
The pathspecs whose uncommitted changes make a run dirty (Juggernaut.Engine.Checkout):
inputs/2, mix.exs, the configuration .juggernaut.exs and the triage file, since
the options and the claims decide what runs and how it is scored.
The full commit when the project at request.root is clean under what cached results
rest on, else nil. Clean means git status lists nothing there nor among the data
files of cache_inputs (with :tracked, no tracked file is modified) and the project's
mix.exs is tracked: a project inside a directory its repository ignores (whose files
git status never lists) is never clean. Without git, or before the first commit, nil.
The files outside the code and the tests that cached results rest on (cache_inputs),
relative to request.root and sorted: with :tracked, every file git tracks except
those under paths and test_paths (their functions and test files are hashed
one by one) and the triage file (claims apply on their own); none without git. With
a list of globs, every regular file matching one.
The pathspecs a run's results rest on: paths, the test paths, config, priv, mix.lock.
The jobs of jobs the cache answers: {reused results, the jobs still to run, the state}. ctx holds the run's :root, :run_id, :store, :fingerprint,
:test_paths, :git, the index's :current hashes (globals, tests) and the boot
:inventory. With the cache off, every job runs.
Writes the cache entries of the jobs that ran in run (their results, with the
footprints by mutant id), when recordable?/2 holds. ctx is as for lookup/3 plus
:config.
Whether this run writes the cache when it ends: it may write (writable?) and the tree
is still clean at the commit it started on. ctx is as for record/4.
The reuse state of a run of request (:root, :config, :lane, :cache, :git)
with test paths test_paths, or the config error of a malformed triage file.
Splits mutants by their triage claims: {equivalent results, the mutants still to run}, with the claims of the run kept in the state.
Whether this run may write the cache when it ends: the lane writes, the tree was clean
when it started and the cache was loaded. recordable?/2 adds that the tree is still
clean.
Writes the cache entries as record/4 does, once the caller has checked
recordable?/2 (the engine checks it first, so a run that writes nothing has no
cache phase).
Types
@type t() :: %{ mode: Juggernaut.Cache.mode(), writable?: boolean(), commit: String.t() | nil, triage: Juggernaut.Triage.t(), claims: [map()], weakening: [map()], cache: Juggernaut.Cache.t() | nil, tests: %{required(String.t()) => String.t()}, data: String.t() | nil }
Functions
The pathspecs whose uncommitted changes make a run dirty (Juggernaut.Engine.Checkout):
inputs/2, mix.exs, the configuration .juggernaut.exs and the triage file, since
the options and the claims decide what runs and how it is scored.
The full commit when the project at request.root is clean under what cached results
rest on, else nil. Clean means git status lists nothing there nor among the data
files of cache_inputs (with :tracked, no tracked file is modified) and the project's
mix.exs is tracked: a project inside a directory its repository ignores (whose files
git status never lists) is never clean. Without git, or before the first commit, nil.
The files outside the code and the tests that cached results rest on (cache_inputs),
relative to request.root and sorted: with :tracked, every file git tracks except
those under paths and test_paths (their functions and test files are hashed
one by one) and the triage file (claims apply on their own); none without git. With
a list of globs, every regular file matching one.
The pathspecs a run's results rest on: paths, the test paths, config, priv, mix.lock.
The jobs of jobs the cache answers: {reused results, the jobs still to run, the state}. ctx holds the run's :root, :run_id, :store, :fingerprint,
:test_paths, :git, the index's :current hashes (globals, tests) and the boot
:inventory. With the cache off, every job runs.
@spec record(t(), Juggernaut.Run.t(), [map()], map()) :: :ok | {:error, Juggernaut.Error.t()}
Writes the cache entries of the jobs that ran in run (their results, with the
footprints by mutant id), when recordable?/2 holds. ctx is as for lookup/3 plus
:config.
Whether this run writes the cache when it ends: it may write (writable?) and the tree
is still clean at the commit it started on. ctx is as for record/4.
@spec start(map(), [String.t()]) :: {:ok, t()} | {:error, Juggernaut.Error.t()}
The reuse state of a run of request (:root, :config, :lane, :cache, :git)
with test paths test_paths, or the config error of a malformed triage file.
@spec triage(t(), [Juggernaut.Mutant.t()], Path.t()) :: {[Juggernaut.Result.t()], [Juggernaut.Mutant.t()], t()}
Splits mutants by their triage claims: {equivalent results, the mutants still to run}, with the claims of the run kept in the state.
Whether this run may write the cache when it ends: the lane writes, the tree was clean
when it started and the cache was loaded. recordable?/2 adds that the tree is still
clean.
@spec write(t(), Juggernaut.Run.t(), [map()], map()) :: :ok | {:error, Juggernaut.Error.t()}
Writes the cache entries as record/4 does, once the caller has checked
recordable?/2 (the engine checks it first, so a run that writes nothing has no
cache phase).