# Juggernaut v0.4.0 - API Reference

## Modules

- API
  - [Juggernaut](Juggernaut.md): Fast mutation testing for Elixir.
  - [Juggernaut.Error](Juggernaut.Error.md): An error that stops a task before or instead of a verdict.
  - [Juggernaut.Mutant](Juggernaut.Mutant.md): One replacement at one site (design notes §6, §14.1).
  - [Juggernaut.MutantId](Juggernaut.MutantId.md): Canonical mutant keys and short ids (design notes §6).
  - [Juggernaut.Phase](Juggernaut.Phase.md): One timed phase of a run (design notes §10.1, §15). `started_ms` is milliseconds since
the run started.

  - [Juggernaut.Result](Juggernaut.Result.md): What happened to one mutant in one run (design notes §10.7, §14.1).
  - [Juggernaut.Run](Juggernaut.Run.md): One mutation run: what was asked, where, by whom, and what happened (design notes §14.1).
  - [Juggernaut.Summary](Juggernaut.Summary.md): The scored outcome of a run (design notes §10.7, §14.1).
  - [Juggernaut.Telemetry](Juggernaut.Telemetry.md): The `:telemetry` events Juggernaut emits. Names and metadata keys are a public API: a
rename is a breaking change.
  - [Juggernaut.TestRef](Juggernaut.TestRef.md): One ExUnit test, as recorded for a mutant (design notes §14.1).

- Configuration
  - [Juggernaut.Config](Juggernaut.Config.md): The validated configuration of one project (see the [configuration guide](configuration.md)).
  - [Juggernaut.Ignore](Juggernaut.Ignore.md): Ignore comments (design notes §8.3): Mutare's grammar under each configured prefix
(default `juggernaut:ignore` and `mutare:ignore`).
  - [Juggernaut.Ignore.Directive](Juggernaut.Ignore.Directive.md): One parsed ignore directive (`Juggernaut.Ignore`): its prefix, scope, the lines it
covers (`first` for a line directive, `first..last` for a region, all for a file), its
filter (`nil` for none, else `{family, label | nil}` items) and reason.

  - [Juggernaut.Routing](Juggernaut.Routing.md): Raw, skipped and arid calls (design notes §8.2, §8.4).
  - [Juggernaut.TestLanes](Juggernaut.TestLanes.md): The test lanes of a project (`test_lanes` in `.juggernaut.exs`, design notes §10.6):
which of its tests are integration tests, and the timeouts each lane is held to.
  - [Juggernaut.Triage](Juggernaut.Triage.md): The committed triage file, `.juggernaut.triage.json` (design notes §7.4): claims that a
mutant is equivalent (no test can tell it from the original), each with its reason,
who made it and the hash of the mutated function when it was made.
  - [Juggernaut.WarmSafe](Juggernaut.WarmSafe.md): Warm-safe declarations (design notes §10.8, §7.5): the committed file
`.juggernaut.warm_safe.json`, in which a person says that the boot-set mutants of a
function may be settled on a warm worker instead of a fresh boot each.
  - [Juggernaut.Config.Loader](Juggernaut.Config.Loader.md): Reads and checks `.juggernaut.exs` (see the [configuration guide](configuration.md)).
  - [Juggernaut.Config.Mutare](Juggernaut.Config.Mutare.md): Converts a Mutare 0.5.1 `.mutare.exs` to Juggernaut configuration (design notes §3,
`mix juggernaut.install --from-mutare`).
  - [Juggernaut.Config.Schema](Juggernaut.Config.Schema.md): The NimbleOptions schema of `.juggernaut.exs` (see the [configuration guide](configuration.md)).

- Output formats
  - [Juggernaut.View](Juggernaut.View.md): The output formats of a run (design notes §5, §11) and the pieces they share.
  - [Juggernaut.View.Advise](Juggernaut.View.Advise.md): `mix juggernaut.advise` for people (`:human`) and for agents (`:agent`, one JSON
document, `"kind": "advise"`), from `Juggernaut.Advise.analyse/2`, and the result of
`--verify` (`verified/2`).
  - [Juggernaut.View.Agent](Juggernaut.View.Agent.md): The agent format (`--format agent`, see the [agent output guide](agent-output.md)): one
compact JSON document, format 1, summary first, then one page of survivors, then where
the page sits.
  - [Juggernaut.View.Compare](Juggernaut.View.Compare.md): A comparison (`Juggernaut.Compare`) for people, agents and pull requests
(`mix juggernaut.compare`, design notes §3): how the sides were paired, the blocking
class first (killed in A, not killed in B, on core), every other status change, the
counts, both score formulas, and the time each side took: measured wall and phase
clocks, and the recorded per-mutant durations of the mutants both sides ran.
  - [Juggernaut.View.DryRun](Juggernaut.View.DryRun.md): The mutant inventory of `mix juggernaut --dry-run` (design notes §3): counts by file and
by operator, ignored mutants, compile-time sites that are not mutated, and the ignore
and routing warnings.
  - [Juggernaut.View.Explain](Juggernaut.View.Explain.md): One mutant of a run in full (`mix juggernaut.explain`, see the
[agent output guide](agent-output.md)): where it is, what changed (diff and source
excerpt), its status and kill kind, the test that killed it (`file:line`) or the tests
that ran and passed, why those tests were selected, the nearest miss, any ignore
comment or triage claim, where a reused result came from, the control rerun and its
duration.
  - [Juggernaut.View.Github](Juggernaut.View.Github.md): The GitHub Actions format (`--format github`, design notes §5.4): one workflow-command
annotation per survivor, then the run summary as one annotation.
  - [Juggernaut.View.History](Juggernaut.View.History.md): The run history (`mix juggernaut.history`, design notes §3, §7.2): one row per recorded
run, newest first, then trends over the runs shown, oldest to newest, as sparklines of
the score, the mutant count, the wall time and the results reused.
  - [Juggernaut.View.Human](Juggernaut.View.Human.md): The human format (design notes §5.1): survivors, each with its diff, the tests that ran
