Skip to content

fix: clear the 7 root-tsconfig type errors gating master typecheck (#2003) - #2006

Closed
ranxianglei wants to merge 2 commits into
masterfrom
2026-10-03_master-typecheck-red
Closed

ranxianglei wants to merge 2 commits into
masterfrom
2026-10-03_master-typecheck-red

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Fixes #2003.

What: the 7 type errors that made master's four required test checks RED at 129200d (and, via the merge ref, every open PR's):

  • tests/codex-responses-ws.test.ts — 4× (tools/input/error typed through Item = Record<string, unknown>): explicit casts instead of optional-chaining through unknown
  • tests/ws-bridge.test.ts — 2× (handler must return Promise<void>; untyped close-wait Promise)
  • tests/issue1993-preflight-400.test.ts — 1× (ProxyOptions imported from src/config.ts, its definition home, instead of the non-exported src/server.ts binding)

Scope: test-side only — no src changes, no runtime changes, no behavior changes. Zero diff outside the 3 files named in #2003.

Evidence (branch = master + this one commit):

  • npx tsc --noEmit --project tsconfig.json → 0 errors (was 7)
  • node --import tsx --test tests/codex-responses-ws.test.ts tests/ws-bridge.test.ts tests/issue1993-preflight-400.test.ts → 13/13 pass
  • full suite green per CI on this PR (the whole point: required checks turn green here)

Merge note: master is currently red — this PR is the unblock; every other open PR (incl. #1632) turns green automatically once this lands, because the errors are inherited through the merge ref.

Found while hardening #1632's CI lane; filed separately per one-issue-one-scope.

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-03_master-typecheck-red (0ac6b45)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2022-pr.2006.9f78dc9

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-pr2006.tgz
npm install -g package

Install instructions are refreshed on each push.

…2003)

Test-side only, zero src changes, zero runtime changes:

- codex-responses-ws: cast request.tools / request.input / error.error off
  the Item record type instead of optional-chaining through unknown
- ws-bridge: handler returns Promise<void>; type the close-wait Promise
- issue1993-preflight-400: import ProxyOptions from src/config.ts (its
  definition home) instead of the non-exported src/server.ts binding

Fixes #2003
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 PR #2006 review — 可合并(CI 已全绿)

结论先行:这是把 master 的 root-tsconfig typecheck 门从 RED 拉回 GREEN 的解锁 PR。我独立复现了基线、逐行核对了 diff、本地验证了修法,并确认了当前 head 的 CI 状态。

⚠️ review 期间该 PR 被更新过:我最初拉到的 head 是 fbcc7fa5(单提交);现已被 rebase 到最新 master 并补了一个提交,当前 head 为 0ac6b459(两提交)。以下全部针对当前 head。

我的验证(证据,非复述 diff):

  • 基线复现:tsc -p tsconfig.json @ 129200db → 恰好 issue 所列 7 条(文件/行列/错误码逐字一致),exit 2。
  • 修法验证:tsc -p tsconfig.json @ 当前 head 0ac6b459 → 0 错误;定向跑改动涉及的 4 个测试文件 → 14/14 pass。
  • CI:当前 head 的 14 个 check-run 全部 success(含四个 test os/node 矩阵、build-artifact、version-guard、registry e2e、各 lane e2e)。
  • 范围核对:相对当前 master(33d58e5e)diff = 仅 4 个测试文件,12+/10-,零 src/运行时改动;mergeable_state=clean,基于最新 master、无落后、无需 rebase。

结构化七问:

  1. 是什么问题:feat: ACP-aware OpenCode V2 Responses WebSocket proxy + generic WS bridge shell (#1844/#1467) #1968/fix(preflight): log+dump rejected summary bodies and shrink-retry hard 400/413 #1994(及后来的 fix: preflight transport resilience + shipped-payload baseline anchor (#1987) #1989)合入后,若干测试文件带未过 root-tsconfig 门的类型标注缺陷,使 master 的 typecheck 步骤 RED;merge-ref 机制让所有 open PR 的 required checks 同步变红(含无关 PR)。
  2. 什么原因导致的:2e6e508a 把 tests/ 纳入 root tsconfig typecheck 范围并清零存量后,后续合入的测试文件在合并前从未真正过这道门(concurrency 取消了引入点 700e6dd 的检查运行,RED 延迟暴露);fix: preflight transport resilience + shipped-payload baseline anchor (#1987) #1989 又新带入一个同类文件(issue1987)。属"测试侧类型标注缺失 / 导入源错误",非产品代码缺陷。
  3. 怎么修复的:全部测试侧、零 src——①对 JSON.parse / server.address() 等消费点加显式类型 cast(Item[]、{code:string}、AddressInfo),恢复真实运行时形状而非掩盖;②ws-bridge dispatch fake 从返回 Promise<ServerResponse> 改为 async 块体返回 Promise<void>(对齐 src/ws-bridge.ts:81 签名);③new Promise 补 <void> 泛型;④ProxyOptions 导入源从 server.ts(仅本地 import 别名)改到其定义处 src/config.ts——type-only 导入,运行时擦除,与其余测试文件做法一致。
  4. 是否有回归问题:无。逐项过触碰路径的既有行为:cast / 泛型 / async 包装 / 导入源变更均为纯类型层,运行时字节零影响;断言逻辑与断言语义逐行未动(codex 的 Array.isArray 守卫与 .some 谓词不变、firstText 的 .find 谓词不变、error.error.code 比较不变)。两个有运行时邻接的 hunk 单独论证过行为中性:(a) codex 第 144 行去掉 ?. 直调 .map —— row[1] 是全重放真实轮次,pipeline 保证 tools 为数组(第 138 行 probe 即为 []),退化缺失路径不可达;(b) ws-bridge dispatch fake —— 新旧形式都在调用时同步执行 writeHead().end(),时序一致,且 Promise<void> 契约下解析值不被消费。高危模式逐项排除:无语义漂移、无 fail-fast 变吞错、无阈值/时序/输出格式漂移、无缓存/重试失效。
  5. 是否破坏缓存:不涉及。
  6. 是否改了设计方向:不涉及(纯测试类型层,无架构/边界/数据流变化)。
  7. 是否引入了新的配置:不涉及(零 env/config/默认值)。

顺带说明(均不阻塞):

收工判定:CI 已全绿、diff 干净(每行都服务于本 issue)、零回归——可直接合并。合并后所有 open PR 经 merge-ref 继承绿色 typecheck,#1632 等同步解锁。

@ranxianglei

Copy link
Copy Markdown
Owner Author

[bot] 🏷 重复判定:与 #2007 同题同失败域(master typecheck 12 错),打「重复」标签,保持打开待 owner 拍板方案。

两者实测对比(均基于当前 master tip 33d58e5):

#2006(本 PR) #2007
覆盖全部 12 错 ✅ ✅
typecheck(本地实测) 0 错 0 错
CI 14/14 绿 16/16 绿
src 变更 无 src/server.ts +1 行 export type { ProxyOptions }(type-only,编译期擦除,零运行时痕迹)
ProxyOptions 取法 测试文件改从定义处 ../src/config.ts import server.ts re-export,测试保持从 startServer 所在模块 import

唯一差异即上表最后一行。建议:默认合 #2007(集中补全模块契约,后续从 server.ts 取 startServer 参型的写法不再踩坑);若 owner 偏好零 src 变更,则合本 PR、关 #2007——二选一,避免双合并冲突。完整 review 见 #2007 帖。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

master typecheck RED since #1968/#1994 merges: 7 errors in 3 test files — blocks every open PR's required checks

1 participant