zjncs opened a new pull request, #4184:
URL: https://github.com/apache/rocketmq-dashboard/pull/4184

   ## Motivation
   
   `rmq.dashboard.summary` fails with `IllegalStateException` on every real V5 
or multi-instance deployment.
   
   The tool's output schema (from #642) declares `cluster.proxies`, 
`stats.totalProxies` and `stats.totalNameServers` as required plain integers. 
But #2419 (`e9f5df9a`, "preserve unavailable dashboard topology counts") 
deliberately made those counts nullable on the provider side, and the handler 
was never updated:
   
   - `RocketMQDashboardProvider.collectDashboardData` sets `.proxies(V4_DIRECT 
? 0 : null)` for every V5 proxy cluster and `.totalProxies(V4_DIRECT ? 0 : 
null)` in stats;
   - `unavailableInstanceCluster` does the same for unreachable instances;
   - `aggregateInstances` sets `.totalProxies(null)` **unconditionally** โ€” so 
any deployment with registered Apache instances hits it;
   - `unavailableTopologyDashboard` sets both `totalProxies` and 
`totalNameServers` to null.
   
   `DashboardSummaryToolHandler` passes the values straight through and 
`ToolGatewayService.validateOutput` rejects the result:
   
   ```
   IllegalStateException: Tool output validation failed for 
rmq.dashboard.summary:
   [/cluster/proxies: null found, integer expected,
    /stats/totalNameServers: null found, integer expected,
    /stats/totalProxies: null found, integer expected]
   ```
   
   The existing gateway test masked this by stubbing 
`.proxies(1)`/`.totalProxies(1)`, so the production wiring was never exercised.
   
   ## Modification
   
   Allow `null` for the three topology-count fields in 
`tool-catalog/rmq-tools.yaml` using the same type-list convention the 
nameserver config diff tool already uses (`type: [string, 'null']`). This keeps 
#2419's semantics โ€” null means "unknown/unavailable", not zero โ€” for AI 
consumers, and requires no handler change since the handler already passes the 
counts through.
   
   ## Verification
   
   Fail-before (schema change stashed, test kept):
   
   ```
   [ERROR] Tests run: 33, Errors: 1
   
ToolGatewayServiceTest.executesDashboardSummaryWhenTopologyCountsAreUnavailable 
ยป
   IllegalStateException: Tool output validation failed for 
rmq.dashboard.summary:
   [/cluster/proxies: null found, integer expected, /stats/totalNameServers: 
null found,
    integer expected, /stats/totalProxies: null found, integer expected]
   ```
   
   This is exactly the failure every V5/multi-instance deployment hits in 
production.
   
   Pass-after (fix applied):
   
   ```
   ToolGatewayServiceTest  Tests run: 33, Failures: 0, Errors: 0
   ToolCatalogTest         Tests run: 6,  Failures: 0, Errors: 0
   ```
   
   New test `executesDashboardSummaryWhenTopologyCountsAreUnavailable` drives 
the full gateway (schema validation included) with a V5 proxy cluster whose 
proxy counts are unavailable, and asserts the tool succeeds with 
`proxies`/`totalProxies`/`totalNameServers` present as null.


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