feat(server/coverart): auto-bump version on registered-provider change

On boot, the SettingsService computes a SHA-256 hash of the sorted
registered-provider IDs and compares to the hash stored on
cover_art_sources_meta. Mismatch → atomic bump of current_version +
update of stored hash. The next enrichment pass picks up the new
version, all 'none' rows become eligible, and they get retried
against the new chain (now including Deezer / Last.fm).

One-shot: subsequent boots without a provider-set change don't bump
again. The check is best-effort — failures are logged at Warn but
don't refuse startup; a temporarily unreachable DB at boot just
means 'none' rows stay parked until a manual re-search (next task).

Tests cover first-boot (empty stored hash → bump), repeat-boot
(no change → no bump), and the registered-providers-hash
determinism.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-07 07:55:07 -04:00
parent 238920540f
commit 8f5ec4c304
3 changed files with 137 additions and 0 deletions
+6
View File
@@ -90,6 +90,12 @@ func run() error {
logger.Error("coverart settings service init failed", "err", err)
os.Exit(1)
}
if newVer, bumped, berr := coverSettings.BumpVersionIfProvidersChanged(ctx); berr != nil {
logger.Warn("coverart: provider-hash boot check failed", "err", berr)
} else if bumped {
logger.Info("coverart: registered provider set changed; version bumped",
"new_version", newVer)
}
coverEnricher := coverart.NewEnricher(pool, logger.With("component", "coverart"), coverSettings)
coverEnricher.DataDir = cfg.Storage.DataDir