Frun1na opened a new pull request, #6797:
URL: https://github.com/apache/rocketmq-dashboard/pull/6797
### Which Issue(s) This PR Fixes
- Fixes #6795
### Brief Description
`rmq.broker.list` and `rmq.proxy.list` aggregate across every manageable
Instance when `clusterName` is omitted, and an Instance whose discovery throws
was skipped with a server-side warning only: `BrokerListToolHandler.execute`
(`server/.../handler/broker/BrokerListToolHandler.java:74-81`) and
`ProxyListToolHandler.execute`
(`.../handler/proxy/ProxyListToolHandler.java:71-78`) caught the exception,
logged `Skipping instance ...` and returned `ListOutput<>(items)`. Neither the
record nor either output schema carried a partial-scan channel, so an
unreachable Instance answered as one that has no brokers (or proxies) - while
the producer-connection scan of the same family reports `complete` plus its
failed scopes (#4468).
Both tools now return `ScanOutput<T>(items, scan)` with a nested
`Scan(complete, failedInstances)`: the failing Instances are named and
`complete` is false, so a partial list can never be read as the full inventory.
The block is nested rather than two flat fields because the catalog generator
derives the CLI's table data key from a schema's single array property
(`rmqctl/internal/catalog/generate/main.go:835-855`); a flat `failedInstances`
array would silently drop `TableDataKey` and degrade the table view. The two
tool descriptions and their catalog output schemas document the block, and the
generated catalog is regenerated.
### How Did You Test This Change?
```
$ cd server && mvn -B -ntp test -DforkCount=1
-Dsurefire.failIfNoSpecifiedTests=false \
-Dtest=BrokerListToolHandlerTest,ProxyListToolHandlerTest,ToolOutputSchemaContractTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0 -- in
...BrokerListToolHandlerTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0 -- in
...ProxyListToolHandlerTest
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 -- in
...ToolOutputSchemaContractTest
[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0
$ make -C rmqctl catalog-verify # server YAML ↔ regenerated Go catalog
# the mapped checks for this change also ran gofmt on the regenerated
catalog, go vet and
# go test -race ./internal/catalog (the workbench's rmqctl component)
```
The new tests fail before the fix (base handler code, new tests kept):
```
$ mvn -B -ntp test -Dtest=BrokerListToolHandlerTest,ProxyListToolHandlerTest
-DforkCount=1
[ERROR] Tests run: 3, Failures: 2 ... -- in BrokerListToolHandlerTest
java.lang.AssertionError:
Expecting map:
{"items"=[{"addr"="10.0.0.3:10911", ..., "name"="broker-u", ...}]}
to contain entries:
["scan"={"complete"=false, "failedInstances"=["instance-down"]}]
but could not find the following map entries:
["scan"={"complete"=false, "failedInstances"=["instance-down"]}]
```
and the mutation that reverts just the fix's effect - the handlers report
the scan as complete again - turns the two failure-path cases red while the
happy path stays green:
```
$ # handlers: return ScanOutput.of(items, List.of());
$ mvn -B -ntp test -Dtest=BrokerListToolHandlerTest,ProxyListToolHandlerTest
-DforkCount=1
[ERROR] Tests run: 6, Failures: 2, Errors: 0, Skipped: 0
Expecting map:
{"items"=[...], "scan"={"complete"=true, "failedInstances"=[]}}
to contain entries:
["scan"={"complete"=false, "failedInstances"=["instance-down"]}]
```
The assertion reads the serialized payload (`wireForm`, the same conversion
`ToolSchemaValidator` uses), so it is exactly the wire shape a caller branches
on.
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits (`feat:` / `fix:` /
`refactor:` / `chore:` / `docs:` / `perf:`)
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [ ] New UI text has both Chinese and English entries under `web/src/i18n/`
- [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [x] New source files carry the ASF license header
- [x] Documentation touched where behaviour changed (README / `docs/` /
in-app help)
--
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]