zjncs opened a new pull request, #5498: URL: https://github.com/apache/rocketmq-dashboard/pull/5498
## Defect The mock branch of `listAclRules` in `web/src/services/aclService.ts` does not enforce the pagination contract the real backend applies: - `page` is clamped with `Math.max(params?.page ?? 1, 1)` — a `page: 0` request silently becomes page 1, while the backend `AclService.requireValidPage` rejects it with **400**. - `pageSize` is clamped to a minimum but has **no upper bound** — `pageSize: 500` silently returns 500 rows, while the backend `requireValidPageSize` rejects `pageSize > 100` with **400**. The sibling mock `pageAclUsers` in the same file already enforces exactly this contract (`page < 1 || pageSize > 100` → error), so this is an intra-file inconsistency, same family as #5486 (mock queue-count contract). Consequence: code developed against mock mode (e.g. an export that requests a large page) works locally and then fails with 400 once pointed at a real backend. ## Fix Apply the same validation as `pageAclUsers` (and the backend): reject `page < 1` and `pageSize` outside `1..100` in the mock branch. ## Tests New `web/src/services/aclServicePagination.test.ts` (4 cases): - `pageSize: 500` → rejects (failed on master: returned every row) - `page: 0` → rejects (failed on master: clamped to 1 and returned page 1) - `page: 1, pageSize: 20` → returns the page (control) - `page: 1000` → empty items, page echoed back (control; note `page` is no longer clamped) Verification: fail-before (2 failed) → pass-after (4/4) → mutation (reverting to the Math.max clamping) → 2 failures return → existing `aclService.test.ts` stays green (8/8). ## Collision check No open PR touches `aclService.ts`. -- 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]
