Skip the second Free Tests run when a PR lands onto a moved main (GST-3303) (#4655)

When the land tool merges a PR whose base moved, it has already run Free
Tests on the exact merged tree. Main's push run now reuses that run
instead of running the whole suite again, and still runs it whenever
main moved again before the merge or the newest land run wasn't green.

This also fixes the outdated `QUEUE_LAND_MERGED_CHECKS` row in the
maintainers' land guide. Nothing to do: the next stale-base land shows
`REUSE: accepted run …` on main's push run.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-22 02:33:20 +00:00
1 parent 6e90fa3d31
commit 7abc1949e1
9 files changed
+91 -15

No files matched your search

+17 -1
View File
@@ -1507,13 +1507,29 @@ job keeps the workflow's `contents: read`). It runs
1. finds the pull request whose merge commit is the pushed commit
(`repos/{repo}/commits/{sha}/pulls`, one page of at most 10), merged into
main from a same-repository head (`no_pr`, `ambiguous_pr`, `fork_head`);
2. requires that head's tree to equal the pushed tree (`tree_mismatch`);
2. requires that head's tree to equal the pushed tree, with one exception
below for a stale-base land (`tree_mismatch`);
3. lists that head's `pull_request` and `workflow_dispatch` runs of the same
workflow, newest first, at most 10 (`no_candidate`); and
4. accepts the first one `verifyRun` accepts under the profile in the pushed
tree's `.gstack/pregate.json` (`no_verified_run` lists each refusal; a newer
red run on the head vetoes an older green one).
The exception is a pull request that `gstack-ship-queue land` merged onto a
base that had moved past it. Under `land.merged_ci`, land already ran this
workflow on the merged commit, on the scratch branch `gstack-land/<n>`
([ship-policy.md](ship-policy.md#land-direct)), and GitHub's merge has that
same tree unless main moved again before the merge. So when the head's tree
differs, `find` takes the newest `workflow_dispatch` run on `gstack-land/<n>`
and reuses it only when `verifyRun` accepts it and its `tested-tree` record
names the pushed tree (`no_verified_run` or `tree_mismatch` otherwise; a branch
with no such run keeps `tree_mismatch`). Only the newest run counts, newest by run id
rather than start time, so a red retry on the same tree is never hidden
behind an older green one, even when that older run is re-run later. Unlike a pull
request consumer, this one needs no byte-identical check on the reuse files:
the run executed the workflow in its own commit, whose tree is the pushed tree,
so the rules it ran under are the ones now on main, whoever dispatched it.
It writes `reused=true` with the run's id and link, or `reused=false` and the
reason, and prints one `REUSE:` line in the step summary. Every suite job
needs `reuse` and runs unless it succeeded with `reused=true`; their
+4 -1
View File
@@ -3053,7 +3053,10 @@ The run is on CI runners, so it needs no `--allow-repo-commands`, and
under `ci-reuse/free-tests`, so the whole free suite has run on a stale-base tree
before it lands (about 5 minutes); its `merged_checks` still run first and fail
fast. A rerun after the merge checks the landed tree with `merged_checks` only,
and main's own push run tests it in CI.
and main's own push run tests it in CI. When main didn't move again before
the merge, the landed tree is the one this run tested, so main's push run of
`free-tests.yml` reuses it instead of running the suite a second time
([pregate.md](pregate.md#ci-reuse)).
Then land runs `gh pr merge
--squash --match-head-commit <pin>` (`--merge` under `history: merge-only`),