Frun1na opened a new pull request, #6541:
URL: https://github.com/apache/rocketmq-dashboard/pull/6541
### Which Issue(s) This PR Fixes
- Fixes #6540
### Brief Description
The audit result vocabulary is `SUCCESS` / `FAILED` / `PARTIAL` — declared
in the api-spec vocabulary table
(`docs/api-spec.md`, "审计结果") and implemented by
`MybatisPlusAuditRepository.summarize`, which buckets only
those three while taking `total` from every matching row. Three writers
stored other words, so their rows were
counted in the total and in no bucket:
- `NotificationOutboxService.retry`
(`server/src/main/java/org/apache/rocketmq/studio/ops/alert/NotificationOutboxService.java:540`)
audited a retry-wait attempt as `RETRYING`. #4657 fixed the exhausted
branch next to it and left this as a
follow-up: "`"RETRYING"` in the same file has the same total-vs-bucket gap
and is left for a follow-up, since
fixing it means deciding the bucket vocabulary rather than renaming one
literal" — the vocabulary is already
decided by the table and the summary, so this PR maps the writers onto it
instead of adding a fourth word.
- `RocketMQDLQProvider` audited a missing DLQ topic as `NOT_FOUND` (`:226`)
and a resend that matched nothing as
`NO_MESSAGES` (`:241`, `:311`, the word `classifyOutcome` returns for that
case).
Both branches of the retry audit describe a failed attempt and now use
`FAILED`; the missing-topic path audits
`FAILED` (it still answers `404`); the resend path maps its outcome through
a new `auditResult(outcome)` helper
that sends `NO_MESSAGES` to `SUCCESS` (nothing matched, so nothing was
mutated) and passes the other three words
through unchanged.
The domain nuance is deliberately kept outside the result column: the
outbox's operation distinguishes
`RETRY_ALERT_NOTIFICATION` from `FAIL_ALERT_NOTIFICATION`, the DLQ resend
response keeps its own documented
`outcome` vocabulary (`SUCCESS` / `PARTIAL` / `FAILED` / `NO_MESSAGES`) and
its `dlqTopicMissing=true` detail
marker, and the result filter keeps accepting the raw stored values so rows
written before this change stay
readable — the same treatment #4657 gave `FAILURE`.
User-visible change: `GET /api/audit-logs/summary` no longer drops these
rows from its buckets (for newly written
rows `successful + failed + partial == total`), and the result filter stops
offering `RETRYING` / `NOT_FOUND` /
`NO_MESSAGES` once no legacy row carries them.
### How Did You Test This Change?
```
cd server && mvn -B -ntp test -DforkCount=1
-Dsurefire.failIfNoSpecifiedTests=false
-Dtest=NotificationOutboxServiceTest,RocketMQDLQProviderTest
[INFO] Tests run: 34, Failures: 0, Errors: 0, Skipped: 0 -- in
NotificationOutboxServiceTest
[INFO] Tests run: 60, Failures: 0, Errors: 0, Skipped: 0 -- in
RocketMQDLQProviderTest
[INFO] BUILD SUCCESS
```
The three retry-audit cases and the five DLQ cases
(`resendMessagesThrowsNotFoundWhenDlqTopicMissingTest`,
`resendMessagesThrowsNotFoundWhenClientReportsNoMessageTest`,
`resendLeavesAnUnresolvableDlqRouteToTheScanNotFoundTest`,
`resendMessagesShouldNormalizeGroupNameBeforeBuildingDlqTopicAndAuditing`,
`resendMessagesDoesNotPullWhenDlqQueueSetIsNull`) now assert the shared
word; the two no-match cases additionally
assert that the response still reports `outcome = NO_MESSAGES`, which is the
control that the response vocabulary
was not touched.
The changed assertions fail without the fix — only the three product lines
reverted, the tests kept:
```
[ERROR] Tests run: 34, Failures: 3, ... -- in NotificationOutboxServiceTest
[ERROR] Tests run: 60, Failures: 5, ... -- in RocketMQDLQProviderTest
Argument(s) are different! Wanted:
operationAuditService.record("RETRY_ALERT_NOTIFICATION",
"ALERT_NOTIFICATION", "8", null,
"alertId=9, channel=dingtalk", "FAILED", ...);
Actual invocations have different arguments at position [5]:
auditService.record("RESEND_DLQ", "DLQ", "group-a", isNull(),
contains("dlqTopicMissing=true"), "FAILED");
Actual invocations have different arguments at position [5]:
```
All eight failures are the `result` argument (position 5) differing, and the
`outcome = NO_MESSAGES` control
assertions keep passing in the same run, so the tests are sensitive to the
audit word rather than to the fixtures.
### Checklist
- [x] One coherent change; unrelated modifications are not bundled in
- [x] Commit subject follows Conventional Commits (`feat:` / `fix:` /
`refactor:` / `chore:` / `docs:` / `perf:`)
- [x] Tests added or updated for non-trivial changes, test methods named
`...Test`
- [ ] New UI text has both Chinese and English entries under `web/src/i18n/`
- [ ] Architecture constraints stay green (`mvn test` runs the ArchUnit
checks)
- [ ] New source files carry the ASF license header
- [ ] Documentation touched where behaviour changed (README / `docs/` /
in-app help)
--
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]