summary refs log tree commit diff
path: root/doc/reviewing-contributions.xml
blob: 849bb9316c608bb88071cf5539c27f5d96199e8f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
<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="sec-reviewing-contributions">
 <title>Reviewing contributions</title>
 <warning>
  <para>
   The following section is a draft, and the policy for reviewing is still
   being discussed in issues such as
   <link
	   xlink:href="https://github.com/NixOS/nixpkgs/issues/11166">#11166
   </link> and
   <link
	   xlink:href="https://github.com/NixOS/nixpkgs/issues/20836">#20836
   </link>.
  </para>
 </warning>
 <para>
  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.
 </para>
 <para>
  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 these. 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>.
 </para>
 <para>
  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.
 </para>
 <para>
  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.
 </para>
 <para>
  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.
 </para>
 <para>
  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.
 </para>
 <section xml:id="reviewing-contributions-package-updates">
  <title>Package updates</title>

  <para>
   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.
  </para>

  <para>
   It can happen that non-trivial updates include patches or more complex
   changes.
  </para>

  <para>
   Reviewing process:
  </para>

  <itemizedlist>
   <listitem>
    <para>
     Add labels to the pull-request. (Requires commit rights)
    </para>
    <itemizedlist>
     <listitem>
      <para>
       <literal>8.has: package (update)</literal> and any topic label that fit
       the updated package.
      </para>
     </listitem>
    </itemizedlist>
   </listitem>
   <listitem>
    <para>
     Ensure that the package versioning fits the guidelines.
    </para>
   </listitem>
   <listitem>
    <para>
     Ensure that the commit text fits the guidelines.
    </para>
   </listitem>
   <listitem>
    <para>
     Ensure that the package maintainers are notified.
    </para>
    <itemizedlist>
     <listitem>
      <para>
       <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.
      </para>
     </listitem>
    </itemizedlist>
   </listitem>
   <listitem>
    <para>
     Ensure that the meta field information is correct.
    </para>
    <itemizedlist>
     <listitem>
      <para>
       License can change with version updates, so it should be checked to
       match the upstream license.
      </para>
     </listitem>
     <listitem>
      <para>
       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.
      </para>
     </listitem>
    </itemizedlist>
   </listitem>
   <listitem>
    <para>
     Ensure that the code contains no typos.
    </para>
   </listitem>
   <listitem>
    <para>
     Building the package locally.
    </para>
    <itemizedlist>
     <listitem>
      <para>
       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.
      </para>
      <para>
       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.
<screen>
$ git remote add channels https://github.com/NixOS/nixpkgs-channels.git <co
  xml:id='reviewing-rebase-1' />
$ git fetch channels nixos-unstable <co xml:id='reviewing-rebase-2' />
$ git fetch origin pull/PRNUMBER/head <co xml:id='reviewing-rebase-3' />
$ git rebase --onto nixos-unstable BASEBRANCH FETCH_HEAD <co
  xml:id='reviewing-rebase-4' />
</screen>
       <calloutlist>
        <callout arearefs='reviewing-rebase-1'>
         <para>
          This should be done only once to be able to fetch channel branches
          from the nixpkgs-channels repository.
         </para>
        </callout>
        <callout arearefs='reviewing-rebase-2'>
         <para>
          Fetching the nixos-unstable branch.
         </para>
        </callout>
        <callout arearefs='reviewing-rebase-3'>
         <para>
          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.
         </para>
        </callout>
        <callout arearefs='reviewing-rebase-4'>
         <para>
          Rebasing the pull-request changes to the nixos-unstable branch.
         </para>
        </callout>
       </calloutlist>
      </para>
     </listitem>
     <listitem>
      <para>
       The <link xlink:href="https://github.com/madjar/nox">nox</link> tool can
       be used to review a pull-request content in a single command. It doesn't
       rebase on a channel branch so it might trigger multiple source builds.
       <varname>PRNUMBER</varname> should be replaced by the number at the end
       of the pull-request title.
      </para>
<screen>
$ nix-shell -p nox --run "nox-review -k pr PRNUMBER"
</screen>
     </listitem>
    </itemizedlist>
   </listitem>
   <listitem>
    <para>
     Running every binary.
    </para>
   </listitem>
  </itemizedlist>

  <example xml:id="reviewing-contributions-sample-package-update">
   <title>Sample template for a package update review</title>
<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

</screen>
  </example>
 </section>
 <section xml:id="reviewing-contributions-new-packages">
  <title>New packages</title>

  <para>
   New packages are a common type of pull-requests. These pull requests
   consists in adding a new nix-expression for a package.
  </para>

  <para>
   Reviewing process:
  </para>

  <itemizedlist>
   <listitem>
    <para>
     Add labels to the pull-request. (Requires commit rights)
    </para>
    <itemizedlist>
     <listitem>
      <para>
       <literal>8.has: package (new)</literal> and any topic label that fit the
       new package.
      </para>
     </listitem>
    </itemizedlist>
   </listitem>
   <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>
    <itemizedlist>
     <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>
       A maintainer must be set, this can be the package submitter or a
       community member that accepts to take maintainership of the package.
      </para>
     </listitem>
    </itemizedlist>
   </listitem>
   <listitem>
    <para>
     Ensure that the code contains no typos.
    </para>
   </listitem>
   <listitem>
    <para>
     Ensure the package source.
    </para>
    <itemizedlist>
     <listitem>
      <para>
       Mirrors urls should be used when available.
      </para>
     </listitem>
     <listitem>
      <para>
       The most appropriate function should be used (e.g. packages from GitHub
       should use <literal>fetchFromGitHub</literal>).
      </para>
     </listitem>
    </itemizedlist>
   </listitem>
   <listitem>
    <para>
     Building the package locally.
    </para>
   </listitem>
   <listitem>
    <para>
     Running every binary.
    </para>
   </listitem>
  </itemizedlist>

  <example xml:id="reviewing-contributions-sample-new-package">
   <title>Sample template for a new package review</title>
