feat: add DB-backed scanner entrypoint and compute-only main hook

Implements ScanArtist/ScanAll in internal/scanner loading local/external
releases via the database layer with ctx-cancellation checks, plus a
compute-only run() hook that logs missing-release counts. Add table-driven
tests using in-memory SQLite fixtures.
This commit is contained in:
2026-07-19 18:19:57 +03:00
parent a4f0460664
commit c2da8c2095
6 changed files with 348 additions and 8 deletions

View File

@@ -10,6 +10,20 @@ import (
"naviwatcher/internal/normalize"
)
// DefaultThreshold is the fallback similarity threshold used when a caller
// passes threshold == 0. It matches config.Scanner.FuzzyThreshold default.
const DefaultThreshold = 0.85
// resolveThreshold returns the provided threshold, or DefaultThreshold when
// the caller passes zero (unset). This keeps the engine usable when config
// defaults are not threaded through explicitly.
func resolveThreshold(threshold float64) float64 {
if threshold == 0 {
return DefaultThreshold
}
return threshold
}
// Similarity returns a normalized similarity score in the range [0.0, 1.0]
// between two strings. The strings are normalized first (lowercased,
// bracketed/parenthesized content and years stripped, special characters