tju-yxq opened a new pull request, #2211:
URL: https://github.com/apache/rocketmq-dashboard/pull/2211

   ## Why
   
   Studio protects instance deletion by querying the selected provider for 
current Topic and Consumer Group counts. That is the right default, but it also 
means a registration cannot be removed after its endpoint is decommissioned, 
its cloud instance is deleted, credentials expire, or the provider API is 
unavailable: the count call fails before the local repository delete is reached.
   
   This change adds an explicit recovery path without weakening the 
managed-resource guard. It closes #2210.
   
   ## Backend contract
   
   Instance deletion now uses an instance-specific request containing `id` and 
`force`.
   
   Every request, including `force=true`, still performs the provider preflight:
   
   - verified zero Topics and zero Consumer Groups: delete normally;
   - verified managed resources: return HTTP 409 with 
`instance.delete.managed_resources_present`; force cannot bypass this result;
   - unavailable preflight with a normal request: return HTTP 503 with 
`instance.delete.preflight_unavailable`;
   - unavailable preflight with `force=true`: remove only the Studio 
registration.
   
   The stable `errorCode` is added to business-error responses so clients do 
not parse English messages. Existing business errors continue to use the same 
HTTP/status code and message and omit `errorCode` when none is supplied.
   
   Forced removals keep the existing repository race check and Apache 
AdminClient release path. Their successful audit detail includes:
   
   - `forced=true`
   - `preflight=unavailable`
   - a bounded failure category based only on the exception class
   
   Provider exception messages are intentionally not copied into the audit 
record or warning log because they may contain credentials, endpoint user-info, 
tokens, or unbounded SDK text.
   
   ## Frontend behavior
   
   The instance API always serializes the deletion mode. The instance page 
first sends `force=false` after the existing confirmation.
   
   Only an exact `instance.delete.preflight_unavailable` response opens a 
second destructive confirmation. The warning states that Studio could not 
verify remote resources and that continuing removes only the Studio record; it 
does not delete or validate the remote RocketMQ instance. Confirming sends 
`force=true`.
   
   Managed-resource conflicts and unrelated failures never expose the force 
path.
   
   ## Size
   
   Production code and production-facing API/UI changes, excluding tests:
   
   - 223 additions
   - 24 deletions
   
   The complete PR, including regression tests:
   
   - 525 additions
   - 33 deletions
   
   ## Verification
   
   Backend focused suite:
   
   ```text
   mvn 
-Dtest=InstanceServiceTest,InstanceControllerTest,InstanceDeletionPreflightTest 
test
   75 tests
   0 failures
   0 errors
   BUILD SUCCESS
   ```
   
   Backend full suite:
   
   ```text
   mvn -DskipTests=false test
   1,208 tests
   0 failures
   0 errors
   BUILD SUCCESS
   Checkstyle: 0 violations
   ```
   
   Frontend focused suite:
   
   ```text
   npm test -- src/api/instance.test.ts 
src/pages/instance/__tests__/InstancePage.test.tsx 
src/services/instanceService.test.ts
   24 tests
   all passed
   ```
   
   Frontend full verification:
   
   ```text
   npm test
   95 test files
   568 tests
   all passed
   
   npm run build
   success
   
   npm run lint
   0 errors
   1 pre-existing react-hooks warning in src/pages/instance/topic.tsx
   
   targeted ESLint
   passed
   
   targeted Prettier check
   passed
   ```
   
   `git diff --check` also passes.
   
   The tests are deterministic unit/controller/UI tests. No live Broker, 
cloud-provider, or browser session is claimed.
   
   


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