feat: Minstrel stops acquiring music and drops Discover
release / go (push) Successful in 1m54s
release / web (push) Failing after 5s
release / integration (push) Failing after 3m44s
release / govulncheck (push) Successful in 20s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (push) Canceled after 19s
release / android (push) Canceled after 2m37s

Minstrel is now a viewer of the library it is pointed at. Finding,
downloading and filing music moves out of it.

Removed from the server:
- the request flow (requests, approval, auto-approve) and the wanted list,
  follows, release profiles and release blocks;
- searching indexers, the download clients, the importer, the album
  lifecycle and missing-file re-acquisition;
- the catalogue's discography, search and art (the MusicBrainz release and
  track-list cache stays, for the duplicate resolver);
- Discover: its suggestions of artists not in the library, snoozes, the
  candidate-artist tag enrichment and its tuning scope;
- writes to acquisition tables from moving the library folder and from
  merging duplicates, the want-list join on Suspect sources, the sealing of
  acquisition credentials, and the release-group lookup only
  re-acquisition used.

Settling a wrong-slot duplicate no longer sets the release aside: the
copies go and their slots show as missing until a good copy is in the
library.

Removed from the web: Admin > Acquisition and Requests, /requests,
/discover, Follow on the artist page, the auto-approve toggle, and the
Collection's wanted-list tabs. The Collection is now the library's health:
an overview, Reports, Duplicates, Suspect sources and Missing files. The
README and docs no longer describe getting music.

The tables stay for now; a later migration drops them. The request
notification kinds and the Android screens are still to go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 20:51:14 -05:00
co-authored by Claude Opus 5.5
parent dabe1e052d
commit 55c7497ca7
277 changed files with 521 additions and 40021 deletions
-112
View File
@@ -281,115 +281,3 @@ func TestUpdate_NoOpWritesNoAudit(t *testing.T) {
t.Errorf("no-op update wrote %d audit rows, want 0", len(rows))
}
}
// --- Discover scope ---
func TestNew_SeedsDiscoverDefaults(t *testing.T) {
pool := newPool(t)
s := newService(t, pool)
got := s.Discover()
want := ShippedDiscoverTuning()
if got != want {
t.Errorf("Discover() = %+v, want shipped %+v", got, want)
}
}
func TestUpdateDiscover_PersistsAndAudits(t *testing.T) {
pool := newPool(t)
s := newService(t, pool)
if err := s.UpdateDiscover(context.Background(), map[string]float64{
"tag_overlap_weight": 2.5,
"snooze_days": 30,
}); err != nil {
t.Fatalf("UpdateDiscover: %v", err)
}
if got := s.Discover().TagOverlapWeight; got != 2.5 {
t.Errorf("TagOverlapWeight = %v, want 2.5", got)
}
if got := s.Discover().SnoozeDays; got != 30 {
t.Errorf("SnoozeDays = %v, want 30", got)
}
// The audit row must land under the new scope: a scope missing from
// recommendation_tuning_audit's CHECK fails this INSERT at runtime.
rows := auditRows(t, pool)
if len(rows) != 1 {
t.Fatalf("audit rows = %d, want 1", len(rows))
}
if rows[0].Scope != ScopeDiscover {
t.Errorf("audit scope = %q, want %q", rows[0].Scope, ScopeDiscover)
}
if len(rows[0].Changes) != 2 {
t.Errorf("audit changes = %+v, want both fields", rows[0].Changes)
}
// Reload from the DB to prove it persisted rather than only caching.
s2 := newService(t, pool)
if got := s2.Discover().TagOverlapWeight; got != 2.5 {
t.Errorf("after reload TagOverlapWeight = %v, want 2.5 (not re-seeded to shipped)", got)
}
}
func TestUpdateDiscover_Validation(t *testing.T) {
pool := newPool(t)
s := newService(t, pool)
cases := []struct {
name string
patch map[string]float64
}{
{"unknown field", map[string]float64{"nope": 1}},
{"negative weight", map[string]float64{"tag_overlap_weight": -1}},
{"weight past the typo bound", map[string]float64{"tag_overlap_weight": 100}},
// A sub-day snooze isn't a snooze, it's a flicker.
{"snooze under a day", map[string]float64{"snooze_days": 0.5}},
// Past a year it's a permanent dismissal wearing a snooze's clothes.
{"snooze past a year", map[string]float64{"snooze_days": 400}},
}
for _, c := range cases {
if err := s.UpdateDiscover(context.Background(), c.patch); err == nil {
t.Errorf("%s: expected rejection, got nil", c.name)
}
}
if got := s.Discover(); got != ShippedDiscoverTuning() {
t.Errorf("a rejected patch mutated state: %+v", got)
}
if rows := auditRows(t, pool); len(rows) != 0 {
t.Errorf("rejected patches wrote %d audit rows, want 0", len(rows))
}
}
// Weight 0 must be accepted: it's the off switch for the whole tag term, so
// a "must be positive" bound would leave no way to disable it.
func TestUpdateDiscover_ZeroWeightIsAllowed(t *testing.T) {
pool := newPool(t)
s := newService(t, pool)
if err := s.UpdateDiscover(context.Background(),
map[string]float64{"tag_overlap_weight": 0}); err != nil {
t.Fatalf("UpdateDiscover(0): %v", err)
}
if got := s.Discover().TagOverlapWeight; got != 0 {
t.Errorf("TagOverlapWeight = %v, want 0", got)
}
}
func TestResetDiscover_RestoresShippedDefaults(t *testing.T) {
pool := newPool(t)
s := newService(t, pool)
if err := s.UpdateDiscover(context.Background(),
map[string]float64{"tag_overlap_weight": 4}); err != nil {
t.Fatalf("UpdateDiscover: %v", err)
}
if err := s.Reset(context.Background(), ScopeDiscover); err != nil {
t.Fatalf("Reset: %v", err)
}
if got := s.Discover(); got != ShippedDiscoverTuning() {
t.Errorf("after reset = %+v, want shipped %+v", got, ShippedDiscoverTuning())
}
// Already-at-defaults is a no-op: update + reset = 2 rows, not 3.
if err := s.Reset(context.Background(), ScopeDiscover); err != nil {
t.Fatalf("second Reset: %v", err)
}
if rows := auditRows(t, pool); len(rows) != 2 {
t.Errorf("audit rows = %d, want 2 (the no-op reset must not audit)", len(rows))
}
}