# `Juggernaut.Engine.Reconfirm`
[🔗](https://github.com/holsee/juggernaut/blob/v0.4.0/lib/juggernaut/engine/reconfirm.ex#L1)

The reconfirmation of core survivors (design notes §10.8), in the gate and release
lanes once the main jobs have run.

A mutant of a core file that survived its selected tests runs again on a fresh worker
(`fresh?: true`: its worker is recycled first) with every test of the test files whose
coverage probe hit its source file. Killed there, its result is replaced: status
killed, selection `:reconfirm`, the reason "a selection miss" (for `profile`).
Survived there (or no test file covers it), its first result stands. Any other result
there (a `harness_error`: the worker failed, or the control failed on a fresh worker)
replaces the survivor, so the run reports it (exit 3) instead of a survivor it could
not confirm. Nothing is
reconfirmed in the inner lane, when the request turns it off (`check`), or when
dispatch stopped early.

# `candidate?`

```elixir
@spec candidate?(Juggernaut.Result.t() | nil, Juggernaut.Mutant.t()) :: boolean()
```

Whether `result` of `mutant` is one reconfirmation would run again.

# `covering_tests`

```elixir
@spec covering_tests(String.t(), map()) :: [Juggernaut.Runner.Schedule.test_id()]
```

Every runnable test of the test files whose probe hit `file` (the coverage index's
`hit_sources`), sorted.

# `jobs`

```elixir
@spec jobs(map(), %{required(String.t()) =&gt; Juggernaut.Result.t()}) :: [map()]
```

The reconfirmation jobs of the main jobs of `plan` (`Juggernaut.Engine`'s plan: its
`:jobs`, `:inventory`, `:coverage` and `:schedule_opts`), given their `results` by
mutant id: one per core survivor with covering tests, in the main jobs' order.

# `miss_reason`

```elixir
@spec miss_reason() :: String.t()
```

The reason a result killed on reconfirmation carries.

# `replacements`

```elixir
@spec replacements(%{required(String.t()) =&gt; Juggernaut.Result.t()}) :: [
  Juggernaut.Result.t()
]
```

The reconfirmation results that replace a survivor's, by mutant id: every one that is
not `survived`. A kill carries the miss reason; any other (a `harness_error`, a
`pending`) keeps its own, so a reconfirmation that could not decide is never dropped
in favour of the survivor it was checking.

# `run`

```elixir
@spec run(
  map(),
  [Juggernaut.Runner.worker()],
  %{required(String.t()) =&gt; Juggernaut.Result.t()},
  keyword()
) :: [Juggernaut.Result.t()]
```

Runs the reconfirmation jobs on `workers` (`Juggernaut.Runner.run/3` with `opts`) and
returns the results that replace a survivor's (`replacements/1`).

# `wanted?`

```elixir
@spec wanted?(%{lane: atom(), reconfirm?: boolean()}, String.t() | nil) :: boolean()
```

Whether reconfirmation runs: in the gate and release lanes, when `reconfirm?` is on
and the main dispatch did not stop early (`stopped` is its reason, or `nil`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
