Surface common tracker pattern link across APIs
Expose the existing tracker_patterns.common_tracker_pattern_id foreign key on the TrackerPattern type so it is possible to tell whether a pattern is linked to the global common-tracker catalog (its description likely came from the seed or the mapping/enrichment agents) or has no link (added manually or inherited). This is a read-only debugging aid for agent-generated descriptions; no migration or write path changes. The field is added in sync across all four API surfaces (GraphQL, MCP, CLI, n8n) plus the console UI, and covered by e2e assertions for both the linked and unlinked cases. Signed-off-by: Émile Ré <emile@probo.com>
This commit is contained in:
@@ -40,6 +40,7 @@ query($id: ID!, $first: Int, $after: CursorKey) {
|
||||
source
|
||||
excluded
|
||||
lastMatchedAt
|
||||
commonTrackerPatternId
|
||||
}
|
||||
}
|
||||
pageInfo {
|
||||
@@ -53,14 +54,15 @@ query($id: ID!, $first: Int, $after: CursorKey) {
|
||||
`
|
||||
|
||||
type trackerPattern struct {
|
||||
ID string `json:"id"`
|
||||
Pattern string `json:"pattern"`
|
||||
MatchType string `json:"matchType"`
|
||||
TrackerType string `json:"trackerType"`
|
||||
DisplayName string `json:"displayName"`
|
||||
Source *string `json:"source"`
|
||||
Excluded bool `json:"excluded"`
|
||||
LastMatchedAt *string `json:"lastMatchedAt"`
|
||||
ID string `json:"id"`
|
||||
Pattern string `json:"pattern"`
|
||||
MatchType string `json:"matchType"`
|
||||
TrackerType string `json:"trackerType"`
|
||||
DisplayName string `json:"displayName"`
|
||||
Source *string `json:"source"`
|
||||
Excluded bool `json:"excluded"`
|
||||
LastMatchedAt *string `json:"lastMatchedAt"`
|
||||
CommonTrackerPatternID *string `json:"commonTrackerPatternId"`
|
||||
}
|
||||
|
||||
func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
@@ -157,10 +159,15 @@ func NewCmdList(f *cmdutil.Factory) *cobra.Command {
|
||||
lastMatched = cmdutil.FormatTime(*p.LastMatchedAt)
|
||||
}
|
||||
|
||||
rows = append(rows, []string{p.ID, p.Pattern, p.MatchType, p.TrackerType, p.DisplayName, source, excluded, lastMatched})
|
||||
commonPatternID := ""
|
||||
if p.CommonTrackerPatternID != nil {
|
||||
commonPatternID = *p.CommonTrackerPatternID
|
||||
}
|
||||
|
||||
rows = append(rows, []string{p.ID, p.Pattern, p.MatchType, p.TrackerType, p.DisplayName, source, excluded, lastMatched, commonPatternID})
|
||||
}
|
||||
|
||||
t := cmdutil.NewTable("ID", "PATTERN", "MATCH TYPE", "TRACKER TYPE", "DISPLAY NAME", "SOURCE", "EXCLUDED", "LAST MATCHED").Rows(rows...)
|
||||
t := cmdutil.NewTable("ID", "PATTERN", "MATCH TYPE", "TRACKER TYPE", "DISPLAY NAME", "SOURCE", "EXCLUDED", "LAST MATCHED", "COMMON PATTERN ID").Rows(rows...)
|
||||
_, _ = fmt.Fprintln(f.IOStreams.Out, t)
|
||||
|
||||
if totalCount > len(patterns) {
|
||||
|
||||
@@ -39,6 +39,7 @@ query($id: ID!) {
|
||||
source
|
||||
excluded
|
||||
lastMatchedAt
|
||||
commonTrackerPatternId
|
||||
createdAt
|
||||
updatedAt
|
||||
}
|
||||
@@ -48,19 +49,20 @@ query($id: ID!) {
|
||||
|
||||
type viewResponse struct {
|
||||
Node *struct {
|
||||
Typename string `json:"__typename"`
|
||||
ID string `json:"id"`
|
||||
Pattern string `json:"pattern"`
|
||||
MatchType string `json:"matchType"`
|
||||
TrackerType string `json:"trackerType"`
|
||||
DisplayName string `json:"displayName"`
|
||||
MaxAgeSeconds *int `json:"maxAgeSeconds"`
|
||||
Description *string `json:"description"`
|
||||
Source string `json:"source"`
|
||||
Excluded bool `json:"excluded"`
|
||||
LastMatchedAt *string `json:"lastMatchedAt"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
Typename string `json:"__typename"`
|
||||
ID string `json:"id"`
|
||||
Pattern string `json:"pattern"`
|
||||
MatchType string `json:"matchType"`
|
||||
TrackerType string `json:"trackerType"`
|
||||
DisplayName string `json:"displayName"`
|
||||
MaxAgeSeconds *int `json:"maxAgeSeconds"`
|
||||
Description *string `json:"description"`
|
||||
Source string `json:"source"`
|
||||
Excluded bool `json:"excluded"`
|
||||
LastMatchedAt *string `json:"lastMatchedAt"`
|
||||
CommonTrackerPatternID *string `json:"commonTrackerPatternId"`
|
||||
CreatedAt string `json:"createdAt"`
|
||||
UpdatedAt string `json:"updatedAt"`
|
||||
} `json:"node"`
|
||||
}
|
||||
|
||||
@@ -138,6 +140,12 @@ func NewCmdView(f *cmdutil.Factory) *cobra.Command {
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Last Matched:"), cmdutil.FormatTime(*v.LastMatchedAt))
|
||||
}
|
||||
|
||||
if v.CommonTrackerPatternID != nil && *v.CommonTrackerPatternID != "" {
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Common Pattern:"), *v.CommonTrackerPatternID)
|
||||
} else {
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Origin:"), "Manual (no catalog link)")
|
||||
}
|
||||
|
||||
_, _ = fmt.Fprintln(out)
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Created:"), cmdutil.FormatTime(v.CreatedAt))
|
||||
_, _ = fmt.Fprintf(out, "%s%s\n", label.Render("Updated:"), cmdutil.FormatTime(v.UpdatedAt))
|
||||
|
||||
Reference in New Issue
Block a user