unbridled-41 commented on PR #4748:
URL:
https://github.com/apache/rocketmq-dashboard/pull/4748#issuecomment-5759446982
### Evidence for this PR
**Head / diff (verified against the pushed branch)**
- head `092a9e3d87206cf0c778377f4680425ddb2c576c`, base `rocketmq-studio`
(tip `cd448e17`), 1 commit, `mergeStateStatus: CLEAN`.
- `git show --stat 092a9e3d` → `NativeAlertProcessor.java +13/-1`,
`NativeAlertProcessorTest.java +37/-0`.
**The NPE is not size-dependent**
`MetricCollectionScope` holds `Set.copyOf(...)`, and on this JDK every
implementation rejects a null lookup — `Set12` dereferences the argument
instead of returning false:
```
$ java Probe.java # jdk 21.0.12, Set.copyOf of n distinct keys
size=1 class=Set12 contains(null) THREW java.lang.NullPointerException:
Cannot invoke "Object.equals(Object)" because "o" is null
size=2 class=Set12 contains(null) THREW java.lang.NullPointerException: ...
size=3 class=SetN contains(null) THREW java.lang.NullPointerException
size=5 class=SetN contains(null) THREW java.lang.NullPointerException
```
so a single-key scope is enough to reproduce; no "3 or more metric keys"
precondition.
**Red → green**
```
$ cd server && mvn -B -ntp -o test -Dtest=NativeAlertProcessorTest
[ERROR]
NativeAlertProcessorTest.reconcilesRemainingRulesWhenAnotherRuleHasNoMetricTest
<<< FAILURE!
"java.lang.NullPointerException: Cannot invoke "Object.equals(Object)"
because "o" is null
[ERROR] Tests run: 24, Failures: 1, Errors: 0, Skipped: 0 # BUILD
FAILURE
$ mvn -B -ntp -o test -Dtest=NativeAlertProcessorTest
[INFO] Tests run: 24, Failures: 0, Errors: 0, Skipped: 0 # BUILD
SUCCESS
$ mvn -B -ntp -o test
-Dtest='org.apache.rocketmq.studio.ops.alert.**,CollectorSchedulerTest'
[ERROR] Tests run: 318, Failures: 0, Errors: 5, Skipped: 0
```
The 5 errors are the environment's baseline:
`RmqAlertStateMapperIntegrationTest`, `NotificationOutboxMapperIntegrationTest`
and `NativeAlertEvaluationTransactionTest` need MySQL, and this sandbox has
none (`Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException:
Communications link failure` → `java.net.ConnectException: Connection
refused`). They fail identically on a clean `cd448e17` checkout.
**Teeth**
The new test asserts both halves of the fix:
`assertThatCode(...).doesNotThrowAnyException()` (the pass no longer aborts)
and `verify(states).save(oldKey, state)` with `status == RESOLVED` (the other
rule of the scope is still reconciled). Removing only the `normalizedMetric`
call makes the test fail again at the first assertion with the NPE quoted above.
**Duplicate check (re-run against the current indexes)**
- Open PRs (205 titles) / open issues (214 titles): `reconcile`,
`reconcileMissingActiveStates`, `null metric`, `without a metric`, `alert
state` → only #4571 (AI rule-list tool) and #4711 (rule test run), both open,
both other surfaces.
- `git log --oneline -400 origin/rocketmq-studio | grep -i alert` → no
commit touching this filter.
**Scoring**
PRIORITY = 80 (impact 32 + blast radius 16 + reproducibility 18 +
maintenance value 14); FIX_CONFIDENCE = 95.
--
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]