From 563032f290ddf120e992c5dd2bd4fdbca0c1b43a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20S=C3=A1nchez?= Date: Wed, 19 Aug 2026 09:24:52 -0600 Subject: [PATCH] feat[agent-manager](tenants): scope collector listing by tenant like agents --- agent-manager/agent/collector_imp.go | 9 ++++++++- .../src/features/compliance/types/compliance.types.ts | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/agent-manager/agent/collector_imp.go b/agent-manager/agent/collector_imp.go index 9e2144fe8..e09fd0865 100644 --- a/agent-manager/agent/collector_imp.go +++ b/agent-manager/agent/collector_imp.go @@ -248,8 +248,15 @@ func (s *CollectorService) ListCollector(ctx context.Context, req *ListRequest) page := utils.NewPaginator(int(req.PageSize), int(req.PageNumber), req.SortBy) filter := utils.NewFilter(req.SearchQuery) + // Scoped by the caller: the panel asks for one tenant, and only the + // platform asks for all of them. + where := "" + if req.GetTenantId() != "" { + where = fmt.Sprintf("tenant_id = '%s'", sanitizeTenant(req.GetTenantId())) + } + collectors := []models.Collector{} - total, err := s.DBConnection.GetByPagination(&collectors, page, filter, "", false) + total, err := s.DBConnection.GetByPagination(&collectors, page, filter, where, false) if err != nil { catcher.Error("failed to fetch collectors", err, map[string]any{"process": "agent-manager"}) return nil, status.Errorf(codes.Internal, "failed to fetch collectors: %v", err) diff --git a/frontend/src/features/compliance/types/compliance.types.ts b/frontend/src/features/compliance/types/compliance.types.ts index 3e36951fb..a2c171738 100644 --- a/frontend/src/features/compliance/types/compliance.types.ts +++ b/frontend/src/features/compliance/types/compliance.types.ts @@ -191,7 +191,7 @@ export const isEditStale = (row: ControlRow): boolean => isOverridden(row) && row.originalStatus !== row.engineStatus export interface ReportSummary { - /** Compliant over Evaluated, not over Total. */ + /** Compliant over Total — un-evaluated requirements weigh against the score. */ compliantPct: number total: number evaluated: number