zjncs opened a new pull request, #4134:
URL: https://github.com/apache/rocketmq-dashboard/pull/4134
## Motivation
The `rmq.group.list` AI tool is **deterministically broken for Aliyun and
Tencent instances**:
- `ConsumerGroupListToolHandler.safeProjection` requires both
`subscriptionMode` and `consumeType` (`requiredEnumName` throws
`IllegalStateException` on the first null).
- `AliyunConverters.toConsumerGroupVO` **never sets `subscriptionMode`** and
its `toConsumeType` returns null when the OpenAPI response omits `messageModel`.
- `TencentInstanceProvider.toConsumerGroup` **never sets
`subscriptionMode`** either (its consume type is always CLUSTERING).
So the first group of any cloud instance trips `IllegalStateException:
Consumer group subscriptionMode is unavailable: <name>` and the whole tool call
fails.
This contradicts the invariant the Apache provider already established in
`RocketMQMetadataProvider.toConsumerGroupVO`:
```java
// messageModel stores the subscription mode ("Push"/"Pop"); surface it so
read paths
// (web detail, AI rmq.group.list) never see a null subscriptionMode.
vo.setSubscriptionMode(parseSubscriptionMode(entity.getMessageModel()));
```
The invariant was fixed for Apache only; both cloud converters were missed.
Existing tests never catch it because they always pre-set the enum (e.g.
`ToolGatewayServiceTest` builds groups with `SubscriptionMode.Push`).
## Modification
- Both cloud converters emit `SubscriptionMode.Push`: cloud TCP consumer
groups are push consumers (Aliyun's `messageModel` carries the consume model,
not the subscription mode; Tencent has no POP groups).
- `AliyunConverters.toConsumeType` falls back to `CLUSTERING` for a
missing/unrecognized `messageModel`, mirroring
`RocketMQMetadataProvider.parseConsumeType` ("falling back to CLUSTERING").
## Verification
`mvn -f server/pom.xml test
-Dtest='AliyunInstanceProviderTest,TencentInstanceProviderTest'`
fail-before (fix reverted, tests kept):
```
AliyunInstanceProviderTest.listConsumerGroupsShouldMapGroupIdTest
<<< FAILURE! (subscriptionMode was null)
AliyunInstanceProviderTest.listConsumerGroupsShouldFallBackWhenMessageModelMissingTest
<<< FAILURE!
TencentInstanceProviderTest.listConsumerGroupsShouldMapAndFilterTest
<<< FAILURE! (subscriptionMode was null)
```
pass-after:
```
TencentInstanceProviderTest: Tests run: 43, Failures: 0
AliyunInstanceProviderTest: 27 tests, only
getGroupProgressShouldMapLagRowsTest failing —
verified pre-existing on a clean rocketmq-studio checkout (unrelated to
this change)
```
Follow-up to the Apache-side invariant; no associated issue — found by code
inspection.
--
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]