Repository navigation
Add GitHub pull request creation cap bypass list support - #135
Andrushika wants to merge 3 commits into
Conversation
a248dd2 to
a45c477
Compare
|
On Arrow we ended up implementing the |
|
Thanks! Good to know Arrow has been doing this by hand. |
|
Sandbox-tested at Every "after" below is a read back from
The hand-added Two non-blocking observations: 1. One unknown login discards the whole batch. GitHub's add is all-or-nothing: 2. Not covered: the section-removal path ( Sandbox reset afterwards and confirmed through the API: baseline The matrix passes and README is updated, so this is an approve from me, with the two points above as optional follow-ups. |
|
cc: @Humbedooh -> that one is almost ready - there is one nit to fix @Andrushika will fix it shortly I guess :) |
In our specific case if someone has been given triage (collaborator) allowing them to not have the cap by default seems reasonable. I don't think I can foresee a case where someone is collaborator but want a cap for opened PRs to apply to them. This feature is basically to prevent abuse and those users have already demonstrated they understand how to work with the project. |
4315e54 to
b835821
Compare
|
@potiuk I fixed those two nit -- please take a look when you have a chance :)
Understood, thanks for clarifying! |
yeah. I prefer to keep things explicit as well (Python Zen FTW). We can always add prek-hook to sync the two lists. |
|
Re-tested at The pre-flight check does what the README claims. With and reading the API back afterwards: The rest of the matrix re-run clean on the new head:
One small thing, non-blocking: Also checked, since the new check treats "GitHub knows this login" as "valid": an organization passes Sandbox reset and confirmed through the API: baseline LGTM — this addresses both points from my earlier round. |
potiuk
left a comment
There was a problem hiding this comment.
Sandbox-tested at b835821 — full set/update/idempotent/unset/unmanaged matrix verified by reading the GitHub API back, plus the unknown-login path confirming nothing is changed before the check fails. Details in the comment above. The one remaining note (noop skipping the lookups) is non-blocking.
Thanks! I would prefer to keep that one in a separate PR. |
|
OK. @Humbedooh -> Tested ... Useful :) |
|
Thanks @Andrushika and @potiuk make it possible!! |
## Which issue does this PR close? Follows [DataFusion discussion apache#24413](apache#24413). ## Rationale for this change See discussion for the rationale, most people are voting for 'set limit to 3' from the discussion. ## What changes are included in this PR? Enable `github.pull_requests.creation_cap` in `.asf.yaml` and set `max_open_pull_requests` to `3`. - ASF support: [apache/infrastructure-asfyaml#111](apache/infrastructure-asfyaml#111). - Airflow example followed by this change: [apache/airflow#73758](apache/airflow#73758). Whitelist support through `.asf.yaml` is being added in [apache/infrastructure-asfyaml#135](apache/infrastructure-asfyaml#135), which is still open. Before that I think it's possible to do some manual close/reopen, if some contributor have > 3 concurrent PRs that is mergeable. ## What is the testing strategy for this PR? Should work since it's following the pattern in other ASF project above I don't know if it's possible to test before merging ## Are there any user-facing changes? NA
|
@Humbedooh — following up on my note in #119 with a concrete list. These are sandbox-tested, with the results verified by reading the GitHub API back, and they only need a committer to decide and merge:
#139 (count drafts toward the creation cap) touches the same module as #135, so merging #135 first and letting me rebase #139 on top would be the easiest order. |
The pull request creation cap from apache#111 applies to every user without write access. GitHub keeps a per-repository bypass list of users who may open pull requests regardless of the cap, but .asf.yaml could not set it, so a project that wanted some contributors exempt had to maintain that list by hand in the repository settings. creation_cap.bypass_users is a list of GitHub logins. When the key is present the bypass list is made to match it on every run: missing users are added and anyone else is removed, comparing logins case-insensitively. `bypass_users: ~` empties the list. When the key is omitted the list is left alone, so a list kept in the repository settings keeps working. Removing the whole creation_cap section deliberately does not clear the list, because that would depend on the previous_yaml cache, which is not exercised outside production.
GitHub rejects the whole bypass list PUT with a 422 when any login is unknown, without saying which one, and by then the cap PATCH had already been applied. Look each login to be added up first and fail the run naming every unknown login before the cap is touched. Document that the bypass list is synced even when the cap is disabled.
|
@Andrushika — #139 ( The conflicts were purely additive (schema, I sandbox-tested the rebased branch against my own sandbox, checking the API after each run (
I can't push to your branch (no write access on this repo), so could you pull it in and force-push? git fetch https://github.com/potiuk/infrastructure-asfyaml.git sandbox-test/pr-135
git checkout add-creation-cap-bypass-list
git reset --hard FETCH_HEAD
git push --force-with-leaseOnce that's up it should be mergeable again. @Humbedooh, the order in my comment above flipped (#139 went first), but the rest of that list still stands. |
b835821 to
5766f09
Compare
Planning the bypass list only reads from GitHub, so it does not need to wait for the noop guard. A dry run now reports the users it would add and remove and fails on an unknown login, the same way a real run does. In noop mode the GitHub client only exists when a GH_TOKEN is in the environment, so the lookups are skipped with a message when it is not.
|
Okay I force-pushed.
BTW I ended up fixing this nit here in fd4e831 after all, since a separate follow-up PR could be a burden for maintainers. |
|
Cool. Should be ready to merge. I will test it now. |
|
Sandbox-tested the current head
Thanks @Andrushika! @Humbedooh — this is ready to merge. |
## Which issue does this PR close? Follows [DataFusion discussion apache#24413](apache#24413). ## Rationale for this change See discussion for the rationale, most people are voting for 'set limit to 3' from the discussion. ## What changes are included in this PR? Enable `github.pull_requests.creation_cap` in `.asf.yaml` and set `max_open_pull_requests` to `3`. - ASF support: [apache/infrastructure-asfyaml#111](apache/infrastructure-asfyaml#111). - Airflow example followed by this change: [apache/airflow#73758](apache/airflow#73758). Whitelist support through `.asf.yaml` is being added in [apache/infrastructure-asfyaml#135](apache/infrastructure-asfyaml#135), which is still open. Before that I think it's possible to do some manual close/reopen, if some contributor have > 3 concurrent PRs that is mergeable. ## What is the testing strategy for this PR? Should work since it's following the pattern in other ASF project above I don't know if it's possible to test before merging ## Are there any user-facing changes? NA
|
I hope after returning from Community Over Code and Infra meetings - this one could be looked at very positively soon. We have members of our community who we would love to help with being able to open more PRs. |
|
Thank you for this effort - this will be very useful to me personally as an Airflow |
Why
#111 lets
.asf.yamlturn on GitHub's pull request creation cap. GitHub also has a bypass list for that cap, but.asf.yamlcannot set it. Letting each project manage that list in.asf.yamlgives maintainers a way to keep the cap from blocking active contributors who do not have write access.What
Add an optional
bypass_userslist undercreation_cap.bypass_users: ~clears the list. When the key is absent, the list is not touched.Testing
Tested on a sandbox repo, checking the list through the API after each run.
Full suite passes (176 tests), ruff and mypy clean on the new code.
Generated-by: Claude Fable 5.1, reviewed and tested by me