feat(server/m7-352): BuildSystemPlaylists with atomic replace + concurrency guard
Implements T5 of #352 slice 2: adds CreateSystemPlaylist sqlc query, BuildSystemPlaylists function (For-You + Songs-like mixes, tx atomic replace, in_flight guard, tieBreakHash determinism), and 7 integration tests covering activity, quarantine exclusion, atomic replace, concurrency, daily nonce stability, ListActiveUsers, and stale-in-flight recovery. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -140,3 +140,13 @@ SELECT id, user_id, name, description, is_public, kind, system_variant,
|
||||
WHERE user_id = $1
|
||||
AND ($2::text = 'all' OR kind = $2)
|
||||
ORDER BY updated_at DESC;
|
||||
|
||||
-- name: CreateSystemPlaylist :one
|
||||
-- Inserts a system-generated playlist. Used by BuildSystemPlaylists.
|
||||
-- For 'for_you' variant, pass seed_artist_id as NULL (zero-value pgtype.UUID
|
||||
-- with Valid=false).
|
||||
INSERT INTO playlists (
|
||||
user_id, name, description, is_public,
|
||||
kind, system_variant, seed_artist_id, cover_path
|
||||
) VALUES ($1, $2, '', false, 'system', $3, $4, $5)
|
||||
RETURNING *;
|
||||
|
||||
Reference in New Issue
Block a user