Skip to content

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

Closed

Description

@ranxianglei

来源: #1996 (#1996) 分析 system 消息位置 400 时发现

Problem

On current master, npm run typecheck (tsc --noEmit --project tsconfig.json) fails with 10 errors across 4 test files. Consequence: every CI test job (ubuntu/windows × node22/24) fails at the typecheck step — verified on master HEAD 33d58e5e (all four test (...) check-runs completed failure). No PR can go green until this is repaired.

Repro

git checkout master && npm ci && npm run typecheck

Errors (exact, node 22)

  • tests/codex-responses-ws.test.ts(144,198): TS2339 Property 'map' does not exist on type '{}'
  • tests/codex-responses-ws.test.ts(192,42) / (192,76): TS2571 Object of type 'unknown' / TS7006 implicit any
  • tests/codex-responses-ws.test.ts(242,22): TS18046 'error.error' is of type 'unknown'
  • tests/issue1987-preflight-baseline-anchor.test.ts(11,28): TS2459 'ProxyOptions' declared locally in '../src/server.ts', not exported; plus (91,26)/(95,23): address() possibly null / port on string|AddressInfo
  • tests/issue1993-preflight-400.test.ts(17,28): TS2459 same ProxyOptions import
  • tests/ws-bridge.test.ts(45,67): TS2322 Promise not assignable to Promise
  • tests/ws-bridge.test.ts(111,59): TS2794 expected 1 argument — missing Promise<void> type arg

Root cause

src/server.ts now imports ProxyOptions from ./config.js and no longer re-exports it, but three test files from recent merges still import it from ../src/server.ts. Separately, a few untyped expressions in codex-responses-ws.test.ts and ws-bridge.test.ts fail strict tsc. Same failure domain (the repo's tsc gate), filed as one issue.

Impact

CI gate fully blocked: every open/new PR shows red test jobs regardless of content; §7.4 auto-merge condition "green on the rebased head" is unsatisfiable for anyone.

Suggested fix (already applied, type-level only, zero runtime change)

  • import ProxyOptions from ../src/config.ts (canonical location used by all other test files);
  • (server.address() as AddressInfo).port where address() result is used;
  • explicit Promise<void> / block-body callbacks returning Promise.resolve();
  • narrowing casts on Record<string, unknown> fields (as unknown[], as Record<string, unknown>).
    Applied as a separate labeled commit (fix: repair pre-existing typecheck breakage in 4 test files (unblocks CI gate)) on branch wt-1996-ework-daemon alongside the 压缩的时候system消息不在最前面报错 #1996 work. Post-fix: npm run typecheck exits 0; the touched hermetic suites pass (issue1987/issue1993/ws-bridge 9/9).

Activity

  1. ranxianglei commented on Oct 3, 2026

    @ranxianglei
    OwnerAuthor

    🤖 Powered by ework · qwen3.8-27b

    [bot] 🏷 进展同步(初步审核已完成,正在做本地验证):

    1. 复现确认:master HEAD 33d58e5e 上 npm ci && npm run typecheck 红,12 个错误、4 个测试文件,与 issue 清单逐条一致(codex-responses-ws ×4 / issue1987 ×5 / issue1993 ×1 / ws-bridge ×2)。根因核实:ProxyOptions 定义在 src/config.ts:598,src/server.ts:11 只 import 不 re-export,而这两个测试文件仍从 ../src/server.ts 导入(其余 ~190 个测试文件都从 ../src/config.ts 导入)。

    2. 查重发现(重要):已有两个 open PR 覆盖同一失败域——

      按「一个 issue 至多一个 PR」纪律,我不会再开第三个重复 PR。正在本地检出 fix(typecheck): unblock CI — export ProxyOptions + type-narrow #1987/#1994/ws-bridge tests #2007 的 head 跑 typecheck + 四个受影响测试套件取证,随后给出结构化结论与合并建议。

  2. ranxianglei commented on Oct 3, 2026

    @ranxianglei
    OwnerAuthor

    🤖 Powered by ework · qwen3.8-27b

    [bot] 🏷 验证完成。结论:本 issue 不需要新 PR —— 建议直接合并 PR #2007(我已在其正文追加 Closes #2013,合并后本 issue 自动关闭)。

    结构化七问:

    1. 是什么问题:master 的 tsc 门禁(npm run typecheck)在 fix: preflight transport resilience + shipped-payload baseline anchor (#1987) #1989/fix(preflight): log+dump rejected summary bodies and shrink-retry hard 400/413 #1994 合并后变红——4 个测试文件共 12 个错误,导致每个 PR(无论内容)的全部 4 条 CI test lane 必挂,§7.4「green on the rebased head」对所有人不可满足。
    2. 什么原因导致的:同一失败域内两个独立成因:① ProxyOptions 规范定义在 src/config.ts:598,src/server.ts:11 只 import 不 re-export,而 issue1987/issue1993 两个测试文件仍从 ../src/server.ts 导入 → TS2459(快节奏合并下的语义竞态:两个 PR 各自分支 CI 都绿,叠加到 master 才断);② 同批合并在 codex-responses-ws/ws-bridge 引入的 strict 违规(unknown 上直接操作、Promise<void> 缺类型参数)。
    3. 怎么修复的:按 loop guard + 查重纪律,未开新 PR,逐一本地验证了两个已存在的 open PR:
    4. 是否有回归问题:逐行审了 fix(typecheck): unblock CI — export ProxyOptions + type-narrow #1987/#1994/ws-bridge tests #2007 diff——全部 type-level:type-only re-export 编译期擦除;收窄 cast 只出现在断言消息构造/形参标注/(address() as AddressInfo);ws-bridge handler 改动运行时等价(两者都是 writeHead(200).end())。零运行时行为变化,无阈值/时序/输出格式漂移,14 个测试断言逻辑零改动。既有行为清点:唯一触碰面是 server.ts 导出面(+1 type alias,纯增量)。
    5. 是否破坏缓存:不涉及(未触碰任何缓存/重试/游标/去重键)。
    6. 是否改了设计方向:不涉及(无架构/边界/数据流变更;两候选方案的导入路径偏好属 owner 裁量,若偏好规范导入方向,fix(typecheck): unblock CI — export ProxyOptions + type-narrow #1987/#1994/ws-bridge tests #2007 合并后可再提一个小的 follow-up 把两个测试改从 config.ts 导入并撤掉 re-export)。
    7. 是否引入了新的配置:不涉及。

    判定:建议现在合并 #2007——专用、最小、全验证通过,立即解锁所有其他 PR 的 CI lane。合并后 #2014 的 labeled repair commit 变冗余(narrowing hunks 与 #2007 重叠),rebase 到新 master 时丢掉该 commit、只留 #1996 工作即可。另:#2007 正文提到的 esbuild devDep 发现已有 open PR #2010 覆盖,无需重复立项。

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions