Sean-Walker0 opened a new pull request, #7324:
URL: https://github.com/apache/shenyu/pull/7324
<!-- Describe your PR here; e.g. Fixes #issueNo -->
Found by code audit (no existing issue — happy to file one if maintainers
prefer).
`MetaDataTransfer` drops `namespaceId` on two paths while its sibling
builders set it:
- **`copy(MetaDataDO)`** omits `.namespaceId(source.getNamespaceId())`
(siblings `mapToEntity`/`mapRegisterDTOToEntity` both set it). Its only caller,
`MetaDataServiceImpl#update`, feeds the copy into `metaDataMapper.update`,
whose statement ends with `WHERE id = #{id} AND namespace_id = #{namespaceId}`
— binding null never matches, `update()` returns 0 rows, and the whole *"update
other rpc_ext for the same service"* loop (including its `onUpdated` gateway
sync events) is silently inert on every metadata update.
- **`mapToData(MetaDataDTO)`** omits it while the DO overload sets it, so
every `META_DATA` `UPDATE` `DataChangedEvent` published after an admin metadata
update carries a null `namespaceId` in a sync system whose caches are
namespace-keyed.
<!--
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
- Add `.namespaceId(...)` to both builders in `MetaDataTransfer` (two
one-line changes).
### Verifying this change
- `testCopyKeepsNamespaceId` and `testMapToDataFromDtoKeepsNamespaceId`
map/copy a DTO with `namespaceId = "ns-1"` and assert it survives. Both fail on
current master with `expected: <ns-1> but was: <null>` and pass with this
change.
- Full `shenyu-admin` module suite green (502 test classes); checkstyle
green.
### Notes
- Behavior change: same-service `rpc_ext` propagation on metadata update now
actually persists and publishes its sync events, and META_DATA UPDATE events
carry the real namespaceId.
- Orthogonal to open PRs: no open PR touches `MetaDataTransfer` (checked
against the file lists of all open PRs); `MetaDataServiceImpl` (caller) is
touched by #7267 but that PR changes different methods and not the transfer.
--
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]