zjncs opened a new pull request, #5660:
URL: https://github.com/apache/rocketmq-dashboard/pull/5660
### Problem
`ToolPlan` — the preview/execute contract every mutating AI tool returns —
had **no test**. Its contracts carry behaviours a refactor could silently break:
| Contract | Subtlety |
| --- | --- |
| builder state conversion | prunes null-valued entries — a null field never
reaches the before/after diff |
| `before`/`after` state maps | **deeply immutable** (nested maps reject
mutation; the constructor snapshots caller-owned maps and lists) |
| typed state reads | lenient: unknown JSON keys in a state map do not fail
the record conversion (`FAIL_ON_UNKNOWN_PROPERTIES=false`) |
| `withWarning` | returns a new plan, leaves the original untouched |
| `warningIf` | applies the warning only when the condition holds |
### Change
Add `ToolPlanTest` with eight tests pinning all of the above plus the
null-object-to-empty-map builder behaviour.
### Verification
- New tests: **8/8 green** against unmodified code.
- Discriminating mutations on `ToolPlan` (verified via build result):
- null-value prune removed: **red**
- shallow state copy instead of the deep immutable walk: **3 red**
- strict mapper (without `FAIL_ON_UNKNOWN_PROPERTIES=false`): **red**
- Restored: 8/8 green. No product code changed.
--
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]