The first public release of Fabled Minstrel #158

Merged
bvandeusen merged 256 commits from dev into main 2026-12-03 21:41:58 -05:00
Showing only changes of commit e71c132cc7 - Show all commits
+11 -4
View File
@@ -445,16 +445,23 @@ func TestBuildSystemPlaylists_DailyNonceDeterminism(t *testing.T) {
} }
} }
// snapshotSystemTracks returns a per-playlist-name → []track_id mapping // snapshotSystemTracks returns a per-mix → []track_id mapping for the
// for the user's system playlists, in playlist_tracks position order. // user's system playlists, in playlist_tracks position order.
//
// A mix is keyed by its name AND its seed artist, because names are not
// unique: two artists can share a name (the test fixtures make one artist
// row per track, all named alike), and their Songs like mixes are then
// both called "Songs like X". Keyed by name alone, two such mixes merge
// into one list whose interleaving is whatever order Postgres returns the
// tied rows in, and the snapshot varies even when the mixes do not.
func snapshotSystemTracks(t *testing.T, pool *pgxpool.Pool, userID pgtype.UUID) map[string][]string { func snapshotSystemTracks(t *testing.T, pool *pgxpool.Pool, userID pgtype.UUID) map[string][]string {
t.Helper() t.Helper()
rows, err := pool.Query(context.Background(), ` rows, err := pool.Query(context.Background(), `
SELECT p.name, pt.track_id SELECT p.name || ' [' || COALESCE(p.seed_artist_id::text, '-') || ']', pt.track_id
FROM playlists p FROM playlists p
JOIN playlist_tracks pt ON pt.playlist_id = p.id JOIN playlist_tracks pt ON pt.playlist_id = p.id
WHERE p.user_id = $1 AND p.kind = 'system' WHERE p.user_id = $1 AND p.kind = 'system'
ORDER BY p.name, pt.position ORDER BY p.name, p.seed_artist_id, pt.position
`, userID) `, userID)
if err != nil { if err != nil {
t.Fatalf("snapshot query: %v", err) t.Fatalf("snapshot query: %v", err)