Rules and numbers

These are the rules of Maintainer Mode, not of nixpkgs. nixpkgs decides how the work is done. Read its contributor guide first:

This page tells how Maintainer Mode decides what to show, and which pull requests go in the queues. It also tells how the numbers on /state are made. The site serves this page at /rules. These rules are the rules of Maintainer Mode only. nixpkgs has its own rules for every contribution: read the nixpkgs contributor guide.

Maintainer Mode gives no rights

nixpkgs committers give commit access. Maintainer Mode gives them facts that they do not have today. A person still decides.

A place in the queues is small. Thus a count that only adds, with no dispute process, is sufficient. Commit access is large. If a number can get it, people will try to cheat the number, and this design cannot stop that. Thus nothing here makes a recommendation. No number gives more than a place in the queues.

The record shows the last fifty reviews of a person, the result of each review, and whose work they share. Its first number is pull requests that a committer merged later, with no more changes after the review. This number shows most directly that the judgement of a person agrees with the people who merge. Nobody can cheat it, because a committer must act for it to count. The second number is problems found: the author changed the pull request after a review that asked for changes or commented on a changed line.

The site shows no score and no rank of people. A ranking makes people review more, not better. Each person has a page with the results of their own reviews. It shows no count of reviews.

One page is the exception, and it is not public: the people who grant and remove commit access see every committer and every active reviewer in one queue, each with a status and with counts, on /committers. It has no score either, and the order is one fact that the viewer picks. The counts say where to look; the links under each row lead to the reviews themselves, which is what those people read. For the people who grant commit access tells what it shows.

Inside the nixpkgs rules

Maintainer Mode works inside the nixpkgs automation/AI policy. It adds no rules of its own to that policy.

The rules

The queues need one fact about each review: did it move the pull request? The ledger (src/ledger.rs) keeps this fact. The pages do not show the ledger. GET /api/v1/people/<login> and GET /api/v1/prs/<n> give it under credits.

1. A review that moves a pull request

A review moves a pull request when it is on the pull request of another person, and one or more of these events occur in the next 14 days:

EventThe GitHub fact
The author pusheda commit on the head, or a force push, after the review
The author replieda comment by the author, or a reply in a review thread, after the review
Inline on a changed linethe review has an inline comment on a + or - line of the diff
It mergedthe pull request merged after the review

The ledger keeps such a review as a counted review. A program reads each event. No person must judge. Three of the four events need an action by the other person. Thus one person cannot cause them alone.

What does not count. A plain "LGTM". An approval with no comment. An approval on a pull request that does not merge. A comment on a line that did not change. A review by a bot. A review of a pull request that a bot opened, such as a version update by r-ryantm. A review of your own pull request. The state of nixpkgs lists the bots.

2. Whose pull requests appear

A pull request appears in the queues when its author is in the queues. This means: in the last 60 days, the author has counted reviews on the pull requests of three or more different authors. Two people who review each other cannot get to three. A group that is large enough to get to three is a healthy review community.

After 60 days, a review does not count for a place in the queues.

Your own page /me/progress tells you whether your pull requests are in the queues. Each pull request page tells why it is or is not in a queue.

3. Ready to merge

A pull request goes in the Ready to merge queue when all of these are true:

The other pull requests in the queues go in the review queue, the oldest first. In the Ready to merge queue, the pull requests of authors with more recent counted reviews come first. Section 4 tells how the ledger weighs them.

The tab Ready to merge (/review?tab=ready) also links to looser lists, such as security fixes and backports. They do not need a counted review. For committers tells what each list shows.

4. How the ledger is calculated

The ledger is a function of public GitHub data and the clock only. Nobody types data into it. If you delete the database, the walk writes it again from the archive, with the same ledger. Each counted review has a link to the review.

The constants, and why

ConstantValueWhy
Move window (N)14 dA volunteer author has two weekends to answer. A longer window counts a push or merge that has no relation to the review.
Decay half-life30 dOne month. Two months after a person stops, their weight is one quarter. Shorter punishes a holiday. Longer shows who helped long ago.
Window60 dTwo half-lives. Older reviews are at 25% and tell little. It also keeps the pr table small.
Distinct authors3The smallest number that two people cannot get to. A higher number stops people who know a small part of nixpkgs well.
Daily cap5A careful nixpkgs review takes 15 to 60 minutes. Five is a full but honest day. Twenty in one hour is not careful.
Per pull request1More rounds on one change are the same work. Without this limit, ten small reviews on one pull request weigh more than one good review.
Pair factor1/2A real working pair still gets some weight. The total of all repeats stays below 2.
Queue head age14 dMost nixpkgs pull requests get their first review in the first two weeks, or never. After that, they are the backlog that needs help.
Fresh-pick factor1/2People can still review what they know, and it still counts. The backlog has twice the weight.

