[ML] Make changelog validation robust to shallow-clone merge base#3119
Merged
edsavage merged 1 commit intoJul 27, 2026
Merged
Conversation
The validate-changelogs step fetches the PR base with --depth=1 and then runs a three-dot diff (origin/<base>...HEAD). When a PR branched from an older commit, the shallow histories share no common ancestor and git aborts with 'fatal: origin/main...HEAD: no merge base' (exit 128). As the diff runs in a command substitution under 'set -e', the script died before its own DIFF_EXIT soft-skip handler could run, hard-failing the step. Guard the diff with 'if' (suppressing set -e), progressively deepen both histories to recover a merge base and retry, and only soft-skip as a last resort. This matters now that the overall build status is a required check: a CI clone-depth limitation must not block an otherwise valid PR. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Pinging @elastic/ml-core (Team:ML) |
This was referenced Jul 27, 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.
Summary
The
Validate changelog entriesstep (.buildkite/scripts/steps/validate-changelogs.sh) fetches the PR base with--depth=1and then runs a three-dot diff:When a PR branched from an older point of the base branch, the shallow (
--depth=1) histories share no common ancestor, so git aborts with:(exit 128). The diff runs inside a command substitution under
set -euo pipefail, so the script dies at that line — before its ownDIFF_EXIT/"skipping" soft-handler could run. The handler was effectively dead code, and the step hard-failed.This is latent for any sufficiently-diverged branch; it surfaced on #3078 (see build 2895).
Fix
if ! VAR=$(...), which suppressesset -efor that command (the previous$?inspection could never be reached).--deepen 50/250/1000) to recover a merge base and retry.This matters now that the overall build status (
buildkite/ml-cpp-pr-builds) is a required check onmain: a CI clone-depth limitation must never hard-fail an otherwise valid PR. Valid changelogs are still fully validated whenever a merge base is available (the common case, and now the deepened case).Test plan
>buildlabel, exercising the early-exit path).Validate changelog entriespasses (merge base recovered,docs/changelog/3078.yamlvalidated).