Repository navigation
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
Conversation
… the output value, not the selector's key=value line The select step appends the selector's verdict line (`mode=affected`) to $GITHUB_OUTPUT, which the runner stores as output `mode` = `affected`. The shard step compared $MODE with the whole line, so the affected speed never ran and every pull request and merge-group build ran the full sixteen-shard suite. Compare against `affected`, the shape the type-check scope step already uses. scripts/__tests__/select-affected-tests-wiring.test.ts runs both steps as ci.yml writes them (the real selector, the runner's output parsing, a pnpm stand-in recording argv) and holds the two ends together. Claude-Session: https://claude.ai/code/session_01LyeJkFWzSqWc3SDQPAqpsn Co-authored-by: Claude <noreply@anthropic.com>
Contract reviewServed-tier: Face: Inputs read: card #13350 body and its three comments (6357584416 filing, 6364039593 claim, 6364342801 os-dev-report); PR #13358 body, two-file list, and the net diff against main at merge-base 2c4e5f5 (one commit, +311 −1); the check-runs on the head, polled until every one completed. Not read, by rule: the dispatch order and the dispatching seat's conclusions. Check-runs on the head: 33 of 33 completed — 28 success, 3 skipped by design ( ① Derived judgments
② Semver levelNone owed, none declared — right. The diff touches ③ Boundary flags
Implemented-by: VERDICT: PASS Generated by Claude Code |
维护者速读
席位核对Seat: domain:ui#1 · Clause-②: no · head
|
Requested by Sales · project thread
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
testjob's select step (Select the tests this change affects, idselect) appends the selector's verdict line to$GITHUB_OUTPUT: the literalmode=affectedormode=full. The runner splits that line at its first=, so the step output ismodewith the valueaffectedorfull. The shard step (Run tests (shard N/16)) readssteps.select.outputs.modeinto$MODEand compared it with'mode=affected', which is never true. Every pull request and merge-group build therefore took theelsebranch and ran the full suite on all 16 legs. The type-check scope step in the same file already uses the right shape (it writesscope=affectedand compares against'affected').The fix
One line: the shard step compares
$MODEwith'affected'. A comment above the step says what$MODEholds and names the pin. No other workflow logic changes.The pin:
scripts/__tests__/select-affected-tests-wiring.test.tsIt restates neither end. It extracts both steps'
env:andrun:blocks fromci.yml(textually, asmarkdown-test-inputs.test.tsdoes), runs the select step withbash -eagainst this checkout (the real selector, based on HEAD), parses what it appended the way the runner does, gives the shard step whatever output itsenv:names, and reads which command the shard step chose off apnpmstand-in that records its argv.pull_requestandmerge_group: vitest gets exactly the filters the selector wrote, and the leg printsAffected speed: N vitest filter(s), shard 1 of 16.push, and a pull request with no base sha (fail-open): the fullpnpm testcommand.The selector runs once (about 3 s) and is replayed for the other legs. The file runs in about 3.5 s.
Verification
'mode=affected'fails 2 tests (pull_request, merge_group); the select step alone writingspeed=...instead ofmode=...fails 3.ci.yml(git grepover**/__tests__/**and*.test.*, plusshard-headroom.test.ts): 62 files, 2064 tests passed, run under the verify lock.pnpm exec vitest run --shard=1/16plus this branch's 669 filters): 36 files, 576 tests passed. The sequencer printedshard 1/16 runs 36 of 669 files, 118.5 s of 1895.2 s by the per-file timings.pnpm run type-check:scriptsexit 0;eslinton the new file exit 0;pnpm check:new-line-citations0 new;check:control-bytes,check:shell-escape-residue,check:test-path-roots,check:bash32-floorandcheck:unreferenced-sourcesexit 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 --teston 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=affectedwith 669 of 5721 test files (the always-on set plus the new test). So this PR'sTest (shard K/16)legs should each printAffected speed: 669 vitest filter(s), shard K of 16., and theTestaggregator'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/reactandpackages/app-shell) answersmode=affectedwith 5056 of 5721 files, which is near-full as the card expects.Acceptance notes
The longest test shard's headroom against the cap) isif: always()andcontinue-on-error: true, so it cannot redTest. On affected runs its suggested width will read low. That is the sibling dynamic-shard-width card's subject, not this one.passWithNoTestsis 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.pushandscheduleupload them, unchanged.test-shard-timings-refresh.ymland the timings file, which is disjoint from this diff.Governed surface
.github/workflows/ci.ymlis 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).Implemented by the ui lane card thread, session
https://claude.ai/code/session_01LyeJkFWzSqWc3SDQPAqpsn, branchclaude/issue-13350-affected-fast-path. The claim is on the card, comment 6364039593.Generated by Claude Code
🤖 Generated with Claude Code
https://claude.ai/code/session_01LyeJkFWzSqWc3SDQPAqpsn