GET /api/v1/status gives the current values.

The pull request page

/pr/<n> has four parts: the panel At a glance, the description, the files and the conversation. The header says who opened it, into which branch, and when it was opened and updated, or merged and by whom. The panel helps you decide quickly. It shows each fact once, and only facts that the server has. When a source is missing, the panel says "unknown". It never guesses a value. Details that you need less often fold: the labels, the touched packages after the first six, the checks that pass, the review checklist, and why the pull request is in its queue. In the description, the checklist of the nixpkgs template ("Things done") folds.

A pull request that is older than the synced data comes from the archive (see data.md). Its panel shows only Reached and What changes.

GET /api/v1/prs/<n> gives the facts of the panel that are the same for all people: decision, blockers (each with kind, level and text), checks (each with ok, text and guide), treewide (null, or the counts packages and modules) and too_large (null, or the count files).

Routing: what you see, and what counts

The site shows each person the pull requests in their part of nixpkgs. A review counts only when it moves the pull request. Thus a review outside your part of nixpkgs counts when it moves something. The site only does not ask you for it.

The site calculates your part of nixpkgs. You do not choose it. It is the sum of:

  1. meta.maintainers: each package whose evaluated meta.maintainers has your GitHub login, at the directory of its meta.position. Teams and calculated lists count, because the evaluator reads them.
  2. ci/OWNERS: the file that the "Check / owners" job reads. The site ignores team lines, because team membership is not public.
  3. What you changed: the directories of the files in your merged pull requests of the last year. The site reads them with your own token when you sign in.

You can also add tags in /me/settings: path prefixes such as pkgs/development/python-modules, for new parts of nixpkgs that you want to follow.

A pull request has no maintainer when no meta.maintainers, meta.teams or ci/OWNERS line covers a file that it changes. The same test sets the weight of a review on it, so the label and the ledger agree. These pull requests have their own list on /review: Show No maintainer. A new reviewer can start there: a check of the packaging (complete meta, pinned hashes, platforms, a missing versionCheckHook) needs no expert knowledge. Most first reviews find these problems.

Who built it

nixpkgs CI evaluates and lints a pull request. It does not build the packages that the pull request changes. Thus "checks pass" means "it evaluates". The only build evidence a pull request gets is a person who ran nixpkgs-review on their own machine, or in their own GitHub Actions with nixpkgs-review-gha, and posted the result as a comment. That person lent their compute to vouch for the change. Maintainer Mode reads these comments like approvals: evidence with a name on it.

The pushes are the last 30 that the archive keeps. GET /api/v1/prs/<n> gives the runs as built, each with pushes_since and weight.

Treewide pull requests

A pull request is treewide when it touches 40 or more packages and modules. The count holds each attribute and module that its files or its title link to: the list "Touches" of the pull request page. Thus a Python application can count two times, as python3Packages.<name> and as <name>.

A treewide pull request stays in every list. It comes after the other pull requests in For you, in Needs you, and in the pull requests of a package, module or directory. Among themselves, the treewide pull requests keep the order of the list. The other lists keep their order. These lists and the review lists mark its row, for example "treewide · 340 packages". The panel of the pull request page shows the same mark. In your packages, a treewide pull request alone does not make a package need attention.

A pull request is too large to link when it changes 10 000 files or more: by the count of GitHub, or by the list of the git copy. The git copy keeps no more paths, so a longer list is only a part. A wrong base branch, a bad merge or a reformat of all of nixpkgs goes above this limit.

Such a pull request links to no package, module, directory or person. It is not on their pages, not in For you, not in Needs you, not in the inbox and not in the counts of open pull requests. Its own page and the queues still show it. Its rows in the review lists show a mark, such as "too large · 19,485 files". In the panel of its page, "Touches" says "none: it changes 19,485 files, too many to link to packages and people".

The state of nixpkgs

/state and GET /api/v1/metrics show how pull requests move through nixpkgs, month by month. Each number is a total. No number names a person. The page shows charts of complete months, for the last 2 years, the last 5 years (the default) or all of history (?range=2y, ?range=all). Each chart has a table with its values. When the lines of a chart stop before the last month, because a share waits until its whole period has passed, its note gives the last month with a value. The JSON has every month.

So that no number points at a person, a share or a percentile of fewer than 20 pull requests or people is null, and a count of people below 3 is null. The JSON keeps older fields too, such as the days to merge of the pull requests merged in a month. Those count only merged pull requests, so a clean-up of old pull requests makes them look slower.

The ledger reads only the pull requests updated in the last 60 days and all open ones. These numbers read the facts of every pull request in the archive: the title, the first 30 reviews, the first 50 files, the first 30 labels and the last commit message, but not the description. They are in a separate table, so they never go into the ledger. Until the archive walk reaches the first number, the older months are not complete.