feat(explore): sample the one-album-owned shelf instead of ranking it
"More from artists you own one album by" drew its artists and their albums most-popular first, so it was a second leaderboard: the same handful of big names every time the page opened, which is not what the shelf is saying. The pool is still bounded, but which artists and which albums fill it is RANDOM(), so each visit is a different sample. The test asserts the set rather than the order. Refs #264 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017HJiuc3ZZhxsPXz3ozTirT
This commit is contained in:
@@ -3,6 +3,7 @@ package explore
|
||||
import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"yellowjacket/backend/database"
|
||||
@@ -202,6 +203,11 @@ func TestShelves_MoreFromOwnedNeedsExactlyOneOwnedAlbum(t *testing.T) {
|
||||
titles = append(titles, album.Title)
|
||||
}
|
||||
|
||||
// The row is a random sample, so the *set* is what is asserted and
|
||||
// not the order — see `unownedAlbumsBySinglyOwnedArtists` for why
|
||||
// the ordering was given up.
|
||||
sort.Strings(titles)
|
||||
|
||||
if len(titles) != 2 || titles[0] != "Second" || titles[1] != "Third" {
|
||||
t.Fatalf("albums = %v, want [Second Third]", titles)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user