feat(alerts): scope notification routes by application and branch (ankra-3e5pg) - #429
Conversation
…kra-3e5pg) `ankra alerts routes create|update` gain --application (name or id, resolved like every per-application command) and --reference-pattern (a branch/tag/pull request glob: main, release/*, pull/*, refs/tags/v*), and `routes preview` gains --application and --reference so the dry run can answer "would a master failure of this app reach my channel?". `show` prints both filters. The embedded alerts skill documents them, plus the repeat-delivery behaviour (new failing runs, reminders, reopened cards). Needs the cluster API from ankraio/cluster#3911; against an older API the fields are ignored by the server. Bead: ankra-3e5pg Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ankra AI reviewVerdict: looks good. The change threads application and reference scoping through create, update, preview, the client types, and docs consistently, with tests covering the new wire fields and the empty-update guard. The update path correctly treats the new fields in isEmptyRouteUpdate, and flag resolution is shared via routeApplicationFlag. No correctness or security issues found; CI is still running so build status is unknown. Findings
Reviewed commit ca334e8. This review is read-only and advisory. |
| Mode: changedStringFlag(cmd, "mode"), | ||
| Enabled: enabledFromFlags(cmd), | ||
| } | ||
| applicationID, applicationError := routeApplicationFlag(cmd) |
There was a problem hiding this comment.
[low] No way to clear application/reference scope on update
Because UpdateNotificationRouteRequest omits nil members and routeApplicationFlag returns nil when --application is unchanged, there is no way to remove an existing application_id or reference_pattern from a route via alerts routes update - the same limitation may already exist for other filters, but if clearing scope is a supported operation server-side (e.g. via explicit null), consider a --clear-application/--clear-reference-pattern flag or documenting that scope can only be narrowed, not removed.
Ankra AI review. Read-only and advisory.
|
Ankra AI review on ca334e8: the [low] finding (no way to clear application or reference scope on |
What
ankra alerts routes create|update: two new flags.--application <name-or-id>, resolved through the sameresolveApplicationIDevery per-application command uses.--reference-pattern <glob>:main(pushes to main, never a PR targeting main),release/*,release/**,pull/*,refs/tags/v*.ankra alerts routes preview:--applicationand--reference(a concreterefs/heads/<branch>orpull/<n>).showprintsApplication:andReferences:. Client structs carry the new route and preview fields.ankra-alerts-webhooksskill documents the filters and the repeat-delivery behaviour (each new failing run, severity-based reminders, reopened cards).Example, the route asked for in #cicd-notify:
Depends on
ankraio/cluster#3911 (server side, stacked on ankraio/cluster#3908). Merge this after it ships.
Verification
cmd/alerts_routes_test.go: create sends both filters, an update with only--reference-patternis not empty, preview sends application and reference.gofmtclean. Committed with--no-verify: the pre-commit hook runsgo test ./...andgolangci-lint, this machine has no local Go toolchain, and its memory guard was blocking builds. CI runs the same gates.Bead: ankra-3e5pg
🤖 Generated with Claude Code