unbridled-41 opened a new issue, #4583:
URL: https://github.com/apache/rocketmq-dashboard/issues/4583
## Problem
On the alerts page (both `/ops/alerts` and `/ops/business-alerts`) the rule
editor keeps its dry-run result ("规则试运行结果") in page state. Every entry point
into the editor clears that state except **编辑** (`openEditModal`): 新建
(`openCreateModal`), 复制 (`openDuplicateModal`), the modal `onCancel` and the
footer cancel button all call `setTestResult(null)`.
Steps to reproduce:
1. Open `/ops/alerts`.
2. Click 编辑 on rule A and then 试运行 — the sample table appears.
3. Click 确定 to save; the dialog closes.
4. Click 编辑 on rule B — B's editor renders A's sample table (A's labels and
current values) under the 规则试运行结果 title.
The samples look like fresh evidence for the rule being edited, but they
were produced for a different rule that was never reopened.
## Studio Version
branch: master
git commit id: d50ffecc9d7e8f8f46da64198831bd7952e6974e
deployed as: built from source (frontend only)
## Evidence
- `web/src/pages/ops/alerts.tsx:486` (`openEditModal`) restores the form
values, the instance scope and the modal visibility, but never resets
`testResult`, unlike its siblings at lines 417 (`openCreateModal`), 504
(`openDuplicateModal`), 1041 (modal `onCancel`) and 1059 (footer cancel).
- The dry-run panel is rendered from that state at
`web/src/pages/ops/alerts.tsx:1275` (`testResult && testResult.samples.length >
0`), so nothing distinguishes samples that belong to the rule currently in the
editor.
- Regression test
`web/src/pages/ops/__tests__/AlertsTestResultResidue.test.tsx` fails on
`master` (`npx vitest run
src/pages/ops/__tests__/AlertsTestResultResidue.test.tsx`):
```
FAIL src/pages/ops/__tests__/AlertsTestResultResidue.test.tsx > AlertsPage
rule test results > shows no test samples for a rule the user never tested
AssertionError: expected <div class="ant-table-title"></div> to be null
- Expected:
null
+ Received:
<div class="ant-table-title">
规则试运行结果
</div>
❯ src/pages/ops/__tests__/AlertsTestResultResidue.test.tsx:172:53
```
## Impact
An operator who edits several rules after testing one of them reads another
rule's dry-run evidence as if it belonged to the rule being edited, and can
conclude that the rule currently matches production data when it has never been
tested.
## Expected behavior
Opening the editor — by 编辑, 新建 or 复制 — starts with no dry-run samples.
Samples produced in a previous editor session are never shown again.
## Related work
- #4254 (merged) — same class of stale editor state: the silence form kept
values from a dismissed dialog.
- #4004 (merged) — resets the alerts list state when the alerts domain route
switches, i.e. view state must not leak across page sessions.
## PR
Fix: #PR_PLACEHOLDER.
--
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]