Repository navigation
perf(test): 缓存 worker 编译并稳定 MCP 启动验证 - #3556
Merged
Merged
Conversation
Co-authored-by: TRAE CLI <[email protected]>
Co-authored-by: TRAE CLI <[email protected]>
fangyeqing
marked this pull request as ready for review
November 18, 2026 08:16
fangyeqing
requested review from
47seek,
LucasIcarus,
deepcoldy,
xiaoxueSunn and
xiongz-c
as code owners
November 18, 2026 08:16
deepcoldy
reviewed
Nov 18, 2026
deepcoldy
left a comment
Owner
There was a problem hiding this comment.
结论:可合,0 P1/P2。 以下两项仅为 P3/nit 硬化观察,不阻断合并。
审查范围为 head 54118857ff8421b3e0d65d8cc0c83cee70bf1f6b。PR 只改测试夹具、集成测试与类型检查登记,src/ 生产代码零改动。本地验证树是 rebase 后的 d32f081b2;已逐文件确认 PR 的 10 个文件与指定 head 无差异,其余整树差异来自 master。未修改或推送 PR 分支。
重点核对:
test/helpers/worker-module-snapshot.mjs:12-52:源码/产物身份包含元数据签名与内容 SHA-256;test/helpers/worker-module-snapshot.mjs:72-109在复制、编译前后校验输入,并在失败时恢复权限、清理私有目录。test/helpers/worker-test-modules.ts:31-63:显式 source 复现与 symlink 回退保持原执行路径;编译快照在 spawn 前再次验证源码及产物,worker 与测试 hook 使用同一模块树。test/workflow-c0-isolation.test.ts:99-158:以真实 JSON-RPCinitialize响应证明就绪,再发送notifications/initialized、关闭 stdin 并断言退出码 0;超时和异常路径会终止子进程并清理临时 HOME。
实际验证:
bun run build通过(含 typecheck),构建后工作树干净。- Node 缓存护栏:2 文件、15/15 通过。
- Bun 可执行缓存护栏
test/worker-test-modules.test.ts:11/11 通过。test/worker-module-snapshot-cache.test.ts:9-17使用importOriginal,属于既定 Bun deferred 范围,由上述 Node 腿覆盖。 test/workflow-c0-isolation.test.ts:Node 45/45、Bun 45/45 通过。- 三组真实 worker/PTY/tmux 集成测试:3 文件、83/83 通过,耗时 505.67s。
git diff --check 97637f5d..54118857f通过;指定 head 的 14 个 CI job 全部成功(Node/Bun 各四分片及汇总、build、glibc/musl/Darwin 二进制)。
非阻断观察:
test/helpers/worker-module-snapshot.mjs:23的根级输入(package.json、bun.lock、tsconfig.*)没有目录遍历内的 symlink 拒绝逻辑,因此这种布局不会主动回退 source 执行。本仓库没有此布局,且内容哈希仍校验实际字节,属于额外硬化。test/helpers/worker-module-snapshot.mjs:96-98的编译超时进程组清理限定非 Windows。当前 Windows CI 不运行这些集成测试,不影响现有测试矩阵。
Owner
|
感谢贡献,已合并 🎉 编译缓存夹具的双层指纹(stat 元数据 + 字节哈希)、只读快照、失败编译记忆与 source 回退设计都比较扎实,83 个真实 worker/PTY/tmux 案例全部保留并通过,Node 三文件耗时下降约 7%。 两个非阻断的硬化点,供后续按需跟进(当前均不影响正确性):
再次感谢,欢迎继续贡献。 |
|
@fangyeqing @deepcoldy 合入 master 后的 Midscene E2E 失败:Feishu live Midscene 失败。 这次运行覆盖 7a7307e…697de2f8e(10 个提交),同批合入的还有 #3540 #3552 #3530 #3558 #3563 #3561 #3562 #3560 #3564,失败不一定由本 PR 引起。
|
This was referenced Nov 18, 2026
|
🚀 Released in v3.59.20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TraeX Auto、continuation 与启动就绪三组集成测试逐案例通过 Node+tsx 加载完整 worker,反复支付转译与模块加载成本。本次给每个测试文件缓存一份当前源码的独立 JavaScript 编译快照,让真实 worker 与测试 hook 共用只读模块树。
快照复制源码、编译配置与依赖输入,使用现有 TypeScript 编译器在私有 outDir 发射代码;正常构建与类型检查仍使用原有流程。启动前校验输入及快照,源码变化或自有产物修改会拒绝旧夹具,symlink 输入和显式复现选项使用源码路径。失败的编译在同一文件内保持失败,避免重复启动编译器。临时快照在 worker 退出后清理。
影响范围为测试夹具与测试类型检查清单。保留全部 83 个既有案例、真实 PTY/tmux、时序窗口、输入去重与恢复断言;不调整 CI 分片或生产逻辑。
验证: