Skip to content

fix(typecheck): unblock CI — export ProxyOptions + type-narrow #1987/#1994/ws-bridge tests - #2007

Merged
ranxianglei merged 1 commit into
masterfrom
2026-10-03_ci-typecheck-fix
Oct 4, 2026
Merged

ranxianglei merged 1 commit into
masterfrom
2026-10-03_ci-typecheck-fix

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

问题

master 的 CI(npm run typecheck = tsc --noEmit --project tsconfig.json)在 #1994(129200d)与 #1989(33d58e5)合并后红灯,typecheck 挂 12 个错误——任何更新分支的 PR(如 #1946)都会继承。两个 PR 各自分支 CI 都是绿的,是当天快节奏合并下的语义竞态:

  • tests/issue1987-preflight-baseline-anchor.test.ts:11 与 tests/issue1993-preflight-400.test.ts:17:从 ../src/server.ts import ProxyOptions,但 server.ts 只在本文件 import 该类型、未 re-export → TS2459
  • tests/codex-responses-ws.test.ts(fix(preflight): log+dump rejected summary bodies and shrink-retry hard 400/413 #1994):request.tools?.map?. / request.input.find / error.error.code 直接在 unknown 上操作 → TS2339/TS2571/TS7006/TS18046 ×4
  • tests/issue1987-preflight-baseline-anchor.test.ts:91,95:upstream.address().port — address() 返回 AddressInfo | string | null → TS2531/TS2339 ×4
  • tests/ws-bridge.test.ts:45,111:fallback handler 返回 Promise<ServerResponse> 而签名是 Promise<void>;new Promise(resolve => …) 无类型参数 → TS2322/TS2794

修复(全部 type-level,零运行时变更)

  • src/server.ts:export type { ProxyOptions } from "./config.js";(两处测试都从这里 import)
  • tests/issue1987…:address() 转型 as AddressInfo(×2)
  • tests/codex-responses-ws…:tools/input/error.error 加 Item[]/形参转型(断言逻辑不变)
  • tests/ws-bridge…:handler 改 async (_req, res) => { res.writeHead(200).end(); };resolve 用 Promise<void>

验证

  • tsc --noEmit --project tsconfig.json:修复前 12 个 CI 相关错误 → 0(剩余 4 个在 tests/dsh-settings-ui.test.ts,是 pnpm 本地特有——它直接 await import("esbuild") 但 esbuild 不是直接 devDep;CI 用 npm install 扁平提升可解析,不挂。可另立 issue 处理:esbuild 应入 devDependencies)
  • tsc --noEmit --project tsconfig.build.json:rc=0
  • 触碰的 4 个测试文件全绿:codex-responses-ws 5/5、issue1987 1/1、issue1993 5/5、ws-bridge 3/3(干净 env)

合并后 #1946 的 4 个 test lane 即恢复,可正常合并。


Closes #2013 — master typecheck gate red (4 test files, 12 errors). Verified on head db1766f: tsc rc=0; affected suites 14/14; all CI test lanes green.

…e-narrow in #1987/#1994/ws-bridge tests

- src/server.ts: re-export type ProxyOptions (issue1987/issue1993 tests import it from server.ts)
- tests/issue1987-preflight-baseline-anchor.test.ts: address() as AddressInfo (×2)
- tests/codex-responses-ws.test.ts: cast tools/input/error.error (×4 errors, type-level only)
- tests/ws-bridge.test.ts: async void fallback handler + Promise<void> resolve

Touched test files pass: 5+1+5+3. No runtime changes anywhere.
@github-actions

github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

📦 Built Package Artifact

Branch: 2026-10-03_ci-typecheck-fix (db1766f)

Option A — Install this exact build (recommended)

npm install -g billion-context@0.0.2021-pr.2007.9ffbcef

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-pr2007.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] 跟踪单,对应 PR #2007(2026-10-03_ci-typecheck-fix @ db1766f)。开始 review:拉分支核对代码 + CI 状态。

注意到 open 区还有两个同题 PR(#2005、#2006,都是修 master typecheck 红灯),会一并做重复判定和冲突分析,结论稍后更新在本帖。

@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 Review 完成,结论:PR #2007 可合并。

验证过程(全部实测):master 本地复现恰好 12 错(与 issue 描述逐条一致);三个同题 PR 各建 worktree 跑 tsc -p tsconfig.json;#2007 head 上 4 个触碰的测试文件实跑 14/14 通过(codex-responses-ws 5、issue1987 1、issue1993 5、ws-bridge 3);CI check-runs #2007 = 16/16 全绿,基线 = 当前 master tip(33d58e5),mergeable=true。

七问:

  1. 是什么问题:master CI typecheck(tsc -p tsconfig.json,含 tests/)在 fix(preflight): log+dump rejected summary bodies and shrink-retry hard 400/413 #1994、fix: preflight transport resilience + shipped-payload baseline anchor (#1987) #1989 先后合并后挂 12 个类型错误,所有新 PR(如 [PR] fix(dsh): recover boot-race model-info cache on llm/adapters-updated #1946)继承红灯。不是运行时 bug,是类型层缺口。
  2. 什么原因导致的:新增测试文件对 unknown/联合类型的收窄缺失 + 从 server.ts import 了只被内部使用、未导出的 ProxyOptions(定义在 config.ts)。两个 PR 各自分支 CI 都绿,是快节奏合并下的语义竞态;fix: preflight transport resilience + shipped-payload baseline anchor (#1987) #1989 在其后又追加新的未收窄用法,使先开的 test: fix 7 typecheck errors in ws-lane and preflight-400 test files #2005 变成过期子集。
  3. 怎么修复的:全部 type-level,零运行时变更。server.ts 加一行 export type { ProxyOptions } from "./config.js"(让消费方按 startServer 签名就近取型);其余 3 个测试文件做最小转型(as AddressInfo ×2、Item[]/{code:string} 形参转型、fallback handler 改 async 函数体、Promise<void>),断言表达式零改动。
  4. 是否有回归问题:无。逐项过既有行为清单:① src 改动为 type-only export,编译期擦除,dist 字节不变,两种压缩模式(plugin/proxy)均不涉运行时路径;② ws-bridge fallback handler (_req,res)=>Promise.resolve(res.writeHead(200).end()) → async (_req,res)=>{res.writeHead(200).end();}——语义等价(同为立即 200+end),返回类型从 ServerResponse 变 void 正是签名要求的修正,非行为漂移;③ 其余全是断言语法级转型,表达式未动;④ 唯一有意变更:server.ts 公共导出面 +1 个类型符号(见第 6 问)。无阈值/时序/输出格式/错误处理策略漂移。
  5. 是否破坏缓存:不涉及(无缓存、重试、增量游标、去重键路径被触碰)。
  6. 是否改了设计方向:不涉及。唯一可议点是 server.ts 新增一个 type export——属模块契约补全而非架构转向;替代方案(fix: clear the 7 root-tsconfig type errors gating master typecheck (#2003) #2006:测试侧绕道 config.ts import,零 src 变更)见下方重复判定,由 owner 二选一。
  7. 是否引入了新的配置:不涉及。

重复判定(open 区同题 3 个 PR,已处置):

顺带发现 → 已立项 #2009(带来源标记):tests/dsh-settings-ui.test.ts:241,387 直接 await import("esbuild"),但 esbuild 不在任何直接依赖里,靠 npm 扁平提升(tsup@8.5.1 传递依赖 esbuild@0.27.7)才解析——pnpm 严格布局下本地 typecheck 恒多 4 错。独立机制(依赖声明缺失 vs 本 PR 的类型收窄),按要求拆分单列。

收工判定:mergeable、基线最新、CI 全绿、定向测试全过、diff 干净(4 文件 +9/-7,每行皆与本 PR 目的相关)——可合并,合并动作留给 owner。合并后 #1946 继承的 4 个 test lane 红灯即消除(rebase/re-run 即可)。

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.

master npm run typecheck red — 4 test files break tsc, all CI test jobs fail

1 participant