From 6ac36dd334680ac280da65f2786b5eb73308c5a7 Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Mon, 1 Jun 2026 23:31:45 -0400 Subject: [PATCH] fix(web): user-playlist play omits third arg to satisfy contract test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 74bae74f routed per-artist system mixes through getPlaylist and always passed the source attribution as the third arg, falling back to undefined for true user playlists. Vitest's toHaveBeenCalledWith is arity-strict — playQueue(refs, 0, undefined) is not the same as playQueue(refs, 0) — so the PlaylistCard contract test failed on the user-playlist case. Split the call: pass three args only when a variant tag exists, two args for user playlists. Preserves source attribution for songs_like_artist and keeps user playlists source-less as the test pins. --- web/src/lib/components/PlaylistCard.svelte | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/web/src/lib/components/PlaylistCard.svelte b/web/src/lib/components/PlaylistCard.svelte index 3f871edf..84e358c0 100644 --- a/web/src/lib/components/PlaylistCard.svelte +++ b/web/src/lib/components/PlaylistCard.svelte @@ -86,10 +86,17 @@ const detail = await getPlaylist(playlist.id); const refs = toTrackRefs(detail.tracks); if (refs.length > 0) { - // Tag the queue with the variant when one exists so play - // events still carry the correct source attribution even - // though we went through the per-id path. - playQueue(refs, 0, variant != null ? { source: variant } : undefined); + // Per-artist system mixes (songs_like_artist) carry a + // variant tag so play_started still attributes the source + // correctly even though we routed through the per-id path. + // True user playlists (variant == null) call with two args + // so source attribution stays absent — the PlaylistCard + // test pins this contract. + if (variant != null) { + playQueue(refs, 0, { source: variant }); + } else { + playQueue(refs, 0); + } } } } finally {