Aias00 opened a new issue, #4506:
URL: https://github.com/apache/rocketmq-dashboard/issues/4506

   ### Before Creating the Bug Report
   
   - [x] I searched open and closed issues and pull requests for 
`PlatformClusterResolver`, duplicate cluster names, `DefaultCluster`, and 
cross-instance cluster resolution.
   - [x] I verified the behavior on current `master` 
(`987b748e8f4f421c5cd3c4c4e51a064cc7e59f18`).
   
   ### Problem
   
   Platform-level AI/MCP tools address infrastructure by physical `clusterName` 
instead of `instanceId`. `PlatformClusterResolver.collect` currently stores 
discoveries in `Map<String, ManagedCluster>` and uses `putIfAbsent(clusterName, 
cluster)`. Managed Apache instances are sorted by instance name, so the first 
instance wins deterministically.
   
   RocketMQ cluster names are not globally unique across independent 
deployments; `DefaultCluster` is a common value. If two Studio instances expose 
different clusters with that name:
   
   - the later instance is silently removed from the platform scan;
   - `require("DefaultCluster")` and `resolveInstanceId("DefaultCluster")` 
select the first instance;
   - `rmq.broker.config` and `rmq.nameserver.config` can report configuration 
from a different instance than the operator intended;
   - Broker, NameServer, and Proxy read tools that call `require` inherit the 
same ambiguity.
   
   The current tools are read-only, so this is an inventory and diagnostic 
correctness issue rather than a wrong-cluster mutation.
   
   ### Proposed Design
   
   Keep the existing tool schemas and the existing deduplicated 
`rmq.cluster.list` output for compatibility, but make single-cluster resolution 
fail closed:
   
   1. Preserve the per-instance scan results internally before cluster-name 
deduplication.
   2. Keep `scan()` / `scanWithBrokerVersions()` deduplicated by cluster name 
as today.
   3. Make `require(clusterName)` resolve against the per-instance results.
   4. Return 404 when there are no matches, the unique match when exactly one 
instance owns the name, and 409 when multiple instances expose the same name.
   5. Include the sorted conflicting instance identifiers in the 409 message so 
operators can correct their Studio configuration or choose an instance-scoped 
workflow.
   6. `resolveInstanceId` inherits the same fail-closed behavior.
   
   Adding an explicit instance discriminator to every platform tool is a larger 
contract enhancement and remains out of scope for this fix.
   
   ### Acceptance Criteria
   
   - A unique cluster name resolves exactly as before.
   - A cluster name exposed by two managed instances returns HTTP/business code 
409 instead of selecting the first instance.
   - The conflict result identifies both instance names deterministically.
   - Existing platform scan deduplication, unreachable-instance handling, and 
broker-version enrichment remain unchanged.
   - Focused resolver and handler tests, the backend suite, Checkstyle, and 
`git diff --check` pass.
   
   AI-assisted static analysis; no live cluster mutation is involved.


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