# `Juggernaut.Schemata.Poison`
[🔗](https://github.com/holsee/juggernaut/blob/v0.4.0/lib/juggernaut/schemata/poison.ex#L1)

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.

Only error diagnostics are read. Each error in a metamutant file is mapped through the
file's span map (`Juggernaut.Schemata.Text.blame/2`) to the switches whose code is at
that position; those mutants become compile errors, and the file is rendered again
without them. A file gets at most `rounds` such rounds; after that, or when an error
maps to no mutant, its mutants are bisected (`Juggernaut.Schemata.Bisect`): compiled in
groups until each poisoned one is found, so the rest stay switched. A file that fails
with none of its mutants is compiled as written, every mutant in it a compile error
naming the diagnostic. Errors in files without mutants are ignored while
a metamutant file still has errors (a broken module also fails the modules that need
it); when nothing can be taken out, the compile failed outside the mutants, which is an
infrastructure error (exit 3).

# `describe`

```elixir
@spec describe(Juggernaut.Schemata.Compile.diagnostic()) :: String.t()
```

`file:line: first line of the message`.

# `isolate`

```elixir
@spec isolate(
  [Juggernaut.Schemata.Unit.t()],
  [Juggernaut.Schemata.Compile.diagnostic()],
  pos_integer(),
  pos_integer()
) :: {:ok, [Juggernaut.Schemata.Unit.t()]} | {:error, Juggernaut.Error.t()}
```

The units after one round of isolation for `errors` (`Compile` diagnostics of severity
`:error`, none after a compile that passed), or an infrastructure error when no unit
can change. A unit whose errors cannot be traced within `rounds` rounds is bisected
(`Juggernaut.Schemata.Bisect`), for at most `bisect` compiles of its file.

A bisected unit's group is proven only by a compile that passed: Mix reports nothing
for a file it never compiled (one that requires a module that failed), so a failed
compile without an error in the unit's file proves nothing and the unit waits for the
next. It fails when its file has an error, or when no other unit can act on the errors
(the first waiting unit then takes them, as the likeliest cause).

---

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