soulsync/core/discovery
BoulderBadgeDad 87e5e1fa23 #702: make mirrored-playlist cancel/reset/delete idempotent (un-wedge LB weekly sync)
Root cause (from the reporter's app.log): a ListenBrainz weekly playlist syncs
through the in-memory youtube_playlist_states discovery machine. When that live
state is lost — a Docker restart, or the discovery process ending while the user
waits for the media-server scan — the DB discover-download snapshot survives but
the live state is gone. Every recovery action (Cancel/Reset/Delete) then hit
`key not in states` and returned 404 "YouTube playlist not found" (hence the
confusing "Youtube" on a ListenBrainz playlist), leaving the playlist permanently
wedged with no way to dismiss or re-sync. Works for the maintainer because a
single session with no restart keeps the live state alive.

Fix — these are cleanup ops, so "the thing is already gone" is SUCCESS, not 404:
- cancel_sync core (shared by YouTube + ListenBrainz + Tidal/Deezer/Qobuz/...) →
  missing key returns idempotent success.
- reset_youtube_playlist / delete_youtube_playlist → same.
The playlist becomes recoverable: Cancel/Reset clears the dead state and the user
re-syncs fresh.

Tests: cancel_sync core (missing key = idempotent 200 not 404; present key still
cancels + clears the worker + reverts phase); endpoint-level idempotency for
cancel/reset/delete; updated the old test that locked the 404 wedge. 834 sync/
discovery tests green.
2026-06-11 12:55:55 -07:00
..
__init__.py PR5a: lift _run_sync_task to core/discovery/sync.py 2026-04-28 11:20:47 -07:00
beatport.py PR5f: lift _run_beatport_discovery_worker to core/discovery/beatport.py 2026-04-28 15:36:15 -07:00
deezer.py PR5d: lift _run_deezer_discovery_worker to core/discovery/deezer.py 2026-04-28 12:45:18 -07:00
endpoints.py #702: make mirrored-playlist cancel/reset/delete idempotent (un-wedge LB weekly sync) 2026-06-11 12:55:55 -07:00
hero.py Add MusicBrainz as a metadata source 2026-05-18 18:47:13 -07:00
listenbrainz.py PR5g: lift _run_listenbrainz_discovery_worker to core/discovery/listenbrainz.py 2026-04-28 16:09:02 -07:00
manual_match.py #799: stop mirrored discovery from reverting a manual fix to Wing It 2026-06-05 11:07:32 -07:00
matching.py Fold provider-matching into PlaylistSource contract (Phase 1b) 2026-05-26 13:07:01 -07:00
playlist.py #799: stop mirrored discovery from reverting a manual fix to Wing It 2026-06-05 11:07:32 -07:00
qobuz.py Add Qobuz playlist sync to Sync page (#677) 2026-05-23 23:27:36 -07:00
quality_scanner.py Surface silent exceptions across remaining modules — ~70 sites 2026-05-07 10:28:58 -07:00
scoring.py Lift discovery scoring + tidal-track search to core/discovery/scoring.py 2026-04-30 09:08:47 -07:00
spotify_public.py Add iTunes / Apple Music link import tab on Sync page 2026-05-25 22:32:18 -07:00
sync.py Sync: append mode preserves the playlist image like reconcile (#811) 2026-06-07 23:25:42 -07:00
tidal.py Lift _run_tidal_discovery_worker to core/discovery/tidal.py 2026-04-28 23:02:24 -07:00
youtube.py fix: cast duration_ms to int before :02d format in discovery workers 2026-04-28 12:07:54 -07:00