fix(scanner): backfill PIDArtist property on upgrade

A user upgrading from a pre-PID.Artist version with a non-default
PID.Artist already configured would have hit a silent annotation
loss: empty stored PIDArtistKey was normalized to the current
config, pidHashChanged returned false, no full rescan was forced,
and prevArtistPIDConf stayed empty during the next normal scan so
the artistIDMap guard skipped annotation migration entirely.

Backfill via migration so the stored value reflects the historical
default ('name', byte-identical to the legacy hardcoded artistID).
Drop the empty-string fallback in pidHashChanged — with the
migration in place, an empty stored value would be anomalous, and
the fallback was the exact dead branch that hid this hole.
This commit is contained in:
Deluan 2026-05-24 21:13:17 -03:00
commit 86cb5fee93
2 changed files with 11 additions and 4 deletions

View file

@ -179,10 +179,6 @@ func pidHashChanged(ds model.DataStore) (bool, error) {
if err != nil {
return false, err
}
// Empty stored value is treated as matching — fresh upgrade should not force a rescan.
if pidArtist == "" {
pidArtist = conf.Server.PID.Artist
}
return !strings.EqualFold(pidAlbum, conf.Server.PID.Album) ||
!strings.EqualFold(pidTrack, conf.Server.PID.Track) ||
!strings.EqualFold(pidArtist, conf.Server.PID.Artist), nil