and how to re-check it, then a summary with the counts, scores against the thresholds,
the measured phase times, the recorded time of reused results, new ignores, triage
claims and the gate verdict with the rules that failed. A `Lanes` row names the mutants
killed only by integration tests (`Juggernaut.View.integration_only/2`), when there are
any.
  - [Juggernaut.View.JSON](Juggernaut.View.JSON.md): JSON encoding for the machine formats (design notes §5.2).
  - [Juggernaut.View.Live](Juggernaut.View.Live.md): The human view of a run as it goes (design notes §5.1): a quiet progress line, each
survivor printed as soon as it is found, then the summary.
  - [Juggernaut.View.MTE](Juggernaut.View.MTE.md): The mutation-testing-elements report (`--format json`, design notes §5.4), schema
version 2, the format Stryker and Mutare write (deps:mutation-testing-elements).
  - [Juggernaut.View.Markdown](Juggernaut.View.Markdown.md): The markdown format (`--format markdown`, design notes §5.4), for pull requests, CI step
summaries and release notes: a summary table, the failed rules, the score of each file,
one page of survivors grouped by file with their diffs, the mutants killed only by
integration tests (when there are any), and the measured timings.
  - [Juggernaut.View.Profile](Juggernaut.View.Profile.md): Where a run's time went (`mix juggernaut.profile`, design notes §3): the phase clocks,
the duration of mutant jobs by test selection (p50, p90, p99, max), the fallbacks to a
whole file, the whole suite or the boot lane and the functions that caused them, the
tests that cost the most across mutant jobs, worker utilisation and recycles, the
results reused (recorded time), the selection misses found by reconfirmation, and the
boot set: how many of its mutants a warm worker killed (strikes for the boot lane), how
many the boot lane ran and how many of those a strike killed, at what concurrency and
why (as the run recorded it, `Juggernaut.Run`).
  - [Juggernaut.View.Stream](Juggernaut.View.Stream.md): The NDJSON event stream (`--stream`, see the [agent output guide](agent-output.md)),
format 1: one compact JSON object per line, each with `v`, `event`, `run_id` and `t_ms`
(milliseconds since the run started) first.
  - [Juggernaut.View.Survivors](Juggernaut.View.Survivors.md): The survivors of a run, grouped (`mix juggernaut.survivors`, design notes §3): the
mutants `Juggernaut.View.survivors/2` lists (survived, not covered, and timeouts when
they are scored as survived), grouped by file, module or operator.

- Dashboard
  - [Juggernaut.Report](Juggernaut.Report.md): Writes the HTML dashboard of recorded runs (`mix juggernaut.report`, design notes §3,
§11): reads the selected run, the run recorded before it and the history, builds the
data document (`Juggernaut.Report.Data`) and writes the page (`Juggernaut.Report.Html`)
atomically.
  - [Juggernaut.Report.Assets](Juggernaut.Report.Assets.md): The dashboard's stylesheet and script (`Juggernaut.Report.Html`), kept as plain files
next to this module (`assets/report.css`, `assets/report.js`) and read at compile time,
so the page needs nothing at run time and the package ships them inside the beam.

  - [Juggernaut.Report.CodeMap](Juggernaut.Report.CodeMap.md): The code map's data (design notes §11): the run's files, each with its functions, and
for each the mutants counted by how they ended. `density` is the share of scored
mutants listed as survivors (survived, not covered, or a timeout scored as survived),
`nil` when nothing there was scored; the page colours by it. A file's `score` is the
one its run recorded (`nil` when the summary has none).
  - [Juggernaut.Report.Data](Juggernaut.Report.Data.md): The data document the HTML dashboard embeds (`mix juggernaut.report`, design notes §11).
  - [Juggernaut.Report.Html](Juggernaut.Report.Html.md): The dashboard page (`mix juggernaut.report`, design notes §11): one HTML file holding its
styles, its script and its data (`Juggernaut.Report.Data`) inline. A Content Security
Policy forbids every network request, so the page works offline and leaks nothing.
  - [Juggernaut.Report.Overview](Juggernaut.Report.Overview.md): The overview page's data (design notes §11): the recorded verdict, each gate rule with
the recorded score it was judged on and whether the run's recorded failures name it,
the counts and kill kinds, the survivors with the new ones first, the mutants killed only
by integration tests, new ignores, triage claims, reuse and the wall time.
  - [Juggernaut.Report.Tests](Juggernaut.Report.Tests.md): The test effectiveness page's data (design notes §11), from the mutant jobs this run
ran (a selection other than none, not reused: `Juggernaut.Report.Data.job?/1`).
  - [Juggernaut.Report.Trends](Juggernaut.Report.Trends.md): Trends over the recorded history (design notes §7.2, §11): one point per history record,
oldest first, as recorded. A field that is missing or of the wrong type is `nil` (shown
as a gap), so one odd record never stops the page, as in `mix juggernaut.history`.

- Operators
  - [Juggernaut.Operator](Juggernaut.Operator.md): The behaviour of an operator family (design notes §8.1).
  - [Juggernaut.Operators.Alias](Juggernaut.Operators.Alias.md): A module alias used as a value → `Juggernaut.Sentinel`, a module that does not exist
(Mutare `alias`). Never a call target, a struct name, a directive argument or a
`rescue` type (the walk does not offer those).

  - [Juggernaut.Operators.Arithmetic](Juggernaut.Operators.Arithmetic.md): `+`↔`-`, `*`↔`/`, `div`↔`rem`, and unary `-x`→`x` (Mutare `arithmetic`).
  - [Juggernaut.Operators.Atom](Juggernaut.Operators.Atom.md): A literal atom → `:juggernaut` (Mutare `atom`).
  - [Juggernaut.Operators.Bitstring](Juggernaut.Operators.Bitstring.md): A non-empty bitstring constructor `<<...>>` → `<<>>` (Mutare `bitstring`). Not an
interpolated string, not sigil contents, not in patterns.

  - [Juggernaut.Operators.BitstringSpec](Juggernaut.Operators.BitstringSpec.md): The encoding of a bitstring segment (Mutare `bitstring_spec`): `utf8`, `utf16` and
