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

   Fixes #4655.
   
   ## Problem / Evidence
   
   `MetricsExplorer` (mounted at the bottom of `/ops/dashboard`) never recovers 
from a failed metric-profiles load:
   
   - the profiles effect catches a failed `listMetricProfiles()` with 
`setProfileError(true)` (`web/src/components/MetricsExplorer.tsx:681`), and 
that is the only write of that state in the file — `setProfileError(false)` 
occurs nowhere;
   - the render branch (`MetricsExplorer.tsx:1307-1310`) puts `profileError ? 
<Alert type="error" ... />` above the panel content with no retry action;
   - the effect re-runs whenever its `loadAll` dependency changes (e.g. 
switching the dashboard's instance selector), and a successful re-run fetches 
profiles, sets `profileId` and starts `loadAll` — but the error banner keeps 
rendering over the now-working panels until the component is unmounted.
   
   Red regression (new `clears the profile error and renders the panels again 
after a later load succeeds`): fail the profiles request once, switch the 
instance so the effect re-runs and succeeds, then assert the panels render and 
the banner is gone. On unmodified master it fails — the chart never appears 
(`Unable to find an element with the role 'img'`).
   
   ## Root cause / Fix
   
   The error flag is write-once: the effect's success path never clears it, so 
one transient failure (backend restart, 5xx, timeout) permanently hides the 
explorer for the current mount.
   
   Fix: `setProfileError(false)` in the success path of the profiles effect, 
right after the profiles are stored — the same re-run that previously worked 
invisibly now becomes visible again.
   
   ## Priority & scoring
   
   PRIORITY = 影响 26(一次瞬时失败使 8 个指标面板 + 自定义查询区整体不可用且无重试入口)+ 波及 8(单一挂载点 
/ops/dashboard,但为指标页核心组件)+ 可复现 18(确定性状态逻辑)+ 维护价值 12(保留唯一错误态,补上恢复语义)= **64**。 
FIX_CONFIDENCE = **95**(成功路径复位错误标志是标准 React 错误恢复模式,行为完全可测)。
   
   该候选低于 70,但作为第四轮候选 pool 
中证据链最完整的一项(其余候选均已被认领或证据不足),且修复面极小、与既有测试零冲突,按技能"证据充分"标准执行;如实注明评分低于常规门槛。
   
   ## Tests
   
   - New regression: `MetricsExplorer.test.tsx#clears the profile error and 
renders the panels again after a later load succeeds`.
     - Red on master: `Unable to find an element with the role 'img'` (`Message 
In TPS time series`), error banner still present after the successful re-run.
     - Green after the fix (panels re-render, banner cleared, profile switch to 
`RocketMQ 4.x Exporter` also exercised).
   - Module: `npx vitest run src/components/__tests__/MetricsExplorer.test.tsx` 
→ `Tests 28 passed (28)` (27 pre-existing + 1 new).
   - Full web suite (this branch): `npx vitest run --maxWorkers=4` → `Test 
Files 122 passed (122)`, `Tests 1035 passed (1035)`, no failures (pristine 
master on this machine: 1034 passing + 1 new test here = 1035).
   - `npx tsc --noEmit` → clean. `npx eslint` on the two changed files → 0 
errors, 0 warnings (verified clean; master baseline for these files is also 
clean).
   - Frontend build: `npm run build` → `✓ built in 12.17s`.
   
   ## Risk
   
   Minimal. The flag now mirrors the actual outcome of the most recent profiles 
load. The error branch still renders while a re-run is in flight or failing 
(the skeleton and error take precedence), so a persistently broken backend 
still shows the error banner.
   


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