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

   ### Which Issue(s) This PR Fixes
   
   - Fixes #5263
   
   ### Brief Description
   
   This PR fixes the `mock/dlq.ts` row of #5263: the mock dead-letter groups 
carried a `status`
   vocabulary the backend never sends.
   
   `RocketMQDLQProvider.listDLQGroups` builds every `DLQGroupVO.status` from a 
single expression
   
(`server/src/main/java/org/apache/rocketmq/studio/provider/apache/RocketMQDLQProvider.java:172`):
   
   ```java
   .status(statsAvailable ? (messageCount > 0 ? "ACTIVE" : "EMPTY") : 
"UNAVAILABLE")
   ```
   
   `web/src/mock/dlq.ts` instead declared `status: 'active' | 'empty'` and used 
those lowercase values
   in all eight rows. `ListItem` in `web/src/pages/instance/dlq.tsx` renders 
`group.status` verbatim,
   and the DLQ page's own fixtures already use `'ACTIVE'` / `'UNAVAILABLE'`, so 
mock mode was the only
   place in the repository showing a status the API cannot produce — and a 
status-driven rendering
   change could never be caught against it.
   
   The mock interface now reads `'ACTIVE' | 'EMPTY' | 'UNAVAILABLE'` and the 
eight rows carry the codes
   the provider emits, keeping the same `messageCount` values (so `ACTIVE` 
still means "backlog > 0"
   and `EMPTY` means "no messages"). `web/src/mock/dlq.test.ts` pins all three 
properties — the
   vocabulary, the status/backlog consistency the backend expression 
guarantees, and the
   `%DLQ%{groupName}` topic format — so a future fixture edit that drifts from 
the backend turns the
   suite red.
   
   `web/src/api/message.ts` and `web/src/pages/instance/dlq.tsx` are unchanged: 
the API already types
   `DLQGroup.status` as `string`, and the page already renders the backend 
codes.
   
   ### How Did You Test This Change?
   
   ```sh
   $ cd web && npx vitest run src/mock/dlq.test.ts      # before the fix
    FAIL  src/mock/dlq.test.ts > DLQ mock contract > pins the group status to 
the values the backend emits
   AssertionError: expected [ 'active', 'empty' ] to deeply equal []
   
    FAIL  src/mock/dlq.test.ts > DLQ mock contract > keeps the status 
consistent with the backlog the backend counts
   AssertionError: expected [ Array(8) ] to deeply equal []
   
   - Expected
   + Received
   
   - []
   + [
   +   "cg-order-processor:active:23",
   +   "cg-payment-handler:active:8",
   +   "cg-notification:active:156",
   +   "cg-inventory-sync:active:3",
   +   "cg-analytics:active:42",
   +   "cg-user-tracking:empty:0",
   +   "cg-sms-gateway:active:67",
   +   "cg-email-service:empty:0",
   + ]
   
    Test Files  1 failed (1)
         Tests  2 failed | 1 passed (3)
   ```
   
   ```sh
   $ cd web && npx vitest run src/mock/dlq.test.ts 
src/services/messageService.test.ts
    ✓ src/mock/dlq.test.ts (3 tests) 14ms
    ✓ src/services/messageService.test.ts (7 tests) 18ms
   
    Test Files  2 passed (2)
         Tests  10 passed (10)
   
   $ cd web && npx vitest run src/mock src/services 
src/pages/instance/__tests__/DLQPage.test.tsx
    Test Files  14 passed (14)
         Tests  127 passed (127)
   ```
   
   `npx tsc -b` and `npx eslint src/mock/dlq.ts src/mock/dlq.test.ts` both exit 
0.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits
   - [x] Tests added or updated for non-trivial changes
   - [x] New UI text has both Chinese and English entries under `web/src/i18n/` 
— not applicable, no UI
     text is added or changed; the mock now carries the codes the backend sends
   - [x] Architecture constraints stay green (`mvn test` runs the ArchUnit 
checks) — not applicable, no
     Java source is touched
   - [x] New source files carry the ASF license header
   - [x] Documentation touched where behaviour changed (README / `docs/` / 
in-app help) — not
     applicable, no API or user-visible contract changes; the mock data now 
matches the backend
   


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