`utf32` → each other encoding (endianness dropped for `utf8`), and for `utf16`/`utf32`
`big`↔`little` (a bare one gets `little`). Runtime constructors only.
  - [Juggernaut.Operators.Bitwise](Juggernaut.Operators.Bitwise.md): `&&&`↔`|||` (`band`↔`bor`), `<<<`↔`>>>` (`bsl`↔`bsr`) and `~~~x`→`x` (`bnot`)
(Mutare `bitwise`). A shift by a literal `0` is left alone. Variants name the new
operator in its symbolic form.

  - [Juggernaut.Operators.Boolean](Juggernaut.Operators.Boolean.md): `true`↔`false` literals (Mutare `boolean`).
  - [Juggernaut.Operators.CallRemoval](Juggernaut.Operators.CallRemoval.md): Replaces a type-preserving transform call with its first argument (Mutare
`call_removal`); a pipe stage is removed (`xs |> Enum.sort()` → `xs`).
  - [Juggernaut.Operators.Catalog](Juggernaut.Operators.Catalog.md): The names and categories of the 47 operator families, as Mutare 0.5.1 names them
(`docs/research/mutare-operators.md`).
  - [Juggernaut.Operators.Charlist](Juggernaut.Operators.Charlist.md): A `~c` or `~C` charlist → `~c""` (`empty`) and `~c"juggernaut"` (`sentinel`); a plain
`'...'` charlist gets only the sentinel (`list` makes the empty one) (Mutare
`charlist`).

  - [Juggernaut.Operators.ClauseDrop](Juggernaut.Operators.ClauseDrop.md): Removes one body-bearing clause of a `def` or `defp` that has at least two (Mutare
`clause_drop`), so its inputs fall through to a later clause. A bodiless head is never
removed.

  - [Juggernaut.Operators.Collection](Juggernaut.Operators.Collection.md): Renames a collection call to its complement, arity kept (Mutare `collection`):
`filter`↔`reject`, `all?`↔`any?`, `min`↔`max`, `min_by`↔`max_by`, `take`↔`drop` (and
their `_while` and `_every` forms), `sum`↔`product` on `Enum`; `filter`↔`reject` and
`take`↔`drop` on `Map`, `Keyword` and `Stream`; `first`↔`last` and `foldl`↔`foldr` on
`List`; `filter`↔`reject` on `MapSet`.

  - [Juggernaut.Operators.CollectionArity](Juggernaut.Operators.CollectionArity.md): Replaces a collection call with a related call of another arity (Mutare
`collection_arity`): `Enum.sort/1,2` and `Enum.sort_by/2,3` → `Enum.reverse/1`,
`Enum.reverse/1` → `Enum.sort/1`, `Enum.count/2` → `Enum.count/1`,
`Enum.count_until/3` → `Enum.count_until/2`, `Access.get_and_update/3` → `Access.get/2`.

  - [Juggernaut.Operators.Conditional](Juggernaut.Operators.Conditional.md): A boolean-valued comparison, membership or connective expression → `true` and `false`
(Mutare `conditional`).

  - [Juggernaut.Operators.Convention](Juggernaut.Operators.Convention.md): Swaps convention atoms for their counterpart (Mutare `convention`): a tuple tagged
`:ok`↔`:error` or `:cont`↔`:halt`, and a bare `:lt`↔`:gt`. Also in patterns.

  - [Juggernaut.Operators.Datetime](Juggernaut.Operators.Datetime.md): A date or time sigil moved by one unit (Mutare `datetime`): `~D`, `~N` and `~U` by one
day, `~T` by one second. A value that cannot move forward (the year 9999) moves back.
A sigil whose contents do not parse is left alone.

  - [Juggernaut.Operators.DefaultDrop](Juggernaut.Operators.DefaultDrop.md): Drops a trailing optional argument so that its default applies (Mutare
`default_drop`): `Map`, `Keyword` and `Access` `get/3`, `Map` and `Keyword` `pop/3`,
`Enum.at/3`, `List.keyfind/4`; the `_lazy` forms become the plain ones without the
function; `Float.round/2`, `Float.ceil/2`, `Float.floor/2`, `Integer.to_string/2`,
`Integer.parse/2`, `Integer.digits/2`, `Enum.join/2`, `String.pad_leading/3`,
`String.pad_trailing/3`, `String.trim/2`, `String.trim_leading/2` and
`String.trim_trailing/2`.
Skipped when the argument already is the default literal.

  - [Juggernaut.Operators.Float](Juggernaut.Operators.Float.md): A float literal `x` → `x + 1.0`, `x - 1.0` and `0.0` (Mutare `float`).
  - [Juggernaut.Operators.Genserver](Juggernaut.Operators.Genserver.md): Turns a `GenServer` callback's return into another valid one (Mutare `genserver`), in
`handle_call/3`, `handle_cast/2`, `handle_info/2` and `handle_continue/2` of a module
that uses or declares `GenServer`: `{:reply, r, s}` → `{:noreply, s}`;
`{:noreply, s}` → `{:stop, :normal, s}`; `{:stop, reason, s}` → `{:noreply, s}`;
`{:stop, reason, reply, s}` → `{:reply, reply, s}`. A trailing timeout or continue
element is kept with `:noreply`.

  - [Juggernaut.Operators.GuardDrop](Juggernaut.Operators.GuardDrop.md): Removes the `when` guard of a function head or a single-pattern clause (Mutare
`guard_drop`): `def`, `defp`, `case`, `receive`, `fn` and generators.
  - [Juggernaut.Operators.Helpers](Juggernaut.Operators.Helpers.md): Building blocks shared by the operator families: operator swaps, table-driven call
