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-0053: defining pull-request workflow #53

Closed
wants to merge 18 commits into from

Conversation

mrVanDalo
Copy link

@mrVanDalo mrVanDalo commented Sep 28, 2019

Define our current Pull-Request workflow.

It is meant to be as a guideline for contributors and maintainers which can be referenced in a pull-request to clear discussions about the process.

I find it necessary to define theses things because the NixOS community is growing a lot in the last years. Which can be seen by the amount of people who contribute and the number of pull-requests. Having well defined workflows reduces errors, simplifies on-boarding and provides a proper basis for improvement discussions.

Because github is not properly showing the resulting file, and the SVGs in them, please have a look at them here https://github.com/mrVanDalo/rfcs/blob/rfcs-pull-request-workflow/rfcs/0053-pull-request-workflow.md

rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved
rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved
rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved
rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved
### Packages

* contributor must decide if a Backport is necessary
* after the Pull-Request to master is merged the Backport Pull-Request is created
Copy link
Member

Choose a reason for hiding this comment

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

master or staging or staging-next

Copy link
Member

@jtojnar jtojnar Sep 29, 2019

Choose a reason for hiding this comment

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

Linking #26 would be also good.

rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved
rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved
* The Pull-Request of a Backport should be created by the bot.
But if that is the case, the original contributor might not be able
to make changes on the branch behind the Pull-Request.
* Backports without changes in master are not discussed.
Copy link
Member

Choose a reason for hiding this comment

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

I think the PR should include this. In case the update cannot go through master/staging/staging-next it should be made directly against release-YY.MM or staging-YY.MM.

Copy link
Author

Choose a reason for hiding this comment

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

So this would follow the rules of a normal pull-request, just to a different branch?

Copy link
Member

Choose a reason for hiding this comment

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

And with an extra sentence about the reasons it's irrelevant for master

Copy link
Author

Choose a reason for hiding this comment

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

@FRidh I think I should also put some more information about the branch structure we have. Bad thing is that I don't know the way we use branches. I know the master and release branches. But I don't know what the other branches in https://github.com/nixos/nixpkgs/ are for and how they interact with each other.

These branches look like I should write about them:

  • security-updates : I have no clue how this branch work
  • staging-next : I guess this is the branch that will be the next release. But what is staging than for? I guess your pull-request goes to master, and than you backport to staging-next and staging.
  • staging : I guess this is the branch that will be the next release. But what is staging-next than for? I guess your pull-request goes to master, and than you backport to staging-next and staging.
  • master : I put my pull-request always against master.
  • staging-yy.mm : Hmm we have staging and staging-next why do we need a staging-19.09 ?
  • release-yy.mm : I guess this is the branch which tracks the so called stable channels (nixpkgs-19.03, nixpkgs-19.09, ... ).

Did I miss one?

Copy link
Author

Choose a reason for hiding this comment

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

Ah I found #26 I will read it and come back to this comment.

rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved
rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved
@7c6f434c
Copy link
Member

Would explicitly mentioning the option of pure-Tests PR serve as a kind of encouragement?

### Modules

* modules should have tests
* new modules must have tests
Copy link
Member

Choose a reason for hiding this comment

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

Tbh I'm not sure if that rule is too strict: I remember several cases where I actually wanted to write a test, but failed to find a suitable approach. One example that comes to my mind right now would be the autorandr module where you'd have to simulate several monitors in the test VM.

I'd rather go with "reviewers should encourage contributors to write tests for new modules" to make it clear that we want to have tests but if there's no way around this, it's still fine to skip that task.

Copy link
Author

Choose a reason for hiding this comment

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

True, it is not possible to create module tests for everything.

reviewers should encourage contributors to write tests for new modules

Implies it is the responsibility of the reviewer to make sure tests are written (if possible). I can live with that.

Copy link
Member

Choose a reason for hiding this comment

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

I guess another approach is to say that «new modules should have tests or an explicit description of problems with testing (e.g. hardware interaction)»


* contributor must decide if a Backport is necessary
* after the Pull-Request to master is merged the Backport Pull-Request is created
* Backport Pull-Requests must be linked to the original Pull-Requests in master
Copy link
Member

