zjncs opened a new pull request, #5718:
URL: https://github.com/apache/rocketmq-dashboard/pull/5718
### What
`ToolCapabilityFilter` — the gate that refuses a tool unless the bound
Instance supports every capability the tool declares — had no test. This adds
`ToolCapabilityFilterTest` with 5 tests.
### Why
The filter's javadoc documents a deliberate two-sided contract:
capability-less tools stay ungated because their data is deployment-wide (no
lookup at all), while everything else is gated with a **containsAll**, not a
spot check. A regression on either side either slows every platform-level tool
with a pointless lookup or lets a tool run half-supported against an Instance.
### What is pinned
- a tool that declares no required capabilities passes **without a
capability lookup**;
- a tool whose Instance supports every declared capability proceeds;
- **containsAll, not a spot check**: an Instance holding one of two required
capabilities is still refused;
- an Instance with only unrelated capabilities does not pass the gate;
- a refusal fails loudly with the structured `TOOL_CAPABILITY_UNSUPPORTED`
error naming the tool, and the chain never proceeds.
### Verification
- New tests on unmodified code: **5/5 green**, checkstyle clean (`mvn test
-Dtest=ToolCapabilityFilterTest`).
- Discriminating mutations on `ToolCapabilityFilter`, build result verified
red each time:
1. the ungated pass-through dropped so capability-less tools also pay a
lookup — red;
2. `containsAll` weakened to a non-empty spot check so unrelated
capabilities pass — red;
3. the refusal swapped to the wrong structured error — red.
- Restored: 5/5 green. Test-only change; no product code touched.
--
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]