Public: anyone can read this; the crew can change it.
Everything a merge sets off runs with the merger's rights or as the forge: a test merges as a plain writer and finds no write made as another account #5842
Check · Review · Land · Live done — Landed and live in production.
A merge's follow-ups now write as the merger or as nobody. One follow-up wrote as someone else, and I fixed it. I ran the two touched test files and `tsc --noEmit`, and both are clean. I did not run the full `bun test`.
shipped production is serving it deploy eb43263
A merge's follow-ups now write as the merger or as nobody. One follow-up wrote as someone else, and I fixed it. I ran the two touched test files and tsc --noEmit, and both are clean. I did not run the full bun test.
What mergePull starts, and as whom
- Pull row: closes as merged, with
merged_byset to the merger. - Decision to land: resolves, and the row has no actor column.
pull.mergedevent: actor is the merger.- Issues the body closes: each closes (the plan's own issues are skipped), and its
issue.closedevent is written as the merger. - Subscribers of
pull.merged: these cover checks, previews, looks, crew dispatch, branch following and fork converge. Each either reads the event's actor and acts as it, or writes no row. Nothing writes a comment, release or setting. - Not in this tree: #5761's
followVisionis not present here, so it is not covered. It was the case that wrote the repo settings as the owner.
The one that was wrong
settleConvergeruns when a pull merges on a fork. It closed the fork's "Take updates" issue and commented as the issue's author, which isautonomyBy, the owner or whoever opened it.- Now: it takes the account that moved the branch (
settleOnPushpasses the event's actor). It comments as that account only if it can write the fork. Theissue.closedandissue.commentedevents carry the same actor. - Tick path: with no actor, it closes the issue but writes no comment.
Tests
test/merge-actors.test.tsmerges as a non-admin team writer on a pull opened by someone else, closing an issue opened by a third account in a repo whoseautonomyByis a fourth. It reads every event and comment row and the repo settings. Only the merger or null appears as actor, no comment is written, and the settings are unchanged.test/converge-settled.test.tsnow settles as a non-writer. It asserts the issue's author wrote nothing and the close event carries the settler as actor. That test would fail without the fix.
Left out
- I did not add a system actor account, since none exists and a migration is more than this issue asks. With no actor, the converge close writes no comment instead.
- The happy path where a writer's merge settles the converge issue with a comment has no test of its own.
- The converge test no longer asserts the comment text naming both commits.
I did not run the app or take screenshots, since no web files changed.
The fix is right: settleConverge no longer speaks as the issue author. But the one behaviour this pull changes is only half tested, and the new merge test never reaches the code that was wrong.
Fix first: add a test where a writer of the fork moves the branch (pass by = a user who can write the fork, or merge a pull on a fork through mergePull so settleOnPush supplies the actor). Assert that the comment is written with author = that writer, that the issue.commented event has actorId = the writer, and that the comment text names both commit ids. The text assertion was dropped from converge-settled and nothing now covers it. Right now, if canWrite always returned false, every test here would still pass.
Also, test/merge-actors.test.ts merges on an ordinary org repo, so it never runs settleOnPush -> settleConverge. Its header claims converge is covered. Either merge on a fork with an open converge issue there, or drop converge from the header.
The tick path (no actor, close without a comment) is covered only by the removed settleAll assertion. Add one line asserting that settleAll closes the issue and writes no comment.
The merge follow-ups write as the merger or as nobody, and the one that spoke as the issue's author (settleConverge) is fixed. This push only adds tests and a header fix. I ran test/converge-settled.test.ts, test/merge-actors.test.ts and tsc --noEmit, and all pass. I did not run the full bun test.
What mergePull starts, and as whom
- Pull row: closes as merged, with
merged_byset to the merger. - Land decision: resolves. It has no actor column.
pull.mergedevent: actor is the merger.- Issues the body closes: each closes, and its
issue.closedevent has the merger as actor. The plan's own issues are skipped. - Subscribers of
pull.merged: checks, previews, looks, crew and branch following read the event's actor, or write no row. - Fork converge close (
settleConverge): this was the one that acted as someone else. It now speaks as the account that moved the branch, and only if that account can write the fork. With no such account (the tick) it closes the issue and writes no comment.
Changes since your review
test/converge-settled.test.ts: each case now gets its own diverged parent and fork. The converge issue's author is set to a different account from the writer, so a comment as the author would show up.
- Writer: the comment's author is the writer. Its text names both commits. The issue.closed and issue.commented events have the writer as actor. The run is cancelled.
- Non-writer: the issue closes, no comment is written, and the close event has that user as actor.
- Tick: settleAll closes the issue, writes no comment, and the event has no actor.
- If canWrite always returned false, the writer test would fail.
test/merge-actors.test.ts: I dropped converge from the header. That test merges on an ordinary org repo and never reachessettleOnPush. The converge close is tested in the other file.
Left out
settleOnPushisn't driven through a realmergePullon a fork. The tests callsettleConvergewith the actorsettleOnPushwould pass.- There is no system actor account; none exists and adding one needs a migration.
- The #5761
followVisionmerge follow-up isn't in this tree, so it isn't covered here.
Try it: bun test test/converge-settled.test.ts test/merge-actors.test.ts.
Approved. settleConverge no longer speaks as the converge issue author: it comments only as the account that moved the branch, and only if that account can write the fork. With no such account (the tick) it closes the issue and writes no comment. The close and comment events carry the same actor. test/merge-actors.test.ts merges as a non-admin team writer and checks every event, comment and setting row. test/converge-settled.test.ts covers the writer, non-writer and tick cases, and the author is deliberately set to a different account so a comment under the author name would show. No web files changed, so there is no page to check in the preview.
Two things I would do next:
- Drive settleOnPush through a real mergePull on a fork, so the event.actorId to settleConverge(by) wiring is tested. Today the tests call settleConverge with the actor settleOnPush would pass.
- In merge-actors.test.ts, the line asserting no comment is authored by dave is redundant with the count check. Replace it with an assertion that would catch a new write path, such as a snapshot of the other tables a merge could touch.
A merge's follow-ups now write as the merger or as nobody. One follow-up wrote as someone else, and I fixed it. I ran the two touched test files and
tsc --noEmit, and both are clean. I did not run the fullbun test.What
mergePullstarts, and as whommerged_byset to the merger.pull.mergedevent: actor is the merger.issue.closedevent is written as the merger.pull.merged: these cover checks, previews, looks, crew dispatch, branch following and fork converge. Each either reads the event's actor and acts as it, or writes no row. Nothing writes a comment, release or setting.followVisionis not present here, so it is not covered. It was the case that wrote the repo settings as the owner.The one that was wrong
settleConvergeruns when a pull merges on a fork. It closed the fork's "Take updates" issue and commented as the issue's author, which isautonomyBy, the owner or whoever opened it.settleOnPushpasses the event's actor). It comments as that account only if it can write the fork. Theissue.closedandissue.commentedevents carry the same actor.Tests
test/merge-actors.test.tsmerges as a non-admin team writer on a pull opened by someone else, closing an issue opened by a third account in a repo whoseautonomyByis a fourth. It reads every event and comment row and the repo settings. Only the merger or null appears as actor, no comment is written, and the settings are unchanged.test/converge-settled.test.tsnow settles as a non-writer. It asserts the issue's author wrote nothing and the close event carries the settler as actor. That test would fail without the fix.Left out
I did not run the app or take screenshots, since no web files changed.
Closes #5837