diff --git a/internal/coverart/enricher.go b/internal/coverart/enricher.go index def97899..fe6ab3cc 100644 --- a/internal/coverart/enricher.go +++ b/internal/coverart/enricher.go @@ -63,11 +63,15 @@ func (e *Enricher) EnrichAlbum(ctx context.Context, albumID pgtype.UUID) error { } // Step 2: MBCAA fallback. Requires fetcher + toggle on + MBID. + // When the toggle is disabled OR the album has no MBID, leave + // cover_art_source NULL so a future scan can retry once the + // scanner heals the MBID. 'none' is reserved for genuine MBCAA + // 404s where we know the album really isn't in the archive. if !e.mbcaaOn || e.fetcher == nil { - return e.recordCover(ctx, albumID, "", "none") + return nil } if row.Mbid == nil || *row.Mbid == "" { - return e.recordCover(ctx, albumID, "", "none") + return nil } body, err := e.fetcher.Fetch(ctx, *row.Mbid) diff --git a/internal/coverart/enricher_test.go b/internal/coverart/enricher_test.go index 5ef8f496..a63ac7e5 100644 --- a/internal/coverart/enricher_test.go +++ b/internal/coverart/enricher_test.go @@ -101,7 +101,7 @@ func TestEnrichAlbum_SidecarFound(t *testing.T) { } } -func TestEnrichAlbum_NoSidecarNoMBID_RecordsNone(t *testing.T) { +func TestEnrichAlbum_NoSidecarNoMBID_LeavesNull(t *testing.T) { pool := newPool(t) id, _ := seedAlbumWithTrack(t, pool, "NoMbid", "Artist", "") e := NewEnricher(pool, discardLogger(), nil, true) @@ -112,8 +112,8 @@ func TestEnrichAlbum_NoSidecarNoMBID_RecordsNone(t *testing.T) { if err != nil { t.Fatalf("get: %v", err) } - if row.CoverArtSource == nil || *row.CoverArtSource != "none" { - t.Errorf("source = %v, want 'none'", row.CoverArtSource) + if row.CoverArtSource != nil { + t.Errorf("source = %v, want nil (NULL — eligible for retry on next scan)", row.CoverArtSource) } }