From f29a9e49d3d53bdb1c6ddde47dddf709ebd23fe5 Mon Sep 17 00:00:00 2001 From: Steve Cliff Date: Sun, 3 May 2026 23:50:05 +0100 Subject: [PATCH] server: fix stale RetentionPolicy comment + check Scan errors in maintenance test --- internal/server/http/jobs.go | 2 +- internal/server/http/maintenance_dispatch_test.go | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/internal/server/http/jobs.go b/internal/server/http/jobs.go index e6afd7a..d4efa63 100644 --- a/internal/server/http/jobs.go +++ b/internal/server/http/jobs.go @@ -72,7 +72,7 @@ func (s *Server) dispatchJob(ctx context.Context, user *store.User, } // dispatchJobWithPayload is dispatchJob's variant that lets callers -// fill in structured fields (Includes/Excludes/Tag/RetentionPolicy) +// fill in structured fields (Includes/Excludes/Tag/ForgetGroups/RequiresAdminCreds) // — used by the per-source-group Run-now path. JobID is filled in // here; callers leave it zero on the input payload. func (s *Server) dispatchJobWithPayload(ctx context.Context, user *store.User, diff --git a/internal/server/http/maintenance_dispatch_test.go b/internal/server/http/maintenance_dispatch_test.go index 33a1f4a..9702cf5 100644 --- a/internal/server/http/maintenance_dispatch_test.go +++ b/internal/server/http/maintenance_dispatch_test.go @@ -158,7 +158,9 @@ func TestDispatchMaintenanceForgetSkipsHostWithNoRetention(t *testing.T) { t.Errorf("unexpected command.run: %+v", got) } var n int - _ = st.DB().QueryRow(`SELECT COUNT(*) FROM jobs WHERE host_id = ? AND kind = 'forget'`, hostID).Scan(&n) + if err := st.DB().QueryRow(`SELECT COUNT(*) FROM jobs WHERE host_id = ? AND kind = 'forget'`, hostID).Scan(&n); err != nil { + t.Fatalf("count: %v", err) + } if n != 0 { t.Errorf("forget job rows: got %d, want 0", n) } @@ -184,7 +186,9 @@ func TestDispatchMaintenancePruneSkipsWithoutAdminCreds(t *testing.T) { t.Errorf("unexpected command.run: %+v", got) } var n int - _ = st.DB().QueryRow(`SELECT COUNT(*) FROM jobs WHERE host_id = ? AND kind = 'prune'`, hostID).Scan(&n) + if err := st.DB().QueryRow(`SELECT COUNT(*) FROM jobs WHERE host_id = ? AND kind = 'prune'`, hostID).Scan(&n); err != nil { + t.Fatalf("count: %v", err) + } if n != 0 { t.Errorf("prune job rows: got %d, want 0", n) }