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

   ### Which Issue(s) This PR Fixes
   
   - Fixes #6798
   
   ### Brief Description
   
   The demo queue progress rows did not satisfy the progress contract. 
`web/src/mock/consumers.ts:48` declared its own `QueueProgress` instead of the 
endpoint's, and that copy had no `topic` — `web/src/api/metadata.ts:155` 
requires it. `web/src/services/consumerService.ts:178` and `:378` cast the 
fixtures over the mismatch (`mockQueueProgress[name] as unknown as 
QueueProgress[]`), which is why neither `tsc` nor the suite could see it.
   
   The queue progress table renders that field in its own column 
(`web/src/pages/instance/consumer.tsx:1306-1316`, `render: (topic) => topic || 
'-'`), so in Mock mode the **Topic** column showed `-` for every one of the 43 
demo queues while the broker, queue id and offsets on the same rows were 
populated.
   
   The fixture is now declared as the contract type, each progress row carries 
a topic taken from its group's own subscription list in the same file (so the 
demo data stays internally consistent — `cg-order-notify` gets `order-create` / 
`order-status-change` / `payment-callback`), and the two casts that hid the 
drift are gone, so `tsc` checks the fixture against `web/src/api/metadata.ts` 
from now on.
   
   User-visible change: in Mock mode the queue progress Topic column shows the 
topic instead of a placeholder, and the reset-offset preview's per-topic filter 
now selects the requested topic's rows instead of every row of the group.
   
   ### Other consumers
   
   `git grep "mockQueueProgress"` returns the fixture and two call sites in 
`web/src/services/consumerService.ts`; all three were checked:
   
   - `getConsumerProgress` (`:178`) — the reported path; fixture and cast fixed 
here.
   - `buildMockResetOffsetPreview` (`:378`) — filters with `!progress.topic || 
progress.topic === data.topic`. With the rows now carrying a topic, that filter 
does what it says, so the preview for `order-create` covers that topic's queues 
rather than the group's whole queue set. The existing `builds copied reset 
offset previews in mock mode` still passes (it asserts `queueCount > 0` and the 
requested topic on the queues).
   - `mockSubscriptions` in the same fixture — the source of the topic per 
group; untouched, and the progress rows are deliberately consistent with it.
   - `web/src/pages/instance/consumer.tsx` — reads the record type, not the 
fixture, so it was only ever affected through what the service returned. 
`#6763` also edits this file for the progress row keys, which is a different 
defect: it consumes `topic` from the row (its own fixtures set it), whereas 
these fixtures never provided one.
   - `web/src/api/metadata.ts:155` — the contract the fixture now uses; 
unchanged.
   
   ### How Did You Test This Change?
   
   ```
   $ ./wb test --filter src/services/consumerService.test.ts
   ✗   npx vitest run src/services/consumerService.test.ts --maxWorkers=1 
--fileParallelism=false
         Expected: "string"
         Received: "undefined"
         Test Files  1 failed (1)
              Tests  1 failed | 26 passed (27)
   
   $ ./wb test
   ✓    1.3s  npx eslint src/mock/consumers.ts 
src/services/consumerService.test.ts src/services/consumerService.ts
   ✓    0.6s  npx prettier --check src/mock/consumers.ts 
src/services/consumerService.test.ts src/services/consumerService.ts
   ✓  143.1s  npx vitest related --run src/mock/consumers.ts 
src/services/consumerService.test.ts src/services/consumerService.ts
                 Test Files  1 passed (1)
                      Tests  27 passed (27)
   ✓    4.6s  npx tsc -b
   ```
   
   The new test fails without the fix:
   
   ```
   # web/src/mock/consumers.ts and web/src/services/consumerService.ts 
reverted, the test kept
   $ ./wb test --filter src/services/consumerService.test.ts
   ✗   npx vitest run src/services/consumerService.test.ts --maxWorkers=1 
--fileParallelism=false
         Expected: "string"
         Received: "undefined"
         Test Files  1 failed (1)
              Tests  1 failed | 26 passed (27)
   ```
   
   The assertion goes red because it asks a demo progress row for `topic` as a 
string; with the fixtures reverted the field is absent from the record, so it 
is `undefined` and the failure reads exactly `Expected: "string" / Received: 
"undefined"` — the same absence that made `consumer.tsx:1315` print `-`. The 26 
sibling tests stay green, including the reset-offset preview, which is what 
shows the assertion pins the fixture's contract field rather than the mock 
pipeline as a whole.
   
   ### Checklist
   
   - [x] One coherent change; unrelated modifications are not bundled in
   - [x] Commit subject follows Conventional Commits (`feat:` / `fix:` / 
`refactor:` / `chore:` / `docs:` / `perf:`)
   - [x] Tests added or updated for non-trivial changes, test methods named 
`...Test`
   - [ ] New UI text has both Chinese and English entries under `web/src/i18n/`
   - [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit 
checks)
   - [ ] New source files carry the ASF license header
   - [ ] Documentation touched where behaviour changed (README / `docs/` / 
in-app help)
   


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