You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "zjncs (via GitHub)" <gi...@apache.org> on 2026/09/08 03:41:23 UTC
[PR] fix(ai): allow null counts in tool output schemas [rocketmq-dashboard]
zjncs opened a new pull request, #4117:
URL: https://github.com/apache/rocketmq-dashboard/pull/4117
### Motivation
`rmq.dashboard.summary` and `rmq.group.list` fail output validation (HTTP 500 `IllegalStateException: Tool output validation failed`) whenever the data behind a declared `type: integer` count is unavailable — which the producers deliberately encode as `null`:
- `rmq.dashboard.summary`: `RocketMQDashboardProvider` reports proxy/name-server topology counts as `null` for V5 clusters (`.proxies(clusterType == ClusterType.V4_DIRECT ? 0 : null)`), for aggregate mode (`.totalProxies(null)`), and in the degraded no-namesrv path (both `totalProxies(null)` / `totalNameServers(null)`). `DashboardControllerTest.getDashboardShouldPreserveUnavailableTopologyCounts` pins these nulls as the intended HTTP semantics — only the tool schema rejects them.
- `rmq.group.list`: #3988 deliberately changed the handler projection to `totalLag == ConsumerLagResolver.UNKNOWN ? null : totalLag` (unknown lag for 5.0 gRPC consumers), but the output schema was not updated — so any cluster containing one such group makes the whole listing fail with a 500, exactly when the user most needs it.
`objectMapper.valueToTree` keeps the keys (`{"totalLag": null}`) and the schema validator rejects `null` against `type: integer`.
### Modifications
In `tool-catalog/rmq-tools.yaml`, the four affected fields become `type: ['integer', 'null']` (keys stay in `required`, so they must still be present):
- `rmq.dashboard.summary` → `cluster.proxies`, `stats.totalProxies`, `stats.totalNameServers`
- `rmq.group.list` → `items[].totalLag`
### Verification
Two new `ToolGatewayServiceTest` cases mirroring the producer semantics:
- `executesDashboardSummaryWhenTopologyCountsAreUnavailable` (dashboard with `proxies/totalProxies/totalNameServers = null`)
- `executesConsumerGroupListWhenLagIsUnknown` (group with `totalLag = ConsumerLagResolver.UNKNOWN`)
Before the fix both fail with the production error, e.g.:
```
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]
IllegalStateException: Tool output validation failed for rmq.group.list:
[/items/0/totalLag: null found, integer expected]
```
After the fix: `mvn -f server/pom.xml test -Dtest='ToolGatewayServiceTest,ToolCatalogTest'` → **Tests run: 40, Failures: 0, Errors: 0** (catalog meta-schema validation included).
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(ai): allow null counts in tool output schemas [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed pull request #4117: fix(ai): allow null counts in tool output schemas
URL: https://github.com/apache/rocketmq-dashboard/pull/4117
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(ai): allow null counts in tool output schemas [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins commented on PR #4117:
URL: https://github.com/apache/rocketmq-dashboard/pull/4117#issuecomment-5602086573
Closed as folded into #4115, merged into `rocketmq-studio` as 206314b9.
Your change shipped as-is: `cluster.proxies`, `stats.totalProxies`, `stats.totalNameServers` and `items[].totalLag` in `tool-catalog/rmq-tools.yaml` are now `type: [integer, 'null']` while staying `required`, and your `ToolGatewayServiceTest` cases came across with it. Your diagnosis was the useful part — `ToolGatewayService.validateOutput` keeps null keys through `valueToTree`, so a producer that deliberately emits null for "unknown" failed schema validation and surfaced as a 500 rather than as a missing value. Auditing the rest of the integer output fields confirmed these four are the complete reachable set.
One thing worth knowing: on its own this would not have changed any observable behaviour, because both handlers were still passing the `cluster` input into the `instanceId` slot and therefore threw `404 Instance not found` before output validation was ever reached. That is why it landed together with the routing fix rather than separately.
Nothing further needed from you — thank you for the fix. For context on why these were grouped: the AI resource tool chain had four independent defects (argument-slot routing, output-schema nullability, cloud topic type/perm, cloud consumer-group subscription mode) and merging any single one of them would not have made `rmq.topic.list` or `rmq.group.list` usable, so they were integrated as one change on the target PR's branch, each kept as its own commit with you as the author.
--
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: commits-unsubscribe@rocketmq.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org