From 4b51fa06dfc97e8ba2c015546a5ffbf0d1df3e64 Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Sat, 8 Aug 2026 21:51:11 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=E5=88=86=E7=89=87=E6=95=B0=E8=A6=81?= =?UTF-8?q?=E6=95=B0=E8=85=BF,=E4=B8=8D=E6=98=AF=E6=95=B0=20job=20?= =?UTF-8?q?=E2=80=94=E2=80=94=20#184=20=E6=8A=8A=2065=20=E4=B8=AA=E6=88=90?= =?UTF-8?q?=E5=91=98=E8=B7=91=E6=88=90=E4=BA=86=2029=20=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Plan the shards` 用平台的矩阵条目数当分片数: linux:$(jq -r '[.include[]|select(.platform=="linux")]|length' ...) 在 #184 之前这两个数恰好相等,所以一直是对的。#184 给 linux 加了第二条工具链 腿之后不再相等:平台发 2 x 3 = 6 个条目,而切分仍然是 3 路,每个条目带的 shard 是 0..2。于是 plan 按 6 路切,job 只消费 0/1/2 —— 分到 3/4/5 的成员 一个都没跑。 65 个成员实际只跑了 29 个,而且是**静默**的:一个从未被分配的成员,和一个跑 过并通过的成员,在 CI 界面上长得一模一样。丢掉的里面有 ffmpeg、opencv-module 及其两个 feature 成员、catch2-v2、catch2-main、openssl —— 正是那条新腿被加进 来要测的东西。#184 全绿,但它想验证的路径一次都没执行。 改成读 `.shards`,也就是 emit() 已经写进每个条目、job 自己也在用 (matrix.shards)的那个值。plan 和消费方从此读同一个数,而不是两个碰巧相等 的数。 macos / windows 不受影响也不需要改:它们仍是单腿,条目数正好等于分片数 —— 这正是这个 bug 只咬 linux 的原因,也是它能在 review 里活下来的原因。 验证:拿 #184 那次运行的真实 matrix.json 跑 jq,linux 6 → 3,macos / windows 维持 2;plan_shards 三片合计从 29 回到 65/65,上面点名的成员全部归位。 --- .github/workflows/validate.yml | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 27d653a..10bef6e 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -519,9 +519,24 @@ jobs: { printf '{' first=1 - for spec in linux:$(jq -r '[.include[]|select(.platform=="linux")]|length' /tmp/matrix.json) \ - macos:$(jq -r '[.include[]|select(.platform=="macos")]|length' /tmp/matrix.json) \ - windows:$(jq -r '[.include[]|select(.platform=="windows")]|length' /tmp/matrix.json); do + # `.shards`, NOT the number of matrix entries. + # + # These stopped being the same number the moment linux grew a + # second toolchain leg: the platform emits 2 x 3 = 6 entries while + # the split is still 3 ways, and every entry carries shard 0..2. + # Planning 6 ways and consuming three of them dropped 36 of 65 + # members on the floor — silently, because a member that is never + # assigned is indistinguishable from one that passed. `ffmpeg`, + # `opencv-module*`, `catch2-v2` and `openssl` were among them, on + # the very run that added the leg meant to test them. + # + # `.shards` is the value emit() already wrote per entry and the + # same one the job reads for its own `matrix.shards`, so plan and + # consumer now read one number instead of two that agreed by + # accident. + for spec in linux:$(jq -r 'first(.include[]|select(.platform=="linux")).shards' /tmp/matrix.json) \ + macos:$(jq -r 'first(.include[]|select(.platform=="macos")).shards' /tmp/matrix.json) \ + windows:$(jq -r 'first(.include[]|select(.platform=="windows")).shards' /tmp/matrix.json); do p=${spec%%:*}; n=${spec##*:} [ "$first" = 1 ] || printf ',' first=0