Skip to content

Commit 3513753

Browse files
committed
Merge feat/go-opaque-storage-profile into feat/json-tree-data-plan
Brings in the mutants gate fix from #1381, which reads the pull request's real base from the API and checks out the head, so the gate no longer diffs all of next and times out on this stack. Claude-Session: https://claude.ai/code/session_01N7bCqa3ZVJMcEE99RzVqEu
2 parents 15f5aea + e2e85c9 commit 3513753

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

‎.github/workflows/mutants.yml‎

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@ jobs:
7373
steps:
7474
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
7575
with:
76+
# On a pull request, the PR's head rather than GitHub's test merge
77+
# commit: cargo-mutants applies `pr.diff` to the checked-out tree
78+
# and refuses a hunk whose lines do not match it, and the diff
79+
# below is taken between the base and this head. Empty on a
80+
# manual dispatch, which checks out the default ref.
81+
ref: ${{ github.event.pull_request.head.sha || '' }}
7682
# Full history, to diff the PR against its base for `--in-diff`.
7783
fetch-depth: 0
7884
persist-credentials: false
@@ -91,15 +97,34 @@ jobs:
9197

9298
# PR only: a manual dispatch has no base to diff against, so it sweeps
9399
# both crates instead (see the next step).
100+
#
101+
# The base comes from the API at run time, not from the event payload.
102+
# For a pull request whose base branch is itself the head of another
103+
# open pull request (a stacked PR, or any PR into `next` while `next`
104+
# has a PR into `main`), GitHub has been seen to build the test merge
105+
# commit against the other PR's merge commit and to report the other
106+
# PR's base in `github.base_ref`. The diff was then everything between
107+
# `main` and `next`, and the gate ran for two hours on a Go-only
108+
# change. `gh pr view` returns the base the PR page shows. The diff is
109+
# taken between that base and the PR's head, which is what the checkout
110+
# step put in the tree, so the hunks' line numbers are the tree's.
94111
- name: Compute the PR diff
95112
if: github.event_name == 'pull_request'
96113
env:
97-
BASE_REF: ${{ github.base_ref }}
114+
GH_TOKEN: ${{ github.token }}
115+
PR_NUMBER: ${{ github.event.pull_request.number }}
116+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
117+
PAYLOAD_BASE_REF: ${{ github.base_ref }}
98118
run: |
99-
git fetch --no-tags origin "$BASE_REF"
100-
git diff "origin/$BASE_REF" > pr.diff
101-
echo "Changed lines under mutation:"
102-
cat pr.diff
119+
base=$(gh pr view "$PR_NUMBER" --repo "$GITHUB_REPOSITORY" --json baseRefName,baseRefOid --jq '"\(.baseRefName) \(.baseRefOid)"')
120+
base_ref=${base% *}
121+
base_sha=${base#* }
122+
echo "Base: $base_ref at $base_sha (the event payload said '$PAYLOAD_BASE_REF'); head: $HEAD_SHA"
123+
git fetch --no-tags origin "$base_sha"
124+
test "$(git rev-parse HEAD)" = "$HEAD_SHA" || { echo "the checkout is not the PR head"; exit 1; }
125+
git diff "$base_sha...HEAD" > pr.diff
126+
echo "Files under mutation:"
127+
grep '^diff --git' pr.diff | sed 's|^diff --git a/.* b/| |' || echo " (none)"
103128
104129
# Never fails the job: the enforce step below is the gate, and the
105130
# comment must be posted first.

0 commit comments

Comments
 (0)