musicbrainz-provider #2
@@ -84,11 +84,11 @@
|
|||||||
- [x] run full test suite (`go test ./...`) and `go vet ./...` — must pass before final task
|
- [x] run full test suite (`go test ./...`) and `go vet ./...` — must pass before final task
|
||||||
|
|
||||||
### Task 6: Verify acceptance criteria
|
### Task 6: Verify acceptance criteria
|
||||||
- [ ] verify `FindMissingReleases`/`ScanArtist`/`ScanAll` meet spec: normalization + 0.85 fuzzy threshold, ignore `IsIgnored`, per-artist scoping
|
- [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)
|
||||||
- [ ] verify `config.Scanner.FuzzyThreshold` default 0.85 is used when threshold arg is zero (or document the chosen contract)
|
- [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)
|
||||||
- [ ] run full test suite (unit) — all green
|
- [x] run full test suite (unit) — all green (`go test ./...` passes)
|
||||||
- [ ] run `go vet ./...` and `gofmt -l ./internal ./cmd` — zero issues
|
- [x] run `go vet ./...` and `gofmt -l ./internal ./cmd` — zero issues (fixed two unformatted test files)
|
||||||
- [ ] verify test coverage of `internal/scanner` and `internal/normalize` (target 80%+)
|
- [x] verify test coverage of `internal/scanner` and `internal/normalize` (target 80%+) — scanner 90.3%, normalize 100.0%
|
||||||
|
|
||||||
### Task 7: Update documentation
|
### Task 7: Update documentation
|
||||||
- [ ] update `README.md` to note the Scanner Engine is implemented (compute-only; notifier/web pending)
|
- [ ] update `README.md` to note the Scanner Engine is implemented (compute-only; notifier/web pending)
|
||||||
|
|||||||
@@ -888,4 +888,3 @@ func TestSyncArtistDiscography_ResyncWithNotifications(t *testing.T) {
|
|||||||
t.Errorf("expected 0 notifications after resync, got %d", count)
|
t.Errorf("expected 0 notifications after resync, got %d", count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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) {
|
func TestScanArtist_IgnoredNotReported(t *testing.T) {
|
||||||
db := newTestDB(t)
|
db := newTestDB(t)
|
||||||
defer db.Close()
|
defer db.Close()
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ import (
|
|||||||
|
|
||||||
func TestSimilarity(t *testing.T) {
|
func TestSimilarity(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
a string
|
a string
|
||||||
b string
|
b string
|
||||||
want float64
|
want float64
|
||||||
epsilon float64
|
epsilon float64
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "exact match scores 1.0",
|
name: "exact match scores 1.0",
|
||||||
@@ -127,14 +127,14 @@ func TestFindMissingReleases(t *testing.T) {
|
|||||||
artistB := "artist-b"
|
artistB := "artist-b"
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
name string
|
name string
|
||||||
local []database.LocalAlbum
|
local []database.LocalAlbum
|
||||||
external []database.ExternalRelease
|
external []database.ExternalRelease
|
||||||
want []string // RGIDs expected to be reported as missing
|
want []string // RGIDs expected to be reported as missing
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "no local albums means all external are missing",
|
name: "no local albums means all external are missing",
|
||||||
local: nil,
|
local: nil,
|
||||||
external: []database.ExternalRelease{
|
external: []database.ExternalRelease{
|
||||||
{RGID: "rg1", ArtistID: artistA, Title: "The Wall"},
|
{RGID: "rg1", ArtistID: artistA, Title: "The Wall"},
|
||||||
{RGID: "rg2", ArtistID: artistA, Title: "Animals"},
|
{RGID: "rg2", ArtistID: artistA, Title: "Animals"},
|
||||||
|
|||||||
Reference in New Issue
Block a user