test: verify the test-merge base resolution in real GitHub Actions - #21
Open
gregberge wants to merge 10 commits into
Open
test: verify the test-merge base resolution in real GitHub Actions#21gregberge wants to merge 10 commits into
gregberge wants to merge 10 commits into
Conversation
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Bundles packages/core/src/ci-environment straight from the argos-javascript source with esbuild, so the probe exercises the shipped code and not a re-implementation of it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The expected base is read from the API by the workflow, so the assertion does not depend on the code under test. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Stubs only the /baseline API so the candidate commits the CLI offers the server are visible, and asserts the fork point is among them. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Real-condition test for the base-commit resolution added in argos-ci/argos-javascript#371, and the repro for the "older baseline" bug reported on top of it.
Setup
e5ba9c18maintip (the commit GitHub merges in)78fe66e7mainwas advanced twice after this branch forked, so the merge base and thecommit GitHub merges in are two different commits — an unrebased branch.
What runs
Nothing here re-implements the resolver. The
real sourcejobs check outargos-ci/argos-javascript, bundlepackages/core/src/ci-environmentandfind-reference-commit.tswith esbuild, and call the real functions. Theexpected value is read from the GitHub API by the workflow, so the assertions do
not depend on the code under test. The
probejobs run an instrumented portthat names the guard that fired, across every realistic checkout configuration.
#371 itself works
Same result on
@v6/@v4defaults,fetch-depth: 0,fetch-depth: 50andpersist-credentials: false. The only configuration that falls back isref: refs/pull/N/head, which is correct: those screenshots don't contain thebase branch changes, so the merge base is the right baseline for them.
The whole client-side resolution is sound too — with
/baselinestubbed to findnothing, the CLI hands the server
referenceCommit = 78fe66e7plus all 36ancestors, fork point included.
The actual bug: a stale
head.shasends the build back to the fork pointgetTestMergeBaseCommitSha()recognises GitHub's test-merge commit by comparingits second parent against
pull_request.head.shafrom the event payload.That payload can lag behind the merge ref the runner checked out — this very run
shows
base.shareportingc0f449d3whilemainwas already at78fe66e7.When it lags, a genuine test-merge build is rejected and silently falls back to
the merge base:
No orphan, just an older baseline — the branch is treated as if it had never
been merged with
main.The fix
argos-ci/argos-javascript@
fix/test-merge-refidentifies the test merge fromGITHUB_REF(refs/pull/<n>/merge), which the runner sets from the ref the runwas triggered on and which cannot go stale. The payload comparison stays as the
fallback when the merge ref is absent.
Both branches run side by side here:
mainfix/test-merge-ref78fe66e7✅78fe66e7✅head.shae5ba9c18❌78fe66e7✅🤖 Generated with Claude Code