# `MailglassInbound.Internal.Doctor`
[🔗](https://github.com/szTheory/mailglass/blob/v2.3.0/lib/mailglass_inbound/internal/doctor.ex#L1)

DNS-free pre-deploy config check runner for `mix mailglass.inbound.doctor`
All checks are pure reflection — no DB, no DNS, no network
— so the doctor is fast, offline, and CI-friendly.

`run/1` returns `%{summary: %{pass, warn, fail, cannot_diagnose}, findings: [...]}`
with the locked finding shape `%{check, status, title, observed, remediation,
evidence}`. The CLI shell maps the summary to the three-state exit code.

## Checks (all DNS-free)

  * router configured + compiles (absent -> a `:cannot_diagnose` marker the task
    maps to exit 2);
  * `>= 1` route defined;
  * each route's mailbox is compiled + `function_exported?(mod, :process, 1)`;
  * provider signing keys are PRESENT (reads the same `:mailglass_inbound` config
    the plug reads — NEVER verifies a signature; the finding text says so);
  * MIME backend availability + version via `Mailglass.OptionalDeps.GenSmtp`
    (no bare optional-dep reference);
  * route-conflict detection REUSING `MailglassInbound.Router.Matcher.matches_route?/2`
    structural subsumption (broad-before-narrow) -> `:fail`,
    witness-probe shadow -> `:fail`, regex-vs-regex overlap -> `:warn`. Conflict
    findings name `router.ex:LINE` via `Route.:source`.

# `finding`

```elixir
@type finding() :: %{
  check: atom(),
  status: status(),
  title: String.t(),
  observed: String.t(),
  remediation: String.t(),
  evidence: map()
}
```

# `result`

```elixir
@type result() :: %{summary: map(), findings: [finding()]}
```

# `status`

```elixir
@type status() :: :pass | :warn | :fail
```

# `run`

```elixir
@spec run(keyword()) :: result()
```

Run all DNS-free checks against the configured (or opt-supplied) router.

Options:

  * `:router` — the router module to reflect. Defaults to
    `Application.get_env(:mailglass_inbound, :router)`. When `nil`/absent the
    result carries a `:cannot_diagnose` finding (drives exit 2).

---

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