test(coverart): no-MBID enrich settles 'none' (per canonical behavior)

Operator decision: the enricher is canonical. No MBID still runs the
provider chain (name-based providers — Deezer/Last.fm — resolve
without an MBID); if every provider returns ErrNotFound the row
settles cover/artist source 'none' at the current sources version
(re-eligible only when the registered provider set changes). It does
NOT skip-and-leave-NULL.

The two _NoMBID_LeavesNull tests predated the name-based providers
(0020 slice) and asserted the old skip→NULL contract. Updated:
- TestEnrichArtist_NoMBID_SettlesNone: stub now returns ErrNotFound
  (realistic MBID-only-provider-with-empty-MBID), expect source 'none'.
- TestEnrichAlbum_NoSidecarNoMBID_SettlesNone: empty registry →
  allWere404 stays true → expect 'none'.

Last failing cluster from the CI-integration initiative; suite should
now be fully green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-17 22:27:01 -04:00
parent a86b7a5e07
commit 412b9e37eb
2 changed files with 14 additions and 7 deletions
+8 -4
View File
@@ -496,7 +496,7 @@ func TestCleanupArtistArt_IdempotentMissingDir(t *testing.T) {
// --- MBID guard ---
func TestEnrichArtist_NoMBID_LeavesNull(t *testing.T) {
func TestEnrichArtist_NoMBID_SettlesNone(t *testing.T) {
pool := newPool(t)
ctx := context.Background()
q := dbq.New(pool)
@@ -504,9 +504,13 @@ func TestEnrichArtist_NoMBID_LeavesNull(t *testing.T) {
resetRegistryForTests()
t.Cleanup(resetRegistryForTests)
// No MBID still runs the provider chain (name-based providers can
// resolve without one). An MBID-only provider returns ErrNotFound
// for an empty MBID; with the whole chain returning ErrNotFound the
// row settles 'none' (version-stamped), NOT NULL.
stub := &stubArtistProvider{
fakeProvider: fakeProvider{id: "stub-artist", defaultOn: true},
thumb: []byte("should_not_write"),
err: ErrNotFound,
}
Register(stub)
@@ -523,7 +527,7 @@ func TestEnrichArtist_NoMBID_LeavesNull(t *testing.T) {
if err != nil {
t.Fatalf("GetArtistByID: %v", err)
}
if row.ArtistArtSource != nil {
t.Errorf("source = %v, want nil (no MBID — skip)", row.ArtistArtSource)
if row.ArtistArtSource == nil || *row.ArtistArtSource != "none" {
t.Errorf("source = %v, want 'none' (settled)", row.ArtistArtSource)
}
}
+6 -3
View File
@@ -121,7 +121,7 @@ func TestEnrichAlbum_SidecarFound(t *testing.T) {
}
}
func TestEnrichAlbum_NoSidecarNoMBID_LeavesNull(t *testing.T) {
func TestEnrichAlbum_NoSidecarNoMBID_SettlesNone(t *testing.T) {
pool := newPool(t)
id, _ := seedAlbumWithTrack(t, pool, "NoMbid", "Artist", "")
resetRegistryForTests() // deterministic empty registry (no provider can supply)
@@ -134,8 +134,11 @@ func TestEnrichAlbum_NoSidecarNoMBID_LeavesNull(t *testing.T) {
if err != nil {
t.Fatalf("get: %v", err)
}
if row.CoverArtSource != nil {
t.Errorf("source = %v, want nil (NULL — eligible for retry on next scan)", row.CoverArtSource)
// No sidecar, no MBID, no provider yields → the chain settles
// 'none' (allWere404 stays true), version-stamped so it is only
// re-tried when the registered provider set changes.
if row.CoverArtSource == nil || *row.CoverArtSource != "none" {
t.Errorf("source = %v, want 'none' (settled)", row.CoverArtSource)
}
}