fix(cleanup): unused-tags delete must use the same predicate as the preview #87
Reference in New Issue
Block a user
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The unused-tags cleanup tool deleted fandom tags the preview correctly excluded — real operator data loss (2026-06-08). Root cause: the unused-tag predicate was written twice — once in the preview (
find_unused_tags) and again inline inprune_unused_tags(its COUNT and DELETE). An earlier fix patched only the preview; the delete kept the narrower predicate (image_tag/series_page only, missing the fandom + series_chapter exclusions), so it removed fandoms the preview had hidden. Deleting a fandom SET-NULLs its characters'fandom_id.What
_unused_tag_conditions()as the single source of truth; the preview sample, the dry-run count, and the live DELETE all consume it. No second copy left to drift.Notes
🤖 Generated with Claude Code