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

   ## Problem
   
   `countGroups` (`TencentInstanceProvider.java:193`) returned a hard **0** 
whenever `DescribeConsumerGroupList` came back without `TotalCount`:
   
   ```java
   Long totalCount = response == null ? null : response.getTotalCount();
   if (totalCount == null) {
       return 0;          // ← fabricated zero from unknown data
   }
   ```
   
   The instance page's group count then shows **0** while the group list on the 
*same cloud* shows the real groups — exactly the fabricated-zero anti-pattern 
this repo documents against (`ConsumerLagResolver`: *"returns UNKNOWN ... 
instead of a fabricated zero"*).
   
   The same file already handles this situation correctly everywhere else:
   
   - `countTopics` (:178-181): TotalCount unknown → **falls back to a complete 
listing**;
   - `listConsumerGroups` / `listTopics`: `isUnknownTotalCount` treats 
null/negative as unknown, never as zero.
   
   ## Fix
   
   Mirror `countTopics`: unknown `TotalCount` → `listConsumerGroups(instanceId, 
null, false).size()` — a complete listing bounded by the existing pagination 
loop and `requireCompletePage` guards. The prior zero behavior was pinned by a 
test; that test now asserts the fallback contract instead (with the 
justification in its comment).
   
   ## Verification
   
   - **before**: 
`countGroupsShouldFallBackToCompleteListingWhenTotalCountIsMissing` **fails** — 
`expected: 1 but was: 0` (one group visible in the list, count says zero);
   - **after**: **50/50** in `TencentInstanceProviderTest` (the new fallback 
test passes; the other 49 including the TotalCount-present, null-response, and 
out-of-range paths unchanged);
   - **mutation** (revert the provider): back to 1 failed; restore: 50/50.
   
   ```bash
   cd server && mvn test -Dtest=TencentInstanceProviderTest
   ```


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