Choose a reason for hiding this comment

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

Is there any change to tell GitHub to add the 9.needs: port to stable in case of a backport by an unprivileged contributor?

Also, what about "manual" backports (commiters cherry-picking patches directly to release-yy.mm)?

rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved
rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved

* The Pull-Request of a Backport should be created by the bot.
But if that is the case, the original contributor might not be able
to make changes on the branch behind the Pull-Request.
Copy link
Member

Choose a reason for hiding this comment

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

Random idea: how about something like @ofborg backport 19.09?

Copy link
Author

Choose a reason for hiding this comment

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

The problem is the bot would create the pull-request and the contributor must be able to edit it.
There are two backport possibilities

  • cherry pick
  • new pull-request, because the software differs in the stable branches.

Copy link
Member

Choose a reason for hiding this comment

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

And the main catch is what happens if person A creates a PR and person B requests a backport…

@mrVanDalo
Copy link
Author

Thanks @Ma27 and @FRidh for the quick review.
Just to make sure you've seen the diagrams I've drawn, please have a look at https://github.com/mrVanDalo/rfcs/blob/rfcs-pull-request-workflow/rfcs/0053-pull-request-workflow.md
I thought having SVGs is better, but I will also render some PNGs so you can see the ChangesView too.

Copy link
Author

@mrVanDalo mrVanDalo left a comment

Choose a reason for hiding this comment

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

Everything with a 👍 will be changed according to what you commented.

rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved
rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved

* contributor must decide if a Backport is necessary
* after the Pull-Request to master is merged the Backport Pull-Request is created
* Backport Pull-Requests must be linked to the original Pull-Requests in master
Copy link
Author

Choose a reason for hiding this comment

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

Is there any change to tell GitHub to add the 9.needs: port to stable in case of a backport by an unprivileged contributor?

I've seen this tag, but I did not know who is setting that in which situation. This is also one reason why I created this RFC. What are the rules behind this tag? There is also a 8: has port to stable.

I would love to put the meaning and the ruling behind theses tags in this RFC.


* contributor must decide if a Backport is necessary
* after the Pull-Request to master is merged the Backport Pull-Request is created
* Backport Pull-Requests must be linked to the original Pull-Requests in master
Copy link
Author

Choose a reason for hiding this comment

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

Also, what about "manual" backports (commiters cherry-picking patches directly to release-yy.mm)?

I guess by "manual" you mean without a pull-request. This is something I don't know of at all. The only thing I heard from people is that they don't like it to be done.

### Modules

* modules should have tests
* new modules must have tests
Copy link
Author

Choose a reason for hiding this comment

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

True, it is not possible to create module tests for everything.

reviewers should encourage contributors to write tests for new modules

Implies it is the responsibility of the reviewer to make sure tests are written (if possible). I can live with that.

rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved

* The Pull-Request of a Backport should be created by the bot.
But if that is the case, the original contributor might not be able
to make changes on the branch behind the Pull-Request.
Copy link
Author

Choose a reason for hiding this comment

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

The problem is the bot would create the pull-request and the contributor must be able to edit it.
There are two backport possibilities

  • cherry pick
  • new pull-request, because the software differs in the stable branches.

* The Pull-Request of a Backport should be created by the bot.
But if that is the case, the original contributor might not be able
to make changes on the branch behind the Pull-Request.
* Backports without changes in master are not discussed.
Copy link
Author

Choose a reason for hiding this comment

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

So this would follow the rules of a normal pull-request, just to a different branch?

rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved

* contributor must decide if a Backport is necessary
* after the Pull-Request to master is merged the Backport Pull-Request is created
* Backport Pull-Requests must be linked to the original Pull-Requests in master
Copy link
Author

Choose a reason for hiding this comment

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

may include in parentheses (using git cherry-pick -x)

I will add this, but I had more the pull-request-id in mind.

@mrVanDalo
Copy link
Author

@7c6f434c what do you mean by that?

Would explicitly mentioning the option of pure-Tests PR serve as a kind of encouragement?

You mean I should create a special rule-set for pull-requests that are only adding tests?

@7c6f434c
Copy link
Member

I guess…

The main point I would put there is «don't forget to mention the maintainers of key packages and modules», as the bot doesn't handle this.

(Maybe the same is actually true for adding modules…)

@carlosdagos
Copy link
Member

carlosdagos commented Sep 29, 2019

Nice writeup.

One question about modules. Would it be wise to specify when they should be backported? Right now it says “SHOULD NOT”, but off the top of my head the only situation I can imagine where I would want a module backported is if it’s security-related.

@mrVanDalo
Copy link
Author

@carlosdagos In #53 (comment) , I try to come up with examples when it makes sense to backport modules. If you can remember a Pull-Request please let me know.

Would it be wise to specify when they should be backported?

@Ma27 pointed out

module change that's needed due to a package backport.

I can't think of any other reason so far. But SHOULD NOT does not mean MUST NOT.

@vbgl
Copy link

vbgl commented Sep 30, 2019

Hi. Could there be something like “bots SHOULD NOT open pull requests”? Pull requests are calling humans for reviews.

Unless there is a fully automated reviewing and merging process that could be triggered by bots, opening a pull request is the privilege of reasonable beings.

@mrVanDalo
Copy link
Author

@vbgl a lot of Pull-Requests already created by bots. For example : https://github.com/r-ryantm

@Taneb
Copy link

Taneb commented Sep 30, 2019

@vbgl I disagree. We currently have automated processes creating pull requests upgrading packages for e.g. security updates to good effect, saving the time and attention of humans. However, these updates in my opinion should still be checked manually by a human in most cases.

@nh2
Copy link
Contributor

nh2 commented Sep 30, 2019

I'm definitely in favour of continuing to allow bots to open PRs, like @r-ryantm does. Saves lots of effort.

In an ideal world, bots would do all of the work of finding, building, testing and PRing new versions, and humans would just approve that the changelog looks good and that the upgrade is desired.

@sondr3
Copy link

sondr3 commented Sep 30, 2019

I too would like to throw in my support for bots, they should be allowed to open PRs. I also have some grammatical advice for this document.

  1. Pull-Request is written as pull request, per https://help.github.com/en/articles/about-pull-requests
  2. There seem to be some inconsistent casing, Backports and Document appear with a capital first letter quite often in the text where they should be written in lowercase.
  3. The casing in the first letter in a list should in my opinion be capitalized, i.e. * Big letter

@mrVanDalo mrVanDalo force-pushed the rfcs-pull-request-workflow branch from a3be8dc to 1087e41 Compare September 30, 2019 15:46
Copy link
Member

@zimbatm zimbatm left a comment

Choose a reason for hiding this comment

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

This RFC seems more like a documentation than policy issue. If it's describing the existing process then it can be submitted as a PR to the nixpkgs manual directly.

PS: great idea of documenting this by the way!

Copy link
Member

@Zimmi48 Zimmi48 left a comment

Choose a reason for hiding this comment

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

This RFC seems to me much more about the backport workflow than the PR workflow. But I disagree that deciding whether a PR should be backported is the role of the contributor alone. The contributor may have no idea. The reviewer may also have an opinion.

FTR, if there is a need for a backport bot, then people should be aware that there are already a number of them available, so it might not be needed to reimplement one.

* `Bot` is a bot that provides automated feedback
* `Reviewer` is any person that reviews the pull request
(for example a member of [NixOS/nixpkgs-maintainers](https://github.com/orgs/NixOS/teams/nixpkgs-maintainers))
* `Merger` is any person with merge privileges
Copy link
Member

Choose a reason for hiding this comment

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

In my experience "merger" usually means the resulting of a merge and rarely designate a person. The standard terms that could be used instead are "integrator" and "committer" (the second being less clearly related to PRs but clearer about the required privileges).

rfcs/0053-pull-request-workflow.md Outdated Show resolved Hide resolved
@mrVanDalo
Copy link
Author

This RFC seems more like a documentation than policy issue. If it's describing the existing process then it can be submitted as a PR to the nixpkgs manual directly.

@zimbatm I'm ok with that. I can put it in the documentation once all the discussions are settled. I guess looking at the diagrams is a bit harder in the docbook manual.

@mrVanDalo
Copy link
Author

This RFC seems to me much more about the backport workflow than the PR workflow.

@Zimmi48 What are you missing in the pull request workflow?

The contributor may have no idea. The reviewer may also have an opinion.

@Zimmi48 Of course the reviewer can also arrange a backport, but this would increase the workload of reviewers. I'm not against it, just mention it.

@Zimmi48
Copy link
Member

Zimmi48 commented Sep 30, 2019

What are you missing in the pull request workflow?

I don't know exactly, but as a maintainer without much experience, I don't see anything really informative in this workflow. It's probably too much of a bird view to my taste.

@mrVanDalo
Copy link
Author

I added some changes from the discussions.
I must say I agree with @Zimmi48 a bit. My strategy would be like @zimbatm proposed, to create a pull-request in the Nixpkgs documentation. This has the benefit, that it can be improved over time. An RFC usually is fixed.
I will put a TODO.md right next to the new documentation section, containing my current todo list about this topic.

Thanks to everybody for your help.

@kira-bruneau
Copy link

Just a small nitpick, the States of a pull request graph mentions Contributor has done his work, but not all of us are men 😅

Also, should there be some kind of policy about force pushing vs creating new commits during code review, or should we just use whatever works?

@7c6f434c
Copy link
Member

7c6f434c commented Oct 1, 2019

(looking at the SVG) I think the main part of the PR workflow that needs clarifications is depth of testing, and sometimes handling tradeoffs in the known breakages. Saying «functionality of all affected packages» doesn't help much in any interesting case (like e2fsprogs…).

Also, has I missed something or is there nothing at all about upstream Changelog in the RFC?

I guess this text could be a fine first introduction to the process if put in the documentation, but putting this as an established policy is risky

@mrVanDalo
Copy link
Author

Just a small nitpick, the States of a pull request graph mentions Contributor has done his work, but not all of us are men

Very much true. This slips through some times, sorry. I'm trying.

Also, should there be some kind of policy about force pushing vs creating new commits during code review, or should we just use whatever works?

You force pushes to you own branch. Or more what belongs to a commit and what should be split in multiple commits?

@7c6f434c
Copy link
Member

7c6f434c commented Oct 1, 2019 via email

### Don't backport if ...

* the patch is just for Darwin, they use nixpkgs-unstable not a
stable branch.
Copy link
Member

Choose a reason for hiding this comment

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

Who is "they" in this context? There are hydra jobsets that test and release the nixpkgs-xx.xx-darwin channels for the stable branch on darwin, are these not intended for use?

Copy link
Author

Choose a reason for hiding this comment

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

I got inlined this from https://gist.github.com/grahamc/c60578c6e6928043d29a427361634df6#what-to-backport . I guess it is meant that darwin nix users use the unstable nixpkgs branch.

Copy link
Member

Choose a reason for hiding this comment

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

Seems like outdated information? The stable darwin channels were added after it was written.

Copy link
Author

Choose a reason for hiding this comment

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

Good to know, I will take this into account in my pull-request for the nixos/nixpkgs.

@worldofpeace
Copy link
Contributor

You force pushes to you own branch. Or more what belongs to a commit and what should be split in multiple commits?
No, this was a question about iterating the fixes in additional commits before squashing and force-pushing

I typically ask contributors to please use additional commits for the points I review.
I feel like in general that's a good code review practice, otherwise I have to start completely over with my review which can be tiresome.

@sauyon
Copy link
Member

sauyon commented Oct 1, 2019

I typically ask contributors to please use additional commits for the points I review.
I feel like in general that's a good code review practice, otherwise I have to start completely over with my review which can be tiresome.

For PR flow I've recently settled on pushing a bunch of commits called "fixup xxx Description," then rebasing, then pushing again, which leads to both a clean history and a nice review flow.

@worldofpeace
Copy link
Contributor

@sauyon Yep that's exactly what I suggest. Git also has the fixup commit feature which is very handy for interactive rebases.

@nh2
Copy link
Contributor

nh2 commented Oct 1, 2019

I typically ask contributors to please use additional commits for the points I review.
I feel like in general that's a good code review practice, otherwise I have to start completely over with my review which can be tiresome.

We might also consider adding https://reviewable.io integration to our PRs.

I found it an excellent review tool for my open-source projects, because it allows to:

  • review across force-pushes (you can see what changed since your last push)
  • review commit-by-commit instead of whole-PR if desired (good to ensure no bad commits make it into the history)

Comments made there reflect back into Github, and the other way around, so any reviewer may choose to use it or not. Github review emails work as usual.

Like Github, it's free for open-source projects.


For an example, here's a screenshot of me and @qrilka reviewing a PR iterated with force-pushes on my project nh2/hatrace#49:

image

Here you can see how it tracks how far the reviewers have read across the 7 different force-pushed versions of the PR. As a reviewer, you can display either only the changes since you last looked, or between any force-pushed revisions you manually choose.

I found that this approach saves time because it saves a review roundtrip: People can directly force-push their respective best versions, instead of first pushing fixup commits and then post-review squashing them.

@lilyball
Copy link
Member

lilyball commented Oct 1, 2019

I've used Reviewable in the past and it's an excellent tool, so I second that recommendation.

@alyssais
Copy link
Member

alyssais commented Oct 2, 2019

I think that this RFC, as it stands, is far too intimidating to be useful for new contributors — an extremely long list of rules and complicated diagrams and SHOULD/MUST-style language is going to put people off contributing at all, and the ease of contributing to Nixpkgs compared to other package repositories is one of its core strengths. I think a description of how things usually work for new contributors in the manual would be good. This feels like more like imposing how things should work, and I don’t think we need rules like that.

The RFC also claims to be describing how things currently work rather than proposing something new, but the flow it describes doesn’t match with my experience as a committer. For one thing, it talks at length about backport PRs, but in my experience at least backport PRs are much rarer than the committee who merged just cherry-picking directly to the appropriate branches. I think this works well for most cases. Backport are usually uncontroversial, but they can already be annoying to do, so making it more effort by making them go through PRs would, I think, result in fewer backports.

I think you should take some time to figure out what it is you want to do here — if it’s just to describe things as they are, make a pull request to the manual and we’ll help make sure it’s accurate. If you actually want to change how things work, then it should be done as an RFC that doesn’t suggest that it’s entirely descriptive.

@alyssais
Copy link
Member

alyssais commented Oct 2, 2019

We might also consider adding https://reviewable.io integration to our PRs

What does such an integration consist of? From what you’ve described, I don’t see anything that would even be visible to anybody but the person using it for review?

@worldofpeace
Copy link
Contributor

@alyssais Agree with you completely here, was waiting for you to state it 😄 . I also don't see what is a workflow here, it's just a definition of how changes get integrated which isn't going to be useful to contributors. Unless they're interested in researching how things get integrated into an opensource project like this. A proposal that could benefit from an RFC would be something like an onboarding process.

Though I don't disagree with the inspiration, which I'm seeing is that documentation on how to submit a pull request to nixpkgs and who's going to review it and such would all be helpful (github teams, ofborg). All things I've gone out of my way to explain to people individually. In it's current form it's not designed for that kind of consumer of information though.

But all in all, I'm glad these discussions happened because an RFC was opened.
(in this accessible way on GitHub)

@mrVanDalo @Lassulus

@nh2
Copy link
Contributor

nh2 commented Oct 2, 2019

What does such an integration consist of? From what you’ve described, I don’t see anything that would even be visible to anybody but the person using it for review?

@alyssais See what I mentioned above:

Comments made there reflect back into Github, and the other way around, so any reviewer may choose to use it or not. Github review emails work as usual.

Concrete example: nh2/hatrace#41 (review)

When you post review comments in Reviewable, they appear on the PR as comments, and you can click to jump directly into reviewable.

That means they will be visible to anybody subscribed to the PR or reading through its updates, as usual.

@mrVanDalo
Copy link
Author

Ok, I would close this pull request than, as everybody agrees (including me) this pull request should never be merged.

@nixos-discourse
Copy link

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

https://discourse.nixos.org/t/how-many-people-are-paid-to-work-on-nix-nixpkgs/8307/88

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.