Fix tracker pattern review issues

- Fix TotalCount resolver to dispatch by parent type instead
  of always using the uncategorised banner counter
- Sync MCP tracker_type enum with canonical TrackerType values
- Add validation for UpdateTrackerPatternRequest
- Validate tracker_type on CreateTrackerPatternRequest
- Set LastMatchedAt when creating pattern from detection
- Use COALESCE for SOURCE cursor pagination with NULLs
- Make source nullable in CLI tracker-pattern list

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-05-06 11:06:22 +04:00
parent 5302a9da7e
commit 9de6af936d
5 changed files with 51 additions and 10 deletions

View File

@@ -58,7 +58,7 @@ type trackerPattern struct {
MatchType string `json:"matchType"`
TrackerType string `json:"trackerType"`
DisplayName string `json:"displayName"`
Source string `json:"source"`
Source *string `json:"source"`
Excluded bool `json:"excluded"`
LastMatchedAt *string `json:"lastMatchedAt"`
}
@@ -143,11 +143,15 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
if p.Excluded {
excluded = "yes"
}
source := ""
if p.Source != nil {
source = *p.Source
}
lastMatched := ""
if p.LastMatchedAt != nil {
lastMatched = cmdutil.FormatTime(*p.LastMatchedAt)
}
rows = append(rows, []string{p.ID, p.Pattern, p.MatchType, p.TrackerType, p.DisplayName, p.Source, excluded, lastMatched})
rows = append(rows, []string{p.ID, p.Pattern, p.MatchType, p.TrackerType, p.DisplayName, source, excluded, lastMatched})
}
t := cmdutil.NewTable("ID", "PATTERN", "MATCH TYPE", "TRACKER TYPE", "DISPLAY NAME", "SOURCE", "EXCLUDED", "LAST MATCHED").Rows(rows...)