Repository navigation
fix(web): translate the run detail evolution controls and regression-sample panel in English mode - #1751
fix(web): translate the run detail evolution controls and regression-sample panel in English mode#1751Robert0622 wants to merge 5 commits into
Conversation
The run detail page decorations from evolution.js rendered hardcoded Chinese in English mode: the 反馈问题 / 钉为回归样本 buttons with their titles, the 进化回放 / 进化试用 chips, both afPrompt dialogs and the result toasts. The zh→en dictionary has no entries for these strings, and the file already uses lfT for dynamic copy elsewhere (evoProblemHTML). Wrap every user-visible string of evoDecorateRunDetail, the RSI workbench hint in evoOpenFeedbackFinding and the regression-sample panel note in lfT, following the existing pattern. Verified in a deployed environment: the run detail page in English mode now shows "Report an issue" / "Pin as regression sample" with English titles and dialogs, and a new webtest case asserts the rendered controls carry no Chinese characters in English mode. Co-Authored-By: Claude Code <noreply@anthropic.com>
Same class as the run detail controls: the panel title 回归样本, its
dynamic ${count} 个 badge, the 无备注 fallback, the 移除 button and the
还没有钉选样本 empty state are dynamic or missing from the zh→en
dictionary, so wrap them in lfT like the rest of the feature.
Co-Authored-By: Claude Code <noreply@anthropic.com>
crispinhu27
left a comment
There was a problem hiding this comment.
Code Review — Approve(初审,head d6d139ac,base main b200e66c)
审查范围:web/evolution.js(+12 −12,4 处 hunk:evoSamplesHTML、evoDecorateRunDetail 的两个状态的 chip/按钮/弹窗,反馈结果与 toast,evoOpenFeedbackFinding 的项目切换 toast)与 webtest/tests/evolution-feedback.test.mjs(+24)。逐行对照了 PR 描述点名的每个字符串,没有遗漏;改动只把字面量包进已有的 lfT(zh, en),不新增机制、不改中文分支。
实际执行的验证(隔离 worktree,head 与 base 各一份)
- 新增用例有区分力:把 head 的
webtest/tests/evolution-feedback.test.mjs原样放到 baseb200e66c上跑,English mode renders the run detail feedback and pin controls in English失败:headnot ok 1 - English mode ... actual: '反馈问题'd6d139ac上同一文件 4/4 通过。 - 全量 webtest(head):
npm test→ 607 条,606 过 / 1 跳过 / 0 失败。 - Go 侧(head):
go test ./web/ok(7.4s)、go vet ./web/无输出。注意本地要先make build-chatbot生成web/native-chat,否则embed.go的all:native-chat报 setup failed,这是环境前置,不是本 PR 的问题。 - 手工探针(jsdom,英文模式):
evoSamplesHTML()渲染出Regression samples/No note/Remove/No pinned samples yet,面板aria-label也是英文;把 note 塞成note "quoted" <b>时仍走escapeHTML,标签未被注入。中文模式同一条路径仍是回归样本/无备注/移除,与 base 行为一致。
CI:head d6d139ac 上所有已完成的 check 全部 success(core、webtest、e2e 各平台、browser、secrets 等),发布时无进行中的 check。
一处可选改进(不阻塞)
英文模式下回归样本面板头部的计数只剩裸数字(2,中文是 2 个),读作 Regression samples 2 略突兀。中文侧本来也是裸计数风格,不算本 PR 引入的缺陷,改成 2 samples 之类更好,可留到后续。
本次审查只覆盖该 PR 改动的这两个文件及其直接调用路径,不代表仓库其他部分没有缺陷。
CR + 实测:英文模式运行详情进化控件与回归样本面板(head
|
The samples panel's Remove button was translated but the success toast after unpinning stayed hardcoded Chinese, so English mode showed 「已移除样本」. Wrap it in lfT and add an English-mode webtest that clicks a real [data-evo-unpin] button and asserts the toast text. Co-Authored-By: Claude Code <noreply@anthropic.com>
CR + 部署实测:#1751 @ 6f19253(含 1 处补充修复),结论:可以合入代码审查
部署实测(main
|
| 场景 | main b200e66 | 本 PR 6f19253 |
|---|---|---|
| 普通成功运行详情按钮 | 反馈问题 / 钉为回归样本 | Report an issue / Pin as regression sample(title 亦英文)✔ |
| 进化回放运行 chip | 进化回放 | Evolution replay ✔ |
| 进化试用运行 chip | 进化试用 | Evolution trial ✔ |
| 回归样本面板 | 标题「回归样本」、说明中文且被静态词条搅成中英混排(「…钉为回归样本"Add.」) | Regression samples + 完整英文说明 + Remove ✔ |
| 点「移除」后的 toast | 已移除样本(英文模式下仍中文) | Sample removed ✔(本 head 新修复) |
- 钉选 / 移除走真实 API:
POST /api/runs/:id/pin-sample→ 201,DELETE→ 200,面板列表实时刷新。 - 全程无 console error;telemetry / 日志等接口无 4xx/5xx。
- 中文模式回归(本 PR):按钮「反馈问题 / 钉为回归样本」、chip「进化回放 / 进化试用」、面板「回归样本 · N 个 … 移除」、toast「已移除样本」全部保持中文,无回归。
webtest:608/608 通过(含新增的英文模式 unpin toast 用例)。
截图(英文模式):
The pin regression sample API answers in Chinese ("该运行没有所属项目",
"只能把成功的业务运行设为回归样本"), and the drawer showed those strings verbatim
in English mode, both when pinning and when unpinning. Map the two known
reasons through lfT and keep other messages unchanged; add a webtest.
Co-Authored-By: Claude Code <noreply@anthropic.com>
复测:07dca902(pin-sample API 报错文案英文映射),结论:可以合入新增的
至此 #1751 三个 head(d6d139ac → 6f19253 → 07dca90)均已 CR + 部署实测,可以合入。 |
crispinhu27
left a comment
There was a problem hiding this comment.
Code Review — Approve(复审,head 07dca902,base main b200e66c)
性质:复审。上一轮 APPROVE(review 6161043237,针对 d6d139ac)由作者于 2026-12-03 01:02 手动 dismiss(代码已前进两个提交),因此本轮针对当前 head 重新审查与验证,不复用旧结论。
审查范围:web/evolution.js(+26 −15)与 webtest/tests/evolution-feedback.test.mjs(+70)。相对上一轮新增的两个提交:
6f192530:evoUnpin的删除成功 toast 补lfT('已移除样本','Sample removed');07dca902:新增EVO_PIN_ERRORS/evoPinError(err),把 pin-sample 接口的两个中文原因(该运行没有所属项目、只能把成功的业务运行设为回归样本)在英文模式映射为英文,其它 message 原样透出;pin 与 unpin 两条 catch 路径都改用它。
服务端字符串已逐一核对 internal/httpapi/evolution.go:1063、:1084,与映射键逐字一致;lfT(zh,en) 定义在 web/i18n.js:37,按 dataset.lang 二选一,中文模式原样返回中文,确认不改变中文行为。
实际执行的验证(隔离 worktree,head 与 base 各一份)
- 新增用例有区分力(基线对照):把 head 的
webtest/tests/evolution-feedback.test.mjs原样放到 baseb200e66c上执行node --test tests/evolution-feedback.test.mjs,3 条新增用例全部失败,断言值与 PR 描述的缺陷一致:同一文件在 headnot ok 4 - English mode renders the run detail feedback and pin controls in English actual: '反馈问题' not ok 5 - English mode unpins a regression sample with an English toast actual: '已移除样本' not ok 6 - English mode localizes the server reasons when pinning a regression sample fails actual: '只能把成功的业务运行设为回归样本'07dca902上 6/6 通过(含原有 3 条)。 - 真实浏览器复核(system Chromium via Playwright,静态托管
web/,localStorage['loopforge.lang']切换):- 英文:按钮
Report an issue/Pin as regression sample,title 全英文;evoSamplesHTML()面板标题Regression samples、计数0、无中文残留(去掉data-evo-unpin属性值后正则扫描无 CJK)。 - 中文:
反馈问题/钉为回归样本、面板回归样本/0 个,与 base 行为一致,未回归。
- 英文:按钮
- CI:head
07dca902上 17 个 check 全部 completed + success(core、webtest、browser、e2e ×4、e2e-browser、e2e-required、platform-required、secrets、first-run、tcmcp、validate ×2、curl-install、开源扫描),发布时无进行中任务。
未覆盖 / 非阻塞
- 只审了本 PR 改动的两个文件及其直接调用路径(
runs.js:2708调用evoDecorateRunDetail),不代表仓库其他部分无缺陷。 - 回归样本面板英文计数仍为裸数字(
Regression samples 2),中文侧同为裸计数,非本 PR 引入,留作可选改进。 - 服务端其它中文原因(如
只有项目成员可以查看该项目的RSI工作台、项目不存在)不在本次两处映射内,属既有行为,本 PR 未加重;若后续要把整个 pin 流程英文收口,可一并纳入。
本次审查未发现需阻塞合入的问题。
Co-Authored-By: Claude Code <noreply@anthropic.com>








问题原因
web/evolution.js的运行详情页装饰(evoDecorateRunDetail)与回归样本面板把用户可见文案硬编码为中文:反馈问题/钉为回归样本两个按钮及其 title、进化回放/进化试用两个状态 chip、两个afPrompt弹窗(标题与提示语)、反馈结果通知与 toast、evoSamplesHTML的面板标题、动态计数徽标、无备注回退、移除按钮与还没有钉选样本空状态。英文模式的两层翻译机制都没覆盖到它们:zh→en 字典(
web/i18n-en.js)没有这些词条(只有人工反馈问题,没有反馈问题),且其中的动态文案(${rows.length} 个等)本来就无法靠字典精确匹配。同一文件里evoProblemHTML(web/evolution.js:741)对动态文案的既有做法就是lfT,这两处没有跟上。复现报告
部署环境:本地 MariaDB 11.8.9(utf8mb4_unicode_ci)+ 本仓库 main(b200e66c)构建的平台二进制 + Chromium 无头真实浏览器,会话以本地验收登录进入。
localStorage['loopforge.lang']='en',刷新后document.documentElement.dataset.lang==='en');反馈问题/钉为回归样本(title 也是中文),点开弹窗标题与提示语均为中文;进化回放/试用 chip 同样是中文。复现截图(修复前,英文模式):
新增的 webtest 回归用例(
webtest/tests/evolution-feedback.test.mjs)在修复前的 main 上失败(按钮文案含汉字),修复后通过。修复方案
按同文件既有模式把上述全部文案包进
lfT(中文, English):evoDecorateRunDetail:两个 chip(含 title)、两个按钮(含 title)、反馈弹窗(标题+提示语)、结果通知回退文案与查看问题 ↗、两个 toast;evoOpenFeedbackFinding的项目切换提示 toast;evoSamplesHTML:面板标题、${rows.length} 个计数、无备注回退、移除按钮、还没有钉选样本空状态与说明文案。不改中文模式行为(
lfT在中文模式下原样返回中文),不新增字典词条,不引入新机制。修复后测试结果
同一部署环境以修复后二进制重测:
Report an issue/Pin as regression sample,title、弹窗、toast 均为英文,页面无残留中文(复现脚本输出hardcoded zh found on run detail (en mode): false);webtest:607 条 606 过 / 1 跳过 / 0 失败(含新增英文模式回归用例);go test ./web/:ok;webtest同套全过(用例默认中文模式),中文文案原样。修复后截图(英文模式):
🤖 Generated with Claude Code