renames and literal replacements.

  - [Juggernaut.Operators.IfCondition](Juggernaut.Operators.IfCondition.md): The condition of an `if`, `unless` or `cond` clause → `true` and `false` (Mutare
`if_condition`).
  - [Juggernaut.Operators.Integer](Juggernaut.Operators.Integer.md): An integer literal `n` → `n + 1`, `n - 1` and `0`, without duplicates (Mutare
`integer`). Timeout and duration arguments of known calls are left alone.

  - [Juggernaut.Operators.IntegerCall](Juggernaut.Operators.IntegerCall.md): `Integer.mod`↔`Integer.floor_div` and `Integer.is_even`↔`Integer.is_odd` (Mutare
`integer_call`). Also in guards.

  - [Juggernaut.Operators.KeywordDelete](Juggernaut.Operators.KeywordDelete.md): `Keyword.delete/2`↔`Keyword.delete_first/2` (Mutare `keyword_delete`).
  - [Juggernaut.Operators.List](Juggernaut.Operators.List.md): `++`↔`--`, and a non-empty list literal → `[]` (`empty`) (Mutare `list`). A charlist
literal counts as a list. The collapse is not made on the right of `in` in a guard.

  - [Juggernaut.Operators.Logical](Juggernaut.Operators.Logical.md): `and`↔`or`, `&&`↔`||`, `not x`→`x` and `!x`→`x` (Mutare `logical`).

  - [Juggernaut.Operators.Map](Juggernaut.Operators.Map.md): A non-empty map literal → `%{}` (Mutare `map`). Not a map update (`%{m | k: v}`), not
a struct's fields, not in a pattern or on the right of `in`.

  - [Juggernaut.Operators.MapKeyword](Juggernaut.Operators.MapKeyword.md): Swaps the insertion functions of `Map` and `Keyword` at arity 3 (Mutare `map_keyword`):
`put`↔`put_new`, `put`↔`replace`, `put_new`↔`replace`, `replace`↔`replace!`.

  - [Juggernaut.Operators.MapSet](Juggernaut.Operators.MapSet.md): `MapSet.union`↔`MapSet.intersection` (Mutare `map_set`).
  - [Juggernaut.Operators.Math](Juggernaut.Operators.Math.md): Erlang `:math` swaps (Mutare `math`): `pi()` → `3.0`, `tau()` → `6.0`, `sin`↔`cos`,
`asin`↔`acos`, `sinh`↔`cosh`, `asinh`↔`acosh`, and `log`, `log2`, `log10` to each of
the other two.

  - [Juggernaut.Operators.ModeSwap](Juggernaut.Operators.ModeSwap.md): Swaps a mode or unit atom argument of a standard-library call for its neighbours in
an ordered set (Mutare `mode_swap`, a reduced set): time units (`:second`,
`:millisecond`, `:microsecond`, `:nanosecond`) in `System` clocks and conversions,
`DateTime`/`NaiveDateTime`/`Time` `add`, `diff`, `truncate`, `to_unix`, `from_unix`
and `utc_now`, and `:asc`↔`:desc` in `Enum.sort/2` and `Enum.sort_by/3`. At most two
replacements per argument (the neighbours).
  - [Juggernaut.Operators.Numeric](Juggernaut.Operators.Numeric.md): Numeric function pairs (Mutare `numeric`): `min`↔`max`, `round`↔`trunc`,
`ceil`↔`floor` (Kernel, also in guards), `Float.ceil`↔`Float.floor`,
`Float.max_finite`↔`Float.min_finite`.

  - [Juggernaut.Operators.OperandSwap](Juggernaut.Operators.OperandSwap.md): Reverses the first two operands of a non-commutative operation (Mutare
`operand_swap`): `-`, `/`, `**`, `<>`, `++`, `--`, `div`, `rem`, and the order-sensitive
calls `before?`, `after?`, `compare` and `diff` of `Date`, `Time`, `DateTime` and
`NaiveDateTime`, `Version.compare/2`, `MapSet.difference/2` and `MapSet.subset?/2`.
Identical operands are skipped. A piped call swaps the piped value too.

  - [Juggernaut.Operators.PatternSwap](Juggernaut.Operators.PatternSwap.md): Exchanges two variables of different names inside a pattern container (Mutare
`pattern_swap`): the elements of a tuple or list, or the values of a map or keyword
list. One mutant per pair. `_` and `_name` variables are not moved, nor are pinned
ones; keys stay in place. A whole argument list is not a container.
  - [Juggernaut.Operators.PatternWildcard](Juggernaut.Operators.PatternWildcard.md): A variable bound more than once in one pattern → `_` at one occurrence, removing the
equality constraint (Mutare `pattern_wildcard`). One mutant per occurrence.
  - [Juggernaut.Operators.PeriodBoundary](Juggernaut.Operators.PeriodBoundary.md): Swaps the start and end of a period (Mutare `period_boundary`):
`Date.beginning_of_month`↔`end_of_month`, `Date.beginning_of_week`↔`end_of_week`,
`NaiveDateTime.beginning_of_day`↔`end_of_day`.

  - [Juggernaut.Operators.Regex](Juggernaut.Operators.Regex.md): Mutates a non-interpolated `~r` sigil (Mutare `regex`, a reduced set). Each change is
its own mutant, labelled with Mutare's variants
  - [Juggernaut.Operators.Registry](Juggernaut.Operators.Registry.md): The operator family modules, one per name in `Juggernaut.Operators.Catalog`, in
registry order (design notes §8.1). A family `:string_call` is the module
`Juggernaut.Operators.StringCall`.

  - [Juggernaut.Operators.Relational](Juggernaut.Operators.Relational.md): Comparison boundaries and reversals (Mutare `relational`): `>`→`>=`,`<`;
`>=`→`>`,`<=`; `<`→`<=`,`>`; `<=`→`<`,`>=`; `==`↔`!=`; `===`↔`!==`; `in`→`not in`.
Variants name the new operator (`in`→`not in` has none).

  - [Juggernaut.Operators.RescueType](Juggernaut.Operators.RescueType.md): Narrows what a `rescue` catches (Mutare `rescue_type`): `e in [A, B]` → `e in A` and
`e in B`, and one of several `rescue` clauses removed.

  - [Juggernaut.Operators.ReturnValue](Juggernaut.Operators.ReturnValue.md): Replaces each return path of a `def`, `defp` or `fn` clause with a constant of its
shape (Mutare `return_value`)
  - [Juggernaut.Operators.StrictEquality](Juggernaut.Operators.StrictEquality.md): `===`→`==` and `!==`→`!=`, one way (Mutare `strict_equality`): tests whether the
