Repository navigation
perf(ci): speed up unit test gate and add hygiene checks - #6196
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Signed-off-by: MagicLizi <jiali@magiclizi.com>
Signed-off-by: MagicLizi <jiali@magiclizi.com>
Signed-off-by: MagicLizi <jiali@magiclizi.com>
f4fdb6e to
3441f52
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f4fdb6e19b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
[High impact] Adds test hygiene checks and restructures CI test execution. 整体可以合并;建议补齐源码读取门禁对现有 helper 写法的识别。 Findings
Fix with agent prompt### Issue 1
scripts/check-test-hygiene.mjs:132-134
这里漏掉了仓库已有的 `read(relative)` 写法。`remoteAgentRelocationWiring.test.ts` 在 helper 中调用 `readFileSync(resolve(__dirname, relative))`,却在另一行传入生产源码路径。检查只看字符串所在的单行,无法关联这两处,因此 `sourceReads` 为零,该文件也未进入基线。
后续沿用这种写法新增源码断言时,CI 仍会通过。建议识别这类 helper 读取路径,或要求无法判断的源码读取明确分类,并补上回归用例。
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3441f520b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: MagicLizi <jiali@magiclizi.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4d464d65e2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: MagicLizi <jiali@magiclizi.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 433248f7ff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: MagicLizi <jiali@magiclizi.com>
Signed-off-by: MagicLizi <jiali@magiclizi.com>
Signed-off-by: MagicLizi <jiali@magiclizi.com>
Signed-off-by: MagicLizi <jiali@magiclizi.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1bb1fb225
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: MagicLizi <jiali@magiclizi.com>
Signed-off-by: MagicLizi <jiali@magiclizi.com>
Signed-off-by: MagicLizi <jiali@magiclizi.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a7fe95729
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: MagicLizi <jiali@magiclizi.com>
Signed-off-by: MagicLizi <jiali@magiclizi.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a59e4040e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: MagicLizi <jiali@magiclizi.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d267f2de52
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: MagicLizi <jiali@magiclizi.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65d8f489ac
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: MagicLizi <jiali@magiclizi.com>
Signed-off-by: MagicLizi <jiali@magiclizi.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 27ab96cb14
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: MagicLizi <jiali@magiclizi.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a0f60371a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: MagicLizi <jiali@magiclizi.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c69d742bc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: MagicLizi <jiali@magiclizi.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c110ac265
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Signed-off-by: MagicLizi <jiali@magiclizi.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a3b0226d3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
上游 #6196 新增的回归断言分离窗可见时 clearAttentionWhenVisible 为 true;本 PR 起 分离窗只显示占位、不显示 Worker 对话,可见时也不应清提醒。同步该断言,保留 「隐藏时持续监听、可见才刷新投影」的其余检查。 Signed-off-by: fmfsaisai <fmfsaisai@gmail.com>
这次改了什么
摘要
原 Windows unit gate 关键路径约34.1–34.2分钟。本次将 Linux/Windows unit 从2片扩为各4片,分离可并行的runner/数据库检查,优化重型workspace与测试清理,并加入只减不增的测试卫生门禁。目标是缩短完整CI反馈时间,同时保留必要的行为与跨运行时契约。
变更类型
范围
UI 变化
不涉及:renderer生产文件仅更新被移除测试的注释引用,没有JSX、样式、交互或文案变化。
怎么验证的
自动验证
当前 PR head 5a3b022:
当前完整 client-ci 38922969203 13/13项成功,同head CodeQL全部通过。Windows四片分别16分33秒/14分55秒/17分24秒/18分30秒,最慢18分30秒;相对原34.1–34.2分钟约缩短46%。Linux四片、类型/guard/runner/数据库与Git集成均通过。下文历史样本仅作此前对照,不替代本head最终证据。
Desktop typecheck 通过;Mobile 在独立 frozen-lockfile 依赖环境中 typecheck 通过。完整 check:test-hygiene 372 个文件通过,基线只收紧未上调;check:dev-docs 10/10、diff 检查和 Windows atomic rename 通过。DCO 34 个签名提交、5 个 merge 豁免。
Thread reaction 用例保留 me、count=2、完整分页参数及其余断言,仅等待独立 reactors 请求的最终数字:ChatServerControls + ChatReactionButton 60/60 通过,完整命令 30.09 秒(执行 3.47 秒)。独立只读复核无 P0/P1,无产品修改或超时放宽。上一 head 59db 的 run38896139612 只有该条 Windows 第4片用例失败,其余三片 Windows、四片 Linux、verify-checks、runner/DB 和 Git 集成全部通过。
在既有 dropdownMenuHighlight 中补共享 SubContent 的真实点击打开与 body/父菜单 DOM 边界回归:23/23 通过,Vitest 1.70 秒/完整命令 2.59 秒。内存中只移除 SubContent Portal 后,新断言准确失败(exit 1);生产代码字节未改。该覆盖独立于 SidebarFilterPopover。
最新 main 新增的两条 runOnJS 跨 UI/JS native 契约已迁入既有 required guard,原 4 条行为用例完整保留;Mobile 三文件 16/16 通过(12.46 秒)。上一 a93 的 run38894877249 确实因该新主干源码断言命中卫生门而失败,迁移后完整卫生门通过;未放宽基线或改变原生配置。
scanner 4项完整自测通过(2.40秒);补齐真实 callback timer 的 const 别名、解构和 Node timers 绑定,按函数捕获时刻区分真假时钟,保留 namespace/default 检测及局部遮蔽。独立12项实际probe与root11项probe全部通过,无P0/P1,未修改基线额度。
最后修复 Promise timer 包装函数的静态漏检:d267f2de52 让包装函数按第一个时长参数计数,callback timer 仍按第二参数并保留捕获时钟判断;常量内层等待只计一次,参数与 fixture 遮蔽继续排除。旧 scanner 对真实回归返回 realWaits:0(exit1),修复后5项 probe正确;完整自测4/4、全仓卫生门374文件通过,独立 reviewer 对最终 head执行8项 probe全部通过。
d267 后的收尾修复(65d8f489ac)沿本地 resolve/join/URL 绑定传播仓库锚点,描述性别名不能绕过源码读取检测;真实等待名称只对直接函数调用或已解析的计时器包装生效,meter.pause 等对象方法不再误报。8 个 Desktop 与 1 个 maker-core 源码契约进入显式 guard,相关 scanner/manifest 自测93/93通过,完整卫生扫描373文件、0违规;基线从374收紧到373。
本地完整 test:runner 已最终重跑通过:588项,577通过/11按原条件跳过/0失败,194.20秒;Windows atomic rename 也通过。仅在当前测试进程清除宿主启动变量,系统设置未改。
本轮独立最终审查与原意一致性通过;对 main8252935c 与PR的无冲突组合树中20份后续主干变更测试用真实扫描器逐份检查均无违规。此前 b7 的完整 run38891939786 全部13个job通过,Windows最慢分片18分5秒;该历史性能样本不替代当前head门禁。
此前三处真实组件入口回归119/119通过:活动任务滚动、语音恢复默认、clean IM编辑。本轮收尾两份既有组件文件32/32通过:录音停止、真实模型选择回焦和市场更新/替换保持详情;坏变体均准确失败。空草稿两条既有回归经移除两个闸的变体分别证实有效并已回复关闭。最终Desktop typecheck、完整卫生门374文件、最终两文件实际扫描三项计数均0、docs10/10、diff检查均通过,产品源码未改。
在此前代码阶段还已完成:anthropic-compat-proxy 类型检查、完整双端 guard 与 Mobile unit、相关 Desktop 行为回归和 runner89项调度自测。当前 follow-up 补齐静态callback timer漏检、源码锚点别名与对象方法误报,并保留真实组件历史回归;最终 CI 再次执行完整 Linux/Windows 四分片及两端类型检查。
同机连续对照:codexProxyHost约105→6.7秒(285项及3种随机顺序通过),maker-core从1worker约248秒到4workers约65秒。完整AST卫生扫描约20秒,较最初文本扫描成本更高;不隐瞒该成本。性能审计见docs/dev-rules/desktop-unit-test-performance.md。
测试价值说明
所有新增回归均保护原有行为或具体历史缺口,不新增真实等待。普通unit走生产回调、React hooks/组件或脚本main;纯跨运行时契约进入required guard。最小失败输入、可观察结果、tier与实测如下:
这些行为回归复用原模块文件/harness,避免重复加载重型编辑器;超过5秒或10秒的既有文件如实列明,不放宽timeout。4项实际故障回放移除目标生产保护后,对应结果断言确实失败,随后生产代码逐字恢复,无实验改动入库。
新Desktop contract guard保留原跨运行时合同,原模块行为仍留unit;独立冷启动命令node node_modules/vitest/vitest.mjs run --maxWorkers=1均通过:
Mobile三份native guard分别守JS/native权限凭证及宿主生命周期、Fabric/MVCP/手势/UITextView、native E2E凭证/工作流边界;JS行为由unit覆盖。其余mixed文件逐项保留登录/consent、账号所有权、host-managed权限、pending发送与namespace/native边界;最终完整CI承担全量覆盖。
手工验证
不涉及产品UI;没有将复用测试样式等同于实机目检。
未执行的验证
本机未重跑最终完整Linux/Windows四分片,由上述当前head CI执行。独立 worktree 的 Desktop guard 因 Electron 二进制前置检查 version-missing 未启动,CI 将提供该项最终证据;maker-core guard 已通过。Semgrep未安装,未执行,未计作通过;未做产品UI实机目检,本次无界面变化。
风险
风险分类
影响与回滚
提交前检查
当前 head 收尾验证
d267 Promise timer wrapper 修复及 65d8 alias/wait 收尾已由独立 review 复核并绑定最终 head;此前 1a59 的本地类型检查、runner、UI 回归和 client-ci 证据仍适用于未变更字节,当前 head 的完整 CI 正在重新执行。
27ab96c 收尾:block-bodied async helper中的await计时器现在映射外层时长参数,短等待与内层常量去重保留。scanner/manifest 93/93、全仓卫生门373文件、Desktop typecheck、docs10/10及diff检查通过。独立review执行旧scanner漏检对照与10项probe,且把真实secondary Stop移到voice后方的内存变体使新回归准确失败。同步main1604e09e,两处冲突保持主干产品布局,既有teammatesSectionSpacing10项逐字保留并进入required guard;四份相关测试94/94通过16.07s。独立最终复核没有P0/P1,原意一致。当前head完整CI仍在执行。
9a0f603:路径别名的声明边界改用现有TypeScript AST,格式化多行resolve/join/URL与无分号声明完整读取;其余有限路径传播不变。实际旧scanner对多行例子sourceReads:0,修复后1;新增无分号fixture隔离反例。完整scanner自测4/4(2.48秒)、全仓卫生门373文件、独立6项probe与diff检查均通过,未改基线、运行期或测试超时。独立复核无P0/P1、原意一致;本轮只修改两个脚本文件,前一组合树的双端类型检查证据仍适用于未改字节,当前完整CI会重新验证。
Namespace paths and final contract routing
3c69d74:现有AST识别path.resolve、path['join']等namespace路径工厂及其格式化多行别名链。旧scanner对真实分行输入sourceReads:0,当前为1;fixture保持0,真实源码执行豁免保留。新增两条最小输入加入原有表,不增加文件。
新增识别的存量7文件逐项处理:resourceUsageEntryIsolation与markdownTargetRendererContract进入required guard;缓存6条结构断言和SubagentsBody的1条privileged-link传播断言完整搬入已有guard,运行期行为仍在unit。3份根脚本契约精确登记;migrationCompatibility原文件未改,原本属于manual DB,用冻结companion字节验证真实hash/manifest修复,按单文件输入用途登记。自测确认邻居DB文件仍受源码门禁,所有登记文件仍受reset/wait门禁。基线只删markdown的3条源码额度,373→372。
验证:scanner/manifest93/93(9.11秒)、相关5文件96/96(26.08秒;SubagentsBody原有慢poll行为约8秒,未改超时)、Desktop typecheck、完整卫生门372文件、docs10/10、diff检查与DCO均通过。独立review执行5项实际旧新probe、source/DB分类反例和基线逐项比较,No P0/P1、原意一致。当前完整CI重新覆盖两平台全部分片。
Final filename and composer behavior regressions
6c110ac:源码读取路径中的不可变const文件名及别名链现在沿用词法绑定识别;仅展开真实read路径参数中的字符串,fixture、shadow、动态/重赋值和源码执行豁免保持。scanner/manifest93/93(10.00秒),独立14项旧新对照通过。全仓卫生门仍372文件,基线未改。
既有ChatInput harness新增真实hardware dispatcher三种动作(submit/skill/composer-text):首次只撤预览,隐藏草稿不变且不发送,第二次确实执行动作。语音用真实effect、decoration和scroller验证saved range而非当前selection;range单独变化后锚点与scrollTop也更新。17/17通过(9.34秒,其中执行1.43秒;独立复跑17/17)。五项内存坏变体全部被断言拒绝(hardware gate、无滚动、忽略range、漏range依赖、强制滚底),独立第六项anchorLocked坏变体同样失败;生产磁盘字节未变。Desktop typecheck、docs10/10、diff与DCO通过。独立复核No P0/P1、原意一致。上一head3c69的client-ci38917865587完整13项全绿,Windows最慢17分17秒;本head重新跑完整CI,不复用历史绿灯。
Lightbox behavior retained after deletion audit
5a3b022:复用既有ImageLightbox组件harness新增一条正常模式回归:真实加载后有明确拟合尺寸;单击图片保持打开;连续两次点真实背景只关闭一次。原标注误点保笔迹用例保留。完整13/13通过(Vitest3.74秒,执行734ms),独立复核通过。四种内存坏变体(移除背景关闭、图片误关闭、重复关闭、移除拟合尺寸)均准确被断言拒绝,产品磁盘字节未改。Desktop typecheck、全仓卫生门372文件和diff通过;基线不变。最终49个整文件删除项逐项复核了旧断言与保留覆盖,没有继续增加冗余harness或源码接线断言。最终head全量CI仍以本次run为准。