yx9o opened a new pull request, #6642: URL: https://github.com/apache/rocketmq-dashboard/pull/6642
### Brief Description A Studio-native alert rule can be created with no comparison operator because the request DTO permits null and the native policy does not check it. The evaluator treats a missing operator as a non-matching condition, so an enabled rule silently never fires. Require one of the existing supported operators when validating a recognized native metric. Reuse the policy already called by creation, update, trial evaluation, and the creation service used by JSON imports. Preserve legacy Prometheus rules' existing optional-operator behavior. Add regression coverage for missing, blank, and unsupported operators, all seven supported values, legacy compatibility, and rejection before persistence or audit in creation and single-rule import. ### How Did You Test This Change? - Before the fix, 115 tests ran with eight expected failures: invalid operators were accepted by the policy, creation service, and import path. - `cd server && mvn -B -ntp -Dtest=NativeAlertRulePolicyTest,AlertServiceTest,AlertRuleTransferServiceTest,NativeAlertRuleTestServiceTest,NativeAlertMetricCatalogServiceTest,AlertRuleControllerTest,ClusterAlertRuleControllerTest,AlertRuleEvaluatorTest test`: 156 tests passed, with zero failures, errors, or skipped tests. Compilation and Checkstyle passed. - `git diff --check` passed. - Independent code review found no actionable issues. Repositories and metric-catalog access are mocked. No live Broker or database integration was performed, and existing invalid stored rules are not automatically rewritten. ### Checklist - [x] One coherent change; unrelated modifications are not bundled in - [x] Commit subject follows Conventional Commits (`fix:`) - [x] Regression tests added, with methods named `...Test` - [x] No new UI text; bilingual UI requirement is not applicable - [ ] Architecture checks were not run in the focused suite - [x] ASF source headers retained; no new source files - [x] Documentation reviewed; the existing API specification already marks operator as required -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
