Repository navigation
fix(release): count every pusher of a release, need a second maintainer, date approvals - #8076
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
…cond maintainer must have
…er, date approvals
5a0ac84 to
4f84c2b
Compare
jrusso1020
left a comment
There was a problem hiding this comment.
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 onrelease/v0.9.62andrelease/v0.9.55). Pushing through a bot is closed off by ruleset 27422526, which allows only admins to updaterelease/v*. - Approvals: an approval must be on
commit_id == headand post-date the lastbase_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.commitsbecause 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.Zname, so a pusher from an earlier closed attempt also counts.
Review by Rames
jrusso1020
left a comment
There was a problem hiding this comment.
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_deletioncounts 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
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, therelease-sourcestep ("Find the release this push publishes") now: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.pulls/<n>/commitslists (GitHub stops at 250), since who wrote the rest is then unknown.Userwith 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.base_ref_changedevent, so the review saw the diff intomain.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 fakeghalso answers the PR (commitscount) and the branch's activity log. New cases: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.mjsfails with main'spublish.yml(test-only commitaee488aa) in 3 of 3 runs.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.mjspasses 26 of 26 tests, 3 runs in a row (Node 24, Linux).activity?ref=refs/heads/release/v0.9.61lists its creation and each push with the pushing account. The entries stay readable after the branch is deleted.