Skip to content

fix(ci): 修复 main 上 Static checks 与 Vitest 的既有失败 / restore green Static checks and Vitest on main - #1347

Merged
iruriQ merged 4 commits into
BytePioneer-AI:mainfrom
sduhantao-maker:fix/ci-main-green
Nov 28, 2026
Merged

iruriQ merged 4 commits into
BytePioneer-AI:mainfrom
sduhantao-maker:fix/ci-main-green

Conversation

@sduhantao-maker

Copy link
Copy Markdown
Contributor

摘要

main 的 CI 从 11-27 起一直有两项失败,所有 PR 都继承了这两项红灯(例如 #1346、#1336、#1330):

  • Static checks 在第一步 prettier --check . 就失败,所以后面的 npm run lint 和 npm run typecheck 一直没有运行。prettier 修好后,lint 还有 23 个错误,typecheck 还有 10 个错误。fix(omp): classify 19.2.1 default-model stderr as configurationRequired #1336 已修了同一处 prettier,它的 Static checks 就停在了 lint。
  • Vitest 在 renderer-binding-probe-host-catalog.test.ts 里有 6 个用例失败。

本 PR 只修这些既有失败,不改行为,按类别分成 4 个提交:

  1. style(web):用 Prettier 格式化 SidebarRoot.tsx(586128455 留下的超宽行)。改动与 fix(omp): classify 19.2.1 default-model stderr as configurationRequired #1336 中的同一处完全相同,两个 PR 都合入也不会冲突。
  2. fix(ci):清掉 9 个文件里的 23 个 ESLint 错误,包括 import() 类型注解、非空断言、只赋值一次的 let 和 Promise.withResolvers<void>。涉及两处生产代码:
    • ch-thread-view.ts:projector 只会和 done = true 一起被清空,所以「没有 projector 就跳过」与原来的 done 判断等价。
    • peer-pairing.ts:用已收窄的 introduced.record.name 代替 introducedRecord!.name,取到的是同一个对象。
  3. test:修 5 个测试文件里的 10 个类型错误(tsc -p tests/tsconfig.json)。extension-activity.test.ts 的部分快照改为先转成 unknown,与 client-snapshot-compaction.test.ts 的现有写法一致。
  4. test(renderer):98984852a 新增的 isDelegationMentionMutationNode 会对 Composer 变更调用 matches() 和 closest()。测试里的 FakeElement 没有 matches(),6 个用例报 TypeError: node.matches is not a function。现在给 FakeElement 加了默认的 matches(),并让编辑器的 closest() 对委派提及菜单的选择器返回 null。否则编辑器的变更会被当成菜单变更,不再触发扫描,这些用例就测不到原本要测的行为。

第 2、3 项大部分沿用 #1283 里为过 CI 加入、合并时被剥离的提交 ab5905b。这次单独提交,并删掉了其中一行重复的断言。

关联 Issue

无 / N/A。受影响的 PR 包括 #1346。

测试

基于 main(b9dace80d),macOS(arm64),Node 26.0.0。依赖用 npm ci --ignore-scripts 安装,再手动运行仓库的 scripts/apply-dependency-patches.mjs,因为 @qoder-ai/qoder-agent-sdk 的安装脚本在本机下载失败。

  • 修改前复现:prettier --check . 报 SidebarRoot.tsx;eslint . 报 23 个错误;tsc -p tests/tsconfig.json --noEmit 报 10 个错误;目标 Vitest 文件 6 个用例失败。
  • 修改后:npx prettier --check .、npm run lint、npm run typecheck 都通过。
  • npx vitest run --config tests/vitest.config.js 运行 7 个改动过的 Vitest 文件:165 个通过,其中 renderer-binding-probe-host-catalog.test.ts 50 个通过。
  • node --import tsx --test 运行 6 个改动过的 web-server 测试文件:93 个通过。
  • 本地未运行:完整的 Vitest 和 Web Host 测试套件、Rust 检查,由 CI 覆盖。

UI Demo

No visual changes: 只有格式化、lint 和测试修复,SidebarRoot.tsx 只是 Prettier 换行。


Summary

Since 11-27, two CI checks have been failing on main, and every PR inherits them (for example #1346, #1336 and #1330):

  • Static checks fails at its first step, prettier --check ., so the later npm run lint and npm run typecheck steps never run. Once Prettier passes, lint still has 23 errors and typecheck has 10. fix(omp): classify 19.2.1 default-model stderr as configurationRequired #1336 already fixes the same Prettier line, and its Static checks stops at lint.
  • Vitest has 6 failing cases in renderer-binding-probe-host-catalog.test.ts.

This PR fixes only these existing failures, without behavior changes, in 4 commits by category:

  1. style(web): format SidebarRoot.tsx with Prettier (an over-long line left by 5861284). The change is identical to the same hunk in fix(omp): classify 19.2.1 default-model stderr as configurationRequired #1336, so merging both does not conflict.
  2. fix(ci): clear 23 ESLint errors in 9 files: import() type annotations, non-null assertions, a let that is assigned once and Promise.withResolvers<void>. Two of them are in production code:
    • ch-thread-view.ts: projector is cleared only together with done = true, so skipping a missing projector is equivalent to the old done check.
    • peer-pairing.ts: the narrowed introduced.record.name replaces introducedRecord!.name and reads the same object.
  3. test: fix 10 type errors in 5 test files (tsc -p tests/tsconfig.json). The partial snapshot in extension-activity.test.ts is now cast through unknown, as client-snapshot-compaction.test.ts already does.
  4. test(renderer): isDelegationMentionMutationNode, added by 9898485, calls matches() and closest() on Composer mutations. The test's FakeElement had no matches(), so 6 cases threw TypeError: node.matches is not a function. FakeElement now has a default matches(), and the editor's closest() returns null for the delegation mention menu selector. Otherwise editor mutations would count as menu mutations and stop scheduling scans, and these cases would no longer test the behavior they were written for.

Most of items 2 and 3 reuse commit ab5905b, which was added to #1283 to get CI passing and was stripped when that PR was merged. It now comes as a separate PR, with one duplicated assertion removed.

Related issues

N/A. Affected PRs include #1346.

Test plan

On main (b9dace8), macOS (arm64), Node 26.0.0. Dependencies were installed with npm ci --ignore-scripts, then the repository's scripts/apply-dependency-patches.mjs was run by hand, because the install script of @qoder-ai/qoder-agent-sdk failed to download on this machine.

  • Before the change: prettier --check . flags SidebarRoot.tsx; eslint . reports 23 errors; tsc -p tests/tsconfig.json --noEmit reports 10 errors; the target Vitest file has 6 failing cases.
  • After the change: npx prettier --check ., npm run lint and npm run typecheck pass.
  • npx vitest run --config tests/vitest.config.js on the 7 changed Vitest files: 165 passed, including 50 in renderer-binding-probe-host-catalog.test.ts.
  • node --import tsx --test on the 6 changed web-server test files: 93 passed.
  • Not run locally: the full Vitest and Web Host suites and the Rust checks; CI covers them.

UI Demo

No visual changes: formatting, lint and test fixes only; SidebarRoot.tsx only gets a Prettier line break.

5861284 left the chevron className line over the print width, so `prettier --check .` fails in Static checks.
Static checks stopped at Prettier, so these 23 errors never surfaced. Replace import() type annotations, non-null assertions, a let that is assigned once and void resolver types without changing behavior. ChThreadView clears projector only together with done, so skipping a missing projector matches the old done check.
tsc -p tests/tsconfig.json reported 10 errors in five test files. Narrow the release-notes children, keep the recorded npm arguments mutable, cast the partial Thread snapshot through unknown as client-snapshot-compaction.test.ts does, give the credits fixture its required periodType, and annotate a loop counter.
9898485 checks Composer mutations against the delegation mention menu with matches() and closest(). The fixture's FakeElement had no matches(), so six cases threw TypeError. Add a default matches() and keep the editor outside the menu selector, so editor mutations still schedule scans.
@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 修复
    • 改进本地 Host 配对时显示的名称:优先使用本地分享名称,不可用时显示“Local Host”。
    • 避免在视图已完成或缺少处理器时继续处理会话内容。
  • 测试与维护
    • 调整测试中的类型声明与断言;未涉及面向用户的功能变化。

本次变更调整 Web Server 的 Turn 投影检查和本地主机配对名称处理,并修改多个测试中的类型、断言和测试替身。侧栏切换箭头的条件类名逻辑未变,仅调整排版。

Changes: 运行时与测试调整

Layer / File(s) Summary
Web Server 逻辑与配对测试
packages/web-server/src/ch-thread-view.ts, packages/web-server/src/peer-pairing.ts, packages/web-server/test/peer-host-manager.test.ts
projectTurns 在 view.done 为假且 projector 存在时才处理 Turn。本地配对介绍名称改为使用 selfShare.name,缺少名称时回退为 "Local Host"。相关测试调整了断言和 Promise resolver。
Renderer 测试替身与断言
packages/renderer-extension/test/renderer-binding-probe-host-catalog.test.ts, packages/renderer-extension/test/renderer-binding-probe.test.ts, packages/renderer-extension/test/renderer-handoff-control.test.ts, packages/renderer-extension/test/settings/release-notes.test.ts
测试替身增加 delegation mention 菜单选择器处理。测试输入补充 periodType,并将按钮存在性和围栏节点类型改为显式断言。
测试类型与 Promise resolver
packages/host-runtime/test/desktop-mcp-bridge.test.ts, packages/host-runtime/test/extension-activity.test.ts, packages/update-manager/test/npm-registry.test.ts, packages/web-server/test/remote-peer-attachments.test.ts, packages/web-server/test/remote-peer-skills.test.ts, packages/web-server/test/remote-sessions.test.ts, packages/web-server/test/sidebar-browser-tab.test.ts, packages/web-server/test/tool-output-rpc.test.ts
测试代码调整了 IncomingMessage 类型导入、局部变量及集合类型,并将多个 Promise resolver 从 void 改为 undefined,对应调用显式传入 undefined。
侧栏箭头格式
apps/web-ui/packages/client/ui-sidebar/src/client/SidebarRoot.tsx
切换箭头的 className 表达式改为多行排版,条件类名逻辑未变。

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Other

Suggested reviewers: bytepioneer-ai, ump45nose

Merge Risk: Minimal · up to af42a

This PR fixes CI failures on main through formatting, lint, and test type changes, with two small equivalent runtime edits. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题"fix(ci): 修复 main 上 Static checks 与 Vitest 的既有失败 / restore green Static checks and Vitest on main"与变更集相符。变更包括用 Prettier 格式化 SidebarRoot.tsx、清理 9 个文件中的 23 个 ESLint 错误、修复 5 个测试文件中的 10 个类型错误,以及修复 rende…
Description check Passed 描述与变更集高度相关。它说明了 main 上 CI 失败的原因、四个分类提交(格式化、ESLint 修复、测试类型修复、renderer 测试夹具修复)、两处生产代码的等价性论证以及本地验证结果,与原始摘要和目标一致。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

标题"fix(ci): 修复 main 上 Static checks 与 Vitest 的既有失败 / restore green Static checks and Vitest on main"与变更集相符。变更包括用 Prettier 格式化 SidebarRoot.tsx、清理 9 个文件中的 23 个 ESLint 错误、修复 5 个测试文件中的 10 个类型错误,以及修复 renderer 测试夹具导致的 6 个 Vitest 失败用例。标题准确概括了主要目标,但标题较长且中英混用。

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 42e4bfe and af42a4a.

Files selected for processing: 16

  • apps/web-ui/packages/client/ui-sidebar/src/client/SidebarRoot.tsx
  • packages/host-runtime/test/desktop-mcp-bridge.test.ts
  • packages/host-runtime/test/extension-activity.test.ts
  • packages/renderer-extension/test/renderer-binding-probe-host-catalog.test.ts
  • packages/renderer-extension/test/renderer-binding-probe.test.ts
  • packages/renderer-extension/test/renderer-handoff-control.test.ts
  • packages/renderer-extension/test/settings/release-notes.test.ts
  • packages/update-manager/test/npm-registry.test.ts
  • packages/web-server/src/ch-thread-view.ts
  • packages/web-server/src/peer-pairing.ts
  • packages/web-server/test/peer-host-manager.test.ts
  • packages/web-server/test/remote-peer-attachments.test.ts
  • packages/web-server/test/remote-peer-skills.test.ts
  • packages/web-server/test/remote-sessions.test.ts
  • packages/web-server/test/sidebar-browser-tab.test.ts
  • packages/web-server/test/tool-output-rpc.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.

Recent review details

Context from checks skipped due to timeout: 8

  • GitHub Check: CodeRabbit
  • GitHub Check: Static checks
  • GitHub Check: Web Host tests
  • GitHub Check: Check Linux ARM64
  • GitHub Check: Check macos-26
  • GitHub Check: Vitest
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Check windows-latest
Additional context used

Code guidelines: 3

AGENTS.md — auto-discovered
CLAUDE.md — auto-discovered
docs/product/standalone-web.md — auto-discovered
Path-based instructions: 3

Source excerpt: `renderer-extension` must not import Node.js built-ins, Electron private APIs, or Harness SDKs.

CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/renderer-extension/test/renderer-binding-probe-host-catalog.test.ts
  • packages/renderer-extension/test/renderer-binding-probe.test.ts
  • packages/renderer-extension/test/renderer-handoff-control.test.ts
  • packages/renderer-extension/test/settings/release-notes.test.ts
Source excerpt: Host Runtime loads installed plugins through public contracts, not direct imports of concrete Adapter packages.

CodeRabbit inference engine (AGENTS.md)

Files:

  • packages/host-runtime/test/desktop-mcp-bridge.test.ts
  • packages/host-runtime/test/extension-activity.test.ts
Applicability reference: AGENTS.md: # Repository Guidelines `npm start` / `npm start web` rebuild and relaunch the user's Desktop / Web and may restart the shared Host; `npm stop` stops all local codexhost services across worktrees.

CodeRabbit inference engine (docs/product/standalone-web.md)

Files:

  • apps/web-ui/packages/client/ui-sidebar/src/client/SidebarRoot.tsx
  • packages/web-server/src/ch-thread-view.ts
  • packages/web-server/src/peer-pairing.ts
  • packages/web-server/test/peer-host-manager.test.ts
  • packages/web-server/test/remote-peer-attachments.test.ts
  • packages/web-server/test/remote-peer-skills.test.ts
  • packages/web-server/test/remote-sessions.test.ts
  • packages/web-server/test/sidebar-browser-tab.test.ts
  • packages/web-server/test/tool-output-rpc.test.ts

@iruriQ
iruriQ merged commit cccd156 into BytePioneer-AI:main Nov 28, 2026
5 of 8 checks passed
@iruriQ

iruriQ commented Nov 28, 2026

Copy link
Copy Markdown
Collaborator

感谢贡献,清理得很干净,已合并到 main!

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.

2 participants