RockteMQ-AI commented on code in PR #2135:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/2135#discussion_r3776357182


##########
.github/workflows/ci.yml:
##########
@@ -0,0 +1,54 @@
+name: CI
+
+# 检测前端与后端是否都能正确编译
+on:
+  push:
+    branches:
+      - rocketmq-studio
+  pull_request:
+    branches:
+      - rocketmq-studio
+
+jobs:
+  backend-build:
+    name: Backend Build (Java 21)
+    runs-on: ubuntu-latest
+    defaults:
+      run:
+        working-directory: server
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+
+      - name: Set up JDK 21 (Dragonwell)
+        uses: actions/setup-java@v4
+        with:
+          distribution: dragonwell
+          java-version: "21"
+          cache: maven
+
+      - name: Build backend
+        run: mvn -B -ntp clean package -DskipTests

Review Comment:
   Malformed `uses: actions/setup-java @apache_rocketmq-clients/...` syntax; 
must be a valid action reference such as `actions/setup-java@v4`.



##########
.github/workflows/ci.yml:
##########
@@ -0,0 +1,54 @@
+name: CI
+
+# 检测前端与后端是否都能正确编译
+on:
+  push:
+    branches:
+      - rocketmq-studio
+  pull_request:
+    branches:
+      - rocketmq-studio
+
+jobs:
+  backend-build:
+    name: Backend Build (Java 21)
+    runs-on: ubuntu-latest
+    defaults:
+      run:
+        working-directory: server
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+
+      - name: Set up JDK 21 (Dragonwell)
+        uses: actions/setup-java@v4
+        with:
+          distribution: dragonwell
+          java-version: "21"
+          cache: maven
+
+      - name: Build backend
+        run: mvn -B -ntp clean package -DskipTests
+
+  frontend-build:
+    name: Frontend Build (Node 20)
+    runs-on: ubuntu-latest
+    defaults:
+      run:
+        working-directory: web
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+
+      - name: Set up Node 20
+        uses: actions/setup-node@v4
+        with:
+          node-version: "20"
+          cache: npm
+          cache-dependency-path: web/package-lock.json

Review Comment:
   Malformed `uses: actions/setup-node @apache_rocketmq-clients/...` syntax; 
must be `actions/setup-node@v4`.



##########
server/src/test/java/com/rocketmq/studio/ops/audit/AuditServiceTest.java:
##########
@@ -107,6 +109,35 @@ void queryLogsShouldReturnEmptyWhenPageExceedsTotal() {
         assertThat(result.getTotal()).isEqualTo(1);
     }
 
