unbridled-41 opened a new pull request, #5918: URL: https://github.com/apache/rocketmq-dashboard/pull/5918
### Which Issue(s) This PR Fixes Fixes #5917 ### Problem / Evidence A broker whose runtime-stats read failed arrives with Java zero defaults plus a flag (`BrokerVO`: `double diskUsage`, `long tpsIn/tpsOut`, `@Builder.Default boolean runtimeStatsAvailable = true`; `RocketMQClusterProvider.enrichBrokerWithRuntimeInfo` returns `false` at its first guard and the cluster view reports `status=warning` through `hasUnavailableRuntimeStats`). The Broker tab of the cluster page ignored the flag and rendered the zeros as measurements: ``` ClusterPage: reports a failed broker runtime-stats read as unavailable instead of 0% and 0 TPS AssertionError: expected document not to contain element, found <span ...>0%</span> ``` The same table renders `-` for the version cell of that row, and the studio cluster page already honours the flag (`BrokerCluster.tsx:144-147` maps it to `null`, rendered as `-`). The mock and fixture never set the flag, which is why the suite was blind to it. ### Root cause / Fix The flag was honoured on one page and ignored on the other, and the primitive zero was used as a measurement and as a sort key. Render 不可用 for those cells and give the three sorters a direction-aware comparator that keeps unmeasured brokers after measured ones in both directions (the pattern `compareResourceCounts` in `pages/instance/index.tsx` established for unavailable resource counts). ### Priority and scoring **PRIORITY 62** — impact 22/40 (a fabricated availability/traffic measurement on the broker inventory, and a sort order built on it), blast radius 12/20 (every broker whose stats read fails, on the cluster page), reproducibility 18/20 (deterministic client-side rendering, pinned by the new test), maintenance value 10/20. **FIX_CONFIDENCE 85** — the flag and its intended rendering are both already in the code base. ### Tests `cd web && npx vitest run src/pages/cluster/__tests__/ClusterPage.test.tsx` -> `Tests 31 passed`. | Test | Before | After | |---|---|---| | `reports a failed broker runtime-stats read as unavailable instead of 0% and 0 TPS` | FAIL (row contains `0%`) | PASS | The new case also asserts that a descending sort by TPS does not promote the unmeasured broker. `npx eslint` reports no errors; `npx tsc -b` passes. ### Risk Only the rendering and relative order of brokers whose stats are unavailable change; measured brokers behave exactly as before. -- 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]
