Report matched TSA automation regex in reasons - #521
Open
jack-atlas wants to merge 1 commit into
Open
Conversation
TSA automation rules can contain several regexes, but generated suspension, bounce, and config override reasons were showing the whole regex list. That made internal TransientFailure records hard to read and forced operators to rediscover which pattern actually triggered the automation. This carries the matching regex out of the existing rule scan as MatchedRule metadata, while preserving the full Rule for threshold accounting, hashing, and action identity. The Lua shaping:match_rules API continues to return the original rule objects. The mod-counter-series hunk is the rustfmt change required by the repository's nightly formatter check. Constraint: Maintainer feedback on KumoCorp#350 objected to an additional regex-list scan in the suspension path. Rejected: Re-scan rule.regex while building reasons | increases matching work by another pass over the regex list. Confidence: high Scope-risk: moderate Directive: Keep matched_regex as display metadata only; do not trim Rule.regex before hashing or threshold accounting. Tested: cargo test -p kumo-api-types --lib Tested: cargo test -p tsa-daemon Tested: cargo test -p mod-counter-series Tested: cargo +nightly fmt --all -- --check Tested: git diff --check Not-tested: cargo test -p kumo-api-types full doctests fail on an existing BounceV1Request documentation snippet unrelated to this change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #350.
Notes
This avoids the extra regex-list scan from the earlier sketch in the issue thread. Rule matching still performs a single pass over each rule's regex list; the matched regex is retained as display metadata alongside the full Rule.
Tests
Not tested