musicbrainz-provider #2

Merged
Mrixs merged 72 commits from musicbrainz-provider into master 2026-08-05 20:19:16 +00:00
4 changed files with 39 additions and 16 deletions
Showing only changes of commit 9fc89fd5a4 - Show all commits

View File

@@ -84,11 +84,11 @@
- [x] run full test suite (`go test ./...`) and `go vet ./...` — must pass before final task
### Task 6: Verify acceptance criteria
- [ ] verify `FindMissingReleases`/`ScanArtist`/`ScanAll` meet spec: normalization + 0.85 fuzzy threshold, ignore `IsIgnored`, per-artist scoping
- [ ] verify `config.Scanner.FuzzyThreshold` default 0.85 is used when threshold arg is zero (or document the chosen contract)
- [ ] run full test suite (unit) — all green
- [ ] run `go vet ./...` and `gofmt -l ./internal ./cmd` — zero issues
- [ ] verify test coverage of `internal/scanner` and `internal/normalize` (target 80%+)
- [x] verify `FindMissingReleases`/`ScanArtist`/`ScanAll` meet spec: normalization + 0.85 fuzzy threshold, ignore `IsIgnored`, per-artist scoping (confirmed via tests in scanner_test.go / scan_test.go; grep of diff.go + scan.go shows normalizing via normalize.NormalizeString, IsIgnored skip, ArtistID grouping)
- [x] verify `config.Scanner.FuzzyThreshold` default 0.85 is used when threshold arg is zero (resolveThreshold in scanner.go returns DefaultThreshold=0.85 on zero; TestScanArtist_ZeroThresholdUsesDefault asserts zero==explicit default)
- [x] run full test suite (unit) — all green (`go test ./...` passes)
- [x] run `go vet ./...` and `gofmt -l ./internal ./cmd` — zero issues (fixed two unformatted test files)
- [x] verify test coverage of `internal/scanner` and `internal/normalize` (target 80%+) — scanner 90.3%, normalize 100.0%
### Task 7: Update documentation
- [ ] update `README.md` to note the Scanner Engine is implemented (compute-only; notifier/web pending)

View File

@@ -888,4 +888,3 @@ func TestSyncArtistDiscography_ResyncWithNotifications(t *testing.T) {
t.Errorf("expected 0 notifications after resync, got %d", count)
}
}

View File

@@ -82,6 +82,30 @@ func TestScanArtist(t *testing.T) {
}
}
func TestScanArtist_ZeroThresholdUsesDefault(t *testing.T) {
db := newTestDB(t)
defer db.Close()
seedArtist(t, db, "artist-1", "Pink Floyd")
seedLocalAlbum(t, db, "l1", "artist-1", "The Wall")
seedExternalRelease(t, db, "rg1", "artist-1", "The Wall", false)
seedExternalRelease(t, db, "rg2", "artist-1", "Animals", false)
// Pass 0 (zero value / unset) and the explicit default; results must match.
zero, err := ScanArtist(context.Background(), db, "artist-1", 0)
if err != nil {
t.Fatalf("ScanArtist(0) error: %v", err)
}
explicit, err := ScanArtist(context.Background(), db, "artist-1", DefaultThreshold)
if err != nil {
t.Fatalf("ScanArtist(%v) error: %v", DefaultThreshold, err)
}
if len(zero) != len(explicit) {
t.Errorf("ScanArtist(0) returned %d missing, ScanArtist(%v) returned %d; must match",
len(zero), DefaultThreshold, len(explicit))
}
}
func TestScanArtist_IgnoredNotReported(t *testing.T) {
db := newTestDB(t)
defer db.Close()