unbridled-41 opened a new pull request, #4285:
URL: https://github.com/apache/rocketmq-dashboard/pull/4285

   Fixes #4282.
   
   ## Problem / Evidence
   
   维护窗口创建弹窗(`systemAlerts.tsx` 的 `createSilence`)把请求构造(纯客户端校验)与 API 调用包在同一个 
`try` 中,唯一 `catch` 只显示通用 toast `sysAlerts.silenceCreateFailed`:
   
   - `parseSilenceLabels` 对任何无 `=` 片段 `throw new Error(invalidMessage)`(含尾逗号 
`a=1,` 这种高频输入,split 产生空片段),`invalidMessage` 即专用文案 
`sysAlerts.labelsFormatInvalid`("标签格式应为 key=value,并以逗号分隔")——该 i18n key 
在此路径下不可达(死代码);
   - recurring 窗口的时区字段只校验非空,`GMT+8` 类非 IANA 输入时 `zonedLocalDateTimeToUtc` 
抛出的具体错误同样被吞;
   - 这些异常发生在任何 HTTP 请求之前,axios 拦截器不会兜底展示,用户对失败原因零感知、无字段指向。回归测试先红:`surfaces the 
label validation message when the silence labels are invalid`(断言专用消息出现且 
`createAlertSilence` 未被调用)。
   
   ## Root cause / Fix
   
   单一 catch 无法区分"客户端校验抛出的专用消息"与"API 失败"(axios 拦截器对业务码错误也 reject 普通 
Error,instanceof 无法区分)。修复:把请求构造拆到独立 try,在catch 中显示 
`error.message`(无消息时回退通用文案)后直接返回;API 调用保持原 try/catch/finally 语义不变(+14/−1)。
   
   ## Priority & scoring
   
   PRIORITY 70 = 影响 28(告警降噪核心操作被无指向失败硬性卡死,尾逗号即触发、重试无出路;对比 #4241 
的服务端原因尚有拦截器兜底,本缺陷完全无兜底)+ 波及 10(单弹窗单流程)+ 可复现 18(确定性 UI 序列)+ 维护价值 
14(恢复既有专用校验消息契约,激活死 i18n key);FIX_CONFIDENCE 96(先红后绿,逻辑拆分无行为变化)。
   
   ## Tests
   
   - 回归先红:`npx vitest run src/pages/ops/__tests__/SystemAlertsPage.test.tsx` → 
`Tests 1 failed | 14 passed (15)`;修复后 15/15 全绿。
   - 全量 web(分支上两轮 `npx vitest run`):982 tests(pristine 6c24d2ed = 981 + 本 PR 新增 
1),每轮 2 failed 且集合轮换(AclPage×1+ConsumerPage×1 / 
ConsumerPage×2——历轮记录的未触碰文件负载脆弱族),两失败文件隔离复跑 54/54 通过;本 PR 触碰文件的套件在两轮全量中均全过。
   - `npx tsc -b` 干净;`npx eslint` 0 error(systemAlerts.tsx:227 的 
exhaustive-deps warning 为基线既有、不在改动 hunk);`npm run build` ✓(10.45s)。
   - numstat 自检:`systemAlerts.tsx +14/−1`、`SystemAlertsPage.test.tsx +23/−0`。
   
   ## Risk
   
   低。仅调整校验异常的展示路径;API 调用、成功路径、loading 状态管理均不变。CI:upstream 工作流全部 
startup_failure(0 check-runs),head 59b36f6 无 CI 结果,以上为本地完整验证。
   


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