feat: stack glob patterns and route severity levels (#1651)

* feat: add stack glob patterns and route severity levels

Operators can filter notification routes and mute rules with anchored * globs, and routes can target info, warning, or error. Matching is fail-closed for unsafe stored patterns; write paths keep partial-PUT semantics and ReDoS caps.

* test: split mute and routing chip tests to avoid dialog race

* fix: move stack pattern client validator out of PatternChips

* fix: bound stack glob matching and atomic pattern chip saves
This commit is contained in:
Anso
2026-07-19 14:54:48 -04:00
committed by GitHub
parent 63213c0960
commit 972f2b9483
26 changed files with 1158 additions and 118 deletions
@@ -73,6 +73,36 @@ describe('notificationMatchers', () => {
})).toBe(true);
});
it('matches stack globs with OR across patterns', () => {
expect(matchesNotificationFilters(baseCtx, {
node_id: null,
stack_patterns: ['prod-*', 'my-app'],
label_ids: null,
categories: null,
})).toBe(true);
expect(matchesNotificationFilters({ ...baseCtx, stackName: 'prod-web' }, {
node_id: null,
stack_patterns: ['prod-*'],
label_ids: null,
categories: null,
})).toBe(true);
expect(matchesNotificationFilters(baseCtx, {
node_id: null,
stack_patterns: ['prod-*'],
label_ids: null,
categories: null,
})).toBe(false);
});
it('fails closed on invalid stored stack patterns', () => {
expect(matchesNotificationFilters(baseCtx, {
node_id: null,
stack_patterns: ['****'],
label_ids: null,
categories: null,
})).toBe(false);
});
it('detects when stack labels are needed', () => {
expect(ruleNeedsStackLabels([{ node_id: null, stack_patterns: [], label_ids: [1], categories: null }])).toBe(true);
expect(ruleNeedsStackLabels([{ node_id: null, stack_patterns: [], label_ids: null, categories: null }])).toBe(false);