Sean-Walker0 opened a new pull request, #7321:
URL: https://github.com/apache/shenyu/pull/7321

   <!-- Describe your PR here; e.g. Fixes #issueNo -->
   Found by code audit (no existing issue — happy to file one if maintainers 
prefer).
   
   `DiscoveryVO#getDiscoveryName()` returned `discoveryType` and 
`setDiscoveryName()` wrote `discoveryType`, while the class's own 
`discoveryName` field (with its `@NotNull` validation) was never touched by any 
accessor. `DiscoveryTransfer#mapToVo` sets the name first and the type second, 
so the type assignment silently overwrote the name: every admin REST response 
built from this VO serialized `discoveryName` as the *type* (e.g. 
`"zookeeper"`) and dropped the real discovery name. `equals`/`hashCode` and 
every sibling accessor in the class treat the two fields as distinct, 
confirming the copy-paste.
   
   <!--
   Thank you for proposing a pull request. This template will guide you through 
the essential steps necessary for a pull request.
   -->
   Make sure that:
   
   - [x] You have read the [contribution 
guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [x] You submit test cases (unit or integration tests) that back your 
changes.
   - [x] Your local test passed `./mvnw test -pl shenyu-admin -am and ./mvnw 
checkstyle:check -pl shenyu-admin` (module-scoped; full build left to CI).
   
   ### Modifications
   
   - `DiscoveryVO`: `getDiscoveryName()` now reads and `setDiscoveryName()` now 
writes the `discoveryName` field (2-line change, everything else untouched).
   
   ### Verifying this change
   
   - New `DiscoveryTransferTest#testMapToVoKeepsDiscoveryNameAndTypeSeparate` 
maps a DO with distinct name/type and asserts both, plus 
id/serverList/pluginName passthrough. It fails on current master with 
`expected: <prod-registry> but was: <zookeeper>` and passes with this change.
   - Full `shenyu-admin` module suite green (503 test classes); checkstyle 
green.
   
   ### Notes
   
   - Behavior change: admin API responses now expose the real discovery name in 
`discoveryName` instead of echoing the discovery type; the dashboard shows 
correct names without data migration (source of truth in the DB was always 
correct).
   - Orthogonal to open PRs: no open PR touches `DiscoveryVO` (checked against 
the file lists of all 185 open PRs).


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