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

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.

The file is first compiled with no mutant (an error there is outside the mutants:
the file is compiled as written). Then each group is compiled with the mutants
already proven: a group that compiles is proven; a failing group with inline
mutants has them moved into lifted copies and is compiled again (a place inside a
macro's argument that cannot take a `case` is the usual cause); a failing group of
lifted mutants is split in two; a failing single lifted mutant is a compile error.
After `max` compiles the mutants not yet proven are compile errors with that reason,
and the proven ones stay.

The budget is the file's, not one bisection's: a file whose proven mutants fail again
later is bisected again with the compiles it has left (`Unit.bisected` counts those
spent), and a file with none left is compiled as written.

# `state`

```elixir
@type state() :: %{
  proven: [Juggernaut.Schemata.Unit.entry()],
  queue: [[Juggernaut.Schemata.Unit.entry()]],
  order: %{required(String.t()) =&gt; non_neg_integer()},
  compiles: non_neg_integer(),
  max: pos_integer()
}
```

# `active?`

```elixir
@spec active?(Juggernaut.Schemata.Unit.t()) :: boolean()
```

Whether `unit` is being bisected.

# `start`

```elixir
@spec start(Juggernaut.Schemata.Unit.t(), String.t(), pos_integer()) ::
  Juggernaut.Schemata.Unit.t()
```

Starts bisecting `unit`, whose live mutants failed to compile with `error` (described),
for at most `max` compiles of the file, counting those earlier bisections of it spent.
The failure of all of them counts as the first group's. A file with no compiles left
is compiled as written.

# `step`

```elixir
@spec step(Juggernaut.Schemata.Unit.t(), String.t() | nil) ::
  Juggernaut.Schemata.Unit.t()
```

One step after a compile: `error` is `nil` when the compile passed (the current group
is proven), else the description of the error the group is failed with.

---

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