RockteMQ-AI commented on code in PR #4285:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/4285#discussion_r4001833802


##########
web/src/pages/ops/systemAlerts.tsx:
##########
@@ -399,13 +399,14 @@ const SystemAlertsPage = () => {
       return;
     }
     setSavingSilence(true);
+    let request: CreateAlertSilence;

Review Comment:
   **[Info]** Moving `request` declaration outside the try block and separating 
validation from API call is the right pattern. This ensures:
   1. Validation errors (thrown during request construction) are caught and 
displayed with their specific messages
   2. The axios interceptor never sees these errors, so field-specific messages 
aren't lost
   3. No HTTP request is made when validation fails
   
   The fallback to `t('sysAlerts.silenceCreateFailed')` when `error.message` is 
empty is a good safety net.



##########
web/src/pages/ops/__tests__/SystemAlertsPage.test.tsx:
##########
@@ -547,6 +547,29 @@ describe('SystemAlertsPage', () => {
     });
   });
 
+  it('surfaces the label validation message when the silence labels are 
invalid', async () => {

Review Comment:
   **[Info]** The regression test is well-constructed:
   - Uses a trailing comma (`brokerName=broker-a,`) which is a realistic user 
mistake
   - Asserts the specific validation message appears
   - Verifies `createAlertSilence` was NOT called (validation happens 
client-side)
   
   This test would have caught the original bug where the validation message 
was unreachable.



-- 
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]

Reply via email to