feat(server/m7-380): one-shot MBID backfill worker for existing libraries

Adds a boot-time goroutine that walks albums with NULL mbid, re-reads
tags from one track per album via dhowden/tag, and persists album + artist
MBIDs. Healed albums also get their cover_art_source='none' cleared so the
enricher's next batch retries the MBCAA fetch. Caps at 5000 albums per
boot to avoid stalling startup on huge libraries.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-04 19:40:27 -04:00
parent 26f4c7a79f
commit 34615fffbd
6 changed files with 228 additions and 0 deletions
+8
View File
@@ -44,6 +44,14 @@ UPDATE albums
cover_art_source = NULL
WHERE id = $1;
-- name: ClearAlbumCoverNone :exec
-- M7 #380: when MBID backfill heals an album, clear its 'none' cover_art_source
-- back to NULL so the enricher's next batch retries the MBCAA fetch.
-- Idempotent — only updates rows currently stamped 'none'.
UPDATE albums
SET cover_art_source = NULL
WHERE id = $1 AND cover_art_source = 'none';
-- name: CountAlbumCoverSources :one
-- Diagnostic for the admin overview: counts by source, including NULL.
-- Returns one row with named tallies.