mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 18:11:16 +01:00
The upload marker was inferred: an artwork upload stores the file and clears url_cover, so a stored cover path with no url meant "user supplied this". That signal cannot survive. get_cover returns no path when the file is missing and the scan writes that straight back to path_cover_s, so a single scan run while the resources volume is unavailable erases it. The next scan reads the row as having no cover at all, adopts the provider url, and replaces the user's cover with provider art once storage returns. A resources volume left out of a container recreate is enough to lose every uploaded cover in a library. path_cover_s cannot carry this. It tracks the filesystem and is reconciled on every scan; provenance has to outlive the file. locked_fields records it durably instead. Uploading artwork or a manual locks the field, and removing it, redownloading it, or naming a source url releases it again. A complete rescan clears the locks along with the resource files it deletes, so a lock can't point at a file that is gone and block its replacement. The migration backfills the old inferred marker, which is the last point at which it can still be read. Without it the first scan after upgrading would replace every uploaded cover. Manuals are deliberately not backfilled: an uploaded manual and a scraped one share a path and neither clears url_manual, so any guess would be wrong for half the rows. Manuals stay pinned by the scan and are marked from here on. Backfill verified on MariaDB and PostgreSQL against rows in the old shape, covering uploaded, scraped, coverless, and null-url cases. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>