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

   ## Problem / Evidence
   
   Editing only one of the two queue counts in the broker config dialog can 
never be saved, and the dialog cannot say why.
   
   - `web/src/pages/cluster/index.tsx:1467-1481` renders `写队列数` and `读队列数` as 
two independent `InputNumber`s with a shared tooltip (`cluster.queueMatchHint`: 
"必须保持一致") but **no `rules`**.
   - The submit path always sends both: `buildConfigUpdateRequest` spreads the 
whole form (`:722-729`), and the form is seeded with both counts (`:711-712`).
   - The backend rejects a mismatched pair outright — 
`ClusterService.requireMatchingDefaultQueueNums` throws `400` and is called by 
preview (`:180`), update (`:265`) and propose (`:334`).
   - The failure is then rendered without a cause: `handleConfigPreview`'s 
catch shows `cluster.configPreviewFailed` and `handleConfigSubmit`'s catch 
shows `t('cluster.configUpdateFailed', { brokers: '' })`, i.e. "…please check: 
" with nothing after the colon.
   
   So an operator who changes 写队列数 from 8 to 16 alone sends `writeQueueNums: 
16, readQueueNums: 8`, gets a 400, and sees an error that names no problem.
   
   The backend already supports exactly this edit: `applyConfig` mirrors 
whichever count is supplied onto the other, so a partial update matches the 
broker's single `defaultTopicQueueNums` property (commit `248e3869`, #1075). 
The console simply never sends one.
   
   ## Root cause / Fix
   
   The dialog exposes a two-field view of a one-value property without keeping 
the two fields in step. Fix: mirror the edited value in the form's 
`onValuesChange`, so the partner input visibly follows it and the submitted 
pair always matches. The guard skips writing when the partner already holds the 
value, so `setFieldsValue`'s re-entrant `onValuesChange` cannot loop.
   
   This also makes the tooltip truthful instead of describing a rule the dialog 
could not satisfy.
   
   ## Priority & scoring
   
   PRIORITY 57 = 影响 24 (a documented edit is impossible through the console and 
the error hides the cause; the operator must guess that both fields must be 
typed) + 波及 6 (broker config dialog) + 可复现 20 (deterministic) + 维护价值 7.
   
   FIX_CONFIDENCE 85: a few lines in the existing `onValuesChange`, matching 
the backend's own mirroring semantics; pinned by a regression that asserts both 
the visible input and the submitted payload.
   
   ## Tests
   
   ```
   cd web && npx vitest run src/pages/cluster/__tests__/ClusterPage.test.tsx
   ```
   
   - Red before the fix: `mirrors a queue-count edit onto its pair instead of 
submitting a mismatched pair` fails with `Expected the element to have value: 
16, Received: 8` (the partner input keeps the stale count that the backend 
rejects).
   - Green after: `Test Files 1 passed (1) | Tests 31 passed (31)`.
   - `npx tsc -b` and `npx eslint` on both touched files: clean.
   
   ## Risk
   
   Low. The mirror only runs when a queue input changes; every other field, the 
preview invalidation and the submit path are untouched.


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