RockteMQ-AI commented on PR #4344:
URL:
https://github.com/apache/rocketmq-dashboard/pull/4344#issuecomment-5682161361
## 🤖 Automated Code Review
**PR:** [ISSUE #4343] Add Transaction Message Half-Check Hang & Resolution
Audit Engine
**Verdict: ❌ Critical Issues — Not Ready for Merge**
### 🔴 Critical: Service Implementation Returns Fabricated Data
The core service implementation (`TransactionHalfMessageAuditServiceImpl`)
does **not** query actual RocketMQ broker state. Instead, it generates fake
data:
```java
// TransactionHalfMessageAuditServiceImpl.java
long totalHalf = 12L + (Math.abs(report.getTopic().hashCode()) % 25);
long severeHanging = (totalHalf > 15) ? 4 : 1;
```
The pending half-message details are also hardcoded fake IDs:
```java
detail.setMsgId("half-" + report.getTopic() + "-" + i);
detail.setTransactionId("tx-" + report.getTopic() + "-" + i);
```
This means the audit engine displays **completely fabricated metrics** to
users, which is dangerous for a monitoring/diagnostic feature. Users would
believe they are seeing real transaction half-message data when they are not.
### 🔴 Critical: `resolveTransaction()` Always Returns `true`
```java
public boolean resolveTransaction(String msgId, String transactionId, String
resolutionAction) {
// ... validation only ...
log.info("Resolved transaction: msgId={}, action={}", msgId,
resolutionAction);
return true;
}
```
This method logs a message and returns success without actually committing
or rolling back any transaction. This could lead to data loss if operators rely
on it for real transaction resolution.
### ⚠️ Other Issues
- **No integration with `TransactionMessageService`** — the existing service
that actually queries half-messages is not used
- **No error handling for broker unavailability** — the fake implementation
never fails
- **No tests for the actual audit logic** — only controller endpoint tests
exist
### Recommendation
This PR needs a real implementation that:
1. Queries actual broker state via `MQAdminExt` or the existing
`TransactionMessageService`
2. Performs real commit/rollback operations in `resolveTransaction()`
3. Handles broker connection failures gracefully
---
<sub>🔍 Automated review by RockteMQ-AI. Please verify suggestions before
applying.</sub>
--
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]