Skip to content

fix(ci): stop trusting refs/pull/N/merge for triggered-integration-test - #67

Merged
nerdalert merged 1 commit into
praxis-proxy:mainfrom
jordigilh:fix/triggered-integration-test-pinned-sha-merge
Aug 16, 2026
Merged

fix(ci): stop trusting refs/pull/N/merge for triggered-integration-test#67
nerdalert merged 1 commit into
praxis-proxy:mainfrom
jordigilh:fix/triggered-integration-test-pinned-sha-merge

Conversation

@jordigilh

Copy link
Copy Markdown
Contributor

Fixes #66

Problem

resolve-source's "Verify PR merge checkout" step compares the checked-out merge commit's parents against a live-resolved base_sha (fixed in #62), but the checked-out commit itself still came from GitHub's refs/pull/<n>/merge -- a commit GitHub computes and caches asynchronously.

Per GitHub's own changelog, Changes to test merge commit generation for pull requests (2026-02-19), that ref is only regenerated on a push to the PR branch, a merge-base change, or a 12h max-age timer -- and viewing the PR page no longer forces a refresh.

Live reproduction against PR #63, right after #62 merged: refs/pull/63/merge stayed stale for 49+ minutes (including after an explicit mergeable recheck that returned true), which would fail "Verify PR merge checkout" with a "base changed" error for a transient, unrelated-to-the-PR reason. Full writeup and evidence in #66.

Fix

Stop depending on refs/pull/N/merge entirely. resolve-source already resolves head_sha (PR API) and base_sha (live refs/heads/main) as two pinned commit SHAs -- construct the merge locally from those with git merge --no-ff instead, in both:

  • resolve-source's "Resolve source" step, to fail fast on a real conflict before the 120-minute glb-e2e job runs, and
  • glb-e2e's new "Reconstruct PR merge" step, to get the actual tested tree.

Pinning author/committer identity and date (new MERGE_COMMIT_* workflow-level env vars) makes the merge commit fully deterministic, so both jobs -- running on separate, stateless runners -- independently arrive at the identical SHA. fetch-depth for the shared checkout moves from 2 to 0 (full clone) since git merge needs enough history to find the true merge-base, which a shallow clone can't guarantee for a PR that's many commits behind main.

The checkout_sha output is new: actions/checkout's ref: now targets a real, always-fetchable commit (base_sha for a PR, main's tip otherwise) instead of a merge SHA that may not exist as a GitHub-side object yet; tested_sha keeps its existing meaning (the commit actually under test) and every downstream consumer (image provenance labels, the demo's own re-check, the summary table) is unchanged.

Validation

No permission to dispatch this workflow on either praxis-proxy/grid (not an admin) or a fork (GitHub doesn't register workflow_dispatch-only workflows added post-fork without manual UI activation) -- same platform constraint noted on #62/#65.

Instead, validated the exact logic live against production data:

  • actionlint (which also runs shellcheck on the embedded scripts) is clean.
  • Simulated resolve-source's new "Resolve source" logic in one directory, and glb-e2e's new "Checkout Grid at base revision" + "Reconstruct PR merge" logic in a separate, unrelated fresh clone (no shared git state, mirroring two independent GitHub Actions runners), both against real PR fix(crdt): cap distinct origin site-slots per tenant_spend counter #63 (base_sha=7ebabdbc.., head_sha=50720c9d..):
    JOB1 (resolve-source) tested_sha=6df4a70a435aa642e03f713be08e6cc857d4abad
    JOB2 (glb-e2e)         reconstructed HEAD=6df4a70a435aa642e03f713be08e6cc857d4abad
    MATCH: both jobs independently reconstruct the identical merge SHA
    PASS: all invariants hold (parent_count=2, parents == base_sha/head_sha)
    
  • Confirmed the "main" (no PR number) path is untouched by this change.

resolve-source's "Verify PR merge checkout" step compares the checked-out
merge commit's parents against a live-resolved base_sha (fixed in praxis-proxy#62),
but the checked-out commit itself still came from GitHub's
refs/pull/<n>/merge -- a commit GitHub computes and caches
asynchronously. Per GitHub's own changelog ("Changes to test merge
commit generation for pull requests", 2026-02-19), that ref is only
regenerated on a push to the PR branch, a merge-base change, or a 12h
max-age timer, and viewing the PR no longer forces a refresh. Live
reproduction against PR praxis-proxy#63 right after praxis-proxy#62 merged: the ref stayed
stale for 49+ minutes, including after an explicit mergeable recheck,
which would fail "Verify PR merge checkout" with a "base changed" error
for a transient, unrelated-to-the-PR reason (see grid#66).

Stop depending on that ref. resolve-source already resolves head_sha
(PR API) and base_sha (live refs/heads/main) as pinned commit SHAs --
construct the merge locally from those two SHAs with `git merge --no-ff`
instead, in both resolve-source (to fail fast on real conflicts before
the 120-minute glb-e2e job) and glb-e2e's checkout (to get the actual
tested tree). Pinning author/committer identity and date makes the
merge commit fully deterministic, so both jobs independently arrive at
the identical SHA despite running on separate runners with no shared
git state -- verified live: two independent fresh-clone reconstructions
of PR praxis-proxy#63's merge (base 7ebabdb.., head 50720c9..) produced the exact
same commit SHA (6df4a70a..).

fetch-depth changes from 2 to 0 (full clone) for the shared checkout
step, since `git merge` needs enough history to find the true
merge-base between base_sha and head_sha, which a shallow clone cannot
guarantee for a PR that is many commits behind main.

Fixes grid#66

Signed-off-by: Jordi Gil <jgil@redhat.com>
@shaneutt shaneutt assigned shaneutt and nerdalert and unassigned shaneutt Aug 14, 2026
@shaneutt shaneutt added this to AI Grid Aug 14, 2026
@github-project-automation github-project-automation Bot moved this to Next in AI Grid Aug 14, 2026
@shaneutt shaneutt moved this from Next to Review in AI Grid Aug 14, 2026
@shaneutt shaneutt added this to the v0.2.0 milestone Aug 14, 2026
@nerdalert
nerdalert merged commit 1e79610 into praxis-proxy:main Aug 16, 2026
16 checks passed
@github-project-automation github-project-automation Bot moved this from Review to Done in AI Grid Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

triggered-integration-test: refs/pull/N/merge can lag live main by up to 12h, causing spurious 'base changed' failures

3 participants