fix(playlists): each daily mix keeps its id across rebuilds (#8081)

The nightly rebuild deleted every system playlist and inserted new rows, so
each mix got a new id every day. A Subsonic app caches, pins, downloads and
syncs a playlist by id, and saw its mixes deleted and recreated daily: a
stored mix answered "not found" and an offline download was orphaned.

The rebuild now refills yesterday's row for the same mix in place (keyed by
kind, plus the seed artist for "Songs like" and the name for a genre mix),
inserts only mixes that are new, and deletes the ones today's build didn't
make, along with their collage files. The rollups move updated_at, which is
the "changed" time Subsonic apps use to see a mix was refreshed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 23:57:41 -05:00
co-authored by Claude Opus 5.5
parent dbf39f90f8
commit d1f76167c8
6 changed files with 236 additions and 65 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ func TestRotateForDay_UntieredPoolIsWholeRotation(t *testing.T) {
func TestFinishMix_PropagatesPickKind(t *testing.T) {
// Tier stamps ride discoverTrack through diversify/truncate into
// the rankedCandidates that insertSystemPlaylist persists.
// the rankedCandidates that materializeSystemPlaylist persists.
pool := []discoverTrack{mixTrack(1, pickKindTier1), mixTrack(2, pickKindTier2)}
got := finishMix(pool, false)
if len(got) != 2 {