RockteMQ-AI commented on issue #1917:
URL:
https://github.com/apache/rocketmq-dashboard/issues/1917#issuecomment-5257604248
**Issue Evaluation**
Category: `bug` | Status: **Confirmed** | Severity: **medium**
The reported behavior divergence between `getAlertRuleAsset` and
`exportAlertRuleAsset` in mock mode has been verified against the codebase.
**Root Cause:**
In `web/src/services/alertRuleAssetService.ts`, the `exportAlertRuleAsset()`
mock branch uses a ternary fallback (`found ? found.yaml : `) that silently
returns an empty `text/yaml` Blob when the asset name is unknown. Meanwhile,
`getAlertRuleAsset()` correctly throws an `Error` for the same case. This means
a stale asset row or a direct service call to export a nonexistent asset
produces a successful (but empty) download in mock mode, while the real backend
would return a 404.
**Affected code:**
```typescript
// getAlertRuleAsset — correct ✅
if (!found) {
throw new Error(`Alert rule asset not found: ${name}`);
}
// exportAlertRuleAsset — incorrect ❌
const yaml = found ? found.yaml : ; // silently returns empty Blob
return new Blob([yaml], { type: text/yaml });
```
**Fix:** Add the same not-found guard to `exportAlertRuleAsset()` so mock
and real behavior stay consistent.
**Impact:** Frontend mock mode only; no backend or production impact.
An automated fix proposal will be generated. Reply `/approve` to proceed
with PR generation.
---
*Automated evaluation by RockteMQ-AI*
--
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]