mix mailglass.inbound.prune (MailglassInbound v0.2.0)

Copy Markdown View Source

Manually run the inbound retention sweep (IOPS-03).

Runs MailglassInbound.Internal.Prune.prune/0 SYNCHRONOUSLY whether or not Oban is installed (D-49-28) — only scheduling needs Oban; the batched sweep is the workhorse. Deletes happen in batches of 1000 (FOR UPDATE SKIP LOCKED) under a pg_try_advisory_lock single-run guard, child-first across the four retention windows (replay_runs 30d, execution_runs 90d, evidence 30d, records 90d), with :infinity on any class disabling that window.

Usage

mix mailglass.inbound.prune              # interactive typed confirmation
mix mailglass.inbound.prune --dry-run    # report scope, delete nothing
mix mailglass.inbound.prune --yes        # skip confirmation (cron/CI)

Because the sweep DELETES rows, the confirmation tier is stronger than replay's [y/N]: it requires a typed yes (D-49-10). --yes/-y skips it for cron/CI; --dry-run reports scope without deleting.

Emits [:mailglass_inbound, :prune, :sweep, :stop] with per-table deletion counts (no PII, D-49-29).

Scheduled pruning

An optional MailglassInbound.Prune.Worker Oban cron worker exists but is NOT auto-registered (D-49-28). Operators wire 0 3 * * * in their own Oban config (Phase 50 operator guide). Oban-less adopters run this task from system cron.