Sean-Walker0 opened a new pull request, #7389: URL: https://github.com/apache/shenyu/pull/7389
<!-- Describe your PR here; e.g. Fixes #issueNo --> Found by code audit (no existing issue; happy to file one if maintainers prefer). `DiscoveryTransfer#mapToDTO(DiscoveryDO)` builds the `DiscoveryDTO` without copying `namespaceId`, even though both `DiscoveryDO` and `DiscoveryDTO` carry the field. The DTO is embedded in the proxy selector `pageList`/`listAllData` responses (`ProxySelectorServiceImpl:140`/`:464`), so a namespaced discovery always reports `namespaceId: null` there. The sibling `mapToVo` overloads in the same class copy every shared field; this overload missed the namespace. The same read-path field-drop class was fixed for `MetaDataTransfer` in #7324 (write paths) and is completed by the companion PR for `mapToVO`. <!-- 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` (1641 tests green on a branch combining this fix with its two sibling read-path fixes; full build left to CI) and `./mvnw checkstyle:check -pl shenyu-admin` (module-scoped). ### Modifications - `mapToDTO(DiscoveryDO)` now copies `namespaceId` to the DTO, like the other shared fields. ### Verifying this change - New `DiscoveryTransferTest` covers both directions: `testMapToDTOKeepsNamespaceId` fails on current master with `expected: <ns-1> but was: <null>` and passes with this change; `testMapToDTOWithoutNamespaceId` pins the unchanged null for rows without a namespace. ### Notes - Behavior change: the embedded `DiscoveryDTO` in proxy selector responses now carries the stored `namespaceId` instead of `null`. - Orthogonality: the open PRs touching `DiscoveryTransfer` (#6456 IPv6 parsing, #6317 gray release, #6315 manual upstream status) were diffed line by line — none touches this method or adds `namespaceId` (their hunks sit in the `mapToDTO(DiscoveryUpstreamDO)` overload further down the file). No open PR touches the callers used here. -- 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]
