ci: merge once the checks have reported, not before they start #1725
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1725
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ci/1116-2020"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What was broken
Every merge gate in this repository is an arm, and an arm is not a gate.
pr-rebase.ymlandauto-rebase.ymlboth POST{"Do":"squash","merge_when_checks_succeed":true}seconds after the force-push thatrebased the branch. Forgejo evaluates that flag against the checks that exist at the
moment of the call — and for a head pushed seconds earlier that set is empty.
"All checks succeeded" over nothing is true, so the pull request merged and CI then
reported on a commit that was already on
main.Baseline (measured,
/commits/{sha}/statusover the 25 most recently merged PRs, 2026-11-16)19:59:43(HTTP 201), merged19:59:54, its own CI run 4091 finished its last leg20:00:51— 58 s after the commit was on mainTest (Node 18/20/22)on run 4091: started 19:59:43-47, all green by 20:00:51 for apull request that had already landed at 19:59:54. The matrix was a post-merge
notification.
The change
ci.yml: new jobArm auto-merge(needs: [changes, test, smoke, docker],if: always() && pull_request && live != 'false'). It reads the head commit'sstatuses and merges only when every reported check is a
successand all threeCI / Test (Node *)legs are in the set.node:20-bookwormstart plus the API calls— ~10 s of a slot.
pr-rebase.yml,auto-rebase.yml: arming is now conditional on the same predicate(
checks_green), so a head that was just rebased is left to the new job instead ofbeing armed while its checks are still empty. Both keep arming a head that is already
green, so a pull request that lost its arm does not sit mergeable and unarmed.
head_commit_id, so a run against a superseded commit cannotmerge a newer one.
Coverage unchanged
No check is dropped or weakened: the gate now reads the checks instead of arming past
them. Same 3-leg matrix, same static checks, same smoke and Docker jobs. Local run on
this branch: 287 suites, 10227 assertions,
check-ci-disk-hygiene,check-node-surface,check-canonical-urlsandcheck-control-bytesall clean.After
Run id for this branch is recorded in a comment below once it concludes.
f04e8e2fdf711fe27cbeAfter
Merged at
20:37:20, 14 s after the last real check reported - not 57 s before.Test (Node 22), task 9259)arm job log, run 4127 task 9262:
The first attempt at this gate (run 4125 task 9254) refused to merge with
not successful: CI / Arm auto-merge (pull_request)=pending- the job's own status while itruns - so the reader's own context is now excluded from all three predicates.
Run 4127 wall clock: classify 20:36:01 -> arm 20:37:28 = 87 s, against 86 s for run 4091
before the change: the gate costs ~14 s of a slot per pull request.
Still red / known
test/board-id-is-a-name.test.jsfailed once locally atPF_TEST_CONCURRENCY=10on thisWindows host (10227 passed / 1 failed) and passes 65/65 standalone; CI at 10-way was
287 suites / 10292 assertions green (run 4091). A dev-host harness flake, and it lives in
test/, which this stream does not touch.pr-rebase.ymlno longer arms a head it just pushed, so a pull request whose CI run neverdispatches is merged by hand, exactly as before.