unbridled-41 opened a new pull request, #5969:
URL: https://github.com/apache/rocketmq-dashboard/pull/5969

   ### Which Issue(s) This PR Fixes
   Fixes #5968
   ### Problem / Evidence
   - `MybatisPlusAlertStateRepository.findActive` selected `status IN (FIRING, 
ACKED)` only.
   - `NativeAlertProcessor.reconcileMissingActiveStates` persisted an update 
only for `AlertStateTransition.RESOLVED`, and the state machine returns the 
PENDING -> OK move with transition `NONE` (`AlertStateMachine.advanceClear`).
   
   So a pending episode whose metric stopped being collected kept 
`firstPendingAt`, and the first sample that returned completed the duration 
with two readings:
   ```
   NativeAlertProcessorTest: a pending episode ends when its fingerprint is no 
longer collected
   Wanted but not invoked: stateRepository.save(...)
   ```
   ### Root cause / Fix
   The state machine has no notion of "the last sample I saw"; the reconcile 
loop is the only thing that can end an episode, and it could not see (or 
persist) a pending one. Include PENDING in `findActive`, and persist whenever 
the status moved even when the transition is not RESOLVED (a real resolution 
still emits the lifecycle event; the unavailable-sample skip is untouched, so a 
failed collection does not clear a pending episode).
   Residual, stated honestly: an episode whose collection pass never runs at 
all, or that only ever sees UNAVAILABLE samples, still needs a last-sample 
timestamp the state schema does not have.
   ### Priority and scoring
   **PRIORITY 85** - impact 32/40 (a false FIRING + notification, and the 
duration guarantee the rule promises is silently not honoured), blast radius 
18/20 (every windowed/`consecutiveSamples` rule whose metric stops being 
collected), reproducibility 18/20 (deterministic, pinned by two new tests), 
maintenance value 12/20. **FIX_CONFIDENCE 72** for this scope (see the residual 
above).
   ### Tests
   `cd server && mvn -o -B -ntp test 
-Dtest='org.apache.rocketmq.studio.ops.alert.**'` -> `Tests run: 328, Failures: 
0, Errors: 0`. Both new cases fail before the change and pass after it; 
`checkstyle:check` passes.
   ### Risk
   A pending state can now be cleared by any successful collection pass that no 
longer contains its fingerprint, which is the intended semantics; a failed 
collection still keeps it.
   


-- 
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]

Reply via email to