fix(alerts): compare FQN filters literally in matchAnyEntityFqn#27987
fix(alerts): compare FQN filters literally in matchAnyEntityFqn#27987
Conversation
2a7796d to
a1677b6
Compare
a1677b6 to
86fc831
Compare
|
Thanks for the suggestion @gitar-bot. I considered Allocation cost dominates at typical n. Consistency with the rest of the file. Every other identifier-matcher in Hot path is actually publication, not evaluation. Each subscription evaluates each event once; the per-rule overhead is dwarfed by the I/O cost of the webhook delivery downstream. If a user ever stuffs hundreds of FQNs into a single rule, we can revisit, but at that point the right answer is probably to split the rule or use the entity ID list — not to micro-optimize the matcher. So I'd prefer to keep |
That's a well-reasoned case and I agree with the conclusion. The allocation-vs-scan crossover argument is sound for n ≈ 1–5, the consistency rationale with the rest of |
Code Review ✅ Approved 1 resolved / 1 findingsUpdates ✅ 1 resolved✅ Performance: List.contains() is O(n); consider Set for FQN lookup
OptionsDisplay: compact → Showing less information. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
🔴 Playwright Results — 3 failure(s), 13 flaky✅ 4012 passed · ❌ 3 failed · 🟡 13 flaky · ⏭️ 86 skipped
Genuine Failures (failed on all attempts)❌
|
|



Fixes open-metadata/openmetadata-collate#4019
Summary
AlertsRuleEvaluator.matchAnyEntityFqncompiles each user-supplied FQN as a Java regex and matches withMatcher.find(). Entity FQNs that contain regex metacharacters ([,],.,(,),+,?,*,\,|,^,$,{,}) silently never match their own filter — e.g. a name like[TML] Fraud Mart Suiteis interpreted as the regex[TML](a character class meaning one of T, M, L) followed byFraud Mart Suite, so the literal FQN starting with[never matches. Affected alerts drop events with no log line.Change
matchAnyEntityFqnand itstestSuiteMatcherhelper now compare FQNs literally:Why this is the right default (and why reverting #14946 is safe)
String.equalsuntil [Fix] Add Regex for Entity FQn matches #14946 swapped it toPattern.compile + matcher.find(). That PR added regex matching with no test, no UI surface, and no doc update — the behavior drift was undocumented.AlertsRuleEvaluatoralready uses literal equality —matchUpdatedBy,matchAnyEntityId,getTestCaseStatusIfInTestSuite,matchAnyOwnerName, and the direct-domain branch ofmatchAnyDomain. The same bug class onfilterByTableNameTestCaseBelongsTowas already corrected in Fixes #16357: Improve Alerts Filtering with Exact FQN Matching #17034 withPattern.quote.matchAnyEntityFqnwas the lone outlier.src/main, no seed or default rule hardcodes a regex (every reference ismatchAnyEntityFqn(${fqnList}), withfqnListfilled from runtime user input), no test pinned regex semantics, and the UI alert builder populates the field from a typeahead picker that emits canonical FQNs. The only surface that could change behavior is hand-crafted PATCH-API rules whose author intentionally exploited the undocumented regex behavior.Type of change
Tests
Parameterized regression
test_matchAnyEntityFqn_treatsRegexMetacharsAsLiteralinAlertsRuleEvaluatorResourceITcovers FQNs with[],(),+,?,*,|. A second test covers the testCase → parent test-suite fallback. Both would fail under the prior regex semantics; they pin the literal contract going forward.