integer/float distinction matters.

  - [Juggernaut.Operators.String](Juggernaut.Operators.String.md): A string literal, plain or interpolated → `""` (`empty`) and `"juggernaut"`
(`sentinel`) (Mutare `string`). In a pattern only the sentinel is made, and only for a
plain string. A replacement equal to the original is omitted.

  - [Juggernaut.Operators.StringByte](Juggernaut.Operators.StringByte.md): `String.length(s)` → `byte_size(s)`, one way (Mutare `string_byte`): shows whether
non-ASCII input is tested.

  - [Juggernaut.Operators.StringCall](Juggernaut.Operators.StringCall.md): Renames a string call to its mirror (Mutare `string_call`): on `String`,
`starts_with?`↔`ends_with?`, `upcase`↔`downcase`, `trim_leading`↔`trim_trailing`,
`replace_prefix`↔`replace_suffix`, `replace_leading`↔`replace_trailing`,
`pad_leading`↔`pad_trailing`, `first`↔`last`, `graphemes`↔`codepoints`; on `:string`,
`uppercase`↔`lowercase`; on `:binary`, `first`↔`last`. `String.equivalent?(a, b)`
becomes `a == b`.

  - [Juggernaut.Operators.StringSigil](Juggernaut.Operators.StringSigil.md): A `~s` or `~S` sigil → `""` (`empty`) and `"juggernaut"` (`sentinel`) (Mutare
`string_sigil`).

  - [Juggernaut.Operators.TemporalOrder](Juggernaut.Operators.TemporalOrder.md): `before?`↔`after?` on `Date`, `Time`, `DateTime` and `NaiveDateTime` (Mutare
`temporal_order`).

  - [Juggernaut.Operators.Tuple](Juggernaut.Operators.Tuple.md): A non-empty tuple literal → `{}` (Mutare `tuple`). Not in patterns, and not in the
pattern of a `match?/2` when the tuple binds a variable: `match?({:ok, info} when
ok?(info), x)` with `{}` leaves `info` unbound in the guard, so the mutant would not
compile.

  - [Juggernaut.Operators.WordList](Juggernaut.Operators.WordList.md): A non-interpolated `~w` or `~W` word list → `~w()` (`empty`) and `~w(juggernaut)`
(`sentinel`), modifiers kept (Mutare `word_list`). The empty one is not made on the
right of `in` in a guard.

- Internals
  - [Juggernaut.Advise](Juggernaut.Advise.md): What `mix juggernaut.advise` says about a recorded run (design notes §3, §10.8), from data
Juggernaut already keeps: the run's results (each mutant's selection), the coverage
index (who hit each site, `Juggernaut.Coverage.Index`), the warm/fresh pairs of its
boot set (`Juggernaut.WarmSafe.pairs/2`) and the tags the test files carry.
  - [Juggernaut.Advise.Tags](Juggernaut.Advise.Tags.md): The tags each test file declares, read from its source without running it, for
`mix juggernaut.advise` (`Juggernaut.Advise`): `@moduletag`, `@describetag` and `@tag`
values (an atom, a list of atoms, or `key: value` with a truthy value), plus the tags of
each case template the file `use`s that is defined under the test paths (a
`Juggernaut.IntegrationCase` whose `using` block sets `@moduletag :fixture`, say).
  - [Juggernaut.CLI](Juggernaut.CLI.md): Runs a `Juggernaut.CLI.Task`: parses argv, prints `--help`, executes, reports errors
and returns the exit code (design notes §3).
  - [Juggernaut.Cache](Juggernaut.Cache.md): The per-mutant result cache (design notes §7.3, `_build/juggernaut/cache/results/`):
a mutant's result from an earlier run, reused while nothing that decided it changed.
  - [Juggernaut.Compare](Juggernaut.Compare.md): Compares two sides mutant by mutant (`mix juggernaut.compare`, design notes §3): two
recorded runs, or an imported report (`Juggernaut.Import.MTE`, the baseline A) and a run
(B).
  - [Juggernaut.Coverage](Juggernaut.Coverage.md): Coverage for a run (design notes §10.5): which tests each mutant runs.
  - [Juggernaut.Diff](Juggernaut.Diff.md): Where a site is in the original text, and the mutant as a patch of that text
(design notes §6, `docs/dependencies/sourceror.md`).
  - [Juggernaut.Engine](Juggernaut.Engine.md): One mutation run from end to end (design notes §10.1), and `check/1` of named mutants.
  - [Juggernaut.Failures](Juggernaut.Failures.md): How an infrastructure error says why tests failed, not only which: the first failing
outcome's failure message (`Juggernaut.Peer.Formatter`'s `failure`), its whitespace
collapsed and cut at 300 characters, so the error fits on one line and the cause needs
no rerun by hand.

  - [Juggernaut.Import.MTE](Juggernaut.Import.MTE.md): Reads a mutation-testing-elements report (Mutare 0.5.1, Stryker, or our own export) as
one side of a comparison (`mix juggernaut.compare --mutare`, design notes §3;
deps:mutation-testing-elements).
  - [Juggernaut.Install](Juggernaut.Install.md): The file edits behind `mix juggernaut.install` (design notes §3), as pure functions of
file contents, so they are tested without Igniter and the installer stays a thin layer
over them. Each edit detects its own earlier application, which keeps the installer
idempotent.

  - [Juggernaut.Mutator](Juggernaut.Mutator.md): Turns one source file into its mutants (design notes §6, §8, §10.1 step 3).
  - [Juggernaut.Parallel](Juggernaut.Parallel.md): Maps over a collection a scheduler each at once, for work on files (reading, parsing,
writing) whose results do not depend on their order.

  - [Juggernaut.Plan](Juggernaut.Plan.md): Resolves a run's scope to files and lines, and turns them into the run's mutants
(design notes §3, §10.1 steps 2-3).
  - [Juggernaut.Pool](Juggernaut.Pool.md): The warm pool: a supervisor of `Juggernaut.Pool.Worker`s, one `:peer` each, all booted
in the sandbox at once (design notes §10.5).
  - [Juggernaut.Runner](Juggernaut.Runner.md): Runs scheduled jobs on the warm pool and turns each into a `Juggernaut.Result`
