You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "unbridled-41 (via GitHub)" <gi...@apache.org> on 2026/09/21 01:43:26 UTC

[PR] fix(instance): grade cloud import audits by the import outcome [rocketmq-dashboard]

unbridled-41 opened a new pull request, #4660:
URL: https://github.com/apache/rocketmq-dashboard/pull/4660

   Fixes #4656.
   
   ## Problem / Evidence
   
   `InstanceService.importCloudInstances` collects region and per-instance failures and reports them in `CloudImportResultVO` (the API response 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` calls `recordAudit("IMPORT_CLOUD_INSTANCES", ...)` with the failure counts embedded in the detail text only (`InstanceService.java:356-358`);
   - the private `recordAudit` helper hardcoded `"SUCCESS"` as the result (`InstanceService.java:833-841`) and had no way to pass anything else;
   - the existing regression `importCloudInstancesShouldContinueAfterUnexpectedRegionFailureTest` pins the wrong behavior: an import with `failed=1` asserting `eq("SUCCESS")` (`InstanceServiceTest.java:1416-1418` on master).
   
   So an import whose catalog provider is missing, whose `listRegions` throws (invalid credential), or in which every region/instance fails produces an audit timeline entry and summary counts that say the operation succeeded.
   
   Red regressions (two new tests):
   1. `importCloudInstancesShouldContinueAfterUnexpectedRegionFailureTest` (updated expectation): 1 imported + 1 failed must audit `PARTIAL` — on master it failed with the recorded result `SUCCESS`.
   2. `importCloudInstancesShouldAuditAFullyFailedImportAsFailedTest` (new): `listRegions` throwing with zero imports must audit `FAILED` — on master it failed with `SUCCESS`.
   
   ## Root cause / Fix
   
   The import flow grew a proper failure model (failure counts, bounded failure details, partial-failure UI) but never carried the outcome into the audit call, whose helper predated it.
   
   Fix:
   - `recordAudit` gains a `result` parameter; the create/update/delete call sites pass their existing `"SUCCESS"` explicitly;
   - `finishCloudImport` grades the outcome with the shared audit vocabulary — `SUCCESS` when nothing failed, `PARTIAL` when some instances imported and failures occurred, `FAILED` when failures occurred and nothing was imported — mirroring the DLQ resend outcome classification (`RocketMQDLQProvider.classifyOutcome`).
   
   ## Priority & scoring
   
   PRIORITY = 影响 28(审计时间线/汇总把完全失败的导入记为成功,操作审计的可信面受损)+ 波及 10(import-cloud 单一操作,但审计 summary 是共享读面)+ 可复现 20(确定性,无效凭据即触发)+ 维护价值 16(与 #4608/#4607 同族,维护者已接受同类修复)= **74**。FIX_CONFIDENCE = **88**(分级规则与既有 DLQ 分类同构,行为全部可由 Mockito 断言表达)。
   
   ## Tests
   
   - Two red regressions (see above):
     - Red on master: both failed with `expected "PARTIAL"/"FAILED" but was "SUCCESS"`.
     - Green after the fix.
   - Module: `mvn -o -Dtest='InstanceServiceTest' test` → `Tests run: 84, Failures: 0, Errors: 0` (82 pre-existing + 2 changed/new here).
   - Full backend suite (this branch): `SPRING_PROFILES_ACTIVE=dev mvn -o test` → `Tests run: 2415, Failures: 0, Errors: 0, Skipped: 0`, `BUILD SUCCESS` (pristine master on this machine: 2414 passing + 1 new test here = 2415).
   - Checkstyle: `mvn -o checkstyle:check` → clean.
   - Backend package: `mvn -o -DskipTests package` → `BUILD SUCCESS`, `target/rocketmq-studio-1.0.0.jar` produced.
   - Frontend untouched on this branch (build verified: `npm run build` → `✓ built in 11.06s`).
   
   ## Risk
   
   Low. Only the `result` column of `IMPORT_CLOUD_INSTANCES` audit rows changes for imports that had failures; clean imports keep `SUCCESS`, and the create/update/delete audits keep their previous result by passing it explicitly. The API response shape, the web import dialog, and the failure-detail collection are untouched.
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(instance): grade cloud import audits by the import outcome [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins merged PR #4660:
URL: https://github.com/apache/rocketmq-dashboard/pull/4660


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(instance): grade cloud import audits by the import outcome [rocketmq-dashboard]

Posted by "unbridled-41 (via GitHub)" <gi...@apache.org>.
unbridled-41 commented on PR #4660:
URL: https://github.com/apache/rocketmq-dashboard/pull/4660#issuecomment-5754348381

   ## Verification evidence
   
   - **CI**: run `35551820697` ("CI", event `pull_request`) at head `9d7d6158` — conclusion `startup_failure` (the workflow never starts; repository-level issue, other open PRs from the same window show the same). `check-runs`: 0. All results below are from local runs of the exact head commit.
   - **Red** (both regressions on master source): `Tests run: 2, Failures: 2` —
     1. `importCloudInstancesShouldContinueAfterUnexpectedRegionFailureTest` (`InstanceServiceTest.java:1417`): expected the audit result `"PARTIAL"` but the recorded value was `"SUCCESS"`;
     2. `importCloudInstancesShouldAuditAFullyFailedImportAsFailedTest`: expected `"FAILED"` but the recorded value was `"SUCCESS"`.
   - **Module**: `mvn -o -Dtest='InstanceServiceTest' test` → `Tests run: 84, Failures: 0, Errors: 0` (82 pre-existing + 1 new test + 1 updated expectation).
   - **Full backend suite** (this branch, head `9d7d6158`): `SPRING_PROFILES_ACTIVE=dev mvn -o test` → `Tests run: 2415, Failures: 0, Errors: 0, Skipped: 0`, `BUILD SUCCESS`. Pristine master baseline on this machine: 2414 passing; 2415 = baseline + 1 new test, zero new failures.
   - **Build**: `mvn -o -DskipTests package` → `BUILD SUCCESS`, `target/rocketmq-studio-1.0.0.jar` produced (covers the `backend-build` job's compile/package steps). `mvn -o checkstyle:check` → clean. Frontend untouched; `npm run build` on this branch → `✓ built in 11.06s`.
   - **Diff self-check** (`git diff --numstat origin/master..fix/cloud-import-audit-result`): `19/6 server/src/main/java/.../instance/InstanceService.java`, `24/1 server/src/test/java/.../instance/InstanceServiceTest.java` — 2 files, no unrelated changes. Single commit `9d7d6158`.
   


-- 
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: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org