mix rindle.cleanup_orphans (Rindle v0.1.5)

Copy Markdown View Source

Removes expired upload sessions and the staged objects they reference.

Usage

mix rindle.cleanup_orphans [--dry-run | --no-dry-run | --live] [--storage MODULE]

Options

  • --dry-run — explicitly request preview mode (this is also the default when no flag is given).
  • --no-dry-run / --live — perform destructive deletions. --live is kept as an alias for clarity in scripts.
  • --storage MODULE — fully-qualified module name of the storage adapter to use for object deletion. When omitted the adapter is resolved from the :rindle application configuration under :default_storage.

Exit codes

  • 0 — cleanup completed (or dry-run report generated) successfully.
  • 1 — one or more errors were encountered during cleanup.

Examples

# Preview what would be removed (safe default)
mix rindle.cleanup_orphans

# Same, made explicit (matches OPS-02 documented contract)
mix rindle.cleanup_orphans --dry-run

# Destructive cleanup using configured default storage
mix rindle.cleanup_orphans --no-dry-run

# Destructive cleanup using the `--live` alias against a specific adapter
mix rindle.cleanup_orphans --live --storage Rindle.Storage.Local

Safety default

The CLI, the internal cleanup service, and the cron worker (Rindle.Workers.CleanupOrphans) all default to dry-run. Destructive execution requires an explicit opt-in (--no-dry-run/--live here, dry_run: false for the service, "dry_run" => false for the worker job args). This is the T-04-01 mitigation: dry-run and destructive execution are kept separate, with the safer default everywhere.

Notes

Storage side effects happen outside of database transactions. A storage deletion failure for a single object is logged and counted but does not abort the rest of the cleanup lane.

Run mix rindle.abort_incomplete_uploads first to transition timed-out signed/uploading sessions to expired before calling this task.