mix oban_powertools.doctor (oban_powertools v0.5.1)

Copy Markdown View Source

Runs read-only Oban health checks against pg_catalog and information_schema, then exits with an honest exit code for CI pipelines.

Exit Codes

CodeMeaning
0All checks passed — DB and configuration are healthy
1Warnings only (e.g. uniqueness-timeout risk without --strict)
2One or more errors (INVALID index, missing index, migration drift, cannot-run)

Flags

--repo MyApp.Repo     Ecto repo module to connect with. Falls back to
                      `config :oban_powertools, repo: MyApp.Repo`.
--prefix public       Oban schema prefix. Falls back to the host Oban
                      config in application env, then "public". See note below.
--oban-name Oban      Which Oban instance name to look up when reading the
                      prefix from application env (default: "Oban").
--format human|json   Output format. "human" (default) renders a sectioned
                      report with ANSI color that auto-degrades in CI/non-TTY.
                      "json" emits a machine-readable payload with a
                      `schema_version: 1` stability contract.
--strict              Promote the warning tier (uniqueness-timeout risk) to
                      errors. Scope: uniqueness_timeout_risk check only.

Severity Table

FindingDefaultUnder --strict
INVALID indexerror (2)error (2)
Missing expected Oban indexerror (2)error (2)
Migration drift (Oban/Powertools)error (2)error (2)
Uniqueness-timeout riskwarning(1)error (2)
Cannot-run (no repo / DB unreachable)error (2)error (2)

Prefix Resolution

Prefix auto-detection reads the host Oban configuration from the loaded application environment without starting Oban. Because Oban is typically configured under the host OTP app key (e.g. config :my_app, Oban, ...), auto-detection may fall back to "public" when the host app hasn't started. Use --prefix for reliable production results.

Boot Strategy

This task starts only the Ecto repo via Ecto.Migrator.with_repo/2. It does not start Oban or any queue/worker supervision tree. It is safe to run around deploys without triggering job processing.