Skip to content

fix(release): count every pusher of a release, need a second maintainer, date approvals - #8076

Merged
miguel-heygen merged 5 commits into
mainfrom
fix/release-approval-pushers
Nov 17, 2026
Merged

miguel-heygen merged 5 commits into
mainfrom
fix/release-approval-pushers

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

What

A stable release now publishes only when the approver did not push any of it, and a second person with write access opened or pushed it. The approval must also come after the release PR's last base change.

In publish.yml, the release-source step ("Find the release this push publishes") now:

  • reads the release branch's activity log (repos/<repo>/activity?ref=refs/heads/<branch>). Every account recorded pushing it counts as a writer, including the push that created it and every ordinary push. Before, the step took writers from the PR opener, commit author and committer names, and force-push actors only. Commit names can be anyone's, and an ordinary push was never looked up.
  • refuses when the branch has no recorded push, or when the PR has more commits than pulls/<n>/commits lists (GitHub stops at 250), since who wrote the rest is then unknown.
  • needs a second person: the opener or one of the pushers must be a User with write or admin permission. Writers can't approve, so this person is never the approver. An opener without write access, or an app, no longer fills that role.
  • counts an approval only if it was submitted after the PR's last base_ref_changed event, so the review saw the diff into main.

Commit author and committer logins still count as writers, so they can only exclude an approver, never admit one.

Why

Before, one maintainer could approve a release they pushed themselves, as long as the commits carried someone else's name, or none, and another account opened the PR. An approval given while the PR targeted another base also still counted after the base changed to main.

How

  • .github/workflows/publish.yml: the four checks above, in the existing step. Each lookup fails closed.

  • docs/contributing/release-channels.mdx: the stable-release rule now names pushers, the second person and the base.

  • scripts/publish-workflow.test.mjs: the fake gh also answers the PR (commits count) and the branch's activity log. New cases:

    • the approver pushed commits written under another name;
    • the approver pushed commits with no account behind them;
    • the approver created the branch;
    • more commits than GitHub lists;
    • no recorded push;
    • an opener without write access who pushed;
    • an app that opened and pushed;
    • an opener without write access whose only other pusher is an app;
    • an approval given before the base changed to main.

    Passing cases: a maintainer's push as the second person when the opener lacks write access, and an approval after the last base change.

Test plan

