You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "zjncs (via GitHub)" <gi...@apache.org> on 2026/10/06 05:51:30 UTC

[PR] fix(cluster): send targetVersion in the nameserver upgrade request [rocketmq-dashboard]

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

   Closes #5619
   
   ## Problem
   
   `UpgradeNameServerDTO` requires a non-blank `targetVersion` (the Java service reads `command.getTargetVersion()`), but both frontend layers declared the field as `version` — any caller following the type sent a body Jackson silently stripped of the version entirely, and the request was **always rejected with 400 "targetVersion is required"**. The function is exported API surface with no page caller yet, which is why the break went unnoticed.
   
   ## Fix
   
   Rename the field through both layers (`web/src/api/cluster.ts`, `web/src/services/clusterService.ts`).
   
   ## Verification
   
   - **Fail-before (first-hand, on master)**: calling the function per its declared `version` signature and asserting the posted body — `expect(seen.targetVersion).toBe('5.3.1')` → `AssertionError: expected undefined to be '5.3.1'` (the body carries `version`, which the DTO does not declare)
   - **Pass-after**: the committed contract test calls `targetVersion` and pins the body (`targetVersion` present, no stale `version` key) — passes; `tsc --noEmit` clean with the rename propagated through both layers
   - Backend contract cited: `@NotBlank(message = "targetVersion is required")` + `@Valid` on the controller
   
   ## Collision note
   
   `cluster.ts` is touched only by #5151 (hunk @139, config-diff types) — disjoint from ~308-330. `clusterService.ts` is touched only by our own #5486 (mock config region) — the upgrade passthrough at ~372-384 is disjoint. The new test file has no occupants.


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(cluster): send targetVersion in the nameserver upgrade request [rocketmq-dashboard]

Posted by "zjncs (via GitHub)" <gi...@apache.org>.
zjncs commented on PR #5620:
URL: https://github.com/apache/rocketmq-dashboard/pull/5620#issuecomment-6076682037

   Hi @lizhimins, thanks for catching all of these! The PR has been reworked accordingly, rebased onto `rocketmq-studio` (c99b9ad5) and retargeted. Point by point:
   
   - **The missed third consumer**: `cluster.test.ts`'s fixture and its `upgradeNameServer` call now send `targetVersion`, and I re-ran `tsc -b` (the `npm run build` step) — it is clean now. You were right that the description's claim had gone stale.
   - **The `newAddr` mismatch**: I took the second option — the test-header note is gone, and the contract mismatch is now tracked in #5776 (UpdateNameServerDTO has no `newAddr` field while `api/cluster.ts` and `clusterService.ts` send one; either the DTO or the callers need to align, including the mock-mode address rewrite). I kept it out of this PR to leave it single-purpose.
   - **`expect.assertions`**: the folded test starts with `expect.assertions(4)` so a reply that never matched the handler cannot pass silently.
   - **The fourth cluster test file**: it is deleted; the upgrade-contract case now lives next to the existing `/nameservers` operation test in `cluster.test.ts`, reusing its mock setup and asserting `targetVersion` is sent while `version` is not.
   - **Trailing newlines**: restored on all touched files.
   
   Verification: `vitest run` green for the `src/api` and `src/services` suites (248 + 111 tests) and `tsc -b` clean.
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(cluster): send targetVersion in the nameserver upgrade request [rocketmq-dashboard]

Posted by "zjncs (via GitHub) via commits" <co...@rocketmq.apache.org>.
zjncs closed pull request #5620: fix(cluster): send targetVersion in the nameserver upgrade request
URL: https://github.com/apache/rocketmq-dashboard/pull/5620


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org