Skip to content

fix(tencent): reject incomplete catalog pages - #4529

Open
zmuxuny wants to merge 1 commit into
apache:masterfrom
zmuxuny:fix/tencent-incomplete-catalog-page
Open

zmuxuny wants to merge 1 commit into
apache:masterfrom
zmuxuny:fix/tencent-incomplete-catalog-page

Conversation

@zmuxuny

@zmuxuny zmuxuny commented Sep 17, 2026

Copy link
Copy Markdown

Which Issue(s) This PR Fixes

Brief Description

Tencent RocketMQ 5.x catalog pagination previously treated any null/empty Data page as the end of the instance list before consulting TotalCount. A short page was also accepted as complete whenever it returned fewer than PAGE_SIZE rows.

When TotalCount says more provider rows exist, either condition represents an incomplete/contradictory page. Returning the rows collected so far makes Studio's cloud-instance catalog look complete even though instances are missing.

This change fails closed with a 502-style BusinessException when a known TotalCount proves rows remain but the current page is short or empty. Genuine empty catalogs remain valid, and missing/negative TotalCount keeps the previous short-page fallback behavior.

Red / Green Verification

Baseline: master@d50ffecc9d7e8f8f46da64198831bd7952e6974e.

Fail-before, Java 21:

  • Added a regression with TotalCount=1 and Data=null.
  • TencentCatalogServiceTest: 9 tests, exactly 1 failure.
  • The new test failed with Expecting code to raise a throwable, proving current master returned a successful empty catalog.

Green, Java 21:

  • TencentCatalogServiceTest: 11/11 passed, 0 failures/errors.
  • Added coverage for an incomplete non-empty short page and for a genuine empty catalog.
  • Checkstyle: 0 violations.
  • mvn -B -ntp -DskipTests package: BUILD SUCCESS.
  • git diff --check: clean.

Compatibility / Risk

No API, schema, dependency, or frontend changes. Normal full pages, successful final pages, client-side search filtering, count normalization, and genuine empty catalogs are unchanged. Only provider responses that contradict their own known total count now surface as unavailable instead of silently truncating the catalog.

AI-assisted source audit, implementation and regression authoring; Tencent's current DescribeInstanceList API contract and the pinned Java SDK model were checked before filing.

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Fixes the same silent pagination truncation bug for the instance catalog listing path. Adds an isIncompletePage() guard that fails closed with 502 when TotalCount contradicts the current page, and refactors hasFetchedAll() to use offset + returned >= total.

Verdict: LGTM. Clean, well-tested fix (3 new tests including the genuine-empty-catalog edge case). The inline guard approach (boolean check + throw at call site) is slightly different from the requireCompletePage() pattern in #4531, but both are clear and correct.

Minor Note

  • Same cross-PR observation: consider a shared pagination utility if this pattern grows. Not blocking.

Automated review by github-manager-bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Studio][Bug] Tencent cloud catalog treats incomplete instance pages as complete

2 participants