(design notes §10.6-§10.8).
  - [Juggernaut.Sandbox](Juggernaut.Sandbox.md): The persistent mirror of the project that mutants are compiled and run in
(design notes §10.2): `_build/juggernaut/sandbox/`, a Mix project of its own with its
own `_build/test`, at a stable path so Mix stays incremental.
  - [Juggernaut.Schemata](Juggernaut.Schemata.md): Metamutant schemata (design notes §10.3, §10.4): every mutant of a run compiled once,
each turned on by its switch (`Juggernaut.Peer.Switch`).
  - [Juggernaut.Server](Juggernaut.Server.md): The warm daemon of one checkout (`mix juggernaut.server`, design notes §12): one pool of
workers kept between runs, a FIFO queue of jobs, and a socket clients attach to.
  - [Juggernaut.Store](Juggernaut.Store.md): The files Juggernaut keeps under `_build/juggernaut/` (design notes §7).
  - [Juggernaut.Verdict](Juggernaut.Verdict.md): The gate (design notes §10.7): a run's counts, scores and verdict from its mutants and
results.
  - [Juggernaut.Watch](Juggernaut.Watch.md): `--watch` (design notes §12): polls the modification times and sizes of the files under
`paths`, `test_paths` and `config/` every 500 ms (no file-system dependency), waits until
a change has been still for 300 ms, then asks the server for an inner-lane run of what
changed (`mix juggernaut --lane inner`: the clauses changed since `base`, uncommitted
work included).
  - [Juggernaut.CLI.ExitCode](Juggernaut.CLI.ExitCode.md): Exit codes shared by every `mix juggernaut*` task (see the
[agent output guide](agent-output.md)).
  - [Juggernaut.CLI.Inputs](Juggernaut.CLI.Inputs.md): What the analysis tasks read before they call a view (design notes §3, §11): a recorded
run from the store, and the view options a run does not hold (the configured
thresholds and timeout scoring, the source of the mutated files for excerpts, and the
test files that exist for the suggested test file).
  - [Juggernaut.CLI.Options](Juggernaut.CLI.Options.md): Argument parsing shared by every `mix juggernaut*` task (design notes §3).
  - [Juggernaut.CLI.RunOutput](Juggernaut.CLI.RunOutput.md): What `mix juggernaut` writes while a run goes and when it ends (design notes §5): a pure
reducer over the engine's run events (`t:Juggernaut.View.Stream.event/0`).
  - [Juggernaut.CLI.Task](Juggernaut.CLI.Task.md): The behaviour of every `mix juggernaut*` task (design notes §3, §14).
  - [Juggernaut.Cache.Footprint](Juggernaut.Cache.Footprint.md): Function hashes, and the footprint a cached result rests on (design notes §7.3).
  - [Juggernaut.Cache.Shard](Juggernaut.Cache.Shard.md): The result cache on disk (design notes §7.3): one compact JSON file per mutated source
file, under a directory named for the cache's globals.
  - [Juggernaut.Cache.Weakening](Juggernaut.Cache.Weakening.md): Whether the tests were weakened since a cached result was recorded (design notes §7.3),
from the patch of the test paths and `config/` between the entry's commit and the
working tree (untracked files read as added lines).
  - [Juggernaut.Coverage.Index](Juggernaut.Coverage.Index.md): The coverage index (design notes §10.5, `_build/juggernaut/coverage/index.etf`): what
each probed test file hit, kept between runs so that a run probes only the test files
whose coverage may have changed.
  - [Juggernaut.Coverage.Probe](Juggernaut.Coverage.Probe.md): The coverage probe (design notes §10.5): every test file run once on the warm pool with
the switch in probe mode, to learn which tests run each site.
  - [Juggernaut.Coverage.Selection](Juggernaut.Coverage.Selection.md): Which tests a mutant runs, from the probe's labels (design notes §10.5).
  - [Juggernaut.Engine.Checkout](Juggernaut.Engine.Checkout.md): What a run records about the checkout it ran in (design notes §7.2): the commit, whether
the tree was dirty, and a hash of the dirt.
  - [Juggernaut.Engine.Reconfirm](Juggernaut.Engine.Reconfirm.md): The reconfirmation of core survivors (design notes §10.8), in the gate and release
lanes once the main jobs have run.
  - [Juggernaut.Engine.Request](Juggernaut.Engine.Request.md): The validated request of `Juggernaut.Engine.run/1` and `Juggernaut.Engine.check/1`.
  - [Juggernaut.Engine.Reuse](Juggernaut.Engine.Reuse.md): 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.
  - [Juggernaut.Mutator.AST](Juggernaut.Mutator.AST.md): Helpers over Sourceror's AST (`docs/dependencies/sourceror.md`).
  - [Juggernaut.Mutator.Calls](Juggernaut.Mutator.Calls.md): Resolves a call site to `{module, function, arguments}` and rebuilds it in the form it
was written.
  - [Juggernaut.Mutator.Context](Juggernaut.Mutator.Context.md): What an operator knows about the site it is offered (design notes §8.1).
  - [Juggernaut.Mutator.ModuleScan](Juggernaut.Mutator.ModuleScan.md): Finds the modules of a parsed file and what the walk needs to know about each one:
its aliases, imports, local functions, whether it is a `GenServer`, its function
clauses in source order, the module-body expressions that run at compile time, and its
`context`: every module-body expression other than a function clause, a nested module
or a documentation attribute (what a function's behaviour may depend on besides its
own clauses: `use`, `import`, `alias`, attributes, `defstruct`), which
`Juggernaut.Cache.Footprint` hashes with each function.
  - [Juggernaut.Mutator.Tails](Juggernaut.Mutator.Tails.md): Return paths of a function body, for the `return_value` family.
  - [Juggernaut.Mutator.Walk](Juggernaut.Mutator.Walk.md): Walks one function clause (or one compile-time module-body expression) and lists its
