Frun1na opened a new issue, #6515:
URL: https://github.com/apache/rocketmq-dashboard/issues/6515

   ### Before Creating the Bug Report
   
   - [x] I have searched the [open 
issues](https://github.com/apache/rocketmq-dashboard/issues) of this repository 
and believe that this is not a duplicate.
   - [x] This is a defect in RocketMQ Studio, not a usage question and not a 
defect in another Apache RocketMQ repository.
   - [x] I can reproduce this on the current `rocketmq-studio` branch, or I 
have stated the exact version I am running below.
   
   ### Studio Version
   
   branch: `rocketmq-studio`
   git commit id: `779b8c0e`
   deployed as: reproduced by a unit test against that commit (the affected 
code is the web client's demo data source)
   
   ### Runtime Environment
   
   OS: Ubuntu on WSL2
   MySQL: not applicable — the defect is in the web client's demo (mock) data 
source
   browser: not applicable — reproduced in a vitest unit test
   
   ### Connected RocketMQ Cluster
   
   RocketMQ version: not applicable — the defect does not need a cluster
   access mode: not applicable
   deployment: not applicable
   
   ### Describe the Bug
   
   Acknowledging a system alert that the demo inventory does not have is 
reported as a success:
   
   ```ts
   // web/src/services/opsService.ts:408-415
   export async function acknowledgeAlert(id: number): Promise<void> {
     if (isMockMode()) {
       const a = mockSystemAlerts.find((a: Record<string, unknown>) => a.id === 
id);
       if (a) (a as Record<string, unknown>).acknowledged = true;
       return;
     }
     return opsApi.acknowledgeAlert(id);
   }
   ```
   
   The endpoint the mock stands in for answers 404 for that id:
   `AlertService.acknowledgeAlert` throws `BusinessException(404, "System alert 
not found: " + id)`
   
(`server/src/main/java/org/apache/rocketmq/studio/ops/alert/AlertService.java:588-600`),
 and every
   other mock mutation in the same services throws for a missing record (ACL 
rules/users, certificates,
   topics, consumer groups, name servers, proxies, alert rules).
   
   Because the call resolves, `SystemAlertsPage.handleAck` marks the row 
`acknowledged: true` in local
   state and toasts `sysAlerts.acknowledged` — a success claim for an alert the 
backend does not have —
   where the real data source takes the page's existing 
`sysAlerts.acknowledgeFailed` branch.
   
   ### Steps to Reproduce
   
   Reproduced by a unit test against `web/src/services/opsService.ts` in mock 
mode:
   
   1. Read the mock alerts, take an id just outside the stored range
      (`Math.max(...alerts.map((alert) => alert.id)) + 1`).
   2. `await acknowledgeAlert(missingId)` — it resolves; nothing reports the 
failure.
   3. The real data source rejects the same call with `System alert not found: 
<id>`.
   
   ### What Did You Expect to See?
   
   The demo acknowledgement should fail for an id the inventory does not have, 
the way the endpoint does,
   so the page reports the failure instead of a phantom acknowledgement.
   
   ### What Did You See Instead?
   
   A resolved promise (`undefined`) and, in the console, an "acknowledged" 
toast for a row that was not
   acknowledged anywhere.
   
   ### Additional Context
   
   - A fix with a regression test follows in a pull request.
   - The case is pinned by a unit test that fails without the fix:
     `AssertionError: promise resolved "undefined" instead of rejecting`.
   
   ### Are You Willing to Submit a Pull Request?
   
   - [x] Yes, I am willing to submit a pull request.
   


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