Add proboctl catalog and banner reset commands

Add operator commands to proboctl for iterating on the cookie-banner
agents.

The global catalog groups (common-tracker-pattern, common-third-party)
list/filter/sort/show the catalogs using the shared coredata cursor
layer, and common-tracker-pattern reenrich re-describes selected rows by
running the enricher in-process (so it completes synchronously rather
than racing the async queue); a --cfg-file flag reuses probod's config
to wire the agent. --linked-banner/--linked-org target exactly the
catalog rows a banner or org depends on.

The cookie-banner reset-trackers command is tenant-scoped (it derives a
coredata.Scope from the banner/org GID) and rebuilds a banner's
uncategorised, non-excluded patterns from detected_trackers, decomposing
derived globs back into exacts, then re-arms the analysis and mapping
workers. --mapping-only skips the rebuild. A DB-backed test covers the
rebuild, link clearing, and preservation of categorised/excluded
patterns.

Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
Émile Ré
2026-06-03 13:37:48 +02:00
parent 662c0ae428
commit c763f83b13
16 changed files with 2142 additions and 0 deletions

View File

@@ -19,6 +19,9 @@ import (
"github.com/spf13/cobra"
"go.probo.inc/probo/pkg/proboctl/cmdutil"
"go.probo.inc/probo/pkg/proboctl/commonthirdparty"
"go.probo.inc/probo/pkg/proboctl/commontrackerpattern"
proboctlcookiebanner "go.probo.inc/probo/pkg/proboctl/cookiebanner"
"go.probo.inc/probo/pkg/proboctl/seed"
"go.probo.inc/probo/pkg/proboctl/version"
)
@@ -38,7 +41,17 @@ func NewCmdRoot(f *cmdutil.Factory) *cobra.Command {
"PostgreSQL connection URL (default: DATABASE_URL env)",
)
cmd.PersistentFlags().StringVar(
&f.CfgFile,
"cfg-file",
os.Getenv("PROBOD_CFG_FILE"),
"Path to the probod config file (default: PROBOD_CFG_FILE env); required for agent-backed commands",
)
cmd.AddCommand(seed.NewCmdSeed(f))
cmd.AddCommand(commontrackerpattern.NewCmdCommonTrackerPattern(f))
cmd.AddCommand(commonthirdparty.NewCmdCommonThirdParty(f))
cmd.AddCommand(proboctlcookiebanner.NewCmdCookieBanner(f))
cmd.AddCommand(version.NewCmdVersion(f))
return cmd