You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "zjncs (via GitHub)" <gi...@apache.org> on 2026/09/05 08:27:21 UTC
[PR] fix(alert): keep 7-day weekly silence windows active through day 7 [rocketmq-dashboard]
zjncs opened a new pull request, #3303:
URL: https://github.com/apache/rocketmq-dashboard/pull/3303
## Problem
`AlertSilenceSchedule.activeUntil` resolves a recurring window by inspecting candidate anchor dates back from today. For weekly recurrences it only inspected up to **6** days back:
```java
int daysToInspect = recurrence == AlertSilenceRecurrence.DAILY ? 1 : 6;
```
But `AlertSilenceService.validateRecurrence` allows weekly windows of **exactly 7 days** (it only rejects windows longer than `Duration.ofDays(7)`), so a 7-day weekly window is legal input. Such a window anchored 7 days back can still be active (its seventh day, any time before the configured end wall-time), yet that anchor date was never inspected. Result: recurring silences silently stopped suppressing notifications during the final hours of a max-length weekly maintenance window — exactly when operators rely on them.
## Fix
Extend the weekly lookback from 6 to 7 days (`daily` is unchanged — daily windows span at most 24 hours, so a 1-day lookback is already complete):
```java
// A weekly window may span up to 7 days, so an occurrence anchored 7 days
// back can still be in its final hours; daily windows span at most 24 hours.
int daysToInspect = recurrence == AlertSilenceRecurrence.DAILY ? 1 : 7;
```
Any window that would NOT still be active fails the existing `now.isBefore(end)` check, so the extra inspected day cannot produce false positives.
## Verification
New test `weeklyWindowRemainsActiveThroughItsSeventhDayTest` in `AlertSilenceScheduleTest` — a WEEKLY silence (UTC, Tuesdays, seed `2026-09-01T10:00` → `2026-09-08T10:00`, i.e. exactly 7 days):
- fail-before on `36126024`: at `2026-09-15T09:59:59` (the last minute of the occurrence anchored `2026-09-08`) `activeUntil` returned `null`:
`expected: 2026-09-15T10:00 but was: null` — the silence stopped suppressing on its seventh day
- pass-after with this change: returns `2026-09-15T10:00` (suppressed until the window ends)
- `AlertSilenceScheduleTest`: 9/9 pass
- full `ops.alert` test package: 281 tests run; the only failures are the pre-existing `NotificationOutboxServiceTest` mock-expectation failures (4F/1E), which reproduce identically on the pristine base commit `36126024` (verified by stashing this change) and are unrelated to silence scheduling
Build: `mvn test -Dtest='org.apache.rocketmq.studio.ops.alert.**'` (Temurin 21)
---
**AI disclosure:** This change was prepared with AI assistance (GitHub Copilot/Claude-style tooling guided by a human contributor).
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(alert): keep 7-day weekly silence windows active through day 7 [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins merged PR #3303:
URL: https://github.com/apache/rocketmq-dashboard/pull/3303
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org