refactor(providers): cover art and tags share one registry and settings service (#8002)

coverart and tags each carried a line-for-line copy of the provider
registry and the settings service: reconcile at boot, seal and reveal
API keys, bump the sources version when the enabled set or the
registered set changes. A fix to either had to be made twice.

internal/providers now holds Registry, Service (over a small Store
interface) and EnabledAs[T]. Each family keeps its own tables, provider
set and capabilities: a 40-line Store adapter over its sqlc queries and
its capability views (EnabledAlbumProviders, EnabledTrackTagProviders).
Provider, ProviderSettings, TestableProvider, ProviderInfo and
ProviderUpdatePatch stay as the families' names for the shared types.
The service has unit tests over an in-memory store.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-26 12:57:19 -05:00
co-authored by Claude Opus 5.5
parent 58fb2bbe9d
commit 487e11f59f
8 changed files with 769 additions and 830 deletions
-18
View File
@@ -334,21 +334,3 @@ func TestSettingsService_BumpVersion_Increments(t *testing.T) {
t.Errorf("second newVer = %d, want %d", newVer2, afterFirst+1)
}
}
// TestRegisteredProvidersHash_StableAcrossOrder: registry order
// shouldn't matter because we sort before hashing.
func TestRegisteredProvidersHash_StableAcrossOrder(t *testing.T) {
// Hash is a function of the registered set; in this test it just
// needs to be deterministic and non-empty.
h1 := registeredProvidersHash()
h2 := registeredProvidersHash()
if h1 != h2 {
t.Errorf("hash is not deterministic: %q vs %q", h1, h2)
}
if h1 == "" {
t.Errorf("hash empty; expected at least one provider registered (or empty set is valid)")
}
if len(h1) != 64 {
t.Errorf("hash length = %d, want 64 (SHA-256 hex)", len(h1))
}
}