fix: AcoustID decides any one-album mismatch the lengths cannot, not only copies each cut to its slot (#6169)
release / govulncheck (push) Successful in 13s
release / web (push) Successful in 1m21s
release / go (push) Successful in 1m37s
release / integration (push) Successful in 5m3s
release / android (push) Successful in 5m6s
release / Build signed APK (releases and dev) (push) Successful in 5m14s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 15s
release / Verify release artifacts (tag releases only) (push) Skipped

The first pass on the operator's library held 16 groups. In several, every
copy's own lookup names one recording (Wombats Record Shop/Tormentor,
Alchemist (2)/Prelude, Monday Chill 8/9, 404sessions), but one copy sits 3-10s
from its slot, so the every-copy-fits precondition kept AcoustID out. Now:
copies whose lookups all agree are that recording, whatever their
fingerprints read; copies of the same audio are asked about as before; and
the track list places the recording in one copy's slot, or none. Copies
filed as one song are not settled here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-20 10:52:42 -04:00
co-authored by Claude Opus 5.5
parent 18d31e9cdd
commit 3a482bd715
3 changed files with 103 additions and 64 deletions
+12 -19
View File
@@ -114,9 +114,9 @@ func TestWrongSlots(t *testing.T) {
}
}
// One recording cut to each of several slots' lengths (Savant's Mortals): the
// lengths cannot place it, and what AcoustID calls it does (#6169).
func TestTrimmedCopies(t *testing.T) {
// The lengths cannot place a recording filed as several songs (Savant's
// Mortals, cut to each slot's length); what AcoustID calls it can (#6169).
func TestNamedCopies(t *testing.T) {
track := func(title string, ms int32, rec string) dbq.MbReleaseTrack {
return dbq.MbReleaseTrack{Title: title, LengthMs: ms, RecordingMbid: rec}
}
@@ -127,34 +127,27 @@ func TestTrimmedCopies(t *testing.T) {
album := []dbq.MbReleaseTrack{
track("Tormentor", 221000, "rec-tormentor"), track("Record Shop", 180000, "rec-record-shop"), track("Ice Cream", 200000, "rec-ice"),
}
if !trimmedToSlots(copies, album) {
t.Fatal("each copy fits its own slot: trimmedToSlots should hold the group")
}
if trimmedToSlots(copies[:1], album) {
t.Error("one title is not several songs' slots")
}
if trimmedToSlots([]slotCopy{copies[0], {Title: "Record Shop", Artist: "The Wombats", DurationMs: 220000}}, album) {
t.Error("a copy that does not fit its slot is wrongSlots' to decide")
}
cases := []struct {
name string
copies []slotCopy
tracks []dbq.MbReleaseTrack
recordings []string
keep int
losers []int
ok bool
}{
{"AcoustID names Tormentor", album, []string{"rec-tormentor"}, 0, []int{1}, true},
{"one of several candidates is on the album", album, []string{"rec-elsewhere", "rec-record-shop"}, 1, []int{0}, true},
{"AcoustID knows none", album, nil, -1, []int{0, 1}, true},
{"the recording is another song on the album", album, []string{"rec-ice"}, -1, []int{0, 1}, true},
{"candidates in both copies' slots", album, []string{"rec-tormentor", "rec-record-shop"}, -1, nil, false},
{"the track list names no recording for a slot", []dbq.MbReleaseTrack{
{"AcoustID names Tormentor", copies, album, []string{"rec-tormentor"}, 0, []int{1}, true},
{"one of several candidates is on the album", copies, album, []string{"rec-elsewhere", "rec-record-shop"}, 1, []int{0}, true},
{"AcoustID knows none", copies, album, nil, -1, []int{0, 1}, true},
{"the recording is another song on the album", copies, album, []string{"rec-ice"}, -1, []int{0, 1}, true},
{"candidates in both copies' slots", copies, album, []string{"rec-tormentor", "rec-record-shop"}, -1, nil, false},
{"the track list names no recording for a slot", copies, []dbq.MbReleaseTrack{
track("Tormentor", 221000, "rec-tormentor"), track("Record Shop", 180000, ""),
}, []string{"rec-tormentor"}, -1, nil, false},
{"every copy filed as the one song named", []slotCopy{copies[0], copies[0]}, album, []string{"rec-tormentor"}, -1, nil, false},
}
for _, tc := range cases {
keep, losers, ok := trimmedCopies(copies, tc.tracks, tc.recordings)
keep, losers, ok := namedCopies(tc.copies, tc.tracks, tc.recordings)
if keep != tc.keep || ok != tc.ok || fmt.Sprint(losers) != fmt.Sprint(tc.losers) {
t.Errorf("%s: got keep=%d losers=%v ok=%v, want keep=%d losers=%v ok=%v",
tc.name, keep, losers, ok, tc.keep, tc.losers, tc.ok)