fix: an album with missing tracks is wanted back by its release group, not only when it carries a release MBID (#6167)
release / govulncheck (push) Successful in 17s
release / web (push) Successful in 1m24s
release / go (push) Successful in 1m32s
release / integration (push) Successful in 5m1s
release / android (push) Successful in 5m7s
release / Build signed APK (releases and dev) (push) Successful in 5m17s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 16s
release / Verify release artifacts (tag releases only) (push) Skipped
release / govulncheck (push) Successful in 17s
release / web (push) Successful in 1m24s
release / go (push) Successful in 1m32s
release / integration (push) Successful in 5m1s
release / android (push) Successful in 5m7s
release / Build signed APK (releases and dev) (push) Successful in 5m17s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 16s
release / Verify release artifacts (tag releases only) (push) Skipped
The release id was only ever used to find the group. 238 albums matched to a group carried none, so their losses, five of the resolver's wrong-slot removals among them, were never fetched again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -103,7 +103,8 @@ func (s *Sweeper) SweepOnce(ctx context.Context) error {
|
||||
// want records one album as wanted under its release group.
|
||||
func (s *Sweeper) want(ctx context.Context, q *dbq.Queries, album dbq.ListAlbumsDueReacquisitionRow, res *PassResult) error {
|
||||
// The query already filters these out; belt and braces.
|
||||
if album.AlbumMbid == nil || album.ArtistMbid == nil {
|
||||
hasGroup := album.AlbumReleaseGroupMbid != nil && *album.AlbumReleaseGroupMbid != ""
|
||||
if (album.AlbumMbid == nil && !hasGroup) || album.ArtistMbid == nil {
|
||||
return nil
|
||||
}
|
||||
group, err := s.albumReleaseGroup(ctx, q, album)
|
||||
|
||||
@@ -38,17 +38,21 @@ func newSweepPool(t *testing.T) *pgxpool.Pool {
|
||||
}
|
||||
|
||||
// lostAlbum seeds an album whose only track has been missing for two days,
|
||||
// named by MusicBrainz release id and (when group is set) release group.
|
||||
// named by MusicBrainz release id (when release is set) and release group
|
||||
// (when group is set).
|
||||
func lostAlbum(t *testing.T, pool *pgxpool.Pool, title, release, group string) pgtype.UUID {
|
||||
t.Helper()
|
||||
ctx := context.Background()
|
||||
q := dbq.New(pool)
|
||||
artistMBID := "artist-" + release
|
||||
artistMBID := "artist-" + title
|
||||
ar, err := q.UpsertArtist(ctx, dbq.UpsertArtistParams{Name: title + " Artist", SortName: title, Mbid: &artistMBID})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
params := dbq.UpsertAlbumParams{Title: title, SortTitle: title, ArtistID: ar.ID, Mbid: &release}
|
||||
params := dbq.UpsertAlbumParams{Title: title, SortTitle: title, ArtistID: ar.ID}
|
||||
if release != "" {
|
||||
params.Mbid = &release
|
||||
}
|
||||
if group != "" {
|
||||
params.ReleaseGroupMbid = &group
|
||||
}
|
||||
@@ -58,7 +62,7 @@ func lostAlbum(t *testing.T, pool *pgxpool.Pool, title, release, group string) p
|
||||
}
|
||||
tr, err := q.UpsertTrack(ctx, dbq.UpsertTrackParams{
|
||||
Title: "Lost", AlbumID: al.ID, ArtistID: ar.ID, DurationMs: 180000,
|
||||
FilePath: "/music/" + release + "/01.flac", FileSize: 1, FileFormat: "flac",
|
||||
FilePath: "/music/" + title + "/01.flac", FileSize: 1, FileFormat: "flac",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -99,7 +103,11 @@ func TestSweep_WantsBackOnlyAlbumsOnTheList_Integration(t *testing.T) {
|
||||
resolved := lostAlbum(t, pool, "Resolved", "release-resolved", "")
|
||||
unknown := lostAlbum(t, pool, "Unknown", "release-unknown", "")
|
||||
_ = lostAlbum(t, pool, "Off The List", "release-off", "group-off")
|
||||
// Matched to a group with no release id: 238 such albums on the operator's
|
||||
// library were never wanted back (#6167).
|
||||
groupOnly := lostAlbum(t, pool, "Group Only", "", "group-only")
|
||||
heldWant(t, pool, "group-tagged", tagged, "3 days")
|
||||
heldWant(t, pool, "group-only", groupOnly, "3 days")
|
||||
heldWant(t, pool, "group-resolved", resolved, "3 days")
|
||||
heldWant(t, pool, "group-unknown", unknown, "3 days")
|
||||
|
||||
@@ -128,6 +136,7 @@ func TestSweep_WantsBackOnlyAlbumsOnTheList_Integration(t *testing.T) {
|
||||
}
|
||||
wantFor("group-tagged", tagged)
|
||||
wantFor("group-resolved", resolved)
|
||||
wantFor("group-only", groupOnly)
|
||||
if w, _ := q.GetWantByReleaseGroup(ctx, "group-unknown"); !w.FulfilledAt.Valid {
|
||||
t.Error("an album MusicBrainz cannot name was reopened under the wrong group")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user