sites: every node an operator may be offered, with its AST path and its
`Juggernaut.Mutator.Context`.
  - [Juggernaut.Peer.Boot](Juggernaut.Peer.Boot.md): Boots a worker: run once inside a fresh `:peer`, before any job (design notes §10.5).
  - [Juggernaut.Peer.Footprint](Juggernaut.Peer.Footprint.md): Which of the project's functions a job executed (design notes §7.3): the footprint a
cached kill rests on.
  - [Juggernaut.Peer.Formatter](Juggernaut.Peer.Formatter.md): The ExUnit formatter of a worker's jobs (design notes §10.5): it prints nothing and
sends each finished test, as a small map, to the process that runs the job.
  - [Juggernaut.Peer.Health](Juggernaut.Peer.Health.md): The health check a worker runs after every job (design notes §10.5, plan I18): a
fingerprint of the VM's shared state taken after boot, compared with one taken after
the job. Any difference is drift, and the worker is recycled after it reports the
job's result, so one job's leftovers never reach the next.
  - [Juggernaut.Peer.Recorder](Juggernaut.Peer.Recorder.md): The coverage recorder of a worker (design notes §10.5): which sites run, and on behalf of
which test.
  - [Juggernaut.Peer.Reload](Juggernaut.Peer.Reload.md): Hot loading in a warm worker after the sandbox was compiled again (design notes §10.9):
the server's pool outlives a run, so before the next run's jobs every loaded module
whose beam under the sandbox changed is loaded again.
  - [Juggernaut.Peer.Runner](Juggernaut.Peer.Runner.md): Runs one job in a booted worker (design notes §10.5): the selected tests, with one
switch on, through ExUnit again in the same VM.
  - [Juggernaut.Peer.Snapshot](Juggernaut.Peer.Snapshot.md): The state a job may change and a worker puts back after it (design notes §10.5, plan
I18): the environment of every loaded application, the OS environment, and the
`:persistent_term` keys the project owns.
  - [Juggernaut.Peer.Switch](Juggernaut.Peer.Switch.md): The runtime switch that compiled metamutants read (design notes §10.3).
  - [Juggernaut.Plan.Git](Juggernaut.Plan.Git.md): The git queries the planner needs, run in the project root through a runner function
(`run/2` by default; tests pass their own). Paths are relative to the project root
(`--relative`), so a project in a subdirectory of its repository works.
  - [Juggernaut.Plan.Glob](Juggernaut.Plan.Glob.md): Path globs as `Path.wildcard/2` reads them, matched against a relative path without
touching the file system: `**` matches any number of directories, `*` and `?` stay
within one path segment, `{a,b}` is an alternation and `[ab]`, `[a,b]` or `[a-z]` match
one listed character (a comma is listed too, a `-` at either end is literal, nothing
negates). A glob without wildcards matches the path itself and anything under it when
it names a directory (`lib/core`).

  - [Juggernaut.Plan.Hunks](Juggernaut.Plan.Hunks.md): Changed lines from `git diff -U0` output, and which function clauses they touch
(design notes §3 `--since`, plan I11).
  - [Juggernaut.Pool.Baseline](Juggernaut.Pool.Baseline.md): The sharded baseline (design notes §10.5, plan I19): the needed tests, every mutant
off, split across the workers so that every worker runs at least one shard. It proves
each worker (its partition, its database, its loaded tests) before any mutant runs on
it, and records each test's duration for scheduling.
  - [Juggernaut.Pool.Env](Juggernaut.Pool.Env.md): What a worker's `:peer` is started with, as pure functions (design notes §10.5).
  - [Juggernaut.Pool.Output](Juggernaut.Pool.Output.md): An IO device that keeps only the end of what is written to it.
  - [Juggernaut.Pool.PeerReports](Juggernaut.Pool.PeerReports.md): A primary `:logger` filter in the controller that drops the termination reports of
`:peer` control processes.
  - [Juggernaut.Pool.Worker](Juggernaut.Pool.Worker.md): One warm worker: a GenServer that owns a `:peer` node booted in the sandbox and runs
jobs in it, one at a time (design notes §10.5).
  - [Juggernaut.Runner.BootLane](Juggernaut.Runner.BootLane.md): The boot lane (design notes §10.8): a mutant whose site runs while the app starts or the
tests load is tested on a fresh worker booted with that mutant already on, since no
job on a warm worker runs that code again.
  - [Juggernaut.Runner.Classify](Juggernaut.Runner.Classify.md): What one job's result says about its mutant (design notes §10.7): a status and, for a
kill, its kind and the killing test.
  - [Juggernaut.Runner.Schedule](Juggernaut.Runner.Schedule.md): Turns each mutant's selection into a job and orders the jobs (design notes §10.6,
§10.7). Pure: the durations come from the baseline, the previous killers from the
last run.
  - [Juggernaut.Sandbox.MixExs](Juggernaut.Sandbox.MixExs.md): The sandbox's copy of `mix.exs` (design notes §10.2): the project's file with every
relative `path:` given as a string literal (path dependencies such as
`{:juggernaut, path: "../.."}`) made absolute against the project root, because the
sandbox lives at another depth. Everything else is copied as written; a path computed
at run time is left alone.

  - [Juggernaut.Sandbox.Sync](Juggernaut.Sandbox.Sync.md): Mirrors a directory into the sandbox incrementally (design notes §10.2).
  - [Juggernaut.Schemata.Bisect](Juggernaut.Schemata.Bisect.md): Poison isolation's fallback (design notes §10.4): when the span map cannot pin a
file's errors on mutants within its rounds, the file's mutants are compiled in
groups until each poisoned one is found, so the mutants that compile stay switched.
  - [Juggernaut.Schemata.Compile](Juggernaut.Schemata.Compile.md): Compiles the sandbox incrementally with Mix, in a subprocess, and returns Mix's
diagnostics as data (design notes §10.3, `docs/dependencies/mix-compile.md`).
  - [Juggernaut.Schemata.Lift](Juggernaut.Schemata.Lift.md): Lifted dispatch for mutants a `case` cannot stand in for: patterns, guards, dropped
clauses, pipe stages (design notes §10.3).
  - [Juggernaut.Schemata.Poison](Juggernaut.Schemata.Poison.md): Poison isolation (design notes §10.4): after a failed sandbox compile, finds the
