Repository navigation
ui: 诊断页金融提供方行把 {{list}} 占位符原样渲染,列表被拼在第二个冒号之后 - #295
Merged
helsome merged 1 commit intoOct 18, 2026
Merged
Conversation
…{list}}
The diagnostics "Financial providers" rows called t('diagnostics.markets') and
t('diagnostics.capabilities') without interpolation values, then appended the
list themselves after their own ":" separator. Both keys already carry the value
and the separator ('Markets: {{list}}' / '市场:{{list}}'), so the shipped text
was "Markets: {{list}}: US, HK" — the raw placeholder was user-visible, in both
locales, including the empty-coverage fallback ("Markets: {{list}}: —").
The row's `t` prop was narrowed to (key: string) => string, which is why the
call site could not pass options even though the parent hands over the real
TFunction. Widen it to TFunction (same shape TodayView uses for formatWhen) and
pass { list }. No locale copy changes and no new keys: i18n:check stays at
1487 ≡ 1487.
A repo-wide sweep of every t('literal') call against the 67 placeholder-bearing
keys finds exactly these 2 sites missing their values, against 61 that pass them
— 8 of those in this very file (the summary* keys). So these two lines are a
missed spot, not a difference of convention.
Add packages/ui/src/components/settings/DiagnosticsTab.test.tsx (3 cases: en-US
substitution, the em-dash fallback, zh-CN substitution), rendering the real
component against the real resource bundle. Pre-fix 0 pass / 3 fail; post-fix
3 pass / 0 fail. Whole workspace: bun test packages/ui --isolate is
352 pass / 0 fail.
Closes helsome#294
helsome
approved these changes
Oct 18, 2026
helsome
left a comment
Owner
There was a problem hiding this comment.
独立源码审查通过;精确 HEAD focused 3 pass / 0 fail。与最新 main 的本批累计组合独立验证 1831 pass / 7 skip / 0 fail,全 workspace typecheck、i18n 均通过。相关生产变更文件高信号 secret 扫描零命中;不把这些确定性回归声称为真实模型或完整桌面验收。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题与修复
Closes #294
设置 → 诊断页的「金融提供方」卡片把
{{list}}占位符原样渲染给用户,并把真正的列表拼在自己的第二个冒号之后。packages/ui/src/components/settings/DiagnosticsTab.tsx:210/:213(行号基于3a17eca6):两个键的文案本身已经带了占位符与分隔符(en-US
'Markets: {{list}}'/'Capabilities: {{list}}';zh-CN'市场:{{list}}'/'能力:{{list}}'),调用点却没传插值参数,于是 i18next 保留原样占位符:根因是类型把修复路径堵死了:
FinancialProviderRow把t的 prop 收窄成t: (key: string) => string,而父组件传进来的是真实TFunction(:138)。收窄后的签名不允许传第二个参数,调用点只能手工拼字符串。修复(4 处改动):
DiagnosticsTab.tsx:2import type { TFunction } from 'i18next';:202t: (key: string) => string;→t: TFunction;:210{t('diagnostics.markets')}: {…join(', ') || '—'}→{t('diagnostics.markets', { list: …join(', ') || '—' })}:213capabilities同上TFunction的用法与仓库既有写法一致(components/today/TodayView.tsx:5,42的formatWhen(timestamp, t: TFunction))。不改任何 locale 文案、不新增键。为什么判定是「漏网」而不是「口径分歧」
脚本对齐两侧枚举:从
packages/i18n/src/locales/en-US/*.ts得到 637 个键,67 个含{{…}};在packages/{ui,shared,core,skill-hub,pi-runtime}/src+apps/electron/src找所有t('字面量键')(不带第二参数)。:239diagnostics.summaryFolio、:244summaryAgentRuntime、:248summaryLlm、:252summaryBroker、:258summaryLongbridgeCli、:259summarySkills、:263summaryResources、:267summaryRecentErrors。同文件、同一种
{{name}}写法,8 处对、2 处错 ⇒ 这两行是漏网。可复现测试报告
环境:Windows
10.0.26200.9457(x64)、Bun1.4.2、main3a17eca6。新增
packages/ui/src/components/settings/DiagnosticsTab.test.tsx(3 个用例:en-US 插值、空覆盖的—回退、zh-CN 插值)。用真实资源包(createSyncI18n)+ 真实组件渲染,只把client.diagnostics.collect换成固定 bundle(该 channel 的export/restartRuntime一并给出以匹配DiagnosticsChannel类型)。修复前(把
DiagnosticsTab.tsx还原为3a17eca6的原始字节后重跑):修复后:
3 pass / 0 fail。其他校验:
bun test packages/ui --isolatetsc --noEmit(packages/ui)bun run i18n:checken-US 1487 keys ≡ zh-CN 1487 keys (0 issues)说明:352 这个数字包含本 PR 新增的 3 个用例与姊妹 PR #293 新增的 7 个用例(
i18n/localeRendering.test.tsx6 个 +DiscoverView.test.tsx1 个);两个 PR 都只动packages/ui。未运行:
apps/electrone2e(本机无法跑,见 #223);上游PR checks当前state=disabled_manually,新建 PR 不产生 check run,故以上均为本地等价命令结果,非 CI 结论。UI 变化
诊断页「金融提供方」两行的文本变化,布局不变:
Markets: {{list}}: US, HK→Markets: US, HKCapabilities: {{list}}: market.quote→Capabilities: market.quote市场:{{list}}: US, HK→市场:US, HKMarkets: {{list}}: —→Markets: —范围
:)。ErrorRow的同类 prop 类型:它调用的键都不含占位符,收窄不影响,避免无关改动。checkKeyParity的计数与标签方向);与 fix(diagnostics): 诊断包恒报券商「已连接、1 个账户」,与是否登录无关 #245 无关(诊断包券商账户事实)。packages/ui/src/client/diagnostics.ts的DiagnosticsBundle镜像缺packages/shared/src/diagnostics/types.ts的evaluation字段,而该镜像 docstring 自称「keep these two in sync」;组件当前不读该字段,无可复现的用户可见影响,故未并入。