diff --git a/pkg/cookiebanner/reset_trackers_test.go b/pkg/cookiebanner/reset_trackers_test.go index a07965fd7..7897438c0 100644 --- a/pkg/cookiebanner/reset_trackers_test.go +++ b/pkg/cookiebanner/reset_trackers_test.go @@ -70,7 +70,7 @@ func TestResetBannerTrackers_FullRebuild(t *testing.T) { TrackerPatternID: &glob.ID, TrackerType: coredata.TrackerTypeCookie, Identifier: identifier, - Source: ref(coredata.CookieSourceScript), + Source: new(coredata.CookieSourceScript), LastDetectedAt: now, CreatedAt: now, UpdatedAt: now, @@ -97,6 +97,7 @@ func TestResetBannerTrackers_FullRebuild(t *testing.T) { require.NoError(t, client.WithConn(ctx, func(ctx context.Context, conn pg.Querier) error { // The glob is gone. var goneGlob coredata.TrackerPattern + err := goneGlob.LoadByBannerIDTypeAndPattern(ctx, conn, fx.scope, fx.banner.ID, coredata.TrackerTypeCookie, "_ga_*", nil) require.ErrorIs(t, err, coredata.ErrResourceNotFound) @@ -145,10 +146,6 @@ func TestResetBannerTrackers_FullRebuild(t *testing.T) { })) } -func ref[T any](v T) *T { - return &v -} - func seedCommonTrackerPattern(t *testing.T, ctx context.Context, client *pg.Client, pattern string) gid.GID { t.Helper() diff --git a/pkg/proboctl/cmdutil/paginate.go b/pkg/proboctl/cmdutil/paginate.go index 41aaf23f1..c7354fc69 100644 --- a/pkg/proboctl/cmdutil/paginate.go +++ b/pkg/proboctl/cmdutil/paginate.go @@ -44,6 +44,7 @@ func Paginate[E page.Paginable[F], F page.OrderField]( for { size := paginatePageSize + if limit > 0 { remaining := limit - len(result) if remaining <= 0 { diff --git a/pkg/proboctl/commontrackerpattern/list.go b/pkg/proboctl/commontrackerpattern/list.go index 7d99abd51..7cd68cdc5 100644 --- a/pkg/proboctl/commontrackerpattern/list.go +++ b/pkg/proboctl/commontrackerpattern/list.go @@ -144,6 +144,7 @@ func renderPatternTable(cmd *cobra.Command, f *cmdutil.Factory, patterns coredat } var linkedIDs []gid.GID + for _, p := range patterns { if p.CommonThirdPartyID != nil { linkedIDs = append(linkedIDs, *p.CommonThirdPartyID) diff --git a/pkg/proboctl/commontrackerpattern/reenrich.go b/pkg/proboctl/commontrackerpattern/reenrich.go index bade09859..6629d3935 100644 --- a/pkg/proboctl/commontrackerpattern/reenrich.go +++ b/pkg/proboctl/commontrackerpattern/reenrich.go @@ -119,6 +119,7 @@ func newCmdReenrich(f *cmdutil.Factory) *cobra.Command { ctx, func(ctx context.Context, tx pg.Tx) error { var ps coredata.CommonTrackerPatterns + requeued, err = ps.RequestEnrichmentByIDs(ctx, tx, ids, flagResetEnriched) return err @@ -194,6 +195,7 @@ func resolveReenrichIDs( } var tps coredata.TrackerPatterns + ids, err = tps.LoadAllLinkedCommonTrackerPatternIDsByCookieBannerID(ctx, conn, coredata.NewScopeFromObjectID(bannerID), bannerID) return err @@ -204,6 +206,7 @@ func resolveReenrichIDs( } var tps coredata.TrackerPatterns + ids, err = tps.LoadAllLinkedCommonTrackerPatternIDsByOrganizationID(ctx, conn, coredata.NewScopeFromObjectID(orgID), orgID) return err @@ -218,6 +221,7 @@ func resolveReenrichIDs( } var ps coredata.CommonTrackerPatterns + ids, err = ps.LoadAllIDs(ctx, conn, filter) return err @@ -246,6 +250,7 @@ func buildReenrichFilter( } filter.WithCommonThirdPartyID(&id) + hasSelector = true } @@ -256,11 +261,13 @@ func buildReenrichFilter( } filter.WithTrackerType(&tt) + hasSelector = true } if keyword != "" { filter.WithKeyword(&keyword) + hasSelector = true } @@ -271,6 +278,7 @@ func buildReenrichFilter( } filter.WithState(&st) + hasSelector = true } diff --git a/pkg/proboctl/commontrackerpattern/stats.go b/pkg/proboctl/commontrackerpattern/stats.go index 9d3ba3b60..3f9336261 100644 --- a/pkg/proboctl/commontrackerpattern/stats.go +++ b/pkg/proboctl/commontrackerpattern/stats.go @@ -54,11 +54,11 @@ func newCmdStats(f *cmdutil.Factory) *cobra.Command { filter *coredata.CommonTrackerPatternFilter }{ {"total", coredata.NewCommonTrackerPatternFilter()}, - {"queued", coredata.NewCommonTrackerPatternFilter().WithState(refState(coredata.CommonTrackerPatternEnrichmentStateQueued))}, - {"enriched", coredata.NewCommonTrackerPatternFilter().WithState(refState(coredata.CommonTrackerPatternEnrichmentStateEnriched))}, - {"unenriched", coredata.NewCommonTrackerPatternFilter().WithState(refState(coredata.CommonTrackerPatternEnrichmentStateUnenriched))}, - {"linked", coredata.NewCommonTrackerPatternFilter().WithLinked(refBool(true))}, - {"unlinked", coredata.NewCommonTrackerPatternFilter().WithLinked(refBool(false))}, + {"queued", coredata.NewCommonTrackerPatternFilter().WithState(new(coredata.CommonTrackerPatternEnrichmentStateQueued))}, + {"enriched", coredata.NewCommonTrackerPatternFilter().WithState(new(coredata.CommonTrackerPatternEnrichmentStateEnriched))}, + {"unenriched", coredata.NewCommonTrackerPatternFilter().WithState(new(coredata.CommonTrackerPatternEnrichmentStateUnenriched))}, + {"linked", coredata.NewCommonTrackerPatternFilter().WithLinked(new(true))}, + {"unlinked", coredata.NewCommonTrackerPatternFilter().WithLinked(new(false))}, } for _, c := range counts { @@ -94,11 +94,3 @@ func newCmdStats(f *cmdutil.Factory) *cobra.Command { return cmd } - -func refState(s coredata.CommonTrackerPatternEnrichmentState) *coredata.CommonTrackerPatternEnrichmentState { - return &s -} - -func refBool(b bool) *bool { - return &b -}