git/intake/main
issues/0026-fix-the-library-copy-can-lose-its-cover-or-be-dest.md
13 lines1 KB last change raw · rendered · history
---
title: fix: the library copy can lose its cover or be destroyed by a failed rebuild
status: closed
labels: []
created: 2026-09-14
closed:
---
Found by the audit of 2026-09-14.

The commonest shape a Soulseek album arrives in is a folder cover.jpg and no embedded art. The cover is chosen from the staging folder, execute.Run copies and embeds it into the archive and then deletes it as a staging leftover, and the library is built after that from the same now-deleted path. library.Transcode skipped a cover it could not stat without a word, so the library was built with no artwork at all while the archive had the right cover and every summary still named it. A copy of the cover is now taken before the archive runs, and a cover that cannot be read is reported as a warning.

The library swap was RemoveAll(old) followed by Rename(new). A failure part-way through the RemoveAll left the old library half deleted, the new one was thrown away by the deferred cleanup because the rename never happened, and there was a window between the two calls in which neither copy existed. The old library is now moved aside first and moved back if the new one cannot land. A failed cover optimisation also used to leave whatever ImageMagick had half-written to be promoted into the library, where library audit only ever asked whether a cover.jpg existed.