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

   Fixes #4611.
   
   ## Problem / Evidence
   
   In `web/src/utils/clientConnectionDiagnostics.ts` the resource summary table 
never sees the per-connection issues. Two key shapes for the same concept 
coexist in one file:
   
   - Connection-level producers set `resource` to the bare normalized name: 
`addUnknownFieldIssues` (`:292` → `UNKNOWN_PROTOCOL:307`, 
`UNKNOWN_LANGUAGE:325`, `UNKNOWN_VERSION:343`, `INVALID_CONNECTION_TIME:361`) 
and the duplicate-record path (`:277`).
   - The summaries match issues with `issuesForResource(issues, resource)` 
(`:474`) where the key is the type-qualified `${group.type}:${group.resource}` 
(`resourceKey:164`, `addResourceIssues:378`, `buildResourceSummaries:483`).
   
   The equality filter compares `cg-order` against `Consumer:cg-order` and 
never matches, so a resource row whose connections carry 
unknown-protocol/unknown-version warnings renders 状态 healthy and 问题数 0 in the 
clients page's 资源维度 table (`web/src/pages/cluster/clients.tsx:518-527`, 
`:588-594`, dataSource `:869`) while the issues panel below lists those very 
findings. Existing tests only exercised resource-level producers (which already 
used the qualified key), so the mismatch was never caught.
   
   ## Root cause / Fix
   
   Unify the key shape: the connection-level issue producers now call the 
existing `resourceKey(connection)` helper, and the duplicate-record path 
rebuilds `${type}:${bareResource}` from its identity parts. The bare-name 
variables remain untouched for evidence strings. No UI or API changes — the 
resource table and the issues panel now agree by construction.
   
   ## Priority & scoring
   
   PRIORITY 66 = 影响 22 (the diagnostics tab's resource rollup silently 
under-reports: all-green rows next to a warnings-filled issue list) + 波及 8 
(single util, two consumer surfaces) + 可复现 18 (deterministic pure function, 
unit-testable) + 维护价值 18 (one key contract, clearly documented). FIX_CONFIDENCE 
95: pure-function change fully covered by deterministic unit tests.
   
   ## Tests
   
   ```
   cd web && npx vitest run src/utils/clientConnectionDiagnostics.test.ts
   ```
   - Red (fix stashed, tests present): both new tests fail — `expected { id: 
'Consumer:cg-order', … } to match object { status: 'warning', issueCount: 3 }` 
(received healthy/0 on master) and the duplicate-record assertion likewise.
   - Green: **7 passed (7)** — 5 pre-existing + 2 new regressions 
(per-connection issues roll up with the qualified key; a clean multi-client row 
stays healthy/0).
   - Consumers: `ClientsPage.test.tsx` **20 passed (20)**.
   - `npx tsc -b`: clean. `npx eslint` on both touched files: 0 errors, 0 
warnings. `npm run build`: ✓ built in 11.40s.
   
   ## Risk
   
   Low. The `resource` field on connection-level issues changes from a bare 
name to the qualified key — the issues panel column displays it verbatim, so 
values there now read `Consumer:cg-order`, matching how resource rows identify 
themselves (same `:` id). No other code matches issues by bare resource name 
(verified by grep: only `issuesForResource` consumes `issue.resource`).


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