Skip to content

[PR] fix(web): pack-editor i18n — {need} placeholder + scannable key refs (#1024) - #5366

Merged
ranxianglei merged 1 commit into
masterfrom
fix/i18n-pack-editor-parity
Oct 31, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
fix/i18n-pack-editor-parity

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

来源: #5341 回归评审(v0.1.209 → master)期间发现的 master CI 红(#1024 i18n 守卫),根因在 #5345 pack editor 的 i18n 内容。

问题

master push(44fcbe4)与 #5341 车分支的 test 矩阵各挂 2-4 job,失败全部集中在 #1024 守卫:

  • catalog parity — placeholder mismatch for "cfg.q_pack_ai_p1"(en 串漏 {need},zh 孪生串有,client.ts 运行时以 t("cfg.q_pack_ai_p1", { need }) 传参);
  • no dead keys — 底本下拉 4 键 + packSectionField 的 label/help 共 8 键经数组/helper 参数间接引用,Web UI 英文翻译开关(i18n)— 社区 PR #807 (@amirzamli) #1024 扫描器只认字面量 t("key") ⇒ 逐个报死键。

修复(owner 备好的 commit 7fad432a,本分支原样应用)

  • en cfg.q_pack_ai_p1 末尾补 : {need},与中文占位符集合一致;
  • 底本下拉 4 选项与 packSectionField 的 label/help 改为调用处直接 t(...)、helper 收现成字符串——行为零变化,只让每个键有扫描器可见的字面引用。

验证(本地,origin/master 44fcbe4 + 本提交)

  • tests/web-i18n.test.ts + tests/web-user-packs.test.ts:11/11(owner 报告修前 9/11);
  • tsc --noEmit:CI 把关(本地未重复全量,按测试纪律交 CI);
  • diff 仅 2 文件(+12/−9),无无关改动。

合入后 master push CI 与 #5341 车分支的 #1024 失败项转绿。

…ption keys visible to the #1024 dead-key guard

The guided pack editor (#5345) broke the i18n parity tests on master push CI:
1) en cfg.q_pack_ai_p1 was missing the {need} placeholder its zh twin has
   (client.ts interpolates t("cfg.q_pack_ai_p1", { need })).
2) Four catalog keys were passed as bare strings through helper parameters
   (option array / packSectionField), which the #1024 reference scanner
   (literal t(\"key\") only) cannot see — flagged as dead keys. Labels are now
   translated at the call sites so every key has a scannable literal reference.

Verified locally at origin/master (44fcbe4): tests/web-i18n.test.ts +
web-user-packs.test.ts 11/11 (was 9/11); all web/pack/i18n suites 257/257;
tsc --noEmit clean.
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: fix/i18n-pack-editor-parity (dc141fc)

Latest build — install this exact version

npm install -g billion-context@0.0.7559-pr.5366.37247fa

This exact version is immutable and reproducible. The rolling pr tag tracks the newest test build across all PRs.

Recent builds (commit → version)

commit version build
dc141fc billion-context@0.0.7559-pr.5366.37247fa build

Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pr5366.tgz
npm install -g package

Install instructions are refreshed on each push.

@ranxianglei ranxianglei changed the title fix(web): pack-editor i18n — {need} placeholder + scannable key refs (#1024) [PR] fix(web): pack-editor i18n — {need} placeholder + scannable key refs (#1024) Oct 31, 2026
@ranxianglei
ranxianglei merged commit a2388eb into master Oct 31, 2026
47 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

📦 Merged Build Published

This merge to master was published as 0.0.968-master.a2388eb (rolling master tag).

npm install -g billion-context@0.0.968-master.a2388eb  # this exact build
npm install -g billion-context@master  # always the newest merged build

npm view billion-context@master prints the current version at any time.

Louie0806 added a commit to Louie0806/billion-context that referenced this pull request Oct 31, 2026
…fix instead of widening the gate

Upstream shipped the same two master-reds I had just fixed my own way, in
a2388eb / ranxianglei#5366 (`fix(web): pack-editor i18n — {need} placeholder +
scannable key refs (ranxianglei#1024)`). Their approach is strictly better than mine and
supersedes it, so this merge takes theirs in both places:

- src/web/i18n.ts: they restore `{need}` with a slightly fuller sentence
  ("My scenario and requirements are as follows: {need}") — taken verbatim.
- tests/web-i18n.test.ts: they keep the dead-key gate EXACTLY as strict as
  it was and move the burden to the call sites — `packSectionField(t("…"), t("…"))`
  and `[["", t("cfg.q_pack_base_blank")], …]` become literal `t("…")` calls
  (src/web/client.ts). My version had widened `collectRefs()` to accept any
  `cfg.*` literal, which would have let a future dead key slip through if it
  appeared in any web source for an unrelated reason. Their fix keeps the gate
  able to catch that, so my test edit is reverted to master's file verbatim
  (`git diff upstream/master -- tests/web-i18n.test.ts` is empty).

Net effect: this lane no longer carries an i18n change at all. The sixth
master-red is fixed upstream, not by me, and the branch diff vs master is back
to 14 files / +1244 / -45 — the two thinking-leak lemmas, their tests, and the
config-docs seed they need to keep docs-sync a fixed point.

Verified on the merged tree: web-i18n 10/0 (master's original strict gate),
gen-config-docs fixed point, tsc clean.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant