unbridled-41 opened a new pull request, #4172:
URL: https://github.com/apache/rocketmq-dashboard/pull/4172

   Fixes #4171.
   
   ## Problem / Evidence
   
   The Consumer Groups page applies the subscription-mode select client-side 
only: `visibleConsumerGroups` (`web/src/pages/instance/consumer.tsx`, base 
`0a596661`, lines 154-162) filters the rows of the **current server page**, 
while `loadConsumerGroupPage` (343-371) never sends the mode and the paginator 
shows the unfiltered `totalGroups`. The same view's export already filters 
server-side (`/api/groups/export` → `MetadataService.exportConsumerGroups` 
lines 436-438), so the list and the export disagree.
   
   New regression test `passes the subscription mode filter to the server query 
and resets the page` fails on base: after selecting "Pop", the last 
`listConsumerGroupPage` call does not include `subscriptionMode: 'Pop'` (`- 
"subscriptionMode": "Pop"` missing from the received call).
   
   ## Root cause / Fix
   
   Root cause: the mode filter was implemented as a client-side slice over 
server-paginated data.
   
   Fix:
   - **Backend**: `/api/groups/page` accepts an optional `subscriptionMode` 
request parameter and threads it through 
`MetadataService.listConsumerGroupsPage` → provider chain. 
`RocketMQMetadataProvider` pushes the filter into the database query via the 
`rmq_group.message_model` column (the same column `toConsumerGroupVO` reads), 
so `total` matches the filtered rows. Cloud providers keep a default in-memory 
implementation (filter on `getSubscriptionMode().name()` then paginate) since 
their remote APIs have no such filter; `ConsumerGroupListToolHandler` (AI tool) 
passes `null` explicitly, preserving its behavior.
   - **Frontend**: `listConsumerGroupPage` sends `subscriptionMode`; the 
client-side slice filter is removed; changing the mode resets the page to 1 
(same as the search box).
   
   ## Priority & scoring
   
   - Impact 30/40 (the filter lies on a core list page whenever the filtered 
set spans pages; list/export inconsistency) + breadth 14/20 (all 
server-paginated consumer group lists, any instance with ≥ 2 pages) + 
reproducibility 18/20 (deterministic API-call regression + DB query assertion) 
+ maintainability value 14/20 (restores the list/export contract symmetry) = 
**PRIORITY 76** ≥ 70.
   - Signature-threading with in-file precedent (export path) and red→green 
regressions on both ends → **FIX_CONFIDENCE 85** ≥ 80.
   
   ## Tests
   
   - Red (frontend): `npx vitest run 
src/pages/instance/__tests__/ConsumerPage.test.tsx` on base with only the test 
added → 1 failed (`subscriptionMode: 'Pop'` not sent).
   - Green (frontend): same command after the fix → `Tests 32 passed (32)`.
   - Backend module: `mvn -o test 
-Dtest='RocketMQMetadataProviderTest,MetadataServiceTest,ConsumerGroupControllerTest,ToolGatewayServiceTest'`
 → `Tests run: 132, Failures: 0, Errors: 0` (new: DB-query filter assertion, 
service passthrough, controller param passthrough).
   - Full web suite after the fix: `npx vitest run` → `Test Files 115 passed 
(115)`, `Tests 945 passed (945)` (an earlier run had 1 failure in `ConsumerPage 
> shows group health diagnostics`, which passes in isolation and in this full 
re-run — the documented load-flaky test).
   - `npx tsc --noEmit` clean; eslint clean on the changed web files; `npm run 
build` → `✓ built in 12.18s`.
   
   ## Risk
   
   Low-moderate. The `/groups/page` endpoint gains an **optional** parameter — 
existing callers (including the AI tool, which passes null) are unaffected; 
cloud providers get a default that filters in memory over the already-fetched 
list (same data their unfiltered path returns). The Apache DB filter uses the 
exact `message_model` values ("Push"/"Pop") that `toConsumerGroupVO` maps. One 
behavioral change is intended: the table now shows only server-filtered rows 
and the total reflects the filter.
   


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