apache / apache/rocketmq-dashboard

[Studio][Bug] Silence creation shows only a generic failure toast; the label/time-zone validation messages are unreachable

Open
#4,282 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
683
Avg merge
2d 12h
Merged PRs (30d)
62

Description

## Problem / Evidence

维护窗口创建弹窗(`web/src/pages/ops/systemAlerts.tsx` 的 `createSilence`)把**请求构造**(纯客户端校验)与 API 调用放在同一个 `try` 里,唯一 `catch` 只显示通用 toast `sysAlerts.silenceCreateFailed`:

- `parseSilenceLabels` 对任何不含 `=` 的片段 `throw new Error(invalidMessage)`,其中 `invalidMessage` 是专用文案 `sysAlerts.labelsFormatInvalid`("标签格式应为 key=value,并以逗号分隔")——该 i18n key 在此路径下**永远不可达**;
- 标签输入含尾逗号(`brokerName=broker-a,`,split 产生空片段)即触发;时区字段仅校验非空, recurring 窗口填 `GMT+8` 之类非 IANA 时区时 `zonedLocalDateTimeToUtc` 抛出具体 RangeError 同样被吞;
- 这些异常发生在任何 HTTP 请求之前,axios 拦截器不会代为展示服务端原因,用户只能看到通用"创建失败",没有任何字段指向。

回归测试(先红):`surfaces the label validation message when the silence labels are invalid` 在未修复代码上失败(专用消息不出现、只有通用 toast),修复后通过。

## Impact

运维人员在配置告警静默窗口时被硬性卡死:反复重试同一输入得到完全相同的无指向失败;专用校验消息作为死代码存在。创建静默窗口是告警降噪的核心操作。

## Expected behavior

客户端校验失败时应显示字段专用错误消息(已存在的 `sysAlerts.labelsFormatInvalid` 等);API 失败仍走通用 toast(服务端原因由 axios 拦截器展示)。

## Related work

- #4251(开放,本账号)处理同一弹窗的**表单残留**——取消后旧值影响下次创建,与本缺陷(校验消息不可达)不同面。
- #4241(开放)实例弹窗隐藏服务端错误原因——同类信息损失缺陷,但服务端原因尚有拦截器兜底;本缺陷无兜底。
- #4052(开放)维护窗口编辑功能——不触碰创建路径的校验反馈。

## PR

Fix: #4285.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in web/src/pages/ops/systemAlerts.tsx at createSilence and the named regression test, “surfaces the label validation message when the silence labels are invalid.” Trace how client-side parsing and timezone validation are handled before the API call; done means field-specific validation messages appear while API failures retain the generic toast. PR #4285 is already listed for this issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.