From 0ebfe3e4f690514704c0783d473b7583fc64759a Mon Sep 17 00:00:00 2001 From: Wynne Pirini Date: Thu, 29 Oct 2026 15:51:03 +1300 Subject: [PATCH] fix(ci): compare the CLA ledger with the fork point, not main's tip The append-only guard added in #161 compares the pull request's ledger with the tip of the base branch. Signatures are committed to main by the CLA bot, so any signature added after a PR was opened is absent from its head by construction. Comparing with today's main calls that "removed" and fails the PR. That is what happened to #176, #179, #158 and #159 at once: MohammadHadi2031 signed, the ledger on main grew from 11 to 12 entries, and every PR forked before that point was reported as revoking his signature. Nothing was removed. Compare against git merge-base HEAD origin/ instead, which only sees entries the PR's own branch actually had. A shallow clone cannot compute a merge base, so warn and skip rather than fail closed on an infrastructure limitation. Checkout now fetches full history for this job; the repository is 8MB. Verified against the real #176: base=main tip reports "MohammadHadi2031 (id 17288524)" as removed and exits 1; base=merge-base reports nothing and exits 0. A ledger with one signature genuinely deleted still fails, naming tgrahammer (id 3223680). --- .github/workflows/ci.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 491ffd90..c68eb835 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,11 @@ jobs: check: runs-on: ubuntu-latest steps: + # Full history, because the CLA check below needs the fork point of the pull + # request, not just the tip of the base branch. The repository is small. - uses: actions/checkout@v7 + with: + fetch-depth: 0 # The CLA signature ledger may only grow. Signatures live in # signatures/version1/cla.json, committed to main, and the contributor-assistant action @@ -30,13 +34,24 @@ jobs: run: | set -euo pipefail ledger=signatures/version1/cla.json - git fetch --no-tags --depth=1 origin "${{ github.base_ref }}" - # Bootstrap case: if the base branch has no ledger yet, there is nothing to protect. - if ! git cat-file -e "FETCH_HEAD:${ledger}" 2>/dev/null; then - echo "No CLA ledger at base; nothing to protect yet." + base="origin/${{ github.base_ref }}" + git fetch --no-tags origin "${{ github.base_ref }}" + # Compare against the FORK POINT, not the tip of the base branch. Signatures + # are committed to main by the CLA bot, so any signature added after a pull + # request was opened is absent from its head by construction. Comparing with + # today's main tip calls that "removed" and fails every older PR; comparing + # with the merge base only sees entries the PR's own branch had. + merge_base=$(git merge-base HEAD "$base" 2>/dev/null || true) + if [ -z "$merge_base" ]; then + echo "::warning::no merge base with $base (shallow clone?); skipping the append-only check" + exit 0 + fi + # Bootstrap case: if the fork point has no ledger yet, there is nothing to protect. + if ! git cat-file -e "${merge_base}:${ledger}" 2>/dev/null; then + echo "No CLA ledger at the fork point; nothing to protect yet." exit 0 fi - git show "FETCH_HEAD:${ledger}" > /tmp/cla-base.json + git show "${merge_base}:${ledger}" > /tmp/cla-base.json python3 - <<'PY' import json, sys