<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
- [ ] patches that are remotely available are fetched with `fetchpatch`

##### Possible improvements

##### Comments

</screen>
  </example>
 </section>
 <section xml:id="reviewing-contributions-module-updates">
  <title>Module updates</title>

  <para>
   Module updates are submissions changing modules in some ways. These often
   contains changes to the options or introduce new options.
  </para>

  <para>
   Reviewing process
  </para>

  <itemizedlist>
   <listitem>
    <para>
     Add labels to the pull-request. (Requires commit rights)
    </para>
    <itemizedlist>
     <listitem>
      <para>
       <literal>8.has: module (update)</literal> and any topic label that fit
       the module.
      </para>
     </listitem>
    </itemizedlist>
   </listitem>
   <listitem>
    <para>
     Ensure that the module maintainers are notified.
    </para>
    <itemizedlist>
     <listitem>
      <para>
       <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.
      </para>
     </listitem>
    </itemizedlist>
   </listitem>
   <listitem>
    <para>
     Ensure that the module tests, if any, are succeeding.
    </para>
   </listitem>
   <listitem>
    <para>
     Ensure that the introduced options are correct.
    </para>
    <itemizedlist>
     <listitem>
      <para>
       Type should be appropriate (string related types differs in their
       merging capabilities, <literal>optionSet</literal> and
       <literal>string</literal> types are deprecated).
      </para>
     </listitem>
     <listitem>
      <para>
       Description, default and example should be provided.
      </para>
     </listitem>
    </itemizedlist>
   </listitem>
   <listitem>
    <para>
     Ensure that option changes are backward compatible.
    </para>
    <itemizedlist>
     <listitem>
      <para>
       <literal>mkRenamedOptionModule</literal> and
       <literal>mkAliasOptionModule</literal> functions provide way to make
       option changes backward compatible.
      </para>
     </listitem>
    </itemizedlist>
   </listitem>
   <listitem>
    <para>
     Ensure that removed options are declared with
     <literal>mkRemovedOptionModule</literal>
    </para>
   </listitem>
   <listitem>
    <para>
     Ensure that changes that are not backward compatible are mentioned in
     release notes.
    </para>
   </listitem>
   <listitem>
    <para>
     Ensure that documentations affected by the change is updated.
    </para>
   </listitem>
  </itemizedlist>

  <example xml:id="reviewing-contributions-sample-module-update">
   <title>Sample template for a module update review</title>
<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

</screen>
  </example>
 </section>
 <section xml:id="reviewing-contributions-new-modules">
  <title>New modules</title>

  <para>
   New modules submissions introduce a new module to NixOS.
  </para>

  <itemizedlist>
   <listitem>
    <para>
     Add labels to the pull-request. (Requires commit rights)
    </para>
    <itemizedlist>
     <listitem>
      <para>
       <literal>8.has: module (new)</literal> and any topic label that fit the
       module.
      </para>
     </listitem>
    </itemizedlist>
   </listitem>
   <listitem>
    <para>
     Ensure that the module tests, if any, are succeeding.
    </para>
   </listitem>
   <listitem>
    <para>
     Ensure that the introduced options are correct.
    </para>
    <itemizedlist>
     <listitem>
      <para>
       Type should be appropriate (string related types differs in their
       merging capabilities, <literal>optionSet</literal> and
       <literal>string</literal> types are deprecated).
      </para>
     </listitem>
     <listitem>
      <para>
       Description, default and example should be provided.
      </para>
     </listitem>
    </itemizedlist>
   </listitem>
   <listitem>
    <para>
     Ensure that module <literal>meta</literal> field is present
    </para>
    <itemizedlist>
     <listitem>
      <para>
       Maintainers should be declared in <literal>meta.maintainers</literal>.
      </para>
     </listitem>
     <listitem>
      <para>
       Module documentation should be declared with
       <literal>meta.doc</literal>.
      </para>
     </listitem>
    </itemizedlist>
   </listitem>
   <listitem>
    <para>
     Ensure that the module respect other modules functionality.
    </para>
    <itemizedlist>
     <listitem>
      <para>
       For example, enabling a module should not open firewall ports by
       default.
      </para>
     </listitem>
    </itemizedlist>
   </listitem>
  </itemizedlist>

  <example xml:id="reviewing-contributions-sample-new-module">
   <title>Sample template for a new module review</title>
<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
- [ ] meta.maintainers is set
- [ ] module documentation is declared in meta.doc

##### Possible improvements

##### Comments

</screen>
  </example>
 </section>
 <section xml:id="reviewing-contributions-other-submissions">
  <title>Other submissions</title>

  <para>
   Other type of submissions requires different reviewing steps.
  </para>

  <para>
   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.
  </para>

  <para>
   Container system, boot system and library changes are some examples of the
   pull requests fitting this category.
  </para>
 </section>
 <section xml:id="reviewing-contributions--merging-pull-requests">
  <title>Merging pull-requests</title>

  <para>
   It is possible for community members that have enough knowledge and
   experience on a special topic to contribute by merging pull requests.
  </para>

  <para>
   TODO: add the procedure to request merging rights.
  </para>

<!--
The following paragraph about how to deal with unactive contributors is just a
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>
-->

  <para>
   In a case a contributor leaves definitively the Nix community, he should
   create an issue or post on
   <link
   xlink:href="https://discourse.nixos.org">Discourse</link> with
   references of packages and modules he maintains so the maintainership can be
   taken over by other contributors.
  </para>
 </section>
</chapter>