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 ef2a9dc89 docs(api-spec): match the LiteTopic session table to the 
serialized view (#7289)
ef2a9dc89 is described below

commit ef2a9dc89cebec5ddee20a4c54c32f9de647d13b
Author: bai mengxuan <[email protected]>
AuthorDate: Fri Nov 27 12:20:59 2026 +0800

    docs(api-spec): match the LiteTopic session table to the serialized view 
(#7289)
---
 docs/api-spec.md                                   |  2 +-
 .../topic/LiteTopicSessionApiSpecTest.java         | 84 ++++++++++++++++++++++
 2 files changed, 85 insertions(+), 1 deletion(-)

diff --git a/docs/api-spec.md b/docs/api-spec.md
index ea419fd9b..e719d4a2a 100644
--- a/docs/api-spec.md
+++ b/docs/api-spec.md
@@ -1490,8 +1490,8 @@ GET /api/liteTopic/session/:sessionId
 | `status` | `string` | 会话状态 |
 | `totalMessages` | `number` | 消息总数 |
 | `consumedMessages` | `number` | 已消费消息数 |
+| `consumedScanTruncated` | `boolean` | 已消费消息数是否为下限:`true` 时消费位点扫描在 lite topic 
上限处截断,`consumedMessages` 只是下界 |
 | `pendingMessages` | `number` | 待消费消息数 |
-| `popProgress` | `number` | 消费进度 |
 | `liteTopicCreationCount` | `number` | 会话内创建的 Topic 数 |
 | `liteTopics` | `object[]` | 会话内 Topic:`topicName` / `status` / 
`ttlRemaining` |
 
diff --git 
a/server/src/test/java/org/apache/rocketmq/studio/instance/topic/LiteTopicSessionApiSpecTest.java
 
b/server/src/test/java/org/apache/rocketmq/studio/instance/topic/LiteTopicSessionApiSpecTest.java
new file mode 100644
index 000000000..a61cc3b04
--- /dev/null
+++ 
b/server/src/test/java/org/apache/rocketmq/studio/instance/topic/LiteTopicSessionApiSpecTest.java
@@ -0,0 +1,84 @@
+/*
+ * 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.instance.topic;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * The session endpoint's field table is what an API client codes against, so 
it has to name exactly
+ * the properties the controller serializes: a fabricated row sends clients 
after a value that never
+ * arrives, and a missing row hides a field that changes how the payload must 
be read.
+ */
+class LiteTopicSessionApiSpecTest {
+
+    private static final String SESSION_SECTION = "### 5.10 ";
+
+    private static final Pattern FIELD_ROW = 
Pattern.compile("^\\|\\s*`([A-Za-z_][\\w.]*)`\\s*\\|");
+
+    @Test
+    void documentsExactlyTheSessionFieldsTheApiReturnsTest() throws 
IOException {
+        List<String> documented = documentedSessionFields(readApiSpec());
+        Map<String, Object> wire = new ObjectMapper()
+                .convertValue(LiteTopicSessionVO.builder().build(), Map.class);
+
+        
assertThat(documented).containsExactlyInAnyOrderElementsOf(wire.keySet());
+    }
+
+    private static List<String> documentedSessionFields(String spec) {
+        int start = spec.indexOf(SESSION_SECTION);
+        assertThat(start)
+                .as("api-spec.md must keep a '%s' section for the session 
endpoint", SESSION_SECTION)
+                .isGreaterThanOrEqualTo(0);
+        int next = spec.indexOf("\n### ", start + SESSION_SECTION.length());
+        String section = next < 0 ? spec.substring(start) : 
spec.substring(start, next);
+
+        List<String> fields = new ArrayList<>();
+        for (String line : section.split("\n")) {
+            Matcher matcher = FIELD_ROW.matcher(line);
+            if (matcher.find()) {
+                fields.add(matcher.group(1));
+            }
+        }
+        return fields;
+    }
+
+    private static String readApiSpec() throws IOException {
+        Path directory = Paths.get("").toAbsolutePath();
+        for (int depth = 0; directory != null && depth < 6; depth++, directory 
= directory.getParent()) {
+            Path candidate = directory.resolve("docs").resolve("api-spec.md");
+            if (Files.isRegularFile(candidate)) {
+                return Files.readString(candidate, StandardCharsets.UTF_8);
+            }
+        }
+        throw new IllegalStateException("docs/api-spec.md not found above " + 
Paths.get("").toAbsolutePath());
+    }
+}

Reply via email to