fails without the fix: "a push to main publishes only the merge of exactly one approved release PR from this repo" in scripts/publish-workflow.test.mjs fails with main's publish.yml (test-only commit aee488aa) in 3 of 3 runs.

  • At the fix (31039389, on top of fix(release): a release merged in one push with other PRs publishes at its own commit #8077), node --test scripts/publish-workflow.test.mjs passes 26 of 26 tests, 3 runs in a row (Node 24, Linux).
  • Each part of the fix was removed in turn: pushers as writers, the second person, the dated approval, the commit count. With any one removed, that test fails.
  • Read from the live API: activity?ref=refs/heads/release/v0.9.61 lists its creation and each push with the pushing account. The entries stay readable after the branch is deleted.
  • Not run: a real release through the new step. The next stable release is its first run. The 0.9.61 and 0.9.62 releases would pass it: an admin created and pushed the branch, and a different maintainer approved after the last push.

@mintlify

mintlify Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
hyperframes 🟢 Ready View Preview Nov 17, 2026, 3:46 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need: Fallow audit green. REQUEST_CHANGES at 4f84c2bd.

The logic is clean; the only blocker is the red check this PR introduces (details under Blocker below). I'll approve as soon as it's green.

Rebase onto #8077 is correct. I compared 5a0ac845 → 4f84c2bd against #8077's own diff. The only merge edits in publish.yml are adding .user.type to #8077's row and author_type to the matching read. The test helper was renamed push → pushBy so it doesn't collide with #8077's push(). #8077's push-range scan is intact (publish.yml:84-111): the compare guard, the per-commit loop, the error for a release commit with no linked PR, and the refusal when more than one release PR is found. (Correction to the re-pin note: the loop is #8077's; the pre-rebase head had none.)

Combined logic, probed:

  • A release commit that isn't the push tip publishes at its own merge commit.
  • Two release commits in one push stop with an error.
  • A release commit with no linked PR yet stops with an error, so a rerun can recover it.
  • Pushers come from repos/…/activity?ref=refs/heads/<ref>. The actor recorded there is the account that actually pushed, so a reviewer who pushed someone else's commits can't approve their own push. That data is still readable after the branch is deleted (checked on release/v0.9.62 and release/v0.9.55). Pushing through a bot is closed off by ruleset 27422526, which allows only admins to update release/v*.
  • Approvals: an approval must be on commit_id == head and post-date the last base_ref_changed. A standing change request blocks. COMMENTED reviews are dropped before the latest review per person is picked. Dismissed reviews are filtered out.
  • Pagination: every list is paginated, and the commit list is checked against pull.commits because GitHub caps it at 250.

Tests: scripts/publish-workflow.test.mjs passes 26/26. Removing any one of the four guards fails the named test: pushers counted as writers, the date clause, the second-person check, and the commit-count check. That test also fails against main's publish.yml, so the "fails without the fix:" line holds.

Blocker: Fallow audit failed on both runs at this head (job) with this PR's fallow/high-crap-score at scripts/publish-workflow.test.mjs:137: the run test helper scores 31.6 against a threshold of 30. Splitting the history.* defaults out of run should clear it.

Nits, not blocking:

  • An activity entry with a null actor writes a tab-only line that passes the "no recorded push" guard (:130). This is harmless in practice: a deleted account shows as ghost, and only admins can push.
  • The activity log spans every past life of a reused release/vX.Y.Z name, so a pusher from an earlier closed attempt also counts.

Review by Rames

@jrusso1020 jrusso1020 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-reviewed at 40e31ea3. This head fast-forwards 4f84c2bd, so I reviewed the delta: 2 lines in publish.yml and 43 in the test.

Earlier blocker fixed. The run helper's Fallow CRAP score (31.6 > 30) is gone. The defaults now live in historyOf(pulls, ref, history), which removes most of run's ?? branches, and Fallow audit passes at this head.

A push with no account now stops the release. jq @tsv writes a null actor.login as an empty field, and the new ! cut -f1 pushers.tsv | grep -qx '' || exit 1 catches it.

  • node --test scripts/publish-workflow.test.mjs: 26/26 pass.
  • With the two new workflow lines deleted, 25/26 pass. The failure is a push with no recorded account.

Bypass check. I looked for a way to approve a release you helped write, or to count one person twice, and found none:

  • Every activity entry except branch_deletion counts as a writer, including creates and force-pushes.
  • App pushers exclude an approver but can't be the second maintainer.
  • The second maintainer is always a writer and the approver never is, so they are always two different people.
  • The approval must be on the head commit and come after the last base change.

Nit (non-blocking): the step runs under -eo pipefail. If grep -q exits early while cut is still writing, cut can die with SIGPIPE, ! turns that into success, and the check is skipped. I hit this once in 200 runs with a 54 KB pushers.tsv. That file size isn't realistic for a release branch, but a check without a pipe can't fail open:

          ! grep -q $'^\t' "$RUNNER_TEMP/pushers.tsv" ||

The suite still passes 26/26 with that line.

Nit (also true on main): Co-authored-by trailers aren't counted as writers, so a co-author who never pushed could approve. That's possible follow-up material.

CI at this head is fully green.

Verdict: APPROVE. Needs reuse: no, it reuses the activity log and permission lookups the step already makes. Over-engineered: no.

— Rames

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit b22ca1a Nov 17, 2026
69 checks passed
@miguel-heygen
miguel-heygen deleted the fix/release-approval-pushers branch November 17, 2026 17:17
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.

2 participants