feat(playlists): twelve Songs like mixes a day, drawn from a top-24 artist pool
release / go (push) Successful in 2m2s
release / web (push) Successful in 1m14s
release / govulncheck (push) Successful in 20s
release / integration (push) Failing after 4m5s
release / android (push) Successful in 4m38s
release / Build signed APK (push) Successful in 5m13s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Skipped
release / Verify release artifacts (tag releases only) (push) Skipped

Six mixes stretched to oversized circles on a wide window; twelve fill
the row at its normal tile size. The pool doubles with the count so the
daily shuffle still rotates which artists get a mix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-24 07:24:58 -05:00
co-authored by Claude Opus 5.5
parent 46d97e51f7
commit 806658aa60
4 changed files with 16 additions and 15 deletions
+3 -3
View File
@@ -360,7 +360,7 @@ SELECT c.artist_id,
FROM chosen c FROM chosen c
LEFT JOIN liked l ON l.artist_id = c.artist_id LEFT JOIN liked l ON l.artist_id = c.artist_id
ORDER BY score DESC, c.artist_id ORDER BY score DESC, c.artist_id
LIMIT 12 LIMIT 24
` `
type PickSeedArtistsRow struct { type PickSeedArtistsRow struct {
@@ -385,8 +385,8 @@ type PickSeedArtistsRow struct {
// tiered pick-kind ladder and stamps the built tracks, so metrics // tiered pick-kind ladder and stamps the built tracks, so metrics
// can compare mixes seeded from fresh vs stale engagement. // can compare mixes seeded from fresh vs stale engagement.
// Score = unskipped-play count + 5 if user has liked the artist. The // Score = unskipped-play count + 5 if user has liked the artist. The
// Go-side picker (pickSeedArtistsForDay) shuffles the 12 // Go-side picker (pickSeedArtistsForDay) shuffles the 24
// daily-deterministically and takes songsLikeSeedCount (6) so the mix // daily-deterministically and takes songsLikeSeedCount (12) so the mix
// set both rotates day-to-day and fills the dedicated Home row. // set both rotates day-to-day and fills the dedicated Home row.
func (q *Queries) PickSeedArtists(ctx context.Context, userID pgtype.UUID) ([]PickSeedArtistsRow, error) { func (q *Queries) PickSeedArtists(ctx context.Context, userID pgtype.UUID) ([]PickSeedArtistsRow, error) {
rows, err := q.db.Query(ctx, pickSeedArtists, userID) rows, err := q.db.Query(ctx, pickSeedArtists, userID)
+3 -3
View File
@@ -69,8 +69,8 @@ UPDATE system_playlist_runs SET in_flight = false WHERE in_flight = true;
-- tiered pick-kind ladder and stamps the built tracks, so metrics -- tiered pick-kind ladder and stamps the built tracks, so metrics
-- can compare mixes seeded from fresh vs stale engagement. -- can compare mixes seeded from fresh vs stale engagement.
-- Score = unskipped-play count + 5 if user has liked the artist. The -- Score = unskipped-play count + 5 if user has liked the artist. The
-- Go-side picker (pickSeedArtistsForDay) shuffles the 12 -- Go-side picker (pickSeedArtistsForDay) shuffles the 24
-- daily-deterministically and takes songsLikeSeedCount (6) so the mix -- daily-deterministically and takes songsLikeSeedCount (12) so the mix
-- set both rotates day-to-day and fills the dedicated Home row. -- set both rotates day-to-day and fills the dedicated Home row.
WITH liked AS ( WITH liked AS (
SELECT gla.artist_id FROM general_likes_artists gla WHERE gla.user_id = $1 SELECT gla.artist_id FROM general_likes_artists gla WHERE gla.user_id = $1
@@ -132,7 +132,7 @@ SELECT c.artist_id,
FROM chosen c FROM chosen c
LEFT JOIN liked l ON l.artist_id = c.artist_id LEFT JOIN liked l ON l.artist_id = c.artist_id
ORDER BY score DESC, c.artist_id ORDER BY score DESC, c.artist_id
LIMIT 12; LIMIT 24;
-- name: PickTopPlayedTracksForUser :many -- name: PickTopPlayedTracksForUser :many
-- For-You candidate seeds, tiered so For-You never silently vanishes: -- For-You candidate seeds, tiered so For-You never silently vanishes:
+4 -4
View File
@@ -159,7 +159,7 @@ func TestPickDailySeeds_EmptyPool(t *testing.T) {
} }
} }
// pickSeedArtistsForDay takes the user's top-12 candidate artists and // pickSeedArtistsForDay takes the user's top-24 candidate artists and
// returns songsLikeSeedCount of them via daily-deterministic shuffle. // returns songsLikeSeedCount of them via daily-deterministic shuffle.
// Verifies the picker is deterministic within a day, varies across days, // Verifies the picker is deterministic within a day, varies across days,
// and degrades gracefully when fewer than songsLikeSeedCount candidates // and degrades gracefully when fewer than songsLikeSeedCount candidates
@@ -186,7 +186,7 @@ func seedSetKey(seeds []pgtype.UUID) string {
func TestPickSeedArtistsForDay_DeterministicWithinDay(t *testing.T) { func TestPickSeedArtistsForDay_DeterministicWithinDay(t *testing.T) {
u := pgtype.UUID{Bytes: [16]byte{1}, Valid: true} u := pgtype.UUID{Bytes: [16]byte{1}, Valid: true}
pool := bigSeedPool(10) pool := bigSeedPool(24)
a := pickSeedArtistsForDay(pool, u, "2026-05-04") a := pickSeedArtistsForDay(pool, u, "2026-05-04")
b := pickSeedArtistsForDay(pool, u, "2026-05-04") b := pickSeedArtistsForDay(pool, u, "2026-05-04")
if len(a) != songsLikeSeedCount || len(b) != songsLikeSeedCount { if len(a) != songsLikeSeedCount || len(b) != songsLikeSeedCount {
@@ -201,9 +201,9 @@ func TestPickSeedArtistsForDay_DeterministicWithinDay(t *testing.T) {
func TestPickSeedArtistsForDay_VariesAcrossDays(t *testing.T) { func TestPickSeedArtistsForDay_VariesAcrossDays(t *testing.T) {
u := pgtype.UUID{Bytes: [16]byte{1}, Valid: true} u := pgtype.UUID{Bytes: [16]byte{1}, Valid: true}
pool := bigSeedPool(10) pool := bigSeedPool(24)
// Collect the seed set (order-independent) across many dates. With // Collect the seed set (order-independent) across many dates. With
// C(10, songsLikeSeedCount) combinations, 30 dates yield >=2 distinct sets. // C(24, songsLikeSeedCount) combinations, 30 dates yield >=2 distinct sets.
seen := map[string]bool{} seen := map[string]bool{}
for i := 1; i <= 30; i++ { for i := 1; i <= 30; i++ {
got := pickSeedArtistsForDay(pool, u, "2026-05-"+twoDigits(i)) got := pickSeedArtistsForDay(pool, u, "2026-05-"+twoDigits(i))
+6 -5
View File
@@ -35,7 +35,7 @@ type seedArtistRow struct {
} }
// pickSeedArtistsFromRows projects sqlc rows into the seed list. The // pickSeedArtistsFromRows projects sqlc rows into the seed list. The
// SQL already orders by score DESC + artist_id and LIMIT 12, so this is // SQL already orders by score DESC + artist_id and LIMIT 24, so this is
// just a column projection — but pulling it into a function keeps the // just a column projection — but pulling it into a function keeps the
// call-site readable and makes the post-fetch path testable without // call-site readable and makes the post-fetch path testable without
// a database. // a database.
@@ -106,10 +106,11 @@ func pickDailySeeds(pool []pgtype.UUID, userID pgtype.UUID, dateStr string, n in
} }
// songsLikeSeedCount is how many "Songs like {artist}" mixes to build // songsLikeSeedCount is how many "Songs like {artist}" mixes to build
// each day, enough to fill Songs-like's own Home row. Drawn from // each day, enough to fill Songs-like's own Home row at its normal tile
// PickSeedArtists' deeper top-12 pool via a daily-deterministic shuffle so // size on a wide window. Drawn from PickSeedArtists' deeper top-24 pool via
// the set still rotates day to day rather than pinning the same six artists. // a daily-deterministic shuffle so the set still rotates day to day rather
const songsLikeSeedCount = 6 // than pinning the same twelve artists.
const songsLikeSeedCount = 12
// pickSeedArtistsForDay picks up to songsLikeSeedCount seed artists for // pickSeedArtistsForDay picks up to songsLikeSeedCount seed artists for
// the Songs-like mixes; For-You uses pickDailySeeds directly with // the Songs-like mixes; For-You uses pickDailySeeds directly with