This is an automated email from the ASF dual-hosted git repository.
lizhimins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/rocketmq-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 00c964866 fix(audit): keep the record view on the fields the feed
documents (#6760)
00c964866 is described below
commit 00c96486668eb9225fd1ec762237e70081562843
Author: bai mengxuan <[email protected]>
AuthorDate: Fri Nov 27 12:26:11 2026 +0800
fix(audit): keep the record view on the fields the feed documents (#6760)
---
.../rocketmq/studio/ops/audit/AuditRecordVO.java | 5 ++
.../ops/audit/AuditRecordWireContractTest.java | 65 ++++++++++++++++++++++
2 files changed, 70 insertions(+)
diff --git
a/server/src/main/java/org/apache/rocketmq/studio/ops/audit/AuditRecordVO.java
b/server/src/main/java/org/apache/rocketmq/studio/ops/audit/AuditRecordVO.java
index 3ae8f2b04..fae708061 100644
---
a/server/src/main/java/org/apache/rocketmq/studio/ops/audit/AuditRecordVO.java
+++
b/server/src/main/java/org/apache/rocketmq/studio/ops/audit/AuditRecordVO.java
@@ -16,6 +16,7 @@
*/
package org.apache.rocketmq.studio.ops.audit;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.apache.rocketmq.studio.common.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -30,6 +31,10 @@ import java.time.LocalDateTime;
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
+// The feed's contract (docs/api-spec.md AuditRecord) is exactly the ten
fields below. The base class
+// carries the bookkeeping columns, and the audit query never selects them, so
without this they reach
+// the wire as an always-null gmtCreate / gmtModified pair that neither the
spec nor the console reads.
+@JsonIgnoreProperties({"gmtCreate", "gmtModified"})
public class AuditRecordVO extends BaseEntity {
private LocalDateTime timestamp;
private String operator;
diff --git
a/server/src/test/java/org/apache/rocketmq/studio/ops/audit/AuditRecordWireContractTest.java
b/server/src/test/java/org/apache/rocketmq/studio/ops/audit/AuditRecordWireContractTest.java
new file mode 100644
index 000000000..edebd7a5d
--- /dev/null
+++
b/server/src/test/java/org/apache/rocketmq/studio/ops/audit/AuditRecordWireContractTest.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.rocketmq.studio.ops.audit;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import java.time.LocalDateTime;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import org.junit.jupiter.api.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * The audit feed's wire contract (docs/api-spec.md ยง13.1 AuditRecord) is
exactly the ten fields
+ * asserted here. The view inherits the bookkeeping columns from BaseEntity,
and the audit query
+ * never selects them, so without the pin they reach the wire as an
always-null gmtCreate /
+ * gmtModified pair that neither the spec nor the console knows about.
+ */
+class AuditRecordWireContractTest {
+
+ private static final Set<String> DOCUMENTED_FIELDS = Set.of(
+ "id", "timestamp", "operator", "operationType", "resourceType",
"target", "clusterId",
+ "detail", "result", "errorMessage");
+
+ @Test
+ void auditRecordSerializesExactlyTheDocumentedFieldsTest() throws
Exception {
+ AuditRecordVO record = AuditRecordVO.builder()
+ .timestamp(LocalDateTime.of(2026, 10, 15, 12, 30, 5))
+ .operator("system")
+ .operationType("CREATE_TOPIC")
+ .resourceType("TOPIC")
+ .target("orders")
+ .clusterId("DefaultCluster")
+ .detail("queues=4/4")
+ .result("SUCCESS")
+ .errorMessage("")
+ .build();
+ record.setId(7L);
+
+ JsonNode wire = new ObjectMapper().registerModule(new
JavaTimeModule()).valueToTree(record);
+ Set<String> keys = new TreeSet<>();
+ for (Iterator<Map.Entry<String, JsonNode>> fields = wire.fields();
fields.hasNext(); ) {
+ keys.add(fields.next().getKey());
+ }
+ assertThat(keys).isEqualTo(new TreeSet<>(DOCUMENTED_FIELDS));
+ }
+}