unbridled-41 opened a new pull request, #5936:
URL: https://github.com/apache/rocketmq-dashboard/pull/5936
### Which Issue(s) This PR Fixes
Fixes #5935
### Problem / Evidence
The Excel export treats `msgIds` as a filter over the scanned window and
reports only scan completeness, while the page reports the request as the
result:
```java
// RocketMQDLQProvider.exportExcel
List<DLQMessageVO> messages = scanResult.messages().stream()
.filter(message -> selected.isEmpty() ||
selected.contains(message.getMsgId()))
```
```ts
// dlq.tsx (before)
message.success(`已导出 … 选中的 ${detailSelectedMsgIds.length} 条 …`);
```
```
DLQPage: reports how many selected messages the export actually contained
TestingLibraryElementError: Unable to find an element with the text:
选中的 2 条死信消息中有 1 条不在导出窗口内,未写入文件
```
A selected message outside the window (the range picker does not clear the
selection, and another operator can resend a message in the meantime) is
silently absent from the sheet, and neither the response nor the toast says so.
### Root cause / Fix
The number written was never computed. Count it
(`exportedRows`/`selectedRows` on the export result), expose it through
`X-DLQ-Export-Rows` / `X-DLQ-Export-SelectedRows` (added to
`DlqExportHeaders.ALL`, hence the CORS exposed-headers list), parse it in the
web client, and warn when the selection was only partially written instead of
claiming success.
### Priority and scoring
**PRIORITY 60** — impact 22/40 (an evidence file that claims to contain
messages it does not, with no way to notice), blast radius 14/20 (every
selected-message export, i.e. the export operators use to hand evidence on),
reproducibility 18/20 (deterministic once the window does not cover the
selection, pinned by tests on both sides), maintenance value 6/20.
**FIX_CONFIDENCE 80** — the counts are already in hand in the provider; the
change is a count plus two headers and one branch in the toast.
### Tests
`cd server && mvn -o -B -ntp test
-Dtest='RocketMQDLQProviderTest,DLQControllerTest,DLQServiceTest'` -> `Tests
run: 105, Failures: 0, Errors: 0`; `cd web && npx vitest run
src/pages/instance/__tests__/DLQPage.test.tsx src/api/message.test.ts` ->
`Tests 38 passed`.
| Test | Before | After |
|---|---|---|
|
`RocketMQDLQProviderTest#exportExcelReportsTheRowsItWroteForASelectionTest` |
compile-red (the counts did not exist) | PASS (`exportedRows=1`,
`selectedRows=2`) |
| `DLQPage: reports how many selected messages the export actually
contained` | FAIL (the page showed its success claim) | PASS |
`npx eslint` reports no errors; `npx tsc -b` passes; `checkstyle:check`
passes.
### Risk
For a full-window export the new headers are `exportedRows=<rows>` and
`selectedRows=0`, and the page keeps the existing success message. The web
client treats an absent header as 0, so an older server cannot produce a false
warning (the check is skipped when `exportedRows` is absent).
--
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]