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

   Fixes #4251.
   
   ## Problem / Evidence
   
   The maintenance windows dialog on `/ops/system-alerts` keeps its create form 
mounted across open/close cycles and the cancel path only calls 
`setSilencesVisible(false)`. Values typed into a dismissed attempt (rule ID, 
label scope, recurrence, times) survive the cancel and pre-fill the next open. 
Creating a silence after a cancelled attempt then sends the stale scope: the 
request carries the previous attempt's `ruleId` and `labels` even though the 
operator only changed the window times.
   
   Repro: open dialog → rule ID `42`, labels `brokerName=broker-a`, times → 
cancel → reopen → fields still filled → change only the times → create → 
`createAlertSilence` is called with the stale `ruleId: 42` and `labels` from 
the cancelled attempt.
   
   ## Root cause / Fix
   
   `onCancel` (web/src/pages/ops/systemAlerts.tsx:831) closes the dialog 
without resetting the form, while the create-success path (`createSilence`) 
already calls `silenceForm.resetFields()`. The fix adds 
`silenceForm.resetFields()` to the cancel path, mirroring the create-success 
path and the reset-on-cancel convention used by the other create dialogs in the 
codebase.
   
   ## Priority & scoring
   
   PRIORITY 70 = impact 27 (the silence is created on the wrong scope, so the 
alert notifications the window was meant to suppress keep firing; a residual 
DAILY/WEEKLY recurrence also creates an unintended recurring silence) + scope 
11 (single create dialog) + reproducibility 18 (deterministic UI repro, covered 
by a regression test) + maintenance value 14 (same reset-on-cancel convention 
as the sibling dialogs; fixes the residue class recorded in #4251). 
FIX_CONFIDENCE 95: one-line handler change mirroring in-file precedents, 
red→green verified.
   
   ## Tests
   
   - New regression `resets the silence form after the dialog is dismissed 
without creating` fills rule ID / label scope / times, cancels, reopens, 
asserts empty fields and asserts `createAlertSilence` is called without the 
stale `ruleId`/`labels`.
   - Red on the unfixed code: 
`src/pages/ops/__tests__/SystemAlertsPage.test.tsx` → `Tests  1 failed | 14 
passed (15)` with `× resets the silence form after the dialog is dismissed 
without creating`.
   - Green with the fix: `Tests  15 passed (15)`.
   - Full web suite `npx vitest run`: 982 tests, 1 failed — 
`ConsumerPage.test.tsx`, a file this branch does not touch and a known 
load-fragile case under the parallel run; re-run in isolation: `Tests  31 
passed (31)`.
   - `npx tsc -b` clean; `npx eslint .` 0 errors (the `systemAlerts.tsx` 
warning at line 227 is a pre-existing `react-hooks/exhaustive-deps` notice, 
untouched by this change); `npx vite build` succeeds.
   
   ## Risk
   
   Cancel now discards typed input by design, consistent with the 
create-success path. No API or state changes; diff is one handler plus one test.
   
   Head: 33771da6 (fix/alert-silence-form-residue, 1 commit).
   


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