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

The validated request of `Juggernaut.Engine.run/1` and `Juggernaut.Engine.check/1`.

A request is a map with atom keys. A key whose value is `nil` counts as not given, so a
caller can pass an absent flag straight through. A missing required key, an unknown
key or a value of the wrong type is a usage error (exit 2), never a crash.

`check/1` takes `:ids` in place of `:lane` and `:scope`, and none of `:record?`, `:cache`,
`:reconfirm?` and `:inventory_filter`, which it sets itself. The keys of `run/1`:

* `:root` (`t:String.t/0`) - Required. The project root.

* `:config` (struct of type `Juggernaut.Config`) - Required. The loaded `.juggernaut.exs` (`Juggernaut.Config.load/2`).

* `:lane` - Required. The lane.

* `:scope` - Required. `%{kind: :changed | :since | :files | :full, ref:, files:}`.

* `:env` (map of `t:String.t/0` keys and `t:String.t/0` values) - The environment (`System.get_env/0`).

* `:argv` (list of `t:String.t/0`) - The command line, recorded with the run.

* `:seed` (`t:non_neg_integer/0`) - The ExUnit seed of every job (random).

* `:workers` (`t:pos_integer/0`) - At most this many workers.

* `:max_mutants` (`t:pos_integer/0`) - Run at most N mutants; the rest are pending.

* `:budget_ms` (`t:non_neg_integer/0`) - No job starts after this many milliseconds.

* `:fail_fast` (`t:boolean/0`) - Stop once the gate has failed (on in the inner lane).

* `:strict_ignores` (`t:boolean/0`) - Ignore warnings stop the run too.

* `:plan_opts` (`t:keyword/0`) - Options of `Juggernaut.Plan.resolve/3`.

* `:deps_path` (`t:String.t/0`) - The project's dependencies (`deps` under the root).

* `:worker_opts` (`t:keyword/0`) - Extra `Juggernaut.Pool.Worker` options.

* `:git` (function of arity 2) - A git runner (`Juggernaut.Engine.Checkout.quiet/2`).

* `:on_event` (function of arity 1) - Called with each run event (`t:Juggernaut.View.Stream.event/0`) as it happens.

* `:record?` (`t:boolean/0`) - Write the run files and the history line (true).

* `:reconfirm?` (`t:boolean/0`) - Reconfirm core survivors in gate and release (true).

* `:cache` (`t:boolean/0`) - Use the result cache as the lane allows (true; false is `--no-cache`).

* `:inventory_filter` (function of arity 1) - Called with the inventory; returns `{:ok, inventory}` or `{:error, error}`.

* `:pool` (function of arity 1) - The server's warm pool: called with the request, returns `{:ok, pool}`; never stopped.

* `:lock?` (`t:boolean/0`) - Take the checkout lock (true; the server holds it itself).

* `:warm_safe` (`t:boolean/0`) - Settle the boot-set mutants of warm-safe functions on a warm worker (true; never in the release lane; `mix juggernaut.advise --verify` turns it off).

* `:force_unlock` (`t:boolean/0`) - Remove the checkout lock first, whoever holds it (`--force-unlock`; false).

# `t`

```elixir
@type t() :: %{required(atom()) =&gt; term()}
```

A request; see the module doc for its keys.

# `validate`

```elixir
@spec validate(term(), :run | :check) :: {:ok, t()} | {:error, Juggernaut.Error.t()}
```

Validates a request of `Juggernaut.Engine.run/1` (`:run`) or
`Juggernaut.Engine.check/1` (`:check`). Returns the request without its `nil` values,
or the usage error.

---

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