unbridled-41 opened a new issue, #4599:
URL: https://github.com/apache/rocketmq-dashboard/issues/4599

   ## Problem
   
   When the audit summary request fails, the audit page renders the summary 
cards as an all-zero aggregate. The cards then state that no audit record 
matched the current filters, while the record table and the risk-insights panel 
on the same screen still list and count the matching records.
   
   ## Evidence
   
   `web/src/pages/ops/audit.tsx` (summary effect, before the fix):
   
   ```ts
   void getAuditSummary(activeFilter)
     .then((value) => {
       if (!cancelled) setSummary(value);
     })
     .catch(() => {
       if (!cancelled) message.error('审计概览加载失败,请稍后重试');
     })
   ```
   
   The failure only raises a transient toast and leaves `summary` as `null`, 
and `AuditSummaryCards` substitutes zero defaults for a `null` summary:
   
   ```tsx
   const data = summary || {
     total: 0, successful: 0, failed: 0, partial: 0, uniqueOperators: 0, ...
   };
   ```
   
   The same screen derives its other numbers from the records when the summary 
is missing (`auditRiskInsightModel.ts`: `summary?.total ?? 
safeRecords.length`), so the cards contradict the panel below them.
   
   Reproduction (regression test added with this report, `AuditPage.test.tsx`, 
`reports a failed summary instead of rendering it as empty statistics`): open 
`/ops/audit` with `/api/audit-logs/summary` failing and `/api/audit-logs/page` 
succeeding. Before the fix the test finds the card `匹配记录0` although the table 
lists the matching record; the failure output is `expected '匹配记录0' not to be 
'匹配记录0'`.
   
   ## Impact
   
   A failed aggregate is presented as a factual "no record matched these 
filters" result, i.e. the operator sees zero failures and a 0% success rate for 
a filter that actually matched records.
   
   ## Expected behavior
   
   A failed summary is reported as unavailable (the cards are replaced by an 
explicit failure notice) instead of being rendered as zero statistics.
   
   ## Related work
   
   - The record-list effect in the same file already distinguishes a failed 
load (`message.error` plus no state write) from an empty result.
   - #1163 / #1164 (closed) asked for the opposite direction on the backend 
(failures as structured gateway errors) and were closed; this report only 
covers the web rendering of an already-failed request.
   
   ## PR
   
   Fix incoming.
   


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