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

   ## Which Issue(s) This PR Fixes
   
   Fixes #6759
   
   ## Problem / Evidence
   
   `GET /api/audit-logs` serialized two always-null keys that the feed's 
contract does not have:
   
   ```json
   {"id": 195, "gmtCreate": null, "gmtModified": null, "timestamp": 
"2026-10-15T21:45:27", ...}
   ```
   
   `docs/api-spec.md` §13.1 lists `AuditRecord` with exactly ten fields (`id`, 
`timestamp`, `operator`, `operationType`, `resourceType`, `target`, 
`clusterId`, `detail`, `result`, `errorMessage`), and the console reads neither 
extra field (`grep -rn "gmtCreate\|gmtModified" web/src/pages/ops/audit.tsx 
web/src/pages/ops/AuditRiskInsights.tsx` is empty).
   
   Cause: `AuditRecordVO extends BaseEntity` (which declares `id`, `gmtCreate`, 
`gmtModified`), and the audit query fills only the ten rendered fields, so the 
two bookkeeping columns reach the wire as `null` on every entry.
   
   ## Fix
   
   Ignore the two bookkeeping columns for this view only — the base class stays 
untouched, so the views that do populate them keep serializing real values:
   
   ```java
   @JsonIgnoreProperties({"gmtCreate", "gmtModified"})
   public class AuditRecordVO extends BaseEntity {
   ```
   
   ## Tests
   
   New `AuditRecordWireContractTest` serializes the view and asserts the key 
set is exactly the documented ten. Before the change it fails on the leaked key:
   
   ```
   expected: [... "clusterId", "detail", "errorMessage", "id", "operationType", 
"operator", "resourceType", "result", "target", "timestamp"]
    but was: [... "clusterId", "detail", "errorMessage", "gmtCreate", ...
   ```
   
   After the change (JDK 21, offline Maven):
   
   ```
   Tests run: 32, Failures: 0, Errors: 0, Skipped: 0
     (AuditRecordWireContractTest 1, AuditServiceTest 19, AuditControllerTest 
12)  BUILD SUCCESS
   ```
   
   Test-only addition plus one annotation; the audit service, its queries and 
the CSV export are untouched. Verified against the running stack at `a92c2314`; 
the change was prepared with AI assistance and reviewed, tested and verified by 
me.
   


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