nixpkgs/doc/contributing/reviewing-contributions.xml

489 lines
16 KiB
XML
Raw Normal View History

2016-09-26 07:36:03 +01:00
<chapter xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xi="http://www.w3.org/2001/XInclude"
version="5.0"
xml:id="chap-reviewing-contributions">
2018-05-02 00:54:21 +01:00
<title>Reviewing contributions</title>
<warning>
<para>
2019-09-18 21:12:54 +01:00
The following section is a draft, and the policy for reviewing is still being discussed in issues such as <link
2020-11-11 00:21:21 +00:00
xlink:href="https://github.com/NixOS/nixpkgs/issues/11166">#11166 </link> and <link
xlink:href="https://github.com/NixOS/nixpkgs/issues/20836">#20836 </link>.
2018-05-02 00:54:21 +01:00
</para>
</warning>
<para>
2019-09-18 21:12:54 +01:00
The Nixpkgs project receives a fairly high number of contributions via GitHub pull requests. Reviewing and approving these is an important task and a way to contribute to the project.
2018-05-02 00:54:21 +01:00
</para>
<para>
2019-09-18 21:12:54 +01:00
The high change rate of Nixpkgs makes any pull request that remains open for too long subject to conflicts that will require extra work from the submitter or the merger. Reviewing pull requests in a timely manner and being responsive to the comments is the key to avoid this issue. GitHub provides sort filters that can be used to see the <link
xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc">most recently</link> and the <link
xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-asc">least recently</link> updated pull requests. We highly encourage looking at <link xlink:href="https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+review%3Anone+status%3Asuccess+-label%3A%222.status%3A+work-in-progress%22+no%3Aproject+no%3Aassignee+no%3Amilestone"> this list of ready to merge, unreviewed pull requests</link>.
2018-05-02 00:54:21 +01:00
</para>
<para>
2019-09-18 21:12:54 +01:00
When reviewing a pull request, please always be nice and polite. Controversial changes can lead to controversial opinions, but it is important to respect every community member and their work.
2018-05-02 00:54:21 +01:00
</para>
<para>
2019-09-18 21:12:54 +01:00
GitHub provides reactions as a simple and quick way to provide feedback to pull requests or any comments. The thumb-down reaction should be used with care and if possible accompanied with some explanation so the submitter has directions to improve their contribution.
2018-05-02 00:54:21 +01:00
</para>
<para>
2019-09-18 21:12:54 +01:00
pull request reviews should include a list of what has been reviewed in a comment, so other reviewers and mergers can know the state of the review.
2018-05-02 00:54:21 +01:00
</para>
<para>
2019-09-18 21:12:54 +01:00
All the review template samples provided in this section are generic and meant as examples. Their usage is optional and the reviewer is free to adapt them to their liking.
2018-05-02 00:54:21 +01:00
</para>
2018-09-01 20:06:38 +01:00
<section xml:id="reviewing-contributions-package-updates">
2018-05-02 00:54:21 +01:00
<title>Package updates</title>
<para>
2019-09-18 21:12:54 +01:00
A package update is the most trivial and common type of pull request. These pull requests mainly consist of updating the version part of the package name and the source hash.
2018-05-02 00:54:21 +01:00
</para>
<para>
2019-09-18 21:12:54 +01:00
It can happen that non-trivial updates include patches or more complex changes.
2018-05-02 00:54:21 +01:00
</para>
<para>
Reviewing process:
</para>
<itemizedlist>
<listitem>
<para>
Ensure that the package versioning fits the guidelines.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
<listitem>
<para>
Ensure that the commit text fits the guidelines.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
<listitem>
<para>
Ensure that the package maintainers are notified.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
2019-09-18 21:12:54 +01:00
<link xlink:href="https://help.github.com/articles/about-codeowners/">CODEOWNERS</link> will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
2016-09-26 16:36:59 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that the meta field information is correct.
2018-05-02 00:54:21 +01:00
</para>
2016-09-26 16:36:59 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
2019-09-18 21:12:54 +01:00
License can change with version updates, so it should be checked to match the upstream license.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
<listitem>
<para>
2019-09-18 21:12:54 +01:00
If the package has no maintainer, a maintainer must be set. This can be the update submitter or a community member that accepts to take maintainership of the package.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that the code contains no typos.
</para>
</listitem>
<listitem>
<para>
Building the package locally.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
2019-09-18 21:12:54 +01:00
pull requests are often targeted to the master or staging branch, and building the pull request locally when it is submitted can trigger many source builds.
2018-05-02 00:54:21 +01:00
</para>
<para>
2019-09-18 21:12:54 +01:00
It is possible to rebase the changes on nixos-unstable or nixpkgs-unstable for easier review by running the following commands from a nixpkgs clone.
2016-09-26 07:36:03 +01:00
<screen>
<prompt>$ </prompt>git fetch origin nixos-unstable <co xml:id='reviewing-rebase-2' />
2019-06-17 12:25:50 +01:00
<prompt>$ </prompt>git fetch origin pull/PRNUMBER/head <co xml:id='reviewing-rebase-3' />
<prompt>$ </prompt>git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD <co
xml:id='reviewing-rebase-4' />
2016-09-26 16:36:59 +01:00
</screen>
2018-05-02 00:54:21 +01:00
<calloutlist>
<callout arearefs='reviewing-rebase-2'>
<para>
Fetching the nixos-unstable branch.
</para>
</callout>
<callout arearefs='reviewing-rebase-3'>
<para>
2019-09-18 21:12:54 +01:00
Fetching the pull request changes, <varname>PRNUMBER</varname> is the number at the end of the pull request title and <varname>BASEBRANCH</varname> the base branch of the pull request.
2018-05-02 00:54:21 +01:00
</para>
</callout>
<callout arearefs='reviewing-rebase-4'>
<para>
Rebasing the pull request changes to the nixos-unstable branch.
2018-05-02 00:54:21 +01:00
</para>
</callout>
</calloutlist>
</para>
</listitem>
<listitem>
<para>
The <link xlink:href="https://github.com/Mic92/nixpkgs-review">nixpkgs-review</link> tool can be used to review a pull request content in a single command. <varname>PRNUMBER</varname> should be replaced by the number at the end of the pull request title. You can also provide the full github pull request url.
2018-05-02 00:54:21 +01:00
</para>
2016-09-26 16:36:59 +01:00
<screen>
<prompt>$ </prompt>nix-shell -p nixpkgs-review --run "nixpkgs-review pr PRNUMBER"
2016-09-26 07:36:03 +01:00
</screen>
2018-05-02 00:54:21 +01:00
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Running every binary.
</para>
</listitem>
</itemizedlist>
2018-09-01 20:20:57 +01:00
<example xml:id="reviewing-contributions-sample-package-update">
2018-05-02 00:54:21 +01:00
<title>Sample template for a package update review</title>
2016-09-26 07:36:03 +01:00
<screen>
##### Reviewed points
- [ ] package name fits guidelines
- [ ] package version fits guidelines
- [ ] package build on ARCHITECTURE
- [ ] executables tested on ARCHITECTURE
- [ ] all depending packages build
##### Possible improvements
##### Comments
2018-05-02 00:54:21 +01:00
</screen>
</example>
</section>
2018-09-01 20:06:38 +01:00
<section xml:id="reviewing-contributions-new-packages">
2018-05-02 00:54:21 +01:00
<title>New packages</title>
<para>
2019-09-18 21:12:54 +01:00
New packages are a common type of pull requests. These pull requests consists in adding a new nix-expression for a package.
2018-05-02 00:54:21 +01:00
</para>
<para>
Reviewing process:
</para>
<itemizedlist>
<listitem>
<para>
Ensure that the package versioning is fitting the guidelines.
</para>
</listitem>
<listitem>
<para>
Ensure that the commit name is fitting the guidelines.
</para>
</listitem>
<listitem>
<para>
Ensure that the meta field contains correct information.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
License must be checked to be fitting upstream license.
</para>
</listitem>
<listitem>
<para>
Platforms should be set or the package will not get binary substitutes.
</para>
</listitem>
<listitem>
<para>
2019-09-18 21:12:54 +01:00
A maintainer must be set. This can be the package submitter or a community member that accepts to take maintainership of the package.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that the code contains no typos.
</para>
</listitem>
<listitem>
<para>
Ensure the package source.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
Mirrors urls should be used when available.
</para>
</listitem>
<listitem>
<para>
2019-09-18 21:12:54 +01:00
The most appropriate function should be used (e.g. packages from GitHub should use <literal>fetchFromGitHub</literal>).
2018-05-02 00:54:21 +01:00
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Building the package locally.
</para>
</listitem>
<listitem>
<para>
Running every binary.
</para>
</listitem>
</itemizedlist>
2018-09-01 20:20:57 +01:00
<example xml:id="reviewing-contributions-sample-new-package">
2018-05-02 00:54:21 +01:00
<title>Sample template for a new package review</title>
2016-09-26 07:36:03 +01:00
<screen>
##### Reviewed points
- [ ] package path fits guidelines
- [ ] package name fits guidelines
- [ ] package version fits guidelines
- [ ] package build on ARCHITECTURE
- [ ] executables tested on ARCHITECTURE
- [ ] `meta.description` is set and fits guidelines
- [ ] `meta.license` fits upstream license
- [ ] `meta.platforms` is set
- [ ] `meta.maintainers` is set
- [ ] build time only dependencies are declared in `nativeBuildInputs`
- [ ] source is fetched using the appropriate function
- [ ] phases are respected
2016-10-05 09:40:32 +01:00
- [ ] patches that are remotely available are fetched with `fetchpatch`
2016-09-26 07:36:03 +01:00
##### Possible improvements
##### Comments
2018-05-02 00:54:21 +01:00
</screen>
</example>
</section>
2018-09-01 20:06:38 +01:00
<section xml:id="reviewing-contributions-module-updates">
2018-05-02 00:54:21 +01:00
<title>Module updates</title>
<para>
2019-09-18 21:12:54 +01:00
Module updates are submissions changing modules in some ways. These often contains changes to the options or introduce new options.
2018-05-02 00:54:21 +01:00
</para>
<para>
Reviewing process
</para>
<itemizedlist>
<listitem>
<para>
Ensure that the module maintainers are notified.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
2019-09-18 21:12:54 +01:00
<link xlink:href="https://help.github.com/articles/about-codeowners/">CODEOWNERS</link> will make GitHub notify users based on the submitted changes, but it can happen that it misses some of the package maintainers.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that the module tests, if any, are succeeding.
</para>
</listitem>
<listitem>
<para>
Ensure that the introduced options are correct.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
2019-09-18 21:12:54 +01:00
Type should be appropriate (string related types differs in their merging capabilities, <literal>optionSet</literal> and <literal>string</literal> types are deprecated).
2018-05-02 00:54:21 +01:00
</para>
</listitem>
<listitem>
<para>
Description, default and example should be provided.
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that option changes are backward compatible.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
2019-09-18 21:12:54 +01:00
<literal>mkRenamedOptionModule</literal> and <literal>mkAliasOptionModule</literal> functions provide way to make option changes backward compatible.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
2019-09-18 21:12:54 +01:00
Ensure that removed options are declared with <literal>mkRemovedOptionModule</literal>
2018-05-02 00:54:21 +01:00
</para>
</listitem>
<listitem>
<para>
2019-09-18 21:12:54 +01:00
Ensure that changes that are not backward compatible are mentioned in release notes.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
<listitem>
<para>
Ensure that documentations affected by the change is updated.
</para>
</listitem>
</itemizedlist>
2018-09-01 20:20:57 +01:00
<example xml:id="reviewing-contributions-sample-module-update">
2018-05-02 00:54:21 +01:00
<title>Sample template for a module update review</title>
2016-09-26 07:36:03 +01:00
<screen>
##### Reviewed points
- [ ] changes are backward compatible
- [ ] removed options are declared with `mkRemovedOptionModule`
- [ ] changes that are not backward compatible are documented in release notes
- [ ] module tests succeed on ARCHITECTURE
- [ ] options types are appropriate
- [ ] options description is set
- [ ] options example is provided
- [ ] documentation affected by the changes is updated
##### Possible improvements
##### Comments
2018-05-02 00:54:21 +01:00
</screen>
</example>
</section>
2018-09-01 20:06:38 +01:00
<section xml:id="reviewing-contributions-new-modules">
2018-05-02 00:54:21 +01:00
<title>New modules</title>
<para>
New modules submissions introduce a new module to NixOS.
</para>
<itemizedlist>
<listitem>
<para>
Ensure that the module tests, if any, are succeeding.
</para>
</listitem>
<listitem>
<para>
Ensure that the introduced options are correct.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
2019-09-18 21:12:54 +01:00
Type should be appropriate (string related types differs in their merging capabilities, <literal>optionSet</literal> and <literal>string</literal> types are deprecated).
2018-05-02 00:54:21 +01:00
</para>
</listitem>
<listitem>
<para>
Description, default and example should be provided.
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that module <literal>meta</literal> field is present
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
Maintainers should be declared in <literal>meta.maintainers</literal>.
</para>
</listitem>
<listitem>
<para>
2019-09-18 21:12:54 +01:00
Module documentation should be declared with <literal>meta.doc</literal>.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
<listitem>
<para>
Ensure that the module respect other modules functionality.
</para>
2016-09-26 07:36:03 +01:00
<itemizedlist>
2018-05-02 00:54:21 +01:00
<listitem>
<para>
2019-09-18 21:12:54 +01:00
For example, enabling a module should not open firewall ports by default.
2018-05-02 00:54:21 +01:00
</para>
</listitem>
2016-09-26 07:36:03 +01:00
</itemizedlist>
2018-05-02 00:54:21 +01:00
</listitem>
</itemizedlist>
2016-09-26 07:36:03 +01:00
2018-09-01 20:20:57 +01:00
<example xml:id="reviewing-contributions-sample-new-module">
2018-05-02 00:54:21 +01:00
<title>Sample template for a new module review</title>
2016-09-26 07:36:03 +01:00
<screen>
##### Reviewed points
- [ ] module path fits the guidelines
- [ ] module tests succeed on ARCHITECTURE
- [ ] options have appropriate types
- [ ] options have default
- [ ] options have example
- [ ] options have descriptions
- [ ] No unneeded package is added to environment.systemPackages
2016-09-26 07:36:03 +01:00
- [ ] meta.maintainers is set
- [ ] module documentation is declared in meta.doc
##### Possible improvements
##### Comments
2018-05-02 00:54:21 +01:00
</screen>
</example>
</section>
2018-09-01 20:06:38 +01:00
<section xml:id="reviewing-contributions-other-submissions">
2018-05-02 00:54:21 +01:00
<title>Other submissions</title>
<para>
Other type of submissions requires different reviewing steps.
</para>
<para>
2019-09-18 21:12:54 +01:00
If you consider having enough knowledge and experience in a topic and would like to be a long-term reviewer for related submissions, please contact the current reviewers for that topic. They will give you information about the reviewing process. The main reviewers for a topic can be hard to find as there is no list, but checking past pull requests to see who reviewed or git-blaming the code to see who committed to that topic can give some hints.
2018-05-02 00:54:21 +01:00
</para>
<para>
2019-09-18 21:12:54 +01:00
Container system, boot system and library changes are some examples of the pull requests fitting this category.
2018-05-02 00:54:21 +01:00
</para>
</section>
<section xml:id="reviewing-contributions--merging-pull-requests">
<title>Merging pull requests</title>
2018-05-02 00:54:21 +01:00
<para>
2019-09-18 21:12:54 +01:00
It is possible for community members that have enough knowledge and experience on a special topic to contribute by merging pull requests.
2018-05-02 00:54:21 +01:00
</para>
2016-10-01 11:02:09 +01:00
<!--
The following paragraphs about how to deal with unactive contributors is just a
2016-10-01 11:02:09 +01:00
proposition and should be modified to what the community agrees to be the right
policy.
<para>Please note that contributors with commit rights unactive for more than
three months will have their commit rights revoked.</para>
2016-10-01 11:02:09 +01:00
-->
2016-09-26 16:36:59 +01:00
<para>
Please see the discussion in <link xlink:href="https://github.com/NixOS/nixpkgs/issues/50105">GitHub nixpkgs issue #50105</link> for information on how to proceed to be granted this level of access.
</para>
2018-05-02 00:54:21 +01:00
<para>
2019-09-18 21:12:54 +01:00
In a case a contributor definitively leaves the Nix community, they should create an issue or post on <link
xlink:href="https://discourse.nixos.org">Discourse</link> with references of packages and modules they maintain so the maintainership can be taken over by other contributors.
2018-05-02 00:54:21 +01:00
</para>
</section>
2016-09-26 07:36:03 +01:00
</chapter>