From f1839ad9e7d910f6c220e5e82933aa364fc11aa4 Mon Sep 17 00:00:00 2001 From: Vladimir Zagainov Date: Sun, 19 Jul 2026 19:11:22 +0300 Subject: [PATCH] fix: address code review findings --- cmd/naviwatcher/main.go | 4 ++-- internal/config/config.go | 9 ++++++--- internal/config/config_test.go | 8 -------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/cmd/naviwatcher/main.go b/cmd/naviwatcher/main.go index 447b4d0..55a8214 100644 --- a/cmd/naviwatcher/main.go +++ b/cmd/naviwatcher/main.go @@ -97,8 +97,8 @@ func (a *App) Close() { func (a *App) run(ctx context.Context) error { // Compute-only scanner hook: scan all monitored artists for missing // releases and log the count. Notifier/Web UI are out of scope for this - // plan, so results are only logged. This call is non-blocking and - // goroutine-safe; it observes ctx cancellation and returns early. + // plan, so results are only logged. ScanAll is a blocking DB walk over + // every monitored artist; it observes ctx cancellation and returns early. missing, err := scanner.ScanAll(ctx, a.db, a.cfg.Scanner.FuzzyThreshold) if err != nil { if ctx.Err() != nil { diff --git a/internal/config/config.go b/internal/config/config.go index 107ac93..0cbc9b3 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -47,10 +47,13 @@ type TelegramConfig struct { } // ScannerConfig holds scanner engine parameters. +// +// Bootleg/Compilation filtering is intentionally unconditional: bootlegs, +// promotions, and pseudo-releases are always excluded (musicbrainz/api.go), +// and compilations are always included. These are not user-toggleable, so +// there are no corresponding config fields. type ScannerConfig struct { - FuzzyThreshold float64 `yaml:"fuzzy_threshold"` - IgnoreBootlegs bool `yaml:"ignore_bootlegs"` - IncludeCompilations bool `yaml:"include_compilations"` + FuzzyThreshold float64 `yaml:"fuzzy_threshold"` } // LoadConfig reads a YAML file from path, parses it, applies defaults, diff --git a/internal/config/config_test.go b/internal/config/config_test.go index 323695a..18c0212 100644 --- a/internal/config/config_test.go +++ b/internal/config/config_test.go @@ -35,8 +35,6 @@ telegram: scanner: fuzzy_threshold: 0.9 - ignore_bootlegs: true - include_compilations: false ` if err := os.WriteFile(path, []byte(yaml), 0644); err != nil { t.Fatalf("failed to write config: %v", err) @@ -68,12 +66,6 @@ scanner: if cfg.Scanner.FuzzyThreshold != 0.9 { t.Errorf("expected fuzzy_threshold 0.9, got %f", cfg.Scanner.FuzzyThreshold) } - if !cfg.Scanner.IgnoreBootlegs { - t.Error("expected ignore_bootlegs true") - } - if cfg.Scanner.IncludeCompilations { - t.Error("expected include_compilations false") - } } func TestLoadConfig_Defaults(t *testing.T) {