You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
echo "Affected-set diff base: $SCM_BASE (merge-base of origin/$BASE_REF and HEAD)"
490
-
echo "Frozen payload base.sha: $PINNED_BASE_SHA -- $BASE_REF has moved $DRIFT commit(s) since it was frozen, and that drift is exactly what this step used to charge to this PR."
491
-
TURBO_SCM_BASE="$SCM_BASE" pnpm exec turbo ls --affected --output=json > "$RUNNER_TEMP/turbo-ls.json"
492
-
# `turbo ls --affected` answers "which packages does the dependency
493
-
# GRAPH reach from this diff" — and some suites read files the graph
494
-
# does not connect them to. spec's api-methods-batch-conformance scan
495
-
# walks every `*.object.ts` in the monorepo while spec declares no
496
-
# dependency on the packages it judges (nor should it: the scan reads
497
-
# source text precisely to avoid inverting the spec -> * direction).
498
-
# A platform-objects-only diff therefore left it unrun, and #7769
499
-
# landed a violation on `main` that only PRs touching `spec` ever saw.
500
-
# Measured on turbo 2.10.7: 51 packages affected by that diff, spec
501
-
# not among them.
502
-
#
503
-
# So packages that declare a cross-package input radius are unioned
504
-
# back in when the diff touches it. The declarations, and the static
505
-
# detector that refuses to let a new cross-package scan go
506
-
# undeclared, live in the script (`pnpm check:cross-package-test-inputs`).
507
-
#
508
-
# Failure here falls back to the FULL package list, never to the
509
-
# affected-only set: same posture as the merge-base fallback below
510
-
# (#6195), and the same reason — the full list is a strict superset,
511
-
# so doubt costs minutes rather than coverage. This is the FILTER
512
-
# CONTRACT's half 1 applied one layer down.
513
-
if ! git diff --name-only "$SCM_BASE" HEAD > "$RUNNER_TEMP/changed-files.txt" \
echo "::warning::Could not union cross-package scans into the affected set; falling back to the full package list for this shard."
518
-
pnpm exec turbo ls --output=json > "$RUNNER_TEMP/turbo-ls.json"
519
-
# A fourth signal the failure branches do not cover: a producer that
520
-
# exits 0 with a wrong, plausible, EMPTY answer. Only that `git
521
-
# diff`'s exit STATUS was checked, never its emptiness, so a
522
-
# merge-base resolving to something wrong-but-valid gave an empty
523
-
# changed-file list -> zero affected packages -> a green shard that
524
-
# tested nothing, with every log line reading like a normal quiet PR
525
-
# (#10057). The shard attestation (#6082) does not cover it: it
526
-
# attests "shard N ran and every step passed", which is exactly what
527
-
# a shard that tested nothing does.
528
-
#
529
-
# Empty is decidable as BROKEN here, and only here: a pull_request
530
-
# always differs from its merge-base. At the partitioner zero is
531
-
# frequently the CORRECT answer (a docs-only PR genuinely affects no
532
-
# package, and with 6 shards a small change legitimately leaves
533
-
# shards empty), so a blanket "red on empty" belongs there least of
534
-
# all -- this is the one place selection-failed and nothing-selected
535
-
# can be told apart.
536
-
#
537
-
# Scoping this to pull_request needs no `github.event_name` test:
538
-
# SCM_BASE is assigned only inside the `pull_request` guard above, so
539
-
# this whole `[ -n "$SCM_BASE" ]` branch is unreachable on push and
540
-
# merge_group. Those keep taking the full-list path in the `else`
541
-
# below, by design.
542
-
elif [ ! -s "$RUNNER_TEMP/changed-files.txt" ]; then
543
-
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)."
544
-
pnpm exec turbo ls --output=json > "$RUNNER_TEMP/turbo-ls.json"
545
-
fi
546
-
else
547
-
# Falling back to the FULL package list, never to the frozen
548
-
# base.sha. This is not the #4690 silent-skip anti-pattern: that is
549
-
# about a gate PASSING on input it could not read, and the full list
550
-
# is a strict superset of the affected one — this shard still runs
551
-
# everything it would have run and more. Cost is minutes; the
552
-
# alternative is a red Test Core on a PR with nothing wrong with it.
553
-
# Push and merge-queue builds take this branch by design (the queue
554
-
# result IS the next main, so it gets main's validation).
555
-
if [ "${{ github.event_name }}" = "pull_request" ]; then
556
-
echo "::warning::Could not resolve merge-base(origin/$BASE_REF, HEAD); falling back to the full package list for this shard rather than diffing from the frozen base.sha (#6195)."
557
-
fi
558
-
pnpm exec turbo ls --output=json > "$RUNNER_TEMP/turbo-ls.json"
0 commit comments