Skip to content

fix(cla): stop locking merged PRs, and enforce an append-only signature ledger - #161

Merged
shockalotti merged 1 commit into
mainfrom
fix/cla-lock-policy
Oct 21, 2026
Merged

shockalotti merged 1 commit into
mainfrom
fix/cla-lock-policy

Conversation

@shockalotti

Copy link
Copy Markdown
Contributor

Problem

Every merged PR in this repo is locked, with active_lock_reason=null, and no workflow locks anything. That looks like a mystery but has a precise cause: contributor-assistant/github-action defaults lock-pullrequest-aftermerge to true, and cla.yml did not override it. The action runs on pull_request_target: closed, so it locks each PR at merge.

Proof it is mechanical: 142, 148, 149, 150, 151, 153, 154, 156, 157 are merged and locked; 112, 129, 133, 158, 159 are unmerged and unlocked. Perfect correlation with merge state.

Why it matters

A pullfrog run on merged #142 completed successfully and produced nothing, because both report_progress and create_pull_request_review fail on a locked conversation:

Unable to create comment because issue is locked.

A green run with no output reads as a broken bot, and it cost time today chasing the wrong cause. It also makes an @mention on a merged PR structurally unanswerable.

Why turning it off does not weaken the CLA

The lock exists so a contributor cannot revoke their signing comment. The comment is not the record:

  • Signatures are appended to signatures/version1/cla.json, committed to main.
  • The action only ever appends: src/persistence/persistence.ts does signedContributors.push(...), with no removal path.
  • An outside contributor has no write access to this repository, so they can neither edit the ledger nor rewrite main's history.
  • src/main.ts shows the lock and the check are mutually exclusive: when closed and the setting is true it locks and returns, skipping the check entirely.

What this changes

  1. cla.yml: set lock-pullrequest-aftermerge: 'false' explicitly, so an action bump cannot silently reintroduce it, with a comment recording the reasoning.
  2. ci.yml: a new step, CLA ledger is append-only, that fails any pull request removing a contributor who had already signed. It compares by id, so a login rename is not a false positive, and it skips cleanly when the base branch has no ledger yet.

Verified locally: unchanged passes, a removed entry fails and names the person, an added entry passes. Both files parse, and the shell block passes bash -n.

Not done here

main is currently unprotected. That is a separate decision: the CLA bot commits signatures directly to main with a PAT, so a naive "require a pull request" rule would break it. A ruleset with the bot as a bypass actor is the correct shape if you want it. This PR does not touch repo settings.

…re ledger

The CLA action's `lock-pullrequest-aftermerge` input defaults to true and
cla.yml did not override it, so every merged PR had its conversation locked.
That is not repo CI and not a manual lock, which is why it looked like a
mystery: grepping the workflows finds nothing, because it is an action default.

The cost showed up today. A pullfrog run on merged #142 went green and posted
nothing, because `report_progress` and `create_pull_request_review` both fail on
a locked conversation. A healthy run that produces no output reads as a broken
integration, and an @mention on a merged PR can never be answered.

The lock exists so a contributor cannot revoke their signing comment. That is
not the record. Signatures are appended to signatures/version1/cla.json,
committed to main, and the action only ever appends (persistence.ts calls
push(), never a removal). An outside contributor has no write access here, so
they cannot alter the ledger or rewrite main's history either.

So: turn the lock off, and make the actual guarantee enforced rather than
assumed. A new ci.yml step fails any pull request that drops a contributor who
had already signed, comparing by id so a login rename is not a false positive.
Verified locally: unchanged passes, a removed entry fails naming the person,
an added entry passes.

Set explicitly rather than left to the default, so an action bump cannot
silently reintroduce the lock.

@pullfrog pullfrog Bot 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.

ℹ️ No critical issues — one inline robustness note, plus one follow-up on the PRs that are already locked.

Reviewed changes

  • cla.yml disables post-merge locking — sets lock-pullrequest-aftermerge: 'false', overriding the action's true default, with a comment explaining that the ledger rather than the locked thread is the record.
  • ci.yml adds an append-only ledger gate — a pull_request-only step fetches the base ledger and fails if any previously-signed id is missing from the checked-out tree.

I confirmed the third-party contract against contributor-assistant/[email protected]: the input is read as a string and compared with == 'true', so 'false' genuinely takes the non-locking path, and src/persistence/persistence.ts only pushes entries. The Python comparison behaves as described (unchanged/add pass, removal fails naming the contributor, rename by id passes), and the step ran green on this PR's CI.

ℹ️ Existing merged PRs stay locked

The change stops future locks, but the conversations cited as the motivation (#142, #148, #149, …) remain locked until they are explicitly unlocked, so the motivating bot-run case is still unanswerable there.

Technical details
# Unlock already-locked merged PRs

## Affected conversations
- Merged PRs named in the PR body (e.g. #142, #148, #149, #150, #151, #153, #154, #156, #157) are still `locked`.
- `lock-pullrequest-aftermerge: 'false'` only affects the action's next `closed` event; the action never unlocks.

## Required outcome
- Decide whether the historical conversations are in scope. If they are, unlock each with `DELETE /repos/{owner}/{repo}/issues/{issue_number}/lock` (requires push access), or the equivalent UI action.

## Open questions for the human
- Is re-opening post-merge conversation on historical PRs in scope, or only future ones?

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash | 𝕏

Comment thread .github/workflows/ci.yml
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.

@shockalotti
shockalotti merged commit 25497d7 into main Oct 21, 2026
6 checks passed
shockalotti added a commit to MohammadHadi2031/calnode that referenced this pull request Oct 29, 2026
The append-only guard added in Calnode#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 Calnode#176, Calnode#179, Calnode#158 and Calnode#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/<base> 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 Calnode#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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant