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 06:57:05 UTC
[PR] fix(cloud): guarantee non-null topic type and perm in cloud topic converters [rocketmq-dashboard]
zjncs opened a new pull request, #4137:
URL: https://github.com/apache/rocketmq-dashboard/pull/4137
## Motivation
The `rmq.topic.list` AI tool projection (`TopicListToolHandler.safeProjection`) resolves `topic.type` and `topic.perm` through `requiredEnumName`, which throws `IllegalStateException` on null values (contract introduced with the AI resource tools in #642). Both cloud converters can still produce nulls, so listing topics through the AI tool is broken on cloud instances:
- `AliyunConverters.toTopicVO` never sets `perm` at all, and `AliyunInstanceProvider.toTopics` adds no enrichment afterwards — **every** Aliyun topic carries `perm=null`, so the projection fails on the first listed topic, deterministically.
- `AliyunConverters.toTopicType` returns `null` for a null or unmapped `messageType`, and `TencentInstanceProvider.toTopicType` returns `null` for a blank or unmapped topic type, so the same projection fails whenever the cloud API omits the field or returns a value the switch does not map (e.g. a newly introduced cloud type).
## Modification
- `AliyunConverters.toTopicVO` now defaults `perm` to `TopicPerm.RW`: Aliyun's `ListTopics` API does not return permissions, and console-managed cloud topics are read-write — the same convention `TencentInstanceProvider.toTopic` already applies.
- `AliyunConverters.toTopicType` and `TencentInstanceProvider.toTopicType` now fall back to `TopicType.NORMAL` for blank/unknown values, mirroring the Apache provider's `parseTopicType` fallback so read paths (web detail, AI `rmq.topic.list`) never see a null type.
## Verification
Fail-before (source fix stashed, tests kept) — 4 failures, all `expected: NORMAL but was: null` / missing perm:
```
[ERROR] Tests run: 71, Failures: 4, Errors: 0
AliyunInstanceProviderTest.listTopicsShouldMapMessageTypeAndFilterTest (unmapped type now expected NORMAL; perm expected RW)
AliyunInstanceProviderTest.listTopicsShouldGuaranteeTypeAndPermForAiToolProjectionTest
TencentInstanceProviderTest.listTopicsShouldFallBackToNormalTypeWhenTopicTypeMissingTest
```
Pass-after (fix applied):
```
AliyunInstanceProviderTest Tests run: 27, Failures: 1 (only getGroupProgressShouldMapLagRowsTest — pre-existing on rocketmq-studio, fixed by #4135)
TencentInstanceProviderTest Tests run: 44, Failures: 0
```
The one remaining `getGroupProgressShouldMapLagRowsTest` failure is the pre-existing base failure on `rocketmq-studio` (stale test vs the intentional #2907 production change), already fixed by open PR #4135; it is unrelated to this change.
New/updated tests:
- `AliyunInstanceProviderTest.listTopicsShouldGuaranteeTypeAndPermForAiToolProjectionTest` — null and unmapped `messageType` both map to `NORMAL` with `perm=RW`.
- `AliyunInstanceProviderTest.listTopicsShouldMapMessageTypeAndFilterTest` — the unmapped-type row now asserts `NORMAL` (was documenting the old `null`) and mapped rows assert `perm=RW`.
- `TencentInstanceProviderTest.listTopicsShouldFallBackToNormalTypeWhenTopicTypeMissingTest` — blank and unmapped topic types map to `NORMAL`, `perm` stays `RW`.
--
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(cloud): guarantee non-null topic type and perm in cloud topic converters [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins commented on PR #4137:
URL: https://github.com/apache/rocketmq-dashboard/pull/4137#issuecomment-5602088715
Closed as folded into #4115, merged into `rocketmq-studio` as 206314b9.
Your change shipped as-is: `AliyunConverters.toTopicVO` now sets `TopicPerm.RW` and both cloud `toTopicType` implementations fall back to `TopicType.NORMAL` instead of returning null for a blank or unrecognised type. The Aliyun perm gap was the more serious half — ListTopics returns no permission field and nothing downstream filled it in, so every Aliyun topic had a null perm and `TopicListToolHandler.safeProjection` threw on its first `requiredEnumName` call.
Worth recording that you scoped this correctly: you changed `type` and `perm` but left `messageCount`, `tps` and `consumerGroupCount` alone, which no provider populates either. Defaulting those too would have masked genuinely absent data rather than fixing a broken invariant, so the restraint was the right call.
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
Re: [PR] fix(cloud): guarantee non-null topic type and perm in cloud topic converters [rocketmq-dashboard]
Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed pull request #4137: fix(cloud): guarantee non-null topic type and perm in cloud topic converters
URL: https://github.com/apache/rocketmq-dashboard/pull/4137
--
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