fix: address code review findings

- notifier: show artist display names (not internal IDs) in digest; resolve
  names from artist_settings and fall back to ID when unavailable
- notifier: skip sending an empty digest to avoid daily spam
- config: require telegram token/chat_id when enabled
- web: warn loudly when auth is disabled on a non-loopback bind; add HTTP
  server timeouts
- web: treat SetReleaseIgnored "release not found" as benign redirect (0 rows)
- musicbrainz: reject low-score/name-mismatched MBID resolutions instead of
  silently caching the wrong artist
- database: remove dead duplicate err check; harden DSN param appending
- musicbrainz: check rows.Err() after iterating existing releases
This commit is contained in:
2026-07-19 23:46:05 +03:00
parent 389d177d85
commit 7cdb473d9c
12 changed files with 189 additions and 22 deletions

View File

@@ -100,6 +100,26 @@ func TestNotifyOnce_SendsAndMarksSent(t *testing.T) {
}
}
func TestNotifyOnce_EmptyDoesNotSend(t *testing.T) {
db, err := database.New(":memory:")
if err != nil {
t.Fatalf("New(): %v", err)
}
defer db.Close()
sender := &collectSender{}
n, err := NotifyOnce(context.Background(), db, sender, config.TelegramConfig{}, "http://ui")
if err != nil {
t.Fatalf("NotifyOnce: %v", err)
}
if n != 0 {
t.Fatalf("expected 0 releases notified, got %d", n)
}
if sender.count() != 0 {
t.Fatalf("expected no message sent for empty digest, got %d", sender.count())
}
}
func TestNotifyOnce_SkipsAlreadySent(t *testing.T) {
db, err := database.New(":memory:")
if err != nil {