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

   ## Defect
   
   In mock mode, the cluster config preview and update paths silently mishandle 
conflicting queue counts, while the real backend rejects them:
   
   - `ClusterService.requireMatchingDefaultQueueNums` (server) validates that 
`writeQueueNums` equals `readQueueNums` when both are present — in **all 
three** endpoints (preview, update, apply) — because both fields map to the 
single broker property `defaultTopicQueueNums`.
   - The mock `buildMockBrokerProperties` writes both fields to 
`defaultTopicQueueNums` with read **overwriting** write, so 
`previewClusterConfig({writeQueueNums: 16, readQueueNums: 8})` reports 
`defaultTopicQueueNums: '8'` — the write value silently disappears from the 
preview.
   - The mock `updateClusterConfig` accepts the conflicting pair via 
`Object.assign` and reports `status: 'SUCCESS'` — a success the real backend 
would answer with 400.
   
   Verified on current master with vitest: the mismatched preview resolves 
successfully with the overwritten property.
   
   ## Fix
   
   Add `requireMatchingQueueNums` to the mock branches of both 
`previewClusterConfig` and `updateClusterConfig`, throwing the same message the 
backend returns. One-sided changes (only one of the two fields present) keep 
working, matching the backend's null-tolerant rule.
   
   ## Tests
   
   New `web/src/services/clusterServiceQueueValidation.test.ts` (4 cases):
   
   - mismatched preview → rejects (failed on master: resolved with the 
overwritten value)
   - mismatched update → rejects (failed on master: resolved SUCCESS)
   - matching pair → `defaultTopicQueueNums: '12'` (control)
   - one-sided read change → `defaultTopicQueueNums: '6'` (control)
   
   Verification: fail-before (2 failed) → pass-after (4/4) → mutation (removing 
both validation calls) → existing `clusterService.test.ts` stays green (7/7).
   
   ## Collision check
   
   No open PR touches `clusterService.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]

Reply via email to