apache / apache/rocketmq-dashboard

[Studio][Bug] Enforce deployment-wide Topic name uniqueness in mock mode

Open
#4,141 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
683
Avg merge
2d 14h
Merged PRs (30d)
58

Description

## Problem

In mock mode, Topic reads already respect `instanceId`, but mutations do not consistently use the same resource identity:

- duplicate detection in `createTopic` compares only Topic name and cluster;
- `updateTopic` selects the first matching Topic name;
- `deleteTopic` removes the first matching Topic name.

The real persistence model allows the same `(cluster_id, name)` in different instances because its unique key is `(cluster_id, instance_id, name)`. In mock mode, creating the same Topic in a second instance is rejected, while update or delete can affect the matching row from another instance. This makes demo and test behavior diverge from the real API.

## Expected behavior

- Mock Topic duplicate detection includes `instanceId` when it is supplied.
- The same Topic name and cluster may exist in different instances.
- Mock update and delete affect only the Topic belonging to the requested instance.
- Existing legacy calls that omit `instanceId` keep their current behavior.

## Acceptance criteria

- Add regression coverage for same-name Topics in two instances.
- Verify a duplicate in the same instance is still rejected.
- Verify update changes only the requested instance.
- Verify delete removes only the requested instance.
- Do not change the real backend API contract or persistence schema.

## Scope

Frontend mock service and focused unit tests only.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the frontend mock Topic service and its focused unit tests, then trace createTopic, updateTopic, and deleteTopic with and without instanceId. Done means same-name Topics can coexist across instances, same-instance duplicates remain rejected, and update or delete affects only the requested instance without changing the real backend contract.

Written by the indexing model from the issue text.

Assessment

Domain
frontend, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.