Files
open-design/e2e
254fd7ddf0 fix(ci): only auto-merge a backport that is a pristine bot cherry-pick (#4705)
* fix(ci): only auto-merge a backport that is a pristine bot cherry-pick

The auto-approve/merge premise is that a backport is the untouched cherry-pick of code
already reviewed on main — so it can skip a fresh review. That breaks the moment a human
pushes a commit (resolving a conflict, fixing a failing test): those commits were never
reviewed, yet the existing gates don't catch them — the PR author stays the bot, a draft
gets un-drafted, and head==CI-sha only guards post-green races, not bot-vs-human authorship.

Gate auto-approve + auto-merge on pristine == 'true': every commit on the branch was
committed by github-actions[bot] (what korthout's cherry-pick produces; the human author is
preserved but the committer is the bot). Any human commit -> committer != github-actions[bot]
-> pristine=false -> skip, and the PR falls back to human review (REVIEW_REQUIRED; release-gate
blocks the release until it lands). Fail closed: any lookup miss / empty list -> not pristine.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(ci): paginate the pristine-commit check so a >100-commit backport can't pass on its first page

per_page=100 without --paginate only validated the first 100 commits: a human commit at
position 101+ would be missed and the PR would auto-merge unreviewed code (fail-open). Use
--paginate to fold in every commit and fail if any committer is not github-actions[bot];
-F/-x match the literal bot login (the brackets are not a regex class). Fail closed on an
empty list / lookup miss.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(ci): use portable grep -c count for the pristine check, not grep -qv

`! ... | grep -Fqvx` mis-evaluated to pristine=true on a human-touched branch under BSD grep
(grep -q's early-exit status is unreliable across BSD/GNU) — the opposite of safe. Count the
non-bot committer lines with grep -Fvxc, whose count semantics are portable, and require zero.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(ci): fail closed when paginated commit lookup partially fails

gh api --paginate can emit several pages and then fail on a later one; `|| true` kept that
partial output, so an all-bot first page could read pristine=true without ever inspecting the
commits on the failed page. Capture gh's exit status with `if !` and blank the list on any
failure, so pristine requires a complete, successful enumeration of every commit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* test(ci): assert the pristine check's actual shape (paginate + grep committer count)

The topology assertion still referenced the old in-jq comparison
'(.committer.login // "") == "github-actions[bot]"', which no longer exists after the check
moved to extracting '.[].committer.login // "none"' and counting non-bot committers with
grep -Fvxc across --paginate'd pages. Assert the shape that exists now.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 15:34:40 +00:00
..