Skip to content

Commit cda4677

Browse files
claude[bot]claude
andauthored
ci: treat an empty changed-files.txt on a PR as a full-list fallback (#10708)
Only the exit status of the affected-set `git diff` was checked, never its emptiness. A merge-base resolving to something wrong-but-valid produced an empty changed-file list -> zero affected packages -> a green Test Core shard that tested nothing, with every log line reading like a normal quiet PR. Empty is decidable as broken at this point and only at this point: a pull_request always differs from its merge-base. At the partitioner zero is frequently correct, so the test cannot live there. Scoped to pull_request by construction -- SCM_BASE is assigned only inside the pull_request guard, so push and merge_group never reach this branch and keep taking the full-list path by design. Claude-Session: https://claude.ai/code/session_01DdCnBGcHeufjrq7drTD3wt Co-authored-by: Claude <noreply@anthropic.com>
1 parent b419135 commit cda4677

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,32 @@ jobs:
463463
--changed "$RUNNER_TEMP/changed-files.txt"; then
464464
echo "::warning::Could not union cross-package scans into the affected set; falling back to the full package list for this shard."
465465
pnpm exec turbo ls --output=json > "$RUNNER_TEMP/turbo-ls.json"
466+
# A fourth signal the failure branches do not cover: a producer that
467+
# exits 0 with a wrong, plausible, EMPTY answer. Only that `git
468+
# diff`'s exit STATUS was checked, never its emptiness, so a
469+
# merge-base resolving to something wrong-but-valid gave an empty
470+
# changed-file list -> zero affected packages -> a green shard that
471+
# tested nothing, with every log line reading like a normal quiet PR
472+
# (#10057). The shard attestation (#6082) does not cover it: it
473+
# attests "shard N ran and every step passed", which is exactly what
474+
# a shard that tested nothing does.
475+
#
476+
# Empty is decidable as BROKEN here, and only here: a pull_request
477+
# always differs from its merge-base. At the partitioner zero is
478+
# frequently the CORRECT answer (a docs-only PR genuinely affects no
479+
# package, and with 6 shards a small change legitimately leaves
480+
# shards empty), so a blanket "red on empty" belongs there least of
481+
# all -- this is the one place selection-failed and nothing-selected
482+
# can be told apart.
483+
#
484+
# Scoping this to pull_request needs no `github.event_name` test:
485+
# SCM_BASE is assigned only inside the `pull_request` guard above, so
486+
# this whole `[ -n "$SCM_BASE" ]` branch is unreachable on push and
487+
# merge_group. Those keep taking the full-list path in the `else`
488+
# below, by design.
489+
elif [ ! -s "$RUNNER_TEMP/changed-files.txt" ]; then
490+
echo "::warning::The diff against merge-base $SCM_BASE listed no changed files, which a pull_request cannot legitimately produce; falling back to the full package list for this shard rather than selecting nothing (#10057)."
491+
pnpm exec turbo ls --output=json > "$RUNNER_TEMP/turbo-ls.json"
466492
fi
467493
else
468494
# Falling back to the FULL package list, never to the frozen

0 commit comments

Comments
 (0)