fix(ci): fetch full base history in pr-test-policy (shallow graft broke merge-base) (#7501)

With --depth=1 the base ref is grafted, so 'git diff base...HEAD' resolves a
wrong merge-base for PR branches that recently merged the release branch. The
three-dot diff then attributes ALREADY-MERGED sibling PRs' changes to the PR
under test, producing false high-signal reds (deleted test files / weakened
asserts that exist in no ref reachable from the PR).

Observed live on #7329: the job blamed it for tests/unit/ui/provider-plan-config.test.tsx
(deleted by an unrelated merged PR) and for #7106's antigravity files. Local
reproduction with full history returns PASS for the same head.

The job's checkout is already fetch-depth: 0, so the full base fetch only
updates the ref — negligible cost.
This commit is contained in:
Diego Rodrigues de Sa e Souza
2026-07-17 01:01:38 -03:00
committed by GitHub
parent 88507a6edc
commit e0894cc107
2 changed files with 2 additions and 1 deletions

View File

@@ -519,7 +519,7 @@ jobs:
with:
node-version: ${{ env.CI_NODE_VERSION }}
- name: Fetch base branch
run: git fetch --no-tags origin "${GITHUB_BASE_REF}" --depth=1
run: git fetch --no-tags origin "${GITHUB_BASE_REF}"
- name: Validate source changes include tests
run: node scripts/check/check-pr-test-policy.mjs --summary-file .artifacts/pr-test-policy.md
# Anti test-masking: flag net assert removal / new assert.ok(true) in changed tests.

View File

@@ -0,0 +1 @@
- CI: `pr-test-policy` fetches the base branch with full history instead of `--depth=1` — the shallow graft made `merge-base` resolve wrong for PR branches that recently merged the release, so the three-dot diff blamed the PR for OTHER merged PRs' changes (false "deleted test"/"weakened asserts" reds; observed on #7329 being blamed for #7106's files).