Skip to content

fix(ci): test-shards 探测不再因 SIGPIPE 跳过 node 分片 - #240

Merged
sweetcornna merged 3 commits into
mainfrom
fix/ci-shard-probe
Oct 18, 2026
Merged

sweetcornna merged 3 commits into
mainfrom
fix/ci-shard-probe

Conversation

@sweetcornna

Copy link
Copy Markdown
Owner

问题

atlas/scripts/test-shards.sh 在 set -o pipefail 下用 find … -print | grep -q . 判断目录里有没有测试。GNU find 的输出超过约 4 KB 时会分几次写;grep -q 读到第一行就退出,find 下一次写收到 SIGPIPE,管道返回 141,脚本当成「没有测试」把整个分片跳过。

atlas/packages/node 的测试路径清单约 11 KB,每次都中:从 10-10 换基座起,Linux CI(和 sync-omp)一次都没跑过 node 的 195 个测试文件、约 2200 条用例(10-10、10-11、10-17、10-18 的 CI 日志里分片编号都从 negotiation 直接跳到 paths)。macOS 的 find 不触发,所以本机 verify 一直在跑 node。console 的清单 3.8 KB,再加几个测试文件也会被跳过。

改动

  • 探测改成 [ -z "$(find … -print -quit)" ],不经管道。
  • 新增 --list:只打印会跑的分片目录,不跑测试、不清 test-reports/。
  • 回归用例 atlas/scripts/__tests__/testShards.test.ts:分片清单与独立遍历算出的一致(必须含 atlas/packages/node);测试清单远超一次管道写入的目录仍是分片;没有测试的目录(含只在 node_modules 里有)不是分片。

预期影响

  • 本 PR 的 CI 会第一次在 Linux 上跑 node 分片,ci 时长会多约 9–12 分钟;随后另开 PR 缓存原生插件构建把时间拿回来。
  • 如果出现只在 Linux 红的 node 用例,在这里一并处理。

验证

  • 本机:新用例 3 pass;--list 输出 36 个分片含 node;license-headers OK。
  • Linux 上旧写法会红的证据以本 PR 的 CI 日志为准(日志里要出现 shard N: atlas/packages/node)。

pipefail 下 find | grep -q . 在 GNU find 分多次写(约 4 KB 以上)时
返回 141,被当成「没有测试」,atlas/packages/node 从换基座起在
Linux CI 上从没跑过。改用 find -print -quit,不经管道。

加 --list(只列分片、不跑、不清 test-reports)和回归用例:
分片清单与独立计算的一致,超长清单的目录仍算分片。
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T04:28:46.453235Z e4742fd New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2bcb642fd

ℹ️ 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".

400 个文件约 64–70 KB,GNU find 偶尔能在 grep -q 退出前写完,旧写法
200 次里有 5 次通过。放大到 4000 个长文件名,远超管道缓冲加 grep 一次
读取,find 必然在 grep 退出后还要写;旧探测本机 20/20 失败。
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.

1 participant