Repository navigation
fix(#2626): key decompress image-mode dispatch on a valid imageRef - #2633
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2857-pr.2633.8fdb173This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2633.tgz
npm install -g packageInstall instructions are refreshed on each push. |
decompress carries two modes (text block/range restore vs image recovery) that
were dispatched on whether imageRef was PRESENT rather than whether it carried
a VALID value. Hosts and models emit ""/whitespace/null for optional fields, so
decompress({blockId:"b1",imageRef:""}) jumped into image mode and returned the
"No restorable images" receipt instead of restoring b1 — a success-shaped
receipt that made callers believe the text restore had completed.
Key the selection on a non-blank value in the shared resolveDecompress resolver
(every wire/plugin lane funnels through it): blank/null/undefined => unspecified
=> fall through to block/range restore; a non-blank string => image path
("list"/mNNNNN semantics unchanged); a non-string non-null value => a loud param
error instead of silently defaulting to the image list.
Closes #2626
3f3dea5 to
9435154
Compare
[bot] 🏷 这是我上一轮针对 #2626 开的 PR。按 [PR] 规则我没有重做,而是拉分支核对代码 + 查 CI。发现一处 Windows-only 的 CI 失败,定位后确认是陈旧基线(本 PR 分叉在 #2634 之前)带进来的既有 master 级 CRLF 故障(#2631),不是本 PR 引入的回归。已把 PR rebase 到当前 master(含 #2634 的 ① 审原 issue(方向关)#2626(xiaozhu1337 报):空 ② 回归审查(整体关)触碰路径 =
③ 代码审查(主关)
④ 测试有效性(质量关)
⑤ diff 整洁度3 个文件,+172/-5,单一线性 commit,每一行都服务于本修法(gate + 其注释、聚焦的新测试文件、一条修正的断言)。无无关改动、无大规模空行/缩进扰动、无 lockfile/生成物连带变更。golden 未动(作者有意避开 schema description 措辞编辑以不升级为 wire-shape 变更——判断合理)。干净。 结构化八问
行为变更披露(旧 → 新)
关于 PR 里明确排除的第 4 条(schema 措辞)同意有意排除:现有 description 已把 CI 说明新 head 判定代码正确、单一漏斗点覆盖全入口、行为变更已完整披露、diff 干净无无关改动;Windows 失败系陈旧基线带入的既有 CRLF 故障,rebase 后应转绿。可合并——等 CI 在新 head 全绿即收工,我会盯到确认。 |
[bot] 🏷 CI 更新(接上一轮 review):rebase 后的 head 判定不变:可合并;rebase 带入的 #2634( |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.235-master.51942ba # this exact build
npm install -g billion-context@master # always the newest merged build
|
What & why
decompresscarries two modes — text block/range restore and image recovery (#1995) — and they were dispatched on whetherimageRefwas present rather than whether it carried a valid value. Hosts and models emit""/ whitespace /nullfor optional fields, sodecompress({blockId:"b1", imageRef:""})jumped into image mode and returned the success-shaped[No restorable images right now …]receipt instead of restoringb1. The data never left the session, but callers read that receipt as "text restore done."Fix
Key the mode selection on a non-blank value in the shared
resolveDecompressresolver — the single entry point every wire/plugin lane funnels through (src/loop/core.tsexecuteProxyTool,src/stream.tsexecuteAnthropicProxyTool) — so one fix covers all lanes:undefined/null/""/ whitespace → unspecified → fall through to block/range text restore."list"/ mNNNNN semantics are unchanged).Behavior change (old → new)
{blockId:"b1", imageRef:""}{blockId:"b1", imageRef:" "}{blockId:"b1", imageRef:null}{blockId:"b1", imageRef:42}FAILED: imageRef must be a string{imageRef:"list"}/" LIST "{imageRef:"m00042"}{imageRef:""}(no blockId)FAILED: blockId is requiredNo change to any documented image call; no new config / knob / env / CLI surface; no schema or wire-shape change (goldens untouched).
Scope note (deferred item from the issue)
The issue's suggested item 4 — add wording to the advertised
imageRefschema description noting blank = omitted — is deliberately not included here. The existing description already documents"list"as the enumeration keyword (it never said""means list), so post-fix behavior matches the documented contract; editing that string would force regeneration of the three wire-contract golden files and escalate this clean single-module bugfix into a human-review-required wire-shape change. Happy to add it as a trivial follow-up if you want the explicit wording. Item 5 (Pi-side stripping of optional empty fields) is unnecessary — the shared-resolver fix already covers every lane.Tests
New
tests/decompress-image-ref-dispatch.test.tspins every routing case against the real resolver (valid block + empty/whitespace/nullimageRef→ text restore; invalid types → param error;list/padded/any-case and concrete refs still reach image mode). Updated the one assertion intests/image-restore.test.tsthat pinned the old empty==list behavior. Typecheck clean; targeted decompress / image / wire-contract suites green on the rebased head; full suite via CI.Closes #2626