feat(server,web/m7-cover-sources): scan-orchestrator 4th stage

Adds an artist-art-enrich stage after cover-enrich in RunScan. The
stage drains EnrichArtistBatch with a configurable cap and the
operator's data_dir, persists processed/succeeded/failed tallies to
the scan_runs.artist_art_enrich jsonb column added in migration
0018.

The admin /admin Library Scan card grid expands from 3 to 4 columns
with the new "Artist art" card mirroring the cover-enrichment one
(Processed / Succeeded / Failed). The TS ScanStatus type gains an
optional artist_art_enrich field. The Go scanStatusResp gains the
matching ArtistArtEnrich json.RawMessage field.

cmd/minstrel/main.go (and admin scan-trigger handler) wire the new
RunScanConfig fields: ArtistEnrichCap reuses cfg.Library.CoverArtBackfillCap
for now (can be split if separate budgets are useful), DataDir is
cfg.Storage.DataDir.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-06 13:03:36 -04:00
parent 295d9da361
commit 00cd28e79b
7 changed files with 108 additions and 26 deletions
+12 -8
View File
@@ -17,14 +17,15 @@ import (
// rather than base64 byte arrays — the DB column is bytea-shaped jsonb in
// pgx but the data is already valid JSON.
type scanStatusResp struct {
ID string `json:"id"`
StartedAt string `json:"started_at"`
FinishedAt *string `json:"finished_at"`
Library json.RawMessage `json:"library,omitempty"`
MbidBackfill json.RawMessage `json:"mbid_backfill,omitempty"`
CoverEnrich json.RawMessage `json:"cover_enrich,omitempty"`
ErrorMessage *string `json:"error_message,omitempty"`
InFlight bool `json:"in_flight"`
ID string `json:"id"`
StartedAt string `json:"started_at"`
FinishedAt *string `json:"finished_at"`
Library json.RawMessage `json:"library,omitempty"`
MbidBackfill json.RawMessage `json:"mbid_backfill,omitempty"`
CoverEnrich json.RawMessage `json:"cover_enrich,omitempty"`
ArtistArtEnrich json.RawMessage `json:"artist_art_enrich,omitempty"`
ErrorMessage *string `json:"error_message,omitempty"`
InFlight bool `json:"in_flight"`
}
// handleGetScanStatus implements GET /api/admin/scan/status.
@@ -62,6 +63,9 @@ func (h *handlers) handleGetScanStatus(w http.ResponseWriter, r *http.Request) {
if len(row.CoverEnrich) > 0 {
resp.CoverEnrich = row.CoverEnrich
}
if len(row.ArtistArtEnrich) > 0 {
resp.ArtistArtEnrich = row.ArtistArtEnrich
}
writeJSON(w, http.StatusOK, resp)
}