Skip to content

fix(admin): keep the namespace id in the proxy selector listAllData response - #7387

Open
Sean-Walker0 wants to merge 1 commit into
apache:masterfrom
Sean-Walker0:fix/proxy-selector-list-all-namespace-id
Open

Sean-Walker0 wants to merge 1 commit into
apache:masterfrom
Sean-Walker0:fix/proxy-selector-list-all-namespace-id

Conversation

@Sean-Walker0

Copy link
Copy Markdown
Contributor

Found by code audit (no existing issue; happy to file one if maintainers prefer).

ProxySelectorServiceImpl#listAllData builds a ProxySelectorVO from every ProxySelectorDO but never copies the namespace id, while its sibling listByPage in the same file does (vo.setNamespaceId(proxySelectorDO.getNamespaceId())). The list-all response therefore reports namespaceId: null for every proxy selector even though the rows are namespaced.

The same read-path field drop was fixed for MetaDataTransfer write paths in #7324; this is the proxy-selector variant.

Make sure that:

  • You have read the contribution guidelines.
  • You submit test cases (unit or integration tests) that back your changes.
  • 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

  • listAllData now sets vo.setNamespaceId(proxySelectorDO.getNamespaceId()), mirroring listByPage.

Verifying this change

  • New ProxySelectorServiceTest#testListAllDataKeepsNamespaceId builds a DO with namespaceId=ns-1, calls listAllData, and asserts the VO carries it. Fails on current master with expected: <ns-1> but was: <null>, passes with this change.

Notes

  • Behavior change: the list-all proxy selector API response now carries the stored namespaceId instead of null.
  • Incidental finding (not touched here): the DiscoveryDTO embedded in the same response is produced by DiscoveryTransfer#mapToDTO(DiscoveryDO), which also drops namespaceId — addressed separately to keep this PR single-purpose.
  • Orthogonality: no open PR modifies ProxySelectorServiceImpl (verified via keyword search and per-PR file audit).

…esponse

ProxySelectorServiceImpl#listAllData builds ProxySelectorVO from every
ProxySelectorDO but, unlike its sibling listByPage (which sets
vo.setNamespaceId(proxySelectorDO.getNamespaceId()) a few lines above),
it never copies the namespace id, so the list-all API returns proxy
selectors whose namespaceId is always null even though the rows are
namespaced. The new test pins the round trip and fails on current
master with expected <ns-1> but was <null>.

Verified with ./mvnw test -pl shenyu-admin -am and
./mvnw checkstyle:check -pl shenyu-admin (module-scoped).

@Aias00 Aias00 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ProxySelectorServiceImpl#listAllData builds its VO without copying the namespace id while its sibling listByPage in the same file does — a clear inconsistency, and the one-line fix plus the regression test is exactly right. The red e2e / e2e-logging-rocketmq jobs are the known flakes and unrelated to an admin transfer fix. Approving.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants