Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC 0128] Selective auto-merge on bot upgrades #128

Conversation

superherointj
Copy link

@superherointj superherointj commented Jul 8, 2022

@superherointj superherointj force-pushed the rfc-0128-selective-auto-merge-on-bot-upgrades branch 5 times, most recently from 39ee7a6 to 244efe1 Compare July 8, 2022 23:31
Copy link
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

Some points from me:

  • it could create an incentive to not update dependencies or improve the package because then you wouldn't get an auto merge
  • the review process for updates is already not very great compared to other distros and this wouldn't improve the situation and more likely even worsen it
  • I am not sure yet if this could become a footgun for us.

GitHub Actions will trigger a merge when the following 4 conditions are met:
1) `@r-ryantm` is PR's author.
2) Package `meta.autoMerge` attribute is enabled.
3) All CI checks passed.
Copy link
Member

Choose a reason for hiding this comment

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

This would also enforce that the package has right meta.broken/meta.platforms set otherwise darwin failures blocks auto merges.

Copy link
Author

@superherointj superherointj Jul 9, 2022

Choose a reason for hiding this comment

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

Wouldn't having to review & properly set platforms for autoMerge be a good thing? It could be checked/done when enabling the flag.

1) `@r-ryantm` is PR's author.
2) Package `meta.autoMerge` attribute is enabled.
3) All CI checks passed.
4) Package maintainer has approved PR.
Copy link
Member

Choose a reason for hiding this comment

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

How would that work if a package has multiple maintainers? Would they all need to approve? Would one be enough? Would 50% need to approve? Would we need to prune old maintainers?

Copy link
Author

@superherointj superherointj Jul 9, 2022

Choose a reason for hiding this comment

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

How would that work if a package has multiple maintainers? Would they all need to approve? Would one be enough? Would 50% need to approve?

As it is now, on autoMerge enabled packages, any single maintainer could trigger autoMerge by adding the autoMerge label to PR.

The commiter would have to consider to whom and to which package he is granting auto-merge permission.

The policy can be improved to fullfill needs. Like:

meta.maintainerApprovalsForAutoMerge = 2;
(default = 1)

meta.maintainersGrantedAutoMerge = [ maintainer1 maintainer2 ];
(enabled autoMerge and empty list would grant permission to all maintainers. Empty list being default.)

As an initial proposal, I'd prefer to keep this simple, for a prototype at least. Delaying implementing maintainerApprovalsForAutoMerge and maintainersGrantedAutoMerge. In case of uncertainty on a package or maintainer, or that an unusually complex policy is required, autoMerge shouldn't be enabled (for now at least).

Would we need to prune old maintainers?

Inactive maintainers don't approve PRs. => Not an issue?

Copy link
Member

Choose a reason for hiding this comment

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

I would default to 50% of the maintainers listed.

# Drawbacks
[drawbacks]: #drawbacks

* Reduced trustworthiness.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Reduced trustworthiness.
* Upstream maintainers could send software updates with some delay to the master branch then unstable branch/channel and eventually stable branch/channel potentially without *any* interaction or review from a NixOS committer reducing the trustworthiness of updates

[drawbacks]: #drawbacks

* Reduced trustworthiness.
* Some possible security issue.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Some possible security issue.
* Possible security issues:
* Changing ofborg from being read-only in the nixpkgs repository (aside from setting CI status) to being a critical security related software where potential bugs in the reviewer request code could lead to rogue merges
* packages with many maintainers and auto merge enabled could receive accidental merges from older maintainers not fully aware of the auto merge feature yet

Copy link
Author

@superherointj superherointj Jul 9, 2022

Choose a reason for hiding this comment

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

  • Changing ofborg from being read-only in the nixpkgs repository (aside from setting CI status) to being a critical security related software where potential bugs in the reviewer request code could lead to rogue merges

OfBorg was restricted to adding labels and is absent of merge process.
OfBorg is no longer labelling auto-merge, the maintainer is now responsible to add the auto-merge label.

The auto-merge label only trigger GitHub Actions to run, rules enforcement and merge is done by some code yet to be defined in GitHub Actions. Any failure in the code used to enforce rules and merge would be a security problem, so I've added a mention for it. (Security issues: Possible failures in the GitHub Action code used to enforce rules and merge.)

  • packages with many maintainers and auto merge enabled could receive accidental merges from older maintainers not fully aware of the auto merge feature yet

Removed OfBorg reference. And added:
Maintainer adds "auto-merge" label to PR triggering GitHub Actions to enforce rules and merge.

# Alternatives
[alternatives]: #alternatives

* https://github.com/NixOS/rfcs/pull/50/
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* https://github.com/NixOS/rfcs/pull/50/
* The Marvin MK II experiment ended and didn't yield a noticeable improvement.

Copy link
Author

Choose a reason for hiding this comment

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

The closest alternative I found was #50, should I really remove it?

  • The Marvin MK II experiment ended and didn't yield a noticeable improvement.

How does this sentence relate to this RFC?

Copy link
Member

Choose a reason for hiding this comment

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

How does this sentence relate to this RFC?

it had a similar goal to improve the review and merge situation

@superherointj superherointj force-pushed the rfc-0128-selective-auto-merge-on-bot-upgrades branch 4 times, most recently from cfe3e2b to fb85f0c Compare July 9, 2022 15:55
@superherointj superherointj force-pushed the rfc-0128-selective-auto-merge-on-bot-upgrades branch from fb85f0c to 5b8f79f Compare July 9, 2022 17:46
@superherointj superherointj marked this pull request as draft July 11, 2022 14:23
# Detailed design
[design]: #detailed-design

Add a new `meta.autoMerge` package attribute with type `bool` defaulting to `false`. To be documented in Nixpkgs manual.
Copy link
Member

Choose a reason for hiding this comment

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

If such a attribute/flag is to be implemented, I don't think it should be a meta ket, but a passthru one.

meta, as the name suggests, it for metadata about the package, not about how our particular infrastructure would treat such package.

Even if some meta flags are useful to our infra - license defines if something can be cached or not, but has an informational nature independent of it; the same can be said about broken and badPlatforms.

Maybe meta.hydraXXX is a notable exception.

@AndersonTorres
Copy link
Member

If you accept some form of suggestion, I think that some "keyword" can be used for this. If a committer and/or a maintainer of the package believes it is OK to merge, he can throw a message like

OK, merge this <YYYY-MM-DD>.

and the merge bot will merge it at the specified date, with now meaning now and invalid dates doing nothing.

The merge bot will include the name of the one that issued the OK on the commit message. This way we can trace the responsibilities.

Maintainer adds `auto-merge` label to PR which triggers GitHub Actions to enforce rules and merge.

Rules are:
1) `@r-ryantm` is PR's author.
Copy link
Member

@FRidh FRidh Jul 28, 2022

Choose a reason for hiding this comment

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

Is it currently possible for other committers to push to a @r-ryantm branch? If so, does it get possible then to hijack a PR and (force) push something different? (Of course committers can do that already)

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it is possible and I have do this on many occasions to fixup things.

@superherointj
Copy link
Author

I'd prefer to close this for now. And resume in case it still makes sense later.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/silly-proposal-meta-merger-for-committers-weakly-caring-about-the-package/36390/2

@Lassulus Lassulus mentioned this pull request Mar 27, 2024
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.

9 participants