From 6e985cf5325b6a8b694ad755ad702c9832629f5d Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Wed, 6 May 2026 21:26:36 -0400 Subject: [PATCH] =?UTF-8?q?fix(server/m7-scan-progress):=20forward-fix=20C?= =?UTF-8?q?I=20=E2=80=94=20ScanTrigger=20interface?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit B-T2 changed Scanner.Scan to take a progressCb parameter, but the ScanTrigger interface in internal/server/server.go was missed. The interface gains the same progressCb arg; the HTTP handler at handleAdminScan passes nil (fire-and-forget triggers don't observe partial tallies). The stubScanner in server_test.go gets the new arg too. --- internal/server/server.go | 8 +++++--- internal/server/server_test.go | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/server/server.go b/internal/server/server.go index 73d9ff8e..af477ac3 100644 --- a/internal/server/server.go +++ b/internal/server/server.go @@ -52,9 +52,11 @@ func (a lidarrUnmonitorAdapter) UnmonitorTrack(ctx context.Context, trackMbid, a } // ScanTrigger is the subset of the scanner the HTTP handler needs. Kept as an -// interface so tests can stub it without touching the DB. +// interface so tests can stub it without touching the DB. The progressCb +// parameter (added in m7-scan-progress) lets the orchestrator drive partial- +// tally writes; the HTTP handler passes nil for fire-and-forget triggers. type ScanTrigger interface { - Scan(ctx context.Context) (library.Stats, error) + Scan(ctx context.Context, progressCb func(library.Stats)) (library.Stats, error) } type Server struct { @@ -151,7 +153,7 @@ func (s *Server) handleHealthz(w http.ResponseWriter, _ *http.Request) { // Kept synchronous for v1: libraries are small and the operator can tell when // it's done. Async jobs with status polling are a later-milestone concern. func (s *Server) handleAdminScan(w http.ResponseWriter, r *http.Request) { - stats, err := s.Scanner.Scan(r.Context()) + stats, err := s.Scanner.Scan(r.Context(), nil) w.Header().Set("Content-Type", "application/json") if err != nil { s.Logger.Error("admin scan failed", "err", err) diff --git a/internal/server/server_test.go b/internal/server/server_test.go index a36db94f..e2f35947 100644 --- a/internal/server/server_test.go +++ b/internal/server/server_test.go @@ -247,6 +247,6 @@ func TestRouter_AdminSubtreeNotShadowed(t *testing.T) { // route-presence assertions in this file. type stubScanner struct{} -func (stubScanner) Scan(_ context.Context) (library.Stats, error) { +func (stubScanner) Scan(_ context.Context, _ func(library.Stats)) (library.Stats, error) { panic("stubScanner.Scan called from server_test") }