Repository navigation
fix(ci): 修复 main 上 Static checks 与 Vitest 的既有失败 / restore green Static checks and Vitest on main - #1347
Conversation
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.
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
|
感谢贡献,清理得很干净,已合并到 main! |
摘要
main 的 CI 从 11-27 起一直有两项失败,所有 PR 都继承了这两项红灯(例如 #1346、#1336、#1330):
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。renderer-binding-probe-host-catalog.test.ts里有 6 个用例失败。本 PR 只修这些既有失败,不改行为,按类别分成 4 个提交:
style(web):用 Prettier 格式化SidebarRoot.tsx(586128455 留下的超宽行)。改动与 fix(omp): classify 19.2.1 default-model stderr as configurationRequired #1336 中的同一处完全相同,两个 PR 都合入也不会冲突。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,取到的是同一个对象。test:修 5 个测试文件里的 10 个类型错误(tsc -p tests/tsconfig.json)。extension-activity.test.ts的部分快照改为先转成unknown,与client-snapshot-compaction.test.ts的现有写法一致。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.ts50 个通过。node --import tsx --test运行 6 个改动过的 web-server 测试文件:93 个通过。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):
prettier --check ., so the laternpm run lintandnpm run typechecksteps 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.renderer-binding-probe-host-catalog.test.ts.This PR fixes only these existing failures, without behavior changes, in 4 commits by category:
style(web): formatSidebarRoot.tsxwith 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.fix(ci): clear 23 ESLint errors in 9 files:import()type annotations, non-null assertions, aletthat is assigned once andPromise.withResolvers<void>. Two of them are in production code:ch-thread-view.ts:projectoris cleared only together withdone = true, so skipping a missing projector is equivalent to the olddonecheck.peer-pairing.ts: the narrowedintroduced.record.namereplacesintroducedRecord!.nameand reads the same object.test: fix 10 type errors in 5 test files (tsc -p tests/tsconfig.json). The partial snapshot inextension-activity.test.tsis now cast throughunknown, asclient-snapshot-compaction.test.tsalready does.test(renderer):isDelegationMentionMutationNode, added by 9898485, callsmatches()andclosest()on Composer mutations. The test'sFakeElementhad nomatches(), so 6 cases threwTypeError: node.matches is not a function.FakeElementnow has a defaultmatches(), and the editor'sclosest()returnsnullfor 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'sscripts/apply-dependency-patches.mjswas run by hand, because the install script of@qoder-ai/qoder-agent-sdkfailed to download on this machine.prettier --check .flagsSidebarRoot.tsx;eslint .reports 23 errors;tsc -p tests/tsconfig.json --noEmitreports 10 errors; the target Vitest file has 6 failing cases.npx prettier --check .,npm run lintandnpm run typecheckpass.npx vitest run --config tests/vitest.config.json the 7 changed Vitest files: 165 passed, including 50 inrenderer-binding-probe-host-catalog.test.ts.node --import tsx --teston the 6 changed web-server test files: 93 passed.UI Demo
No visual changes: formatting, lint and test fixes only;
SidebarRoot.tsxonly gets a Prettier line break.