Open Factory Flooropen source

Guides

Review standard

On this page

Every change that touches code is reviewed by someone other than its author before it merges. This is the standard the reviewer follows and the record they leave. A repository can replace it with its own by pointing standard: in factory.yml at another file.

#Who reviews

A reviewer who did not write the change. When agents do the work, the reviewer is a fresh agent that is given the diff and this standard, not the author's reasoning or conclusions.

#What the reviewer checks

  1. It does what it says. Read the diff against the pull request's description. Say so when the change does something the description does not mention; whether that blocks is decided by the test below.
  2. It is correct. Follow the changed code through its callers and its failure paths. Run the tests that cover it. For a change to settings or to prose, where there are no callers or tests, check instead that it says what is true and that what reads it will accept it.
  3. It is safe in the risk areas it touches. The gate's summary lists each risk area and why it matters. Check that reason specifically.
  4. It can be undone. Say how the change would be reversed if it turned out wrong. If it cannot be, say so.

A finding is blocking when the change would do harm, lose data, or not do what it claims. Anything else is a remark and does not block.

#The record

The reviewer posts a comment on the pull request. Its first line is the marker, with the full 40-character head commit that was reviewed:

<!-- independent-review sha=<head commit> verdict=pass -->

or

<!-- independent-review sha=<head commit> verdict=findings -->

Say who did the review. The marker may end with by=agent or by=person:

<!-- independent-review sha=<head commit> verdict=pass by=agent -->

Whoever did the review sets it. An agent that reviewed and posts its record through a person's account (the usual way, when agents do the work on somebody's sign-in) writes by=agent: the factory's reports then say the change was reviewed by "an independent agent, posted from @that-account's account", not by the person. A person who reviewed and posts from their own account writes by=person, or leaves it out: a record that does not say is taken to be by the account that posted it. Do not set it for someone else: a person posting an agent's record keeps the agent's by=agent, and never puts their own name to a review they did not do.

A gate older than version 0.60.0 does not know by= and reads such a marker as malformed (the check goes red): move the project's gate to 0.60.0 or later before its records use it.

It is the record's own word. The gate counts a record the same whatever it says here, and nothing checks it. The automatic reviewer is the exception that is checked: it is known by its account and its signature, not by this.

Near the top of the record, below the marker (and below a title and a line or two about the reviewer, if the record has them), comes a short block for a reader who does not read code: the owner, or an agent asked how things are going. Its heading is exactly **In short**, on a line of its own, and each line under it starts with - :

**In short**
- A customer who pays twice in a minute could be charged twice.
- The nightly report would silently leave out refunds.

For findings, write one plain sentence for each blocking finding: what would go wrong, and for whom. No file names, function names or jargon; those belong further down. For a pass, write one sentence saying what the change does. Keep each line under about 240 characters, and the block to ten lines; it ends at the first line that does not start with - . Tools find the block by its heading, in the first forty lines of the record. Tools that report on the factory quote these lines as they stand, so they should make sense to someone who has not seen the change.

Below that, in full: what was checked, each blocking finding with the file and line, then any remarks that do not block, and how the change would be undone. A pass has the same shape, with no blocking findings. If the record is posted from the same login as the author's, say so in it, and say who did the review in the marker (by=, above).

Rules the gate enforces:

  • A record is for one commit. A new commit needs a new review.
  • Every review is a new comment. Never edit or replace an earlier record. A send-back is part of the change's history.
  • The newest record for the head commit wins. Findings posted after a pass block again; a pass posted after findings clears them.
  • Only accounts that can write to the repository count. The gate looks up what each account may do; being a member of the organisation is not enough. This is checked each time the gate runs, so a record from someone who has since lost write access stops counting, findings included. A record posted by a GitHub App does not count, with one exception: the automatic reviewer that factory.yml names (automatic.account), and only when the record carries the reviewer's signature. Its findings count at every level; its pass counts only for the levels factory.yml lists, and never clears findings a person recorded for the same commit. A repeat of a signed record it has already made is ignored.

#What this is and is not

It is a process control. It makes a second look the default and leaves a dated trail of what was found. It is not proof that a review happened: when the author and the reviewer share one login, that login can post the marker without one.

This guide is docs/REVIEW_STANDARD.md in the repository, and this page is made from it. Something wrong or unclear? Open an issue or send a pull request. Next: The automatic reviewer.