89799969 opened a new pull request, #4327:
URL: https://github.com/apache/rocketmq-dashboard/pull/4327

   Fixes #4326
   
   ## Problem
   
   Every successful `updateRule` and `toggleRule` call unconditionally runs 
`alertStateRepository.deleteByRuleId(id)`. That wipes the live FIRING / ACK / 
PENDING episode even when the evaluation identity did not change.
   
   Consequences:
   
   - Renaming a rule (or editing only description/channels) loses the active 
episode; the next evaluation can re-fire and re-notify.
   - Disabling then re-enabling a rule never keeps ACK status, so a temporary 
mute-and-restore looks like a brand-new alert.
   
   `AlertRuleSemanticFingerprint` already encodes the fields that decide firing 
(metric, threshold, operator, duration, scope, samples, …) and is used for 
duplicate detection.
   
   ## Fix
   
   - `updateRule` loads the existing rule and deletes state **only** when the 
semantic fingerprint changes.
   - `toggleRule` / `bulkToggleRules` no longer delete state (enable/disable is 
not an evaluation change).
   - Rule **delete** still clears state.
   
   ## Testing
   
   - `AlertServiceTest` (79 tests), including:
     - `updatingRuleNameWithoutChangingEvaluationConditionsKeepsStateTest`
     - `updatingRuleThresholdResetsEvaluationStateTest`
     - `togglingRuleKeepsEvaluationStateTest`
     - `updatingRuleShouldResetItsPreviousEvaluationStateTest` (existing, still 
passes when no prior rule row)
   
   ```
   Tests run: 79, Failures: 0, Errors: 0, Skipped: 0
   ```
   
   Local run: Temurin 21.0.12.1, `mvn -Dtest=AlertServiceTest test`
   


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