yyqdbngt opened a new pull request, #3241:
URL: https://github.com/apache/rocketmq-dashboard/pull/3241
## Summary
Adds `ToolDefinitionTest`, a first unit test for `ToolDefinition` (the AI
tool catalog record consumed by the tool gateway and capability handlers). The
record is exercised purely, without Spring.
Coverage:
- defensive copying: mutating the capability list, nested schema maps, and
nested schema lists passed at construction does not leak into the record, and
every exposed collection is unmodifiable;
- schema validation: a non-string key inside a nested JSON Schema map is
rejected with `JSON Schema keys must be strings`;
- risk gating: `isLowRiskReadOnly()` is true only for `L1` risk combined
with a read-only permission, case/whitespace-insensitive;
- permission parsing: `ToolPermission.parse` trims, lower-cases, and
defaults blank/null input to `("", "")`.
## Why
`ToolDefinition` decides which tools are safe for low-risk read-only
execution; its immutability guarantees and permission normalization had no
direct test.
## Testing
`mvn -B test -Dtest=ToolDefinitionTest` — 4/4 pass; checkstyle (validate)
clean.
--
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]