Repository navigation
fix(cli): cover every commit of a branch's first push - #309
Merged
adityankale190895 merged 1 commit intoNov 18, 2026
Merged
Conversation
A push that creates its branch carries before = forty zeros. The range fell back to head^..head, so a change made in an earlier commit of the same push was never analysed, and the Action reported full-suite-required=false with the tests for that change left out. Use the merge base of the head with the default branch's remote-tracking ref (repository.default_branch on GitHub, CI_DEFAULT_BRANCH on GitLab), recorded in mergeBaseSha, the range a pull request from the branch would get. The labelled head-parent range stays the fallback when that ref is not in the checkout or the head is already on it. Signed-off-by: FredApps <[email protected]>
FredApps
marked this pull request as ready for review
November 18, 2026 00:55
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.
Fixes #308
Changed behavior
A push that creates its branch (
before= forty zeros) now resolves its range from the merge base of the head with the default branch's remote-tracking ref:refs/remotes/origin/<repository.default_branch>on GitHub (orGITHUB_DEFAULT_BRANCH),refs/remotes/origin/<CI_DEFAULT_BRANCH>on GitLab. The range issource: "push-event"withmergeBaseShaset, the same range a pull request from the branch gets, so every commit the push brought is analysed.The labelled
head-parentrange stays the fallback when that ref is not in the checkout, the head is already on the default branch (merge base = head), or the branch name is not a plain ref name. Pushes with a realbefore, pull requests and Azure are unchanged. In afetch-depth: 1checkout the existing unshallow retry fetches the default branch, so the second resolution finds the merge base.Fixture and validation
New cases in
packages/diffci-cli/tests/client/context.test.ts(a push that creates its branch): GitHub and GitLab merge-base ranges, the fallbacks, and a real repository whose first commit on a new branch changessrc/alpha.jsand second touchessrc/beta.js.head-parent, and the diff holds onlysrc/beta.js).context.test.ts34/34 pass.npm run typecheckandnpm run buildinpackages/diffci-clipass.End to end with the built CLI on that repository (
GITHUB_EVENT_NAME=push, zerobefore):full-suite-requiredhead-parentsrc/beta.jstest/beta.test.jsfalse(alpha.test.js fails at head, not run)push-event, merge basesrc/alpha.js,src/beta.jstest/alpha.test.js,test/beta.test.jsfalseUnsupported cases
When the default branch's ref is not in the checkout even after the unshallow retry, the range is still
head-parentand the Action'sfull-suite-requiredstill ignores that label (enforce mode already treats it as untrusted). MakingimpactOutputsrequire the full suite forhead-parentwould also change every Azure push build, so it is left for a separate decision.