unbridled-41 opened a new pull request, #5940:
URL: https://github.com/apache/rocketmq-dashboard/pull/5940

   ### Which Issue(s) This PR Fixes
   
   Fixes #5939
   
   ### Problem / Evidence
   
   `ToolMutationFilter` returns a plan for a dry run without proceeding 
(`MutationOutput.Status.PLANNED`), but `ToolAuditFilter` records every 
non-throwing call as an applied change:
   
   ```java
   // before
   output = chain.proceed(invocation);
   ...
   this.record(context, "SUCCESS", null);
   ```
   
   ```
   ToolDryRunAuditTest#aPreviewIsAuditedAsSuchInsteadOfAsAnAppliedChangeTest
   expected the recorded detail to contain "dry_run=true" but was null
   ```
   
   so a previewed deletion and an executed deletion produce the same audit row 
(`operation=DELETE_TOPIC, detail=null, result=SUCCESS`), in `/api/audit-logs` 
and in the CSV export.
   
   ### Root cause / Fix
   
   The filter never looked at the output it received. Mark the detail for a 
`MutationOutput` whose status is `PLANNED` ("dry_run=true (preview only, 
nothing applied)") and keep the empty detail for an execution; the result 
vocabulary stays as it is.
   
   ### Priority and scoring
   
   **PRIORITY 48** — impact 18/40 (the audit trail cannot answer whether an 
AI-driven change was applied), blast radius 10/20 (every previewed mutation, 
which the hosted agent issues by default), reproducibility 18/20 
(deterministic, pinned by the new test), maintenance value 2/20.
   
   **FIX_CONFIDENCE 75** — the status is already on the returned object; the 
marker text is the only new vocabulary.
   
   ### Tests
   
   `cd server && mvn -o -B -ntp test 
-Dtest='ToolMutationFilterTest,ToolDryRunAuditTest'` -> `Tests run: 7, 
Failures: 0, Errors: 0`.
   
   | Test | Before | After |
   |---|---|---|
   | 
`ToolDryRunAuditTest#aPreviewIsAuditedAsSuchInsteadOfAsAnAppliedChangeTest` | 
FAIL (detail null) | PASS (also asserts the handler never executed) |
   | `ToolDryRunAuditTest#anAppliedChangeIsAuditedWithoutThePreviewMarkerTest` 
| PASS (guard) | PASS |
   
   `mvn -o -B -ntp checkstyle:check` passes.
   
   ### Risk
   
   The detail column carries one extra marker for previews; no result code, no 
schema and no caller changes.


-- 
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