ci: Test Core 按包两路分片,verify-CLI 拆为独立并行 job(PR 关键路径 ~13min → ~7min) - #4505
Merged
Conversation
CI 提速:PR 关键路径从 ~13 分钟降到 ~7 分钟。 - Test Core 改为 2 路矩阵,按包分片:scripts/partition-test-shards.mjs 以 测试文件数为权重做确定性 LPT 均衡(当前全量 573/572)。不用 dogfood 的 vitest --shard 透传,因为 vitest 4 对测试文件数少于分片数的包直接报错, 加 --passWithNoTests 后该包在所有分片上都不执行(静默丢覆盖);今天有 3 个单测试文件的包。required check 名称契约由新增的 test-gate 聚合 job 以裸 "Test Core" 上下文承载(#3622 教训,同 dogfood-gate)。 - `objectstack verify` CLI 步骤从 dogfood shard 1 尾部(串行 +4.5 分钟) 拆为并行的 dogfood-verify job,结果并入既有 Dogfood Regression Gate, 分支保护无需变更。 - temporal-conformance 的 Turbo 缓存回退键从 turbo-test-* 改指 turbo-build-core-*:test 命名空间分片化后,单个分片不再是其构建闭包 的超集,而 Build Core 构建全部包。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U8Ms7unkKxTrmNCX2r1dfs
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
verify 步骤挂在 dogfood shard 1 时,workspace 已被测试步骤全量构建, --filter=@objectstack/cli 就够;独立成 job 后,打包的 objectstack.config 在运行时还要导入示例 app 自身的依赖(如 app-showcase 的 @objectstack/connector-mcp),其 dist 无人构建 → verify 时 ERR_MODULE_NOT_FOUND。改用 pkg... 闭包过滤同时构建 CLI 与两个示例 app 的依赖闭包,依赖变动时自维护。已本地实测 app-showcase verify 通过。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U8Ms7unkKxTrmNCX2r1dfs
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.
背景
对 2026-08-01 的真实 PR 运行(如 run 30699899662)做了逐 job 计时分析:
改动
1. Test Core 按包两路分片
scripts/partition-test-shards.mjs:读取turbo ls [--affected] --output=json,以每包测试文件数为权重做确定性 LPT 均衡分片(当前全量 573/572),带--self-test。--shard透传方案,已实测排除:vitest 4.1.10 对测试文件数少于分片数的包直接报错--shard <count> must be a smaller than count of test files;加--passWithNoTests后该包的测试在所有分片上都不执行——静默丢失覆盖。当前有 3 个单测试文件的包(sdui-parser、create-objectstack、embedder-openai)。--filter的turbo run test会跑整个 workspace)。test-gate聚合 job 以裸Test Core上下文报告(与dogfood-gate同一 chore(ci): cut PR wall-clock ~9.5min → ~5-6min — dedupe dogfood, shard it, cache lint's build #3622 模式),分支保护无需改动;cancelled语义同 dogfood-gate。2. verify-CLI 拆为并行 job
objectstack verify(app-crm + app-showcase,~4.5 min)原来串行挂在 dogfood shard 1 尾部,使 shard 1 接近 shard 2 的两倍时长。现拆为dogfood-verify并行 job(Turbo 缓存回退到 build-core 命名空间,CLI 构建闭包基本命中),结果并入既有Dogfood Regression Gate聚合,分支保护无需改动。3. 连带修正
temporal-conformance的 Turbo 缓存回退键从turbo-test-*改指turbo-build-core-*:test 命名空间分片化后单个分片不再是构建闭包的超集,Build Core 构建全部包才是。验证
partition-test-shards.mjs --self-test通过(覆盖性/确定性/均衡界/退化输入)。$FILTERS展开 +turbo run test)实跑通过。pnpm check:node-version通过。预期效果
PR 关键路径 ~12.8 min → ~7 min(Test Core 每片约一半 + dogfood 两片均衡);merge queue 同样受益(full run 也分片)。
未做(需管理员决策)
Turbo 远程缓存(Vercel Remote Cache 或自托管)可根治"PR 只读缓存导致同 PR 重复 push 全量重跑"和 10 GB 缓存池驱逐问题,但需要组织级 token/基础设施,不在本 PR 范围。
🤖 Generated with Claude Code
https://claude.ai/code/session_01U8Ms7unkKxTrmNCX2r1dfs
Generated by Claude Code