Repository navigation
Conversation
7f38724 to
b7c5f99
Compare
DRU-1145: the fix, the tests, and one questionThe fixOn an org repo, a webhook hides a reviewer's private membership, so the reviewer's
Automated tests
Live tests: the bug on
|
| # | Case | Image | Delivered as | Result |
|---|---|---|---|---|
| 1 | I approve a build's PR on the org repo | main |
CONTRIBUTOR |
❌ The build stayed parked on review_work two minutes later. This reproduces the bug. |
| 2 | I approve the same PR again | this PR | CONTRIBUTOR |
✅ In the same second, the gate was answered, the draft was cleared, and the build finished. |
| 3 | I request changes on another org build | this PR | CONTRIBUTOR |
✅ The gate was answered, and triage ran. |
| 4 | I approve a build's PR on my personal repo, where I am the owner | this PR | OWNER |
✅ The gate was answered with no lookup, and on_approval: merge merged the PR. |
| 5 | The member with read access approves a parked org build | this PR | NONE |
✅ The lookup returned read, and the build stayed parked two minutes later. |
| 6 | I tag the App in an inline review comment on the org repo | main |
CONTRIBUTOR |
❌ No reaction and no reply three minutes later. |
| 7 | The same inline comment again | this PR | CONTRIBUTOR |
✅ The App reacted and replied in the thread 10 seconds later. |
| 8 | I tag the App in a top-level PR comment on the org repo | main |
MEMBER |
The App answered. On main too, a top-level comment already reached the chat channel. |
GitHub sent different associations for the same person on the same PR. A review and an inline review comment came as CONTRIBUTOR, and a top-level comment came as MEMBER. So for a private member, the chat channel lost only inline review comments, not top-level ones. The reader in case 5 came as NONE, because CONTRIBUTOR needs a commit in the repo.
A question
_WRITERS includes COLLABORATOR. GitHub reports a person added to the repo as a collaborator as COLLABORATOR, whatever their role, including read. So a read-only collaborator's approval answers the review gate, and their comments reach the chat channel, with no lookup. That holds on main and on this branch. I did not test it live.
Do you want this PR to drop COLLABORATOR from _WRITERS, so that a collaborator's permission is looked up too? Or should it stay as it is, with a ticket of its own?
A person with write access who approved a build's pull request on an org-owned repo left the build parked on
ReviewWork, and no log line said why. GitHub hides private org membership in webhook payloads, so that person'sauthor_associationisCONTRIBUTOR.GitHubEventssetauthor_can_writeonly forOWNER,MEMBER, andCOLLABORATOR, sopr_review_answers_the_gatenever got the approval. The GitHub chat channel dropped the same person's issue and PR comments for the same reason.GitHubEvents._can_writeasks GitHub for the person's permission on the repo:GET /repos/{owner}/{repo}/collaborators/{username}/permission, with the App's installation token.adminorwritesetsauthor_can_write. GitHub reportsmaintainaswrite._can_write, so the review gate and the chat channel follow one rule.GitHubClient.get_permissionmakes the read. It needs only the Metadata read permission, which every GitHub App has. For someone who is not a collaborator, GitHub answersread, not an error.Each review or comment from someone who is not a writer by association now costs a permission read. On a public repo, that includes every passer-by who comments.