unbridled-41 opened a new issue, #4656:
URL: https://github.com/apache/rocketmq-dashboard/issues/4656

   ### Studio Version
   
   branch: `master`
   git commit id: `d50ffecc9d7e8f8f46da64198831bd7952e6974e`
   deployed as: built from source (dev profile)
   
   ### Runtime Environment
   
   Ubuntu (WSL2), JDK Temurin 21, Maven 3.9 (offline repo), dev H2 profile for 
tests.
   
   ### Connected RocketMQ Cluster
   
   Not required — the defect is in the cloud-instance import audit recording on 
the Studio side.
   
   ### Describe the Bug
   
   `InstanceService.importCloudInstances` collects region and per-instance 
failures and returns them in `CloudImportResultVO` (the HTTP layer and the web 
page correctly show a partial-failure warning). But the operation audit row for 
the whole import is always recorded as `SUCCESS`:
   
   - `InstanceService.finishCloudImport` (lines 833-837) calls 
`recordAudit("IMPORT_CLOUD_INSTANCES", ...)` with the failure counts embedded 
in the detail text only;
   - the private `recordAudit` helper (lines 874-880) hardcodes `"SUCCESS"` as 
the result — `InstanceService.recordAudit` has no overload that takes a result, 
so every import outcome is audited identically;
   - the existing regression 
`importCloudInstancesShouldContinueAfterUnexpectedRegionFailureTest` 
(`InstanceServiceTest.java:1416-1418`) pins this: an import with `failed=1` 
still asserts `eq("SUCCESS")`.
   
   So an import where the catalog provider is missing, `listRegions` throws 
(e.g. an invalid credential), or every region/instance fails produces an audit 
timeline entry and audit summary counts that say the operation succeeded. This 
contradicts the result semantics used elsewhere: DLQ resend classifies 
`SUCCESS`/`FAILED`/`PARTIAL`/`NO_MESSAGES` from the outcome 
(`RocketMQDLQProvider.classifyOutcome`), direct consume derives `FAILED` from 
the consume result (#4608), and group settings/direct-consume audits record 
`FAILED` on error paths.
   
   ### Steps to Reproduce
   
   1. Create a cloud credential whose access key is invalid (so `listRegions` 
fails).
   2. `POST /api/instances/import-cloud` with that credential.
   3. The response reports `failedCount ≥ 1` and the web page shows the 
partial-failure warning.
   4. Open Ops → Audit: `IMPORT_CLOUD_INSTANCES` is recorded with result 
`SUCCESS`.
   
   ### What Did You Expect to See?
   
   The audit result reflects the outcome: `SUCCESS` when nothing failed, 
`PARTIAL` when at least one instance was imported and at least one failure was 
recorded, `FAILED` when failures were recorded and nothing was imported.
   
   ### What Did You See Instead?
   
   `SUCCESS` regardless of `failedCount` — a fully failed import is 
indistinguishable from a clean import in the audit timeline and summary.
   
   ### Additional Context
   
   A Mockito regression that runs the same region-failure scenario as the 
existing test but asserts `PARTIAL` (and a fully-failed catalog scenario 
asserting `FAILED`) fails on unmodified `master` with the recorded result being 
`SUCCESS`.
   
   AI-assisted source audit; the fail-before test was executed locally on Java 
21.
   


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