fix(ci): make no-new-getattr guard stable in shallow PR checkouts#38480
Merged
crazywoola merged 3 commits intoJul 8, 2026
Conversation
The check_no_new_getattr guard could fail when CI checked out a shallow synthetic PR merge commit, then fetched a newer main tip with --depth=1. git merge-base failed because the PR base commit wasn't reachable from the shallow-fetched main ref. Fix: - Use GITHUB_BASE_SHA (set by GitHub Actions for PR events) as the stable base commit reference instead of relying on git merge-base against a moving, shallow-fetched main branch. - Remove the now-unnecessary git fetch/bind steps from style.yml. - Add unit tests for the GITHUB_BASE_SHA fallback in resolve_ci_base. Fixes langgenius#38325
Contributor
Pyrefly Type Coverage
|
QuantumGhost
previously approved these changes
Jul 7, 2026
6 tasks
Contributor
|
The merge queue check failed. Besides, I believe the better approach would be inject the base commit directly through the script command line arguments, instead of accessing |
Assisted-by: Codex:GPT-5.4
Contributor
|
Hi, @EvanYao826 I have updated the branch and making base commit passing explicitly. |
crazywoola
approved these changes
Jul 7, 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
no-new-getattrstyle guard could fail in pull request CI when the workflow checked out a shallow synthetic PR merge commit, then fetched a newermaintip with--depth=1.git merge-base main HEADfailed because the PR base commit wasn't reachable from the shallow-fetchedmainref.Root Cause
The workflow fetched
origin/mainwith--depth=1and created a localmainbranch pointing to it. Whenmainhad advanced past the PR's base commit,git merge-base main HEADreturned an error because Git had no common ancestor — the shallow-fetchedmaintip was newer than the PR's base and didn't share history.Fix
scripts/check_no_new_getattr.py:resolve_ci_base()now checks theGITHUB_BASE_SHAenvironment variable first. GitHub Actions automatically sets this to the stable base commit SHA of the pull request, so it's always in Git history regardless of how shallow the checkout is..github/workflows/style.yml: Removed the now-unnecessarygit fetch --depth=1 origin/mainandgit branch main origin/mainsteps. AddedGITHUB_BASE_SHAenv to the guard step.resolve_ci_basewith and withoutGITHUB_BASE_SHAset.Fixes #38325