Frun1na opened a new issue, #6545:
URL: https://github.com/apache/rocketmq-dashboard/issues/6545

   ### Before Creating the Bug Report
   
   - [x] I have searched the [open 
issues](https://github.com/apache/rocketmq-dashboard/issues) of this repository 
and believe that this is not a duplicate.
   - [x] This is a defect in RocketMQ Studio, not a usage question and not a 
defect in another Apache RocketMQ repository.
   - [x] I can reproduce this on the current `rocketmq-studio` branch, or I 
have stated the exact version I am running below.
   
   ### Studio Version
   
   branch: `rocketmq-studio`
   git commit id: `779b8c0e`
   deployed as: reproduced by a component test against that commit (the 
affected code is the web client)
   
   ### Runtime Environment
   
   OS: Ubuntu on WSL2
   MySQL: not applicable — the defect is in the web client's table sorting
   browser: not applicable — reproduced in a jsdom unit test (vitest + Testing 
Library)
   
   ### Connected RocketMQ Cluster
   
   RocketMQ version: not applicable — reproduced with a stubbed DLQ group page 
in a unit test
   access mode: not applicable
   deployment: not applicable
   
   ### Describe the Bug
   
   Sorting the DLQ group list by "Last Enqueue" ranks a group that has no 
enqueue stamp as the oldest
   one (`web/src/pages/instance/dlq.tsx:545`):
   
   ```tsx
         title: '最近入队时间',
         dataIndex: 'lastEnqueueTime',
         sorter: (a, b) => (a.lastEnqueueTime || 
'').localeCompare(b.lastEnqueueTime || ''),
   ```
   
   `RocketMQDLQProvider.listDLQGroups` leaves `lastEnqueueTime` null when the 
group's dead-letter topic
   held no message (`latestUpdate > 0` guards the assignment) and also when the 
stats could not be read
   at all — that branch sets `statsAvailable = false` and leaves the stamp 
null. The cell renders '-'
   for those rows, but the empty-string substitute orders before every real 
timestamp, so an ascending
   sort puts every group without a stamp first, including the groups whose 
queue is unreadable; a reader
   using the column to find the oldest dead letters is shown rows that carry no 
stamp at all.
   
   The repository already has a case for this scenario
   (`sorts DLQ rows with missing enqueue timestamps` in `DLQPage.test.tsx`), 
but it only asserted that
   the '-' cell is rendered, which holds whatever the order is, so the wrong 
order went unnoticed.
   
   ### Steps to Reproduce
   
   Reproduced by a component test rather than against a cluster:
   
   1. Render the DLQ page with two groups: one with `lastEnqueueTime` set, one 
with `null` (the column
      shows '-').
   2. Click the "最近入队时间" header (ascending).
   3. The group without a stamp is listed first, before the stamped one.
   
   ### What Did You Expect to See?
   
   A group without a stamp should stay out of the comparison's extreme 
positions, ascending and
   descending, the way an unmeasured TPS is kept out of it on the broker 
cluster page.
   
   ### What Did You See Instead?
   
   The group without a stamp sorts as the earliest enqueue and appears first.
   
   ### Additional Context
   
   - A fix with a regression test follows in a pull request; it extends the 
existing
     `sorts DLQ rows with missing enqueue timestamps` case with the row order 
it was missing.
   - The case is pinned by a unit test that fails without the fix:
     `AssertionError: expected 1 to be greater than 2` (the unstamped row at 
index 1, the stamped row at
     index 2).
   
   ### Are You Willing to Submit a Pull Request?
   
   - [x] Yes, I am willing to submit a pull request.
   


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