Skip to content

fix(web): protectedTools row must address compress.protectedTools (#1948) - #1949

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-01_web-ptools-under-compress
Oct 3, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-01_web-ptools-under-compress

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

What changed

src/web/client.ts quick-config form: the Protected tools row read/wrote the top-level draft.protectedTools, while every other compress-level row addresses d.compress.*. Top-level protectedTools is not a valid config key (absent from KNOWN_TOP_LEVEL_KEYS), so saved values were silently ignored on load — and since #1817 every such config now also logs a warn ("protectedTools" belongs under "compress" (did you mean "compress.protectedTools"?)).

  • syncAll() now reads cp.protectedTools (cp = compressOf(draft)).
  • the row's change handler now ensures d.compress exists and writes/deletes d.compress.protectedTools, mirroring the nudge / preserveRecentMessages / neverPreserveRecentTools rows.
  • regression test tests/web-ptools-position.test.ts: pins both paths to the compress level and asserts the top-level wiring (draft.protectedTools / d.protectedTools) cannot reappear.

Config surface

None. No field added/renamed/re-semantics'd — the canonical key compress.protectedTools (already in COMPRESS_SETTING_FIELDS, documented in CONFIGURATION.md) is simply what the row now addresses. Migration story: none needed — values stored by the old row were never effective (the loader ignored them), so there is nothing to carry over; existing dead root-level entries are inert noise the #1817 warn already points at.

Why not fix the loader instead

Top-level protectedTools should stay unknown: the three-level compress hierarchy is the system for these knobs, and #1817's warning correctly flags any stray root placement.

Pre-flight

typecheck clean · build clean · targeted tests pass (tests/web-ptools-position.test.ts + tests/web-i18n.test.ts, 8/8) · dist verified to contain the corrected wiring.

Fixes #1948

The quick-config form read/wrote the top-level draft.protectedTools —
a key the loader never consumes (not in KNOWN_TOP_LEVEL_KEYS), so saved
values were ignored and warned about by warnUnknownTopLevelKeys as
"belongs under compress". The row now reads cp.protectedTools in
syncAll and writes d.compress.protectedTools like every other
compress-level row.
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-01_web-ptools-under-compress (c55dc77)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.1949-pr.1949.b1010d2

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

Option B — Download artifact

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

Install instructions are refreshed on each push.

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 收到。这是 PR #1949(head 2026-10-01_web-ptools-under-compress,1 commit / 2 files / +27 −2),修原 issue #1948。正在拉分支核对代码、审 CI、跑定向验证,结论稍后按结构化七问给出。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review 结论 — PR #1949

已做验证:拉分支核对代码(对照原 issue #1948)、核对 base 与当前 master 一致(38a4758,无 stale base)、本地 typecheck / build / 定向测试(tests/web-ptools-position.test.ts + tests/web-i18n.test.ts,8/8 pass)/ dist 产物 wiring 验证(新 wiring 各 1 处、旧 top-level wiring 0 处)、CI 全量确认。

结构化七问:

  1. 是什么问题:Web 快速配置表单的 "Protected tools" 行读写的是顶层 draft.protectedTools —— 一个 loader 不消费的无效键,所以经该行保存的值从未生效,且自 fix(#1815): warn on unknown top-level config keys with compress-placement hint #1817 起还会产生 warnUnknownTopLevelKeys 噪音。
  2. 什么原因导致的:该行的 handler 键路径与其它 compress-level 行不一致(nudge / preserveRecentMessages / neverPreserveRecentTools 都写 d.compress.*,唯独此行写顶层)。缺陷的 producer 是表单 wiring,不是 loader —— loader 只认 compress.protectedTools(KNOWN_TOP_LEVEL_KEYS 不含顶层 protectedTools、含于 COMPRESS_SETTING_FIELDS)是正确行为。
  3. 怎么修复的:读路径(syncAll(),cp = compressOf(draft) 已在作用域)改读 cp.protectedTools;写路径 change handler 用与兄弟行完全相同的 if (!compressOf(d)) d.compress = {} ensure 模式后写删 d.compress.protectedTools。刻意不改 loader:保持顶层 unknown,让 fix(#1815): warn on unknown top-level config keys with compress-placement hint #1817 的警告继续兜住任何 stray 放置——这是治本方向,不是治标。
  4. 是否有回归问题:无回归。逐项审过触碰路径的既有行为:① 表单显示从「读死顶层值(实际恒空)」变为「显示真实 compress-level 值」= 有意变更,PR 正文已披露;② 写路径从写死键变为写规范键 = 有意变更;③ grep 全文件确认无其它代码路径引用 draft.protectedTools / d.protectedTools(整文件仅这两处);④ 不触碰 wire/message shape、两种压缩模式、持久化格式、config schema、版本号;⑤ 空列表清空时留下空 compress:{} 对象,与兄弟行既有行为一致,无害。高危模式(fail-fast 变吞错、阈值/时序/输出格式漂移)逐项过:均不涉及。
  5. 是否破坏缓存:不涉及——未触碰缓存/重试/增量游标/去重逻辑(fix(#1815): warn on unknown top-level config keys with compress-placement hint #1817 的 warn signature dedup 未变)。
  6. 是否改了设计方向:不变。强化既有方向「三级 compress 层级是这些 knob 的唯一归属」;明确拒绝了替代方案(loader 接受顶层),那会削弱 fix(#1815): warn on unknown top-level config keys with compress-placement hint #1817 防线。
  7. 是否引入了新的配置:无。无新 env/字段/默认值;config surface 零变化(PR 正文的 Config surface 节与此一致,我核实了 config.ts 事实)。

测试有效性:回归测试钉住 WEB_CLIENT 模板中的精确 wiring 字符串并断言旧 top-level wiring(draft.protectedTools / d.protectedTools)不得再出现——有牙,任何重新引入都会立即失败;对纯格式变更略脆,但对「wiring 位置回归」这一目的足够。i18n 测试顺带确认标签文案未受影响。

diff 整洁度:干净——2 个文件(+27 −2),每一行都与 PR 目的相关,无无关改动、无 whitespace churn、无 lockfile/生成物变化(dist 未入库)。

判定:可合并。 CI 13/13 全绿(e2e lanes × 6 + test ubuntu/windows × node 22/24 + build-artifact + version-guard),本地定向验证全过,满足 §7.4 auto-merge gate(单模块纯 fix:、回归测试在位、最新 base 上绿、clean diff、Fixes #1948)。按规则合并由人来执行:#1949

@ranxianglei
ranxianglei merged commit a863e93 into master Oct 3, 2026
13 checks passed
@ranxianglei
ranxianglei deleted the 2026-10-01_web-ptools-under-compress branch October 15, 2026 05:32
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.

web quick-config: protectedTools row writes a top-level key the loader ignores

1 participant