Frun1na opened a new pull request, #6520:
URL: https://github.com/apache/rocketmq-dashboard/pull/6520
### Which Issue(s) This PR Fixes
- Fixes #6519
### Brief Description
`LiteTopicService.extendTTL`
(`server/src/main/java/org/apache/rocketmq/studio/instance/topic/LiteTopicService.java:62`)
rewrites the broker-side `lite.topic.expiration` of a live parent topic, the
same class of change as the topic
updates `MetadataService.executeWithAudit` records, but the service wrote no
audit row — it had no
`OperationAuditService` dependency, and
`RocketMQLiteTopicProvider.extendTTL` records nothing either. A TTL
extension therefore could not be attributed in `/api/audit-logs` afterwards.
The service now records `UPDATE_LITE_TOPIC_TTL` on resource type `TOPIC`:
the parent topic as the resource, the
cluster the request was validated against (from the `Ownership` row the
guard returns), and the instance plus the
requested milliseconds in the detail. A broker write that fails is recorded
as `FAILED` with the provider's
message and the exception is still propagated, mirroring
`MetadataService.executeWithAudit`; a request rejected
before the provider call (blank pattern, non-positive TTL, ownership
conflict) still records nothing.
User-visible change: LiteTopic TTL extensions now appear in the operation
audit log (operation
`UPDATE_LITE_TOPIC_TTL`); no endpoint response or validation changes.
### How Did You Test This Change?
```
cd server && mvn -B -ntp test -DforkCount=1
-Dsurefire.failIfNoSpecifiedTests=false -Dtest=LiteTopicServiceTest
[INFO] Tests run: 12, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
0.850 s -- in LiteTopicServiceTest
[INFO] BUILD SUCCESS
```
`extendTTLRecordsTheBrokerSideChangeTest` asserts the exact audit row for a
completed write (including the
provider interaction), `extendTTLRecordsAFailedAttemptTest` asserts the
`FAILED` row and that the 502 still
reaches the caller; the existing `extendTTLRequiresInstanceAndOwnershipTest`
stays as the control that a rejected
request never reaches the provider or the audit sink.
The new tests fail without the fix — only the two `recordAudit(...)` calls
removed, the tests kept:
```
[ERROR] Tests run: 12, Failures: 2, Errors: 0, Skipped: 0
extendTTLRecordsAFailedAttemptTest -- <<< FAILURE!
Wanted but not invoked:
operationAuditService.record(
"UPDATE_LITE_TOPIC_TTL",
"TOPIC",
"chat",
"cluster-a",
"instance=instance-a, newTTLMillis=600000",
"FAILED",
"broker refused"
);
-> at
org.apache.rocketmq.studio.audit.OperationAuditService.record(OperationAuditService.java:39)
Actually, there were zero interactions with this mock.
extendTTLRecordsTheBrokerSideChangeTest -- <<< FAILURE!
```
Both failures are the audit assertions themselves (zero interactions with
the mocked sink), so the tests fail on
the missing audit write rather than on 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]