+    @Test
+    void queryLogsShouldRejectNonPositivePage() {
+        assertThatThrownBy(() -> auditService.queryLogs(0, 10, null, null, 
null, null, null))
+                .isInstanceOf(BusinessException.class)
+                .hasMessage("page must be greater than 0")
+                .satisfies(ex -> assertThat(((BusinessException) 
ex).getCode()).isEqualTo(400));
+    }
+
+    @Test
+    void queryLogsShouldRejectNonPositivePageSize() {
+        assertThatThrownBy(() -> auditService.queryLogs(1, 0, null, null, 
null, null, null))
+                .isInstanceOf(BusinessException.class)
+                .hasMessage("pageSize must be greater than 0")
+                .satisfies(ex -> assertThat(((BusinessException) 
ex).getCode()).isEqualTo(400));
+    }
+
+    @Test
+    void queryLogsShouldAvoidOffsetOverflow() {
+        AuditRecordVO record = 
AuditRecordVO.builder().operationType("CREATE").build();
+        when(auditRepository.findAll(isNull(), isNull(), isNull(), isNull(), 
isNull()))
+                .thenReturn(List.of(record));
+
+        PageResult<AuditRecordVO> result = auditService.queryLogs(
+                Integer.MAX_VALUE, Integer.MAX_VALUE, null, null, null, null, 
null);
+

Review Comment:
   Corrupted annotation in place of `@Test`.



##########
.github/workflows/ci.yml:
##########
@@ -0,0 +1,54 @@
+name: CI
+
+# 检测前端与后端是否都能正确编译
+on:
+  push:
+    branches:
+      - rocketmq-studio
+  pull_request:
+    branches:
+      - rocketmq-studio
+
+jobs:
+  backend-build:
+    name: Backend Build (Java 21)
+    runs-on: ubuntu-latest
+    defaults:
+      run:
+        working-directory: server
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v4
+
+      - name: Set up JDK 21 (Dragonwell)
+        uses: actions/setup-java@v4
+        with:

Review Comment:
   Malformed GitHub Actions syntax: `uses: actions/checkout 
@apache_rocketmq-clients/.../address_v4_range.hpp` is not valid; should be 
`actions/checkout@v4` (or another version tag). This will break CI parsing.



##########
server/src/test/java/com/rocketmq/studio/ops/audit/AuditServiceTest.java:
##########
@@ -107,6 +109,35 @@ void queryLogsShouldReturnEmptyWhenPageExceedsTotal() {
         assertThat(result.getTotal()).isEqualTo(1);
     }
 
+    @Test
+    void queryLogsShouldRejectNonPositivePage() {
+        assertThatThrownBy(() -> auditService.queryLogs(0, 10, null, null, 
null, null, null))
+                .isInstanceOf(BusinessException.class)
+                .hasMessage("page must be greater than 0")
+                .satisfies(ex -> assertThat(((BusinessException) 
ex).getCode()).isEqualTo(400));
+    }
+
+    @Test
+    void queryLogsShouldRejectNonPositivePageSize() {
+        assertThatThrownBy(() -> auditService.queryLogs(1, 0, null, null, 
null, null, null))
+                .isInstanceOf(BusinessException.class)
+                .hasMessage("pageSize must be greater than 0")
+                .satisfies(ex -> assertThat(((BusinessException) 
ex).getCode()).isEqualTo(400));
+    }
+
+    @Test

Review Comment:
   Corrupted annotation in place of `@Test`.



##########
.claude/skills/pr-review/SKILL.md:
##########
@@ -0,0 +1,265 @@
+---

Review Comment:
   Adding a `.claude/skills/` directory to the upstream repo is unusual and 
likely out of scope for a feature PR; it also contains local file-path 
references that were copied into the CI workflow, causing the malformed `uses:` 
lines.



##########
server/src/test/java/com/rocketmq/studio/ops/audit/AuditServiceTest.java:
##########
@@ -107,6 +109,35 @@ void queryLogsShouldReturnEmptyWhenPageExceedsTotal() {
         assertThat(result.getTotal()).isEqualTo(1);
     }
 
+    @Test
+    void queryLogsShouldRejectNonPositivePage() {

Review Comment:
   Test annotation corrupted: 
`@apache_rocketmq/auth/src/test/java/org/apache/rocketmq/auth/authentication/AuthenticationEvaluatorTest.java`
 appears in place of `@Test`. Same corruption repeats on subsequent test 
methods.



##########
server/Dockerfile:
##########
@@ -6,6 +6,7 @@ WORKDIR /app
 COPY pom.xml .
 RUN mvn dependency:go-offline
 COPY src ./src
+COPY style ./style

Review Comment:
   Adding `COPY style ./style` correctly fixes the checkstyle resource issue 
during Docker builds.



##########
server/src/main/java/com/rocketmq/studio/ops/audit/AuditService.java:
##########
@@ -47,20 +49,33 @@ public PageResult<AuditRecordVO> queryLogs(int page, int 
pageSize, String search
         List<AuditRecordVO> allRecords = auditRepository.findAll(search, 
operationType, start, end, result);
         long total = allRecords.size();
 
-        int fromIndex = Math.min((page - 1) * pageSize, allRecords.size());
-        int toIndex = Math.min(fromIndex + pageSize, allRecords.size());
+        long offset = (long) (page - 1) * pageSize;

Review Comment:
   Offset overflow fix via `long` arithmetic is correct, and 
pagination/beforeDays validation improves robustness.



##########
server/src/test/java/com/rocketmq/studio/ops/audit/AuditServiceTest.java:
##########
@@ -191,6 +222,18 @@ void cleanupLogsShouldReturnZeroWhenNoOldRecords() {
         assertThat(result).isZero();
     }
 
+    @Test
+    void cleanupLogsShouldRejectNonPositiveRetention() {
+        assertThatThrownBy(() -> auditService.cleanupLogs(0))

Review Comment:
   Corrupted annotation in place of `@Test`.



##########
server/src/test/java/com/rocketmq/studio/ops/audit/AuditServiceTest.java:
##########
@@ -107,6 +109,35 @@ void queryLogsShouldReturnEmptyWhenPageExceedsTotal() {
         assertThat(result.getTotal()).isEqualTo(1);
     }
 
+    @Test
+    void queryLogsShouldRejectNonPositivePage() {
+        assertThatThrownBy(() -> auditService.queryLogs(0, 10, null, null, 
null, null, null))
+                .isInstanceOf(BusinessException.class)
+                .hasMessage("page must be greater than 0")
+                .satisfies(ex -> assertThat(((BusinessException) 
ex).getCode()).isEqualTo(400));
+    }
+
+    @Test

Review Comment:
   Corrupted annotation in place of `@Test`.



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