mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-09-04 14:45:41 +00:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user