From 3b3d7002a9ae97e3ab4f0af264fe96cdda59feb7 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 27 Jul 2026 14:44:23 +0000 Subject: [PATCH] Drop pre-merge access source count check Scoped rows in the MERGE desired_sources CTE already limit snapshots to sources visible under the scoper. Signed-off-by: Cursor Agent Co-authored-by: Bryan FRIMIN --- pkg/coredata/access_review_campaign_source.go | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/pkg/coredata/access_review_campaign_source.go b/pkg/coredata/access_review_campaign_source.go index e96400b9c..d3fbbb136 100644 --- a/pkg/coredata/access_review_campaign_source.go +++ b/pkg/coredata/access_review_campaign_source.go @@ -166,27 +166,6 @@ func (sources *AccessReviewCampaignSources) MergeByCampaignID( sourceIDStrings[i] = id.String() } - countQ := ` -SELECT COUNT(DISTINCT id) -FROM access_review_sources -WHERE - %s - AND id = ANY(@access_review_source_ids::text[]) -` - countQ = fmt.Sprintf(countQ, scope.SQLFragment()) - - countArgs := pgx.StrictNamedArgs{"access_review_source_ids": sourceIDStrings} - maps.Copy(countArgs, scope.SQLArguments()) - - var found int - if err := conn.QueryRow(ctx, countQ, countArgs).Scan(&found); err != nil { - return fmt.Errorf("cannot count access review sources: %w", err) - } - - if found != len(uniqueSourceIDs) { - return ErrResourceNotFound - } - now := time.Now() q := `