Skip to content

Commit a7e94e9

Browse files
hotlongclaude
andauthored
fix(ci): the ADR merge gate requires an APPROVED review, from anyone (#8172)
The gate matched the approving account against a hard-coded `MAINTAINER_APPROVERS` list. That proxy became unsatisfiable once cloud sessions began authoring PRs under the maintainer's own account: GitHub forbids self-approval, so a required context was permanently red on exactly the PRs the human was driving, while an AI seat holding the same credential could still satisfy it. Per the maintainer ruling of 2026-08-12, the account list is retired rather than widened: the gate now passes when the PR's latest state-setting review is APPROVED, whoever submitted it. The revocation semantics are unchanged -- a later CHANGES_REQUESTED or DISMISSED still turns it red, and COMMENTED/PENDING still set nothing. - `MAINTAINER_APPROVERS` and `isMaintainer` are removed; `latestMaintainerReviewState` becomes `latestReviewState`, folding over every reviewer; `approvalsFromNonMaintainers` becomes `approverLogins`, a pure diagnostic that no longer asserts a distinction the gate does not draw. - Both file headers are rewritten rather than patched: they now state what the gate guarantees (someone approved, currently) and what it no longer does (that the approver is the maintainer, that a human merged). - The job name `ADR maintainer approval` is deliberately unchanged -- it is the required-context string in the `main` ruleset. Co-authored-by: Claude <noreply@anthropic.com>
1 parent ecb39ea commit a7e94e9

3 files changed

Lines changed: 209 additions & 140 deletions

File tree

.github/workflows/adr-merge-approval.yml

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,28 @@
11
name: ADR Merge Approval
22

3-
# Machine enforcement of the #6741 ruling (maintainer, verbatim):
4-
#adr 只能由维护者自己确认,人工合并,ai 不得擅自合并。
3+
# Machine enforcement of the 2026-08-12 ruling (maintainer, verbatim):
4+
#门禁改成只要求「APPROVED review 存在」」/「不要指定具体的人
55
#
6-
# A PR whose diff touches docs/adr/** must carry an APPROVED review from the
7-
# maintainer's OWN account before it is mergeable; approvals from the shared
8-
# bot/agent identities deliberately do not count. Prose enforcement was
9-
# measured insufficient the day the ruling landed — two different AI-operated
10-
# seats merged docs/adr/** PRs within the following hour (#6671, #6732; the
11-
# full record and both replays live in scripts/check-adr-merge-approval.mjs
12-
# and its --self-test). Drafting ADR PRs stays open to every seat; only the
13-
# merge is reserved, and the maintainer's own approval + merge is the intended
14-
# zero-extra-friction green path.
6+
# A PR whose diff touches docs/adr/** must carry an APPROVED review before it
7+
# is mergeable. The gate does NOT check WHO approved: any account with review
8+
# rights on this repo — including an AI seat — satisfies it, which is the
9+
# accepted cost of the ruling and is stated in full in the two-clause table at
10+
# the head of scripts/check-adr-merge-approval.mjs. The approval must be
11+
# current: a later CHANGES_REQUESTED or DISMISSED revokes it.
12+
#
13+
# This supersedes the account-identity rule this workflow used to describe
14+
# (#6741 「adr 只能由维护者自己确认,人工合并,ai 不得擅自合并。」, enforced by
15+
# matching the maintainer's numeric account id). That proxy became
16+
# unsatisfiable once cloud sessions began authoring PRs under the maintainer's
17+
# own account, since GitHub forbids self-approval (#8161). #6741's two halves
18+
# survive as convention, not as anything this workflow can measure.
19+
#
20+
# Prose enforcement was measured insufficient the day #6741 landed — two
21+
# different AI-operated seats merged docs/adr/** PRs within the following hour
22+
# (#6671, #6732; the full record and both replays live in
23+
# scripts/check-adr-merge-approval.mjs and its --self-test). Both had ZERO
24+
# reviews of any kind, so both stay red under the widened rule too. Drafting
25+
# ADR PRs stays open to every seat; only the merge is gated.
1526
#
1627
# Deliberately NO `paths` filter, on either trigger — the same choice
1728
# changeset-presence.yml made in objectui (#3769) and for the same reason
@@ -30,9 +41,11 @@ on:
3041
pull_request:
3142
branches: [main]
3243
# An approval does not fire `pull_request`, so without this trigger the
33-
# failed check would sit red after the maintainer approves until someone
34-
# re-ran it by hand. Subscribing to reviews makes the maintainer's approval
35-
# itself re-run the gate — the zero-friction green path the card requires.
44+
# failed check would sit red after the approval lands until someone re-ran
45+
# it by hand. Subscribing to reviews makes the approval itself re-run the
46+
# gate — the zero-friction green path the card requires. `pull-requests:
47+
# read` below covers listing reviews from ANY account, so the widened rule
48+
# needs no extra permission or token scope.
3649
# (On non-ADR PRs a review re-runs the cheap clean path; harmless.)
3750
pull_request_review:
3851
types: [submitted, edited, dismissed]
@@ -55,6 +68,14 @@ permissions:
5568

5669
jobs:
5770
adr-merge-approval:
71+
# ⛔ Do NOT rename this job. Its name IS the required status-context string
72+
# in the `main` ruleset (#7022), and it is registered under that exact
73+
# spelling in scripts/check-required-contexts.mjs — renaming it here alone
74+
# leaves the ruleset waiting for a context that never reports, which hangs
75+
# the merge queue until the 60-minute timeout. The word "maintainer" now
76+
# over-claims (see this file's header: any approver counts); correcting it
77+
# is a settings action nobody in CI can perform, so it is tracked as
78+
# follow-up work rather than done here.
5879
name: ADR maintainer approval
5980
runs-on: ubuntu-latest
6081
timeout-minutes: 5
@@ -77,7 +98,7 @@ jobs:
7798
# install, no build. The self-test runs first (repo convention), then
7899
# the gate. GITHUB_TOKEN is only read on the gated path (a docs/adr/**
79100
# diff needs the PR's review list); the clean path does zero lookups.
80-
- name: Require the maintainer's own approval on docs/adr/** diffs
101+
- name: Require an APPROVED review on docs/adr/** diffs
81102
env:
82103
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83104
run: node scripts/check-adr-merge-approval.mjs --self-test && node scripts/check-adr-merge-approval.mjs

0 commit comments

Comments
 (0)