fix(server,web/m7-cover-sources): forward-fix CI

Three failures from the prior push:

1. internal/api/library.go and 3 other callers of q.GetArtistByID
   broke because T2 modified the query to use an explicit column
   list, making sqlc generate GetArtistByIDRow instead of returning
   dbq.Artist. dbq.Artist already has every column added by
   migration 0018 (artist_thumb_path / artist_fanart_path /
   artist_art_source / artist_art_sources_version), so the explicit
   column list was unnecessary work. Revert the SELECT to SELECT *,
   regenerate sqlc, GetArtistByIDRow disappears, all callers compile
   again.

2. internal/tracks/service_test.go missed the dataDir parameter
   added to NewService in T9. Add "" as the 4th arg to every test
   call site (tests don't exercise the artist-art cleanup path; the
   empty dataDir is fine).

3. integrations.test.ts:356's mock.calls.filter callback had a
   too-narrow type annotation that svelte-check rejected. Relax to
   any[] to match what mock.calls actually is.
This commit is contained in:
2026-05-06 13:22:36 -04:00
parent 8307cbdbf9
commit 5c386dc73e
4 changed files with 20 additions and 41 deletions
+9 -9
View File
@@ -122,7 +122,7 @@ func TestRemoveTrack_NotFound(t *testing.T) {
bogus.Bytes = [16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}
bogus.Valid = true
svc := NewService(pool, nil, nil)
svc := NewService(pool, nil, nil, "")
_, _, _, err := svc.RemoveTrack(context.Background(), bogus, admin.ID, false)
if !errors.Is(err, ErrNotFound) {
t.Errorf("err = %v, want ErrNotFound", err)
@@ -142,7 +142,7 @@ func TestRemoveTrack_LocalFile_HappyPath(t *testing.T) {
_, _, track := seedArtistAlbumTrack(t, pool, "Solo", "", path)
fake := &fakeLidarrUnmonitorer{}
svc := NewService(pool, nil, fake)
svc := NewService(pool, nil, fake, "")
_, _, lidarrFailed, err := svc.RemoveTrack(context.Background(), track.ID, admin.ID, false)
if err != nil {
t.Fatalf("RemoveTrack: %v", err)
@@ -170,7 +170,7 @@ func TestRemoveTrack_FileAlreadyMissing(t *testing.T) {
missing := filepath.Join(t.TempDir(), "does-not-exist.mp3")
_, _, track := seedArtistAlbumTrack(t, pool, "Ghost", "", missing)
svc := NewService(pool, nil, nil)
svc := NewService(pool, nil, nil, "")
_, _, _, err := svc.RemoveTrack(context.Background(), track.ID, admin.ID, false)
if err != nil {
t.Fatalf("RemoveTrack: %v", err)
@@ -226,7 +226,7 @@ func TestRemoveTrack_Cascade_AlbumEmpty(t *testing.T) {
t.Fatalf("trackB: %v", err)
}
svc := NewService(pool, nil, nil)
svc := NewService(pool, nil, nil, "")
delAlbum, delArtist, _, err := svc.RemoveTrack(context.Background(), trackA.ID, admin.ID, false)
if err != nil {
t.Fatalf("RemoveTrack: %v", err)
@@ -259,7 +259,7 @@ func TestRemoveTrack_Cascade_ArtistEmpty(t *testing.T) {
}
artist, album, track := seedArtistAlbumTrack(t, pool, "Lone", "", path)
svc := NewService(pool, nil, nil)
svc := NewService(pool, nil, nil, "")
delAlbum, delArtist, _, err := svc.RemoveTrack(context.Background(), track.ID, admin.ID, false)
if err != nil {
t.Fatalf("RemoveTrack: %v", err)
@@ -325,7 +325,7 @@ func TestRemoveTrack_Unmonitor_HappyPath(t *testing.T) {
}
fake := &fakeLidarrUnmonitorer{}
svc := NewService(pool, nil, fake)
svc := NewService(pool, nil, fake, "")
_, _, lidarrFailed, err := svc.RemoveTrack(context.Background(), track.ID, admin.ID, true)
if err != nil {
t.Fatalf("RemoveTrack: %v", err)
@@ -381,7 +381,7 @@ func TestRemoveTrack_Unmonitor_LidarrErrorIsNonFatal(t *testing.T) {
}
fake := &fakeLidarrUnmonitorer{err: errors.New("simulated lidarr 5xx")}
svc := NewService(pool, nil, fake)
svc := NewService(pool, nil, fake, "")
_, _, lidarrFailed, err := svc.RemoveTrack(context.Background(), track.ID, admin.ID, true)
if err != nil {
t.Fatalf("RemoveTrack: %v (want nil — Lidarr failure is non-fatal)", err)
@@ -411,7 +411,7 @@ func TestRemoveTrack_Unmonitor_NoMbidSkipsLidarr(t *testing.T) {
_, _, track := seedArtistAlbumTrack(t, pool, "Local", "", path)
fake := &fakeLidarrUnmonitorer{}
svc := NewService(pool, nil, fake)
svc := NewService(pool, nil, fake, "")
_, _, lidarrFailed, err := svc.RemoveTrack(context.Background(), track.ID, admin.ID, true)
if err != nil {
t.Fatalf("RemoveTrack: %v", err)
@@ -437,7 +437,7 @@ func TestRemoveTrack_NoUnmonitor_SkipsLidarr(t *testing.T) {
_, _, track := seedArtistAlbumTrack(t, pool, "NoMon", "track-mbid", path)
fake := &fakeLidarrUnmonitorer{}
svc := NewService(pool, nil, fake)
svc := NewService(pool, nil, fake, "")
_, _, lidarrFailed, err := svc.RemoveTrack(context.Background(), track.ID, admin.ID, false)
if err != nil {
t.Fatalf("RemoveTrack: %v", err)