zjncs opened a new pull request, #5697:
URL: https://github.com/apache/rocketmq-dashboard/pull/5697

   ### What
   
   `ToolDefinition`'s risk predicates had no test. This adds 
`ToolDefinitionTest` with 5 tests pinning them.
   
   ### Why
   
   These three predicates gate the confirmation chain — whether a tool call 
needs a reason, a confirm token, or neither. A wrong predicate silently weakens 
the guardrail: e.g. if `isLowRiskReadOnly()` stopped demanding the L1 level, an 
L2 mutation tool with a read-sounding permission would skip confirmation.
   
   ### What is pinned
   
   - only **L1** is read-only; L2 and L3 are not;
   - only **L3** requires a reason;
   - `isLowRiskReadOnly()` demands **both** halves — the L1 risk level **and** 
a read permission: an L1 with a delete permission, an L2 with a read 
permission, and an L3 with a read permission all fail;
   - the permission check is the exact `:read` suffix, not a loose substring: 
`cluster-read`, `cluster:readonly`, and a bare `read` do not qualify;
   - the `Cli` record exposes resource and verb.
   
   ### Verification
   
   - New tests on unmodified code: **5/5 green** (`mvn test 
-Dtest=ToolDefinitionTest`).
   - Discriminating mutations on `ToolDefinition`, build result verified red 
each time:
     1. `isReadOnly()` level check inverted (`!= L1`) — red;
     2. `requiresReason()` downgraded from L3 to L2 — red;
     3. the `isReadOnly()` conjunct dropped from `isLowRiskReadOnly()` so a 
read permission alone qualifies — red (the L2-with-read-permission case catches 
it).
   - 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]

Reply via email to