mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-25 09:31:43 +01:00
A green CI run now counts for your branch when only main moved under it (GST-3567) (#4728)
/ship's final CI check (`gstack-ship-release accept`) now accepts a green pull request run that tested your branch merged onto a newer main, when main changed none of your lines. Why: before, it refused that run and you had to merge main and rerun CI, which never settles on a busy repo (harness-evals #576, gstack #4722). Nothing to do. Repos with a land step still re-check the merged tree; repos with `land: null` get no merged-tree check. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=testing Review-Finding: lib/pregate/run-check.ts:70:functional-contract reader=qa Review-Finding: p2/outside-voice#1 reader=outside-voice
This commit is contained in:
1 parent
8751b382dd
commit
261f380002
13 files changed
+344
-27
No files matched your search
+14
-3
@@ -951,7 +951,8 @@ once:
|
||||
`tree.json` must name the head (`head_sha`) and the merge commit (`sha`), and
|
||||
the tree git computes for that merge commit must equal the head's tree: the
|
||||
head already contained its base, so the merge tested exactly the head tree
|
||||
(`tree_mismatch` otherwise). The API answers with
|
||||
(`tree_mismatch` otherwise), unless only the base moved
|
||||
([below](#base-moved-carry)). The API answers with
|
||||
the newest attempt, so an earlier green attempt under a newer red one is
|
||||
refused, and the run is read again after the evidence is collected: a new
|
||||
attempt meanwhile is `run_changed`. A newer run of the same workflow on the
|
||||
@@ -1259,8 +1260,18 @@ the Ubicloud VM (`gstack-pregate --stage tests --remote`) is an opt-in for when
|
||||
no such run exists. The order after a push: wait for Free Tests
|
||||
(`gstack-ci-carry wait --base main`), then `gstack-pregate
|
||||
--allow-repo-commands`. A `pull_request` run tests GitHub's merge commit, so on
|
||||
a branch that does not contain the base tip it tested another tree and
|
||||
`CI_CARRY` says `none (no_verified_run: … tree_mismatch)`: dispatch Free Tests
|
||||
a branch that does not contain the base tip it tested another tree.
|
||||
<a id="base-moved-carry"></a>That run still carries for HEAD when only the base
|
||||
moved (GST-3567): the merge commit is HEAD merged onto a commit of the base, and
|
||||
the pull request's own added and removed lines in it are byte-identical to
|
||||
HEAD's at the same places (`lib/pregate/run-check.ts` `onlyBaseMoved`, used by every lane carry and by
|
||||
`clear --run`, never by land's merged-tree CI; why that is safe:
|
||||
[ship-policy.md](ship-policy.md#ci-carry-base-moved)). The receipt adds
|
||||
`base_moved=<base commit>`. GitHub merges onto the base as it was when the run
|
||||
started, so when that base commit is newer than your checkout's `origin/main`,
|
||||
the check fetches main once before it refuses. Otherwise `CI_CARRY` says
|
||||
`none (no_verified_run: … tree_mismatch)`, with a `CARRY_DIAGNOSIS:` line
|
||||
when the rule refused: dispatch Free Tests
|
||||
on the branch
|
||||
(`gh workflow run free-tests.yml --ref <branch>`), which tests HEAD's own tree,
|
||||
and wait again. When the pull_request run tested that merge commit, the
|
||||
|
||||
+29
-3
@@ -2955,9 +2955,35 @@ body plain: they become main's history.
|
||||
note each name a sha, so after any push, a merge of main included, land
|
||||
refuses until checks are green and `ready` has run at the new head (the
|
||||
receipt itself can [carry across a base merge](#carrying-a-receipt-across-a-base-merge-or-a-test-only-fix)).
|
||||
A `pull_request` CI run tests GitHub's merge commit rather than your branch,
|
||||
so on a branch behind main `gstack-ci-carry` reports `tree_mismatch`:
|
||||
dispatch the workflow on the branch (`gh workflow run <workflow> --ref <branch>`).
|
||||
A `pull_request` CI run tests GitHub's merge commit rather than your branch:
|
||||
your branch merged onto main as main was when the run started.
|
||||
- <a id="ci-carry-base-moved"></a>**A green run carries across a base move
|
||||
when only the base moved (GST-3567).** When main has moved past your
|
||||
branch's fork point, that merge commit's tree is not your head's tree. The
|
||||
lane carry (`gstack-ship-release accept`, `gstack-evidence record-ci`,
|
||||
`gstack-ci-carry`, and pregate's own carry and `clear --run`) still counts
|
||||
the green run for your head when the merge commit's parents are a commit on
|
||||
main and then your pushed head, and your pull request's own added and
|
||||
removed lines in that merge are byte-identical to your head's, at the same
|
||||
places (the zero-context patch-id and hunk positions `lib/review-round-grant.ts`
|
||||
`ownLinesSame` compares for a base-only merge of a reviewed head). Main may
|
||||
have changed other files, or other parts of the files you changed, but no
|
||||
line you changed and none next to one. The `CI_CARRY:` receipt
|
||||
then adds `base_moved=<main commit>`. This is safe for two reasons. The run
|
||||
tested exactly your pull request's changes, on a main newer than the one
|
||||
your head forked from, so it tested no less than a run of your head's own
|
||||
tree would have. And neither run tested the tree that lands: under
|
||||
`merge: direct`, [`land --pin`](#land-direct) checks that tree itself with
|
||||
`land.merged_ci` (CI on the pin merged onto the tip) and
|
||||
`land.merged_checks`, and its verification never takes this rule
|
||||
(`lib/land-merged-ci.ts` calls `verifyRun` without it). A repo whose `land`
|
||||
is `null` lands a stale base unchecked (`STALE_BASE: warn`) either way.
|
||||
The run still doesn't carry when main also changed a line your pull request
|
||||
changes or one next to it, when the merge is of a commit other than your pushed head, or when
|
||||
the run isn't green. A `CARRY_DIAGNOSIS:` line says which, and `tree_mismatch`
|
||||
keeps its fix: dispatch the workflow on the branch
|
||||
(`gh workflow run <workflow> --ref <branch>`), which tests your head's own
|
||||
tree, or, when it can't be dispatched, merge main and push.
|
||||
- <a id="ci-carry-rerun"></a>**A carried run that passed only after a re-run is marked, not refused.**
|
||||
When only a run's failed jobs were re-run, its `tree.json` may list
|
||||
`rerun_files` (the files whose newest result came from a re-run attempt) and
|
||||
|
||||
+10
-1
@@ -763,7 +763,16 @@ command `origin/<base>`'s `.gstack/pregate.json` maps in `ship_lanes_from`,
|
||||
and no verified CI run carries it at this tree: the `CI_CARRY: none
|
||||
label=<label> (<reason>)` line above the STOP says why (`no_run`: CI has not
|
||||
run this tree yet; `dirty_tree`: uncommitted work; `tree_mismatch`: the run
|
||||
tested a merge with an older base). A mapped lane is the full suite, which can
|
||||
tested a merge of the branch with main that counts for no commit here). A
|
||||
`pull_request` run that tested the branch merged onto a newer main still
|
||||
carries when only the base moved: the merge is of this pushed head, and the
|
||||
branch's own added and removed lines in it are byte-identical to the head's at
|
||||
the same places, so main changed no line the branch changes and none next to
|
||||
one. That is safe because the run tested
|
||||
exactly the branch's changes on a newer main, and land checks the tree that
|
||||
lands with `land.merged_ci` ([ship-policy.md](ship-policy.md#ci-carry-base-moved)).
|
||||
When that rule refuses, a `CARRY_DIAGNOSIS:` line says why: main also changed
|
||||
a line the branch changes or one next to it, or the merge is of another commit. A mapped lane is the full suite, which can
|
||||
take most of an hour on a small machine (gbrain #9662: a 50-minute unit lane on
|
||||
4 CPUs), so preflight never starts it on its own, whatever the reason (GST-3019;
|
||||
a full preflight did until GST-3277).
|
||||
|
||||
Reference in new issue
Block a user