This repository was archived by the owner on Oct 26, 2026. It is now read-only.
Repository navigation
Commit 861fdff
fix(ci): the affected-tests fast path runs: the shard step compares the output value, not the selector's key=value line (objectui#13350) (#13358)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuUbtHKs1BJTq2BeSm3x6GNc)_
Fixes #13350
Clause-②: no
Metadata-protocol: none
## 维护者速读(草稿)
**改了什么**:`ci.yml` 测试分片步骤里的一行比较,从 `'mode=affected'` 改成
`'affected'`;另加一个钉测,把"选择步骤写出的输出"和"分片步骤读到并比较的值"按 `ci.yml` 原样真跑一遍对上。
**为什么改**:两速 CI(#12214)设计成 PR 和合并队列只跑受影响的测试,但这行比较永远为假,快速通道从没生效,每个 PR
和每次队列构建都跑全部 16 片(约 150 分片分钟)。
**风险与代价(含回滚)**:快速通道第一次真正生效。它漏掉的测试由 main 上每次 push 和每小时的全量运行兜底,这是 #12214
已接受的取舍;选择器出错仍按全量跑。回滚就是 revert 这一行。
**席位意见**:
**你要做的**:看过后在本 PR 上点 Approve(os-zhuang 或 hotlong)。
## What was wrong
The `test` job's select step (`Select the tests this change affects`, id
`select`) appends the selector's verdict line to `$GITHUB_OUTPUT`: the
literal `mode=affected` or `mode=full`. The runner splits that line at
its first `=`, so the step output is `mode` with the value `affected` or
`full`. The shard step (`Run tests (shard N/16)`) reads
`steps.select.outputs.mode` into `$MODE` and compared it with
`'mode=affected'`, which is never true. Every pull request and
merge-group build therefore took the `else` branch and ran the full
suite on all 16 legs. The type-check scope step in the same file already
uses the right shape (it writes `scope=affected` and compares against
`'affected'`).
## The fix
One line: the shard step compares `$MODE` with `'affected'`. A comment
above the step says what `$MODE` holds and names the pin. No other
workflow logic changes.
## The pin: `scripts/__tests__/select-affected-tests-wiring.test.ts`
It restates neither end. It extracts both steps' `env:` and `run:`
blocks from `ci.yml` (textually, as `markdown-test-inputs.test.ts`
does), runs the select step with `bash -e` against this checkout (the
real selector, based on HEAD), parses what it appended the way the
runner does, gives the shard step whatever output its `env:` names, and
reads which command the shard step chose off a `pnpm` stand-in that
records its argv.
- `pull_request` and `merge_group`: vitest gets exactly the filters the
selector wrote, and the leg prints `Affected speed: N vitest filter(s),
shard 1 of 16.`
- `push`, and a pull request with no base sha (fail-open): the full
`pnpm test` command.
- Controls: the comparison reverted to the whole line, the output
written under another key, or another value under the same key each put
a pull request on the full suite.
- It also asserts that both steps sit in one job, the select step first,
and that the shard step binds exactly one select output.
The selector runs once (about 3 s) and is replayed for the other legs.
The file runs in about 3.5 s.
## Verification
- New pin: 8 passed. Ablations on the committed fix, each restored from
HEAD afterwards: the comparison reverted to `'mode=affected'` fails 2
tests (pull_request, merge_group); the select step alone writing
`speed=...` instead of `mode=...` fails 3.
- Every test file that reads `ci.yml` (`git grep` over `**/__tests__/**`
and `*.test.*`, plus `shard-headroom.test.ts`): 62 files, 2064 tests
passed, run under the verify lock.
- One real affected leg, run locally exactly as the step spells it
(`pnpm exec vitest run --shard=1/16` plus this branch's 669 filters): 36
files, 576 tests passed. The sequencer printed `shard 1/16 runs 36 of
669 files, 118.5 s of 1895.2 s by the per-file timings`.
- The planner over this branch's selection gives all 16 legs between 36
and 43 files, about 118 s of measured weight each.
- `pnpm run type-check:scripts` exit 0; `eslint` on the new file exit 0;
`pnpm check:new-line-citations` 0 new; `check:control-bytes`,
`check:shell-escape-residue`, `check:test-path-roots`,
`check:bash32-floor` and `check:unreferenced-sources` exit 0.
- `node scripts/check-changeset-presence.mjs`: no changeset owed (no
released package source changed), so none is added.
- `node scripts/check-governed-queue-guard.mjs --test` on both paths:
GOVERNED (Tier H, `.github/workflows/**`).
## Acceptance (read on this PR's own CI)
This PR is the scripts-only class: the selector on this branch answers
`mode=affected` with 669 of 5721 test files (the always-on set plus the
new test). So this PR's `Test (shard K/16)` legs should each print
`Affected speed: 669 vitest filter(s), shard K of 16.`, and the `Test`
aggregator's headroom notice is the total-shard-time reading the card
asks for.
For the other direction, the selector replayed on `b911ebb` (10 files,
`packages/react` and `packages/app-shell`) answers `mode=affected` with
5056 of 5721 files, which is near-full as the card expects.
## Acceptance notes
- The headroom step (`The longest test shard's headroom against the
cap`) is `if: always()` and `continue-on-error: true`, so it cannot red
`Test`. On affected runs its suggested width will read low. That is the
sibling dynamic-shard-width card's subject, not this one.
- An affected leg passes filters, so the root config's `passWithNoTests`
is false and a leg handed zero files would red. The planner puts a file
on every leg whenever the selection holds at least 16 files. Today the
always-on set alone is 668 files, and the selector already refuses an
empty selection (exit 2, which the step turns into a full run). No guard
is added, because this card adds no behaviour.
- Affected legs do not write per-file timings. Only `push` and
`schedule` upload them, unchanged.
- Sibling objectui#13349 (weekly timings refresh) touches
`test-shard-timings-refresh.yml` and the timings file, which is disjoint
from this diff.
## Governed surface
`.github/workflows/ci.yml` is Tier H. This PR stays draft until an
authorized approval (`os-zhuang` / `hotlong`) is on record. ⛔ No seat
approves it. The maintainer's direct-dispatch word is quoted on the card
(comment 6357584416).
- [x] Adds no product-specific widget, dialog, hook or string (see
AGENTS.md › Product-neutral renderer)
Implemented by the ui lane card thread, session
`https://claude.ai/code/session_01LyeJkFWzSqWc3SDQPAqpsn`, branch
`claude/issue-13350-affected-fast-path`. The claim is on the card,
comment 6364039593.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01LyeJkFWzSqWc3SDQPAqpsn)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01LyeJkFWzSqWc3SDQPAqpsn
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: os-zhuang <jack@objectstack.ai>1 parent cf24190 commit 861fdff
2 files changed
Lines changed: 311 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1288 | 1288 | | |
1289 | 1289 | | |
1290 | 1290 | | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
| 1295 | + | |
| 1296 | + | |
| 1297 | + | |
1291 | 1298 | | |
1292 | 1299 | | |
1293 | 1300 | | |
| |||
1307 | 1314 | | |
1308 | 1315 | | |
1309 | 1316 | | |
1310 | | - | |
| 1317 | + | |
1311 | 1318 | | |
1312 | 1319 | | |
1313 | 1320 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
0 commit comments