[BUG] New registrar path never propagates namespaceId — multi-namespace support broken in @EnableClientRegister path
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
- Severity: High
- Location:
`shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/register/registrar/UriApiRegistrarImplImpl.java:44-52,57-65`; `MateDataApiRegistrarImpl.java:50-68,72-90`; `ApiDocRegistrarImpl.java:65-82`; `shenyu-client/shenyu-client-core/src/main/java/org/apache/shenyu/client/core/register/ClientRegisterConfig.java:22-66` (interface lacks namespace accessor); `ClientRegisterConfigImpl.java:49-62` (has `ShenyuClientConfig` but never reads `getNamespace()`)
-
Description:
The old path (`AbstractContextRefreshedEventListener`) loops over all namespaces: `for (String namespaceId : namespaceIds)` and sets `.namespaceId(namespaceId)` on every DTO (`SpringMvcClientEventListener.buildURIRegisterDTO:159`, `ApacheDubboServiceBeanListener:127`, `handleClass:312`, `handleMethod:327`). The new registrar path publishes DTOs with no `.namespaceId(...)` call at all. `ClientRegisterConfig` has no namespace accessor, and `ClientRegisterConfigImpl` receives `ShenyuClientConfig` but never reads `getNamespace()`. `AbstractApiRegistrar.register` / `BaseApiRegistrarImpl.register` also do not loop over namespaces.
-
Impact:
When the ApiBean-based registrar path is active, all URI/MetaData/ApiDoc registrations carry null namespaceId, breaking multi-namespace support entirely; registrations land in the default namespace regardless of `shenyu.namespace` configuration. Compounds FUNC-B1 (when processors are fixed, namespace is still missing).
-
Suggested fix:
Add `List getNamespace()` to `ClientRegisterConfig`; extract in `ClientRegisterConfigImpl` from `shenyuClientConfig.getNamespace()` (with the same default fallback the old path uses). Have `BaseApiRegistrarImpl.register` or the `doRegisterApi`/`doRegisterBean` methods loop over namespaces and set `.namespaceId(...)`.
-
Confidence: High
- Related existing: none — #6516 is admin-side namespace rewrite corruption; this is client-side namespace propagation omission.
---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/00-consolidated-critical-high.md`](docs/scan2-2026-08-02/00-consolidated-critical-high.md)._
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with ClientRegisterConfig.java and ClientRegisterConfigImpl.java to trace how ShenyuClientConfig is exposed, then inspect BaseApiRegistrarImpl.register and the listed URI, metadata, and API-doc registrar methods. Compare their behavior with the namespace loops in AbstractContextRefreshedEventListener. Done means registrations from the new registrar path carry the configured namespace IDs, including the existing default fallback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100