mix ash_onetime.doctor (ash_onetime v1.2.3)

Copy Markdown View Source

Checks the install health of ash_onetime: the Ash security floor, Oban queue configuration, and prefix validity. Run after install and after each upgrade to catch the silent-failure modes that have no runtime signal.

mix ash_onetime.doctor --repo MyApp.Repo
mix ash_onetime.doctor --repo MyApp.Repo --prefix tenant_1

Checks:

  • Ash floor (fatal): the running Ash version must be >= 3.31.3 (the CVE-floor pinned in mix.exs ash_requirement/0). A below-floor Ash is a security defect, not an advisory.

  • Oban queues (advisory when Oban loaded): the three maintenance workers require :ash_onetime_cleanup, :ash_onetime_reap, and :ash_onetime_partitions. A missing :ash_onetime_partitions queue silently strands the retention-safety path (forward partition creation never executes). The doctor scans the consumer's Oban config for the three queues and warns on any missing. This is advisory — a consumer may configure Oban dynamically at runtime.

  • Prefix validity (when --prefix given): the prefix must be 1..63 bytes (PostgreSQL's NAMEDATALEN bound).

  • Schema currency (fatal, only with --live): queries the database (read-only, catalog tables) and fails when the installed schema is not current for this package version — the failure mode of upgrading the package without running its migrations. Checks: the logical_partition column on both claim tables (the 1.1 logical-partition upgrade), the ash_onetime_response_payloads partitioned table and its _default partition, the three cleanup/reap functions (by name and arity), and the two delete-guard triggers.

    mix ash_onetime.doctor --repo MyApp.Repo --live mix ash_onetime.doctor --repo MyApp.Repo --live --prefix tenant_1

    Without --live the doctor stays offline (compile-env checks only). The schema checked is --prefix when given, else public.

Exits non-zero only on a FAIL (Ash below floor, missing --repo, invalid --prefix, or — with --live — a missing/stale schema). Advisory warnings return :ok.