Repository navigation
feat: unlink a playlist from the database keeping all files - #7
Merged
Merged
Conversation
Add a Danger zone to the playlist detail page with an Unlink from
database button backed by POST /api/playlists/{id}/unlink. The endpoint
refuses playlists with an open job (409, re-checked after the file
work), writes a re-import manifest.json from the playlist_entries
snapshot when the folder has none (an existing manifest from an import
is never overwritten), merges the local video ids append-only into the
download archive, and then removes playlist_entries, jobs and the
playlist row in FK order. Videos, sidecars and archives stay on disk,
so app.ta_import can restore the playlist without re-downloads.
This is the second documented exception to the never delete rule next
to the offline forget CLI: SPEC section 15 now covers both, section 2,
section 8, section 9 and the changelog are updated, plus README,
AGENTS and the PLAN decision log. Six new tests cover the guards, the
kept files and manifest shapes, and a full unlink -> import roundtrip.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Danger zone card at the bottom of the playlist detail page with an Unlink from database button, backed by a new endpoint
POST /api/playlists/{id}/unlink.Unlink removes a playlist from the database only (
playlist_entries→jobs→playlistsin FK order;runsstay). Videos, sidecars and the download archive stay on disk.Before the rows go away:
playlist has an open jobwhenstateisqueued/runningor an open job row exists; the guard is re-checked right before the delete (race with a concurrent enqueue).manifest.json, one is written from theplaylist_entriessnapshot in the exact shapeapp.ta_importreads. An existing manifest (imported playlists) is never overwritten – import detection without a migration.config/archives/<playlist_id>.txt(same rule as the importer), so re-adding the playlist later downloads nothing twice.File work runs before the DB delete: a failure there leaves the playlist untouched and the call retryable.
UI
button.dangerstyling.confirm()dialog naming what stays on disk and that channel playlists come back through the next discovery run.location.hash = state.detailFrom(no page reload, no stale 404 poll).data-idis cleared while another detail page loads, so it can never act on the previously shown playlist.Docs
never deletenow has two documented exceptions: SPEC §15 is retitled to Unlink und Wartungs-CLI app.forget and covers both, with follow-up edits in §2, §8, §9, §14 plus README (intro bullet, behaviour note, forgetting section), AGENTS.md (rule 1, api/forget rows) and a PLAN.md decision log entry.Tests
6 new tests in
tests/test_unlink.py: open-job/404 guards, rows gone + files kept + manifest shape + archive merged, existing import manifest byte-identical, no-folder case, and a fullunlink → scan_manifests → apply_importroundtrip (statedone, no duplicate archive lines).pytest -q= 184 green,ruff check .clean,node --check app/static/app.jsok.