fix(sync): an artist picture found after the artist first synced reaches the Android app (#8080)

The library sync sends each artist's picture paths, and an app learns that a
row changed only from the change log. The artist enricher wrote the paths
without logging, so an artist synced before its picture arrived kept showing
the album-cover fallback on Android until something else touched it. A
picture found is now logged in the same transaction as the write; settling
"none" changes nothing an app shows and isn't logged.

The MBID backfill's heals of albums.mbid and artists.mbid, also part of the
sync payload, are now logged too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-27 00:03:21 -05:00
co-authored by Claude Opus 5.5
parent 8ba1d109c3
commit b6749fcf16
3 changed files with 79 additions and 8 deletions
+9
View File
@@ -10,6 +10,7 @@ import (
"git.fabledsword.com/bvandeusen/minstrel/internal/db"
"git.fabledsword.com/bvandeusen/minstrel/internal/db/dbq"
syncpkg "git.fabledsword.com/bvandeusen/minstrel/internal/sync"
"git.fabledsword.com/bvandeusen/minstrel/internal/tagread"
)
@@ -90,6 +91,12 @@ func BackfillMBIDs(ctx context.Context, pool *pgxpool.Pool, logger *slog.Logger,
continue
}
// The album's mbid is part of what the library sync sends, so an app
// hears about the heal through the change log.
if err := syncpkg.LogChange(ctx, pool, syncpkg.EntityAlbum, syncpkg.FormatUUID(r.AlbumID), syncpkg.OpUpsert); err != nil {
logger.Warn("mbid backfill: log album change failed", "album_id", r.AlbumID, "err", err)
}
// Heal artist (if we got one).
if artistMBID != "" {
am := artistMBID
@@ -103,6 +110,8 @@ func BackfillMBIDs(ctx context.Context, pool *pgxpool.Pool, logger *slog.Logger,
logger.Warn("mbid backfill: set artist mbid failed",
"artist_id", r.ArtistID, "err", err)
}
} else if err := syncpkg.LogChange(ctx, pool, syncpkg.EntityArtist, syncpkg.FormatUUID(r.ArtistID), syncpkg.OpUpsert); err != nil {
logger.Warn("mbid backfill: log artist change failed", "artist_id", r.ArtistID, "err", err)
}
}