Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,42 @@ jobs:
steps:
- uses: actions/checkout@v7

# The CLA signature ledger may only grow. Signatures live in
# signatures/version1/cla.json, committed to main, and the contributor-assistant action
# only ever appends to it. This step makes that invariant enforced rather than assumed:
# no pull request may drop a contributor who had already signed. It matters because
# cla.yml no longer locks merged PRs (see the comment there), so the ledger is the
# guarantee rather than the locked conversation.
- name: CLA ledger is append-only
if: github.event_name == 'pull_request'
run: |
set -euo pipefail
ledger=signatures/version1/cla.json
git fetch --no-tags --depth=1 origin "${{ github.base_ref }}"

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.

The base ledger is fetched from the live ${github.base_ref} tip here, while the tree being checked comes from the merge commit built when the run was created. If a signature commit lands on main in between, the base has an entry the merge tree does not, and this step fails a PR that removed nothing. The merge commit already records the exact base it was built from, so the comparison can be made self-consistent.

Technical details
# Base ref can be newer than the checked-out merge tree

## Affected sites
- `.github/workflows/ci.yml:33` — `git fetch --depth=1 origin "${{ github.base_ref }}"` resolves the live base tip at step time.
- `.github/workflows/ci.yml:39` — `git show "FETCH_HEAD:${ledger}"` therefore may not match the base of the working tree.
- The working tree is `refs/pull/<n>/merge` (the default `actions/checkout` ref for `pull_request`). Verified on this PR: its first parent is `main` at the time the merge ref was generated, its second parent is the head.

## Failure mode
- A CLA signature committed directly to `main` after the merge ref was generated but before this step runs makes the base ledger a strict superset of the merge tree, so the step reports a revocation that did not happen.

## Required outcome
- The base ledger must come from the same revision the checked-out tree was merged against.

## Suggested approach
- Set `fetch-depth: 2` on `actions/checkout@v7` and read `HEAD^1:signatures/version1/cla.json`, dropping the separate fetch.

# 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."
exit 0
fi
git show "FETCH_HEAD:${ledger}" > /tmp/cla-base.json
python3 - <<'PY'
import json, sys

def load(path):
with open(path, encoding="utf-8") as handle:
return json.load(handle)["signedContributors"]

base = load("/tmp/cla-base.json")
head = load("signatures/version1/cla.json")
# id is stable across a login rename; name is only for the message.
base_by_id = {entry["id"]: entry.get("name", "?") for entry in base}
head_ids = {entry["id"] for entry in head}
removed = [f"{name} (id {sid})" for sid, name in base_by_id.items() if sid not in head_ids]
if removed:
sys.exit("CLA signatures may not be revoked, but these were removed: " + ", ".join(removed))
print(f"CLA ledger append-only: {len(base_by_id)} signed at base, {len(head_ids)} now, none removed")
PY

- uses: pnpm/action-setup@v6
with:
version: 10.32.1
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/cla.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,16 @@ jobs:
custom-allsigned-prcomment: 'All contributors have signed the CLA. ✅'
# TODO: replace with your maintainers' GitHub usernames.
allowlist: 'shockalotti,dependabot[bot]'
# The action's default is 'true', which locks every merged PR's conversation. That
# silently blocks all post-merge activity: a bot cannot post a review, and a mention
# on a merged PR can never be answered. It caused a green pullfrog run that produced
# nothing, which reads as a broken integration rather than a lock.
#
# Disabling it does NOT let contributors revoke their CLA, which is what the lock
# exists for. The record is not the signing comment: signatures are appended to
# signatures/version1/cla.json, committed to main, and the action only ever appends
# (src/persistence/persistence.ts does push(), never a removal). An outside
# contributor has no write access to this repository and cannot alter that ledger or
# rewrite main's history. The "CLA ledger is append-only" step in ci.yml enforces
# that no pull request ever removes a recorded signature.
lock-pullrequest-aftermerge: 'false'
Loading