Skip to content

chore: use shallow checkout for semver check - #26604

Merged
neilconway merged 1 commit into
apache:mainfrom
neilconway:neilc/semver-shallow-checkout
Oct 23, 2026
Merged

neilconway merged 1 commit into
apache:mainfrom
neilconway:neilc/semver-shallow-checkout

Conversation

@neilconway

@neilconway neilconway commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

  • N/A

Rationale for this change

The semver check previously compared the PR against the current state of apache/main, and did so by doing a full git checkout, including the entire repository history. This approach has two downsides:

  1. It is expensive: cloning the entire repo history takes ~9 sec locally, versus ~0.7 for a shallow checkout.
  2. There's a race condition which results in comparing the PR against the wrong base when assessing whether the PR breaks semantic versioning.

On (2): when a PR is opened or updated, GitHub creates a test merge commit that merges the PR into main as of that moment (T0). Now suppose that there is a delay between the CI jobs being queued and the semver job actually running, so that when the semver job runs, HEAD is now at T1. The previous version of this check would compare the PR with T1, not T0. For example, if a commit between T0 and T1 added a new API, the semver check would claim that the PR removes that API.

Fix this by comparing the merge commit with its first parent instead, which is T0 in the notation above.

What changes are included in this PR?

See above.

What is the testing strategy for this PR?

CI / dev tooling change only. Tested locally on six open PRs (#26565, #26000, #26582, #25874, #26534, #26576): fetched each PR's merge ref at depth 2 and ran both steps against HEAD^1. The crate lists and semver results match CI, including two PRs that branched 66 and 154 commits behind main.

Are there any user-facing changes?

No.

On pull_request events, the semver check job checks out GitHub's test
merge commit, which merges the PR into the base branch as it was when
the event fired. The job then fetched the base branch again when it
started and used that as the baseline. Jobs currently wait hours for a
runner, and in all 59 runs from October 21 and 22, main had moved 2 to
17 commits ahead of the commit the PR was merged into. If main gains a
public item in a crate that a waiting PR also changes, the check
reports that item as removed by the PR. None of the reports in those
runs was wrong, but nothing prevented one.

Use the merge commit's first parent as the baseline instead. That is
the base branch commit the PR was merged into, so the comparison
covers only the PR's changes. The first parent is one generation back,
so the checkout needs fetch-depth: 2 rather than the full history of
every branch and tag, and the separate fetch of the base branch goes
away. In a single-threaded local test, fetching a PR's merge ref at
depth 2 took 0.7s of CPU and 16 MB, against 9.2s and 267 MB for the
full history. The full-history checkout takes a median of 14s in CI.

Tested by fetching refs/pull/26565/merge at depth 2 and running
changed_crates.sh against HEAD^1. It lists the same four crates as CI's
run for that PR, and semver-check reports the same removed function,
register_physical_expr.
@neilconway

neilconway commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Mostly doing this to save a few cycles in case we want to try running the semver check on ubuntu-slim, but fixing the race doesn't hurt :)

@github-actions github-actions Bot added the development-process Related to development process of DataFusion label Oct 22, 2026

@kumarUjjawal kumarUjjawal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@neilconway
neilconway added this pull request to the merge queue Oct 23, 2026
Merged via the queue into apache:main with commit 2a96d6d Oct 23, 2026
46 checks passed
@neilconway
neilconway deleted the neilc/semver-shallow-checkout branch October 23, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

development-process Related to development process of DataFusion v56.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants