Repository navigation
test(cli): isolate the CLI release tag cases from the runner identity - #3973
Merged
Merged
Conversation
The CLI `Resolve version` step reads the runner's own GITHUB_REF and GITHUB_SHA besides its mapped inputs. Its compose-parity cases ran it through `shell`, which hands them the caller's environment, and named only RELEASE_TAG and the tag source. Inside the v0.5.64 publication runner (refs/tags/v0.5.64) the valid synthetic tags v0.5.42, 0.5.42 and v0.5.42-rc.1 therefore hit the exact-tag guard and exited 1. The branch candidate never took that path, so it passed the same source. Every case now names its whole dispatch: EVENT_NAME, RELEASE_TAG, REPOSITORY, GITHUB_REF, GITHUB_SHA and the tag source. Each tag runs from a branch (building the tag's commit, not the branch head) and from the tag itself. New refusals cover another tag ref, the same version under another tag name, and a tag that has since moved to another commit. Every case must decide alike in its caller's environment and inside a synthetic publication runner for another tag at another commit. So a branch run now catches a tag-only leak. The workflow's exact-tag and exact-source guards are unchanged. Closes #3970
This was referenced Sep 30, 2026
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.
What changed
tools/cli/src/lib/compose/services/compose-parity.test.tsis the only file this PR touches. Each CLI release tag case now owns its whole dispatch identity.Root cause (#3970).
Resolve versionstep (cli.ymlprepare) reads the runner's ownGITHUB_REFandGITHUB_SHA, besides its mapped inputs:cli.yml:89;cli.yml:98.shell, which spreadsprocess.envinto the child. They named onlyRELEASE_TAGand the tag source.workflow_dispatchonrefs/tags/v0.5.64), the valid synthetic tagsv0.5.42,0.5.42andv0.5.42-rc.1hit the exact-tag guard. They exited 1 at:1069on all five platforms.repository_dispatchonmain) never took that path, so it passed.Fix.
resolveCliRelease({ RELEASE_TAG, GITHUB_REF, GITHUB_SHA, TEST_TAG_SOURCE? })runs the real extracted step with the existingshellhelper and the inertghshell-function stand-in.EVENT_NAME,REPOSITORYandGITHUB_OUTPUTare always set.refs/heads/mainat a branch head that is not the tag's commit. It still publishes the tag's commit.refs/tags/<tag>at the tag's commit.::error::line and that no outputs were written:refs/tags/v0.5.41);refs/tags/0.5.42forv0.5.42);GITHUB_REF=refs/tags/v0.5.64,GITHUB_SHA=d…d). A branch, PR or candidate run therefore exercises the tag-runner context too, so a leak like this one can no longer hide until publication.Unchanged.
.github/workflows/cli.yml: the exact-tag and exact-source guards are byte-identical.shellhelper, and every other fixture.Sweep of sibling release fixtures. None of the others reads the runner's identity.
resolveReleasepinsEVENT_NAME=workflow_dispatch, sorelease.ymlnever reaches itsGITHUB_REFbranch.GITHUB_*at all.release-candidate-workflows.test.tssetsGITHUB_REFandGITHUB_SHAitself.deployment-ci.test.tsbuilds its env fromPATHplus explicit values.How I verified it
Everything below ran locally. The outer contexts are plain environment variables. There was no network, no
ghand no dispatch. Old = origin/main89109e3c0; new = this branch ate37c741.-t 'CLI release'in compose-parityrefs/tags/v0.5.64@ebf4546f(the publication)v0.5.42,0.5.42,v0.5.42-rc.1at:1069refs/heads/main@ebf4546f(the candidate)refs/tags/v0.5.42@ the fixture's mock source0.5.42,v0.5.42-rc.1refs/tags/v0.5.42@ebf4546f(wrong inherited source)bun test --timeout 30000, the publication job's own step), ordinaryThe 14 whole-suite failures are identical in all four cells and are specific to this sandbox:
archive --mtime;ssh-keygenhere;git archiveof this repository (SIGXFSZ);The publication's own Linux log shows none of them (1465 pass / 19 skip / 3 fail, of the same 1487 tests).
Mutations. Each ran in the ordinary context, and each file was restored byte-for-byte afterwards:
GITHUB_REF/GITHUB_SHA, i.e. the CLI tag publication tests inherit the runner ref and reject valid fixtures #3970 shape: 6 fail.cli.ymlwithout the exact-tag guard: exactly the two wrong-ref refusals fail.cli.ymlwithout the exact-source guard: exactly the moved-tag refusal fails.Gates on the changed file:
oxfmt --check: clean.oxlint(the package's lint): clean.oxlint --type-aware --type-check: the same 28 pre-existing findings as on origin/main, and none new.tsc --noEmitover the file and its imports: clean.Closes #3970