bootstrap: handle fork shallow upstream detection#155717
bootstrap: handle fork shallow upstream detection#155717cypherair wants to merge 2 commits intorust-lang:mainfrom
Conversation
|
This PR modifies If appropriate, please update |
|
r? @jieyouxu rustbot has assigned @jieyouxu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Thanks for the reminder.
I do not think this PR needs a This PR does not add, remove, rename, or change defaults for any bootstrap configuration option, and it does not change The functional change is limited to So the intent is to preserve the existing rust-lang/rust PR CI behavior while making fork/shallow CI detection more accurate. |
|
Noting that I'd like to take a look at this before it lands, though I don't have time at the moment. |
Fork push workflows can run in GitHub Actions with only the triggering branch fetched. In that shape refs/remotes/origin/main may be absent, and a shallow feature branch may not contain any bors-authored upstream commit. After the CI upstream detection stopped blindly trusting HEAD^1, that missing upstream case could fall through to searching HEAD and then panic when no upstream commit was found. Treat it as MissingUpstream instead, so download-rustc/download-ci-llvm if-unchanged conservatively disables CI downloads and builds locally. Add a regression test for the shallow fork-push shape without an origin/main ref.
|
@rustbot reroll |
Problem
Bootstrap's check_path_modifications selects an upstream commit and then checks whether selected paths changed since that commit to decide whether CI artifacts can be reused.
Before this change, the GitHub Actions path selected HEAD^1 as the upstream commit without checking what kind of commit it was.
That matches the expected rust-lang PR/try/auto CI shape, where HEAD is a generated merge commit and the first parent is the upstream side.
Fork push workflows can instead have shallow history for the triggering ref. In that shape, HEAD can be the branch tip and HEAD^1 can be an earlier commit from the same branch.
Using that branch commit as the base makes if-unchanged compare against the wrong commit.
What changed
The GitHub Actions path now only uses the merge-parent fast path after checking that HEAD is a merge commit and that HEAD^1 is authored by the configured upstream merge-bot account.
If that fast path is not valid, bootstrap falls back to the configured nightly branch ref, such as refs/remotes/origin/main, when that ref is present in the local checkout.
If no trusted upstream commit is available from those sources, bootstrap returns MissingUpstream instead of selecting an untrusted base.
Result
The rust-lang PR/try/auto CI shape continues to use the merge-parent fast path.
Fork push CI no longer treats an earlier contributor commit as the upstream base.
When the checkout contains the configured nightly branch ref, bootstrap can use that trusted ref for the comparison.
When the checkout does not contain a trusted upstream base, existing if-unchanged callers take the conservative path and avoid CI artifact downloads.
I used Codex to help draft the PR.