Administration and reporting
824e49fddb4dcc071fc8e72558aadea224704447. Version 2026.11.0-rc.1. License MIT. Status: source candidate; complete gate and disposable live suite are the qualification authority; not published and not production-qualified. This is the component's committed documentation, not proof of a distribution release or production qualification.
melodee admin is the scriptable administrative surface over the published
native API. It never accesses PostgreSQL or media volumes directly. Every one of
the 76 administrative operations in the pinned 1.0.0 contract has a reviewed
command path; melodee admin coverage is the authoritative offline matrix
(committed copy).
Scopes and capabilities
Administrative access needs both a credential scope and an account capability:
| Scope | Typical commands | Capability |
|---|---|---|
reporting.read | admin reports ..., snapshot list/show | admin_reports |
operations.read | job controls/schedules/events (job inventory is interactive-only), storage volumes/assets/inbound, provider circuits, metrics, account inventory | admin_jobs, admin_storage, admin_accounts |
operations.write | job cancel/retry/progress/run-due/enqueue-ingest/enqueue-normalize, storage moves/quarantine, report capture, circuit reset, account status/capabilities/sessions | corresponding admin capability |
catalog.admin.read | reviews/review evidence, locks, track quality, legacy fields, quality calibration | admin_catalog |
catalog.admin.write | aliases, locks, corrections import, classification, merge/split, artwork mutation, editorial genres | admin_catalog |
A token never grants a capability the account lacks. If the API rejects a request,
the CLI distinguishes SCOPE_REQUIRED from CAPABILITY_REQUIRED when the
server's message permits it and preserves the request id. Never assume an admin
account has every capability.
Reports
# JSON (machine-readable) and table on a terminal
melodee admin reports catalog -o json
melodee admin reports ingestion --from-millis 1764547200000 --to-millis 1765152000000 --timezone UTC
# Server-generated, formula-safe CSV streamed to a file (no in-memory report)
melodee admin reports catalog -o csv --out catalog.csv
# Snapshots
melodee admin reports snapshots
melodee admin reports capture --kind catalog
melodee admin reports snapshot <snapshot-id> -o json
Report families are catalog, ingestion, storage, jobs, providers and
quality. --from-millis and --to-millis are inclusive epoch milliseconds;
the range defaults to 30 days and is capped at 366 days. --timezone is an IANA
name (default UTC) and maps instants to local calendar days. Reversed/overlong
ranges are 400 invalid_range; an invalid timezone is 422 invalid_input. JSON
and CSV use the same range and buckets. --out writes the selected format; with
-o csv the server body is copied directly. JSON diagnostics never enter
stdout.
Jobs, storage inventory and accounts
melodee admin jobs list --state failed --kind cleanup --limit 20
melodee admin jobs controls
melodee admin jobs control cleanup --enable --resume \
--max-running 2 --timeout-ms 60000 --max-attempts 3 --expected-revision 1
melodee admin jobs schedules
melodee admin jobs schedule-create cleanup --interval-ms 3600000 \
--next-run-at-millis 1765152000000 --overlap-policy coalesce
melodee admin jobs run-due
melodee admin jobs show <job-id>
melodee admin jobs events <job-id> -o json # one snapshot
melodee admin jobs watch <job-id> # follow SSE until Ctrl-C
melodee admin jobs progress <job-id> --stage copy --percent 40
melodee admin jobs retry <job-id> --reason "transient failure cleared"
melodee admin jobs cancel <job-id> --reason "maintenance" --yes
# Queue native ingest/normalize work against an active volume.
melodee admin jobs enqueue-ingest <volume-id> --source-path release-dir \
--generation 5 --current-year 2026 --main-artist-kind group --credit-kind group
melodee admin jobs enqueue-normalize <volume-id> \
--source-path staged/source.wav --output-path staged/normalized.mp3
events reads one SSE snapshot; watch follows the stream and treats premature
termination as an error. enqueue-ingest and enqueue-normalize are native
job-creation operations, not direct database writes: the API validates the active
volume and a safety-checked relative inbound path, then queues durable work.
Schedules and run-due remain available for recurring work. Job ids come from an
enqueue response, schedule/worker state or reports. schedule-delete retires the
schedule rather than physically deleting it: active listings hide it, occurrence,
job and audit history remain, repeat deletion is idempotent (204), and an unknown
schedule is 404. It still requires --yes.
Storage
melodee admin storage volumes
melodee admin storage assets --preferred --limit 20
melodee admin storage inbound --volume <volume-id> [--path relative/dir]
melodee admin storage volume-update <volume-id> --status online --priority 10 \
--expected-owner-epoch 3 --yes
melodee admin storage quarantine <asset-id> --yes
melodee admin storage release <asset-id>
move and enqueue-move require a second mounted volume and an accepted target
epoch; both are exercised by the disposable harness with two mounted volumes.
Quarantine is audited and removes playability until release. Integrity
verification is exposed through the job handler surface; there is no separate
storage-integrity list endpoint.
Accounts, metrics and notifications
melodee admin accounts list -q owner
melodee admin accounts show <account-id>
melodee admin accounts status <account-id> --status disabled --yes # revokes sessions + automation credentials
melodee admin accounts grant <account-id> --capability admin_reports --yes
melodee admin accounts revoke <account-id> --capability admin_reports --yes
melodee admin accounts revoke-sessions <account-id> --yes
melodee admin metrics # Prometheus text on stdout
melodee admin notifications list
melodee admin notifications test --yes # interactive session required
admin jobs list, admin notifications list and admin notifications test
require an interactive session (the 1.0.0 transport excludes the job-inventory
and delivery-notification routes from scoped automation). Account status changes
are guarded by the server (409 cannot_change_own_status,
409 last_account_administrator); these are not retried. Disabling an account
revokes its sessions and automation credentials immediately. admin metrics
requires operations.read automation or the admin_jobs capability. The
delivery-notification routes are restricted to an interactive session by the
1.0.0 transport even though they carry the administrative tag; the CLI surfaces
INTERACTIVE_SESSION_REQUIRED rather than pretending an automation credential
works.
Catalog administration
melodee admin catalog track locks <track-id>
melodee admin catalog track lock <track-id> title --value "Corrected" --reason "evidence"
melodee admin catalog track unlock <track-id> title
melodee admin catalog track asset-lock <track-id> --reason "keep master"
melodee admin catalog track asset-unlock <track-id>
melodee admin catalog track merge <from-id> --target-track-id <to-id> --reason "duplicate" --yes
melodee admin catalog split <merge-id> --reason "reverted" --yes
melodee admin catalog release classify <release-id> --classification studio \
--expected-revision 2 --reason "audit" --yes
melodee admin catalog reviews
melodee admin catalog review-show <review-id> # evidence, candidates, actions, locks
melodee admin catalog review-resolve <review-id> --state resolved \
--note "source corrected" --yes
melodee admin catalog corrections export --out corrections.json
melodee admin catalog corrections import corrections.json # dry-run
melodee admin catalog corrections import corrections.json --apply --yes
melodee admin catalog legacy track-fields
melodee admin catalog legacy preview legacy.json
melodee admin catalog legacy reconcile legacy.json
melodee admin catalog quality calibration
melodee admin catalog quality reassess --limit 100
melodee admin catalog track genres <track-id> --genre Rock --yes
melodee admin catalog match-decision --scope-namespace musicbrainz \
--scope-value <id> --subject-kind track --subject-id <track-id> --decision accept --reason "evidence"
Corrections default to dry-run; --apply requires --yes. Legacy preview and
reconcile are bounded/no-write where upstream documents it. Merge/split and
classification preserve canonical identities and revisions; the CLI does not
perform local identity resolution.
Artwork and providers
melodee admin artwork upload artist <artist-id> --file cover.jpg --yes
melodee admin artwork fetch artist <artist-id> --url https://provider.example/cover.jpg --yes
melodee admin artwork prune --keep-revisions 2 --yes
melodee admin artwork prune-cache --max-bytes 67108864 --yes
melodee admin providers circuits
melodee admin providers reset <host> --yes
artwork upload sends the file bytes unchanged as image/jpeg or image/png
(1 byte–10 MiB); the server rejects malformed images, dimensions above 12,000 px
and images above 80,000,000 pixels without creating artwork rows. artwork fetch
uses the typed provider URL request. artwork show retrieves a published
100/250/500 px immutable JPEG variant with a private --out file, reports bytes,
ETag and cache headers, and supports --if-none-match; a 304 leaves an
existing destination untouched.
Provider artwork fetch requires configured allowlisted hosts
(MELODEE_ARTWORK_PROVIDER_HOSTS) and is unavailable when the API has none. Only
HTTPS hosts (or loopback HTTP for controlled tests) are accepted; repeated
failures open the host circuit and providers reset clears it.
Low-level operation access
melodee admin api adminReportCatalog -o json
melodee admin api adminCancelJob --param job_id=<uuid> \
--data '{"reason":"operator request"}' --yes
admin api validates the operation id against the pinned contract, requires all
path parameters and a body when the operation declares one, and requires --yes
for non-GET operations. Prefer the named commands.
Automation and exit behavior
JSON is written to stdout; confirmations/progress/errors go to stderr. Exit codes
are stable (0 success, 2 usage, 3 configuration, 4 invalid/confirmation, 5 I/O,
6 transport/authorization/server, 7 contract). Destructive calls are never
retried. Use a private token file or auth login; never pass a token as an
argument.