mutants that broke it and takes them out, so one bad mutant never blocks the run.
  - [Juggernaut.Schemata.Site](Juggernaut.Schemata.Site.md): Decides how each mutant is switched in its metamutant (design notes §10.3)
  - [Juggernaut.Schemata.Text](Juggernaut.Schemata.Text.md): Source text addressed by byte offset, and the edit tree a metamutant is rendered from
(design notes §10.3, §10.4).
  - [Juggernaut.Schemata.Unit](Juggernaut.Schemata.Unit.md): One file's metamutant (design notes §10.3, §10.4): its live mutants, how each is
switched (`Juggernaut.Schemata.Site`), the lifted functions
(`Juggernaut.Schemata.Lift`), the mutants taken out (with the reason) and the rendered
source with its span map.
  - [Juggernaut.Server.Client](Juggernaut.Server.Client.md): The client side of `mix juggernaut.server` (design notes §12): finds the server of a
checkout from `server/server.json` and `server/token`, sends one request and relays the
frames that come back.
  - [Juggernaut.Server.Protocol](Juggernaut.Server.Protocol.md): The frames between `mix juggernaut.server` and its clients (design notes §12): JSON
documents in `{:packet, 4}` frames over a TCP socket on `127.0.0.1`. A frame is only
ever decoded as JSON (never `:erlang.binary_to_term/1`), and every request carries the
server's token, compared in constant time.
  - [Juggernaut.Server.Queue](Juggernaut.Server.Queue.md): The server's job queue (design notes §12): first in, first out, one job running at a
time. Pure: the server keeps it in its state.
  - [Juggernaut.Server.Shell](Juggernaut.Server.Shell.md): The Mix shell while `mix juggernaut.server` runs: what a task prints with `Mix.shell/0`
goes to the client whose job runs in the calling process (`sink/1`), so an attached run
prints exactly what a standalone one does. Outside a job it is the shell that was in
place when the server started (`install/0`), usually `Mix.Shell.IO`.

  - [Juggernaut.Store.Codec](Juggernaut.Store.Codec.md): Encodes the structs of design notes §14.1 as JSON-ready maps with string keys, and
decodes them back.
  - [Juggernaut.Store.History](Juggernaut.Store.History.md): The append-only run history, `history/runs.ndjson` (design notes §7.2).
  - [Juggernaut.Store.Layout](Juggernaut.Store.Layout.md): The layout of `_build/juggernaut/` and its version (design notes §7).
  - [Juggernaut.Store.Lock](Juggernaut.Store.Lock.md): The checkout lock, `_build/juggernaut/lock` (design notes §7.1): one mutation run per
checkout.
  - [Juggernaut.Store.Runs](Juggernaut.Store.Runs.md): Whole runs on disk: `runs/<run_id>/run.json` and `runs/<run_id>/mutants.ndjson`
(design notes §7).

## Mix Tasks

- Mix tasks
  - [mix juggernaut](Mix.Tasks.Juggernaut.md): Runs mutation testing and gates on the result.
  - [mix juggernaut.advise](Mix.Tasks.Juggernaut.Advise.md): Advice on a recorded run, from the probe data Juggernaut already keeps.
  - [mix juggernaut.check](Mix.Tasks.Juggernaut.Check.md): Re-runs the named mutants now, usually after adding a test.
  - [mix juggernaut.compare](Mix.Tasks.Juggernaut.Compare.md): Pairs the mutants of two runs by their stable key and reports status changes (the
blocking class, killed in A and not killed in B on core code, whatever B's status, first), counts, scores,
phase clock deltas and per-mutant duration deltas.
  - [mix juggernaut.explain](Mix.Tasks.Juggernaut.Explain.md): Shows one mutant from a run: location, operator and variant, unified diff, function
source excerpt, status and kill kind, the killing test (`file:line`) or the tests that
ran and passed, the selection reason, the nearest miss, any ignore or triage entry,
where a reused result came from, and its duration.
  - [mix juggernaut.history](Mix.Tasks.Juggernaut.History.md): One row per recorded run, newest first: id, date, actor, lane, scope, commit (and
whether the tree was dirty), mutants, score, verdict, wall time, and the results reused
from earlier runs with their recorded time. Then trends over the runs shown, oldest to
newest, as sparklines (score, mutants, wall time, reused results). History lines this
version cannot read are listed, never fatal.
  - [mix juggernaut.install](Mix.Tasks.Juggernaut.Install.md): Sets a project up for Juggernaut.
  - [mix juggernaut.profile](Mix.Tasks.Juggernaut.Profile.md): Where a run's time went: phase clocks; per-mutant duration percentiles (p50, p90, p99,
max) by test selection; fallbacks to a whole file, the whole suite or the boot lane and
the functions that caused them; the tests that cost the most across mutant jobs; worker
utilisation and recycles; results reused and their recorded time; selection misses found
by cold reconfirmation. Durations are measured by the run; reused results are counted
apart, with the time recorded by the run they came from.
  - [mix juggernaut.report](Mix.Tasks.Juggernaut.Report.md): Writes one HTML file with the dashboard of recorded runs. Pages
  - [mix juggernaut.server](Mix.Tasks.Juggernaut.Server.md): Starts the single warm daemon for this checkout: one pool of test workers and a job
queue. `mix juggernaut` and `mix juggernaut.check` attach to it when it is reachable
(unless given `--no-server`), which skips booting workers for each run.
  - [mix juggernaut.survivors](Mix.Tasks.Juggernaut.Survivors.md): Lists the survivors (and NoCoverage mutants) of a recorded run, core first. It reports;
it does not gate. When more survivors exist than fit on the page, the output says so and
names the command for the next page (the agent document's `page.next`): nothing is
silently cut. Timeouts count as survivors when the run was scored with
`timeouts: :survived`, as in its gate (a run recorded before the setting was kept uses
`.juggernaut.exs` as it is now). With `--format github` every survivor is printed as an
annotation (no grouping or paging).
  - [mix juggernaut.triage](Mix.Tasks.Juggernaut.Triage.md): Manages the committed triage file, `.juggernaut.triage.json`.

