Video in progress

Staff 🌿 Git

In a large organization the code review load has landed on a few seniors. How do you fix this at the system level?

First I collect data: who does how many reviews, and where the waiting is long. Then I spread the load by widening ownership (a team, not a person, in CODEOWNERS), a review rotation, requirements that differ by risk, and automating the mechanical checks.

📖 Answer

The typical situation: in CODEOWNERS the critical folders list 2-3 people, who see 15 PRs a day and have no time for their own work. As a result either the queue gets longer or the review becomes superficial, and both are bad.

What works:

  • Team ownership. @payments-team in CODEOWNERS, not an individual. The platform assigns one from within by round-robin or by load;
  • Spreading knowledge. Mid-level engineers are also first reviewers, and the senior joins as second only for architecture or risky changes. This grows people as well;
  • Requirements by risk. One approval for a docs or test change; two, including the owner's, for money, security or migrations. The same heavy process for every PR is the most expensive option;
  • Automation. Formatting, static analysis, mutation/coverage, dependency checks all go in CI. Bot comments free people from the small stuff;
  • Design up front. A short design doc or ADR for big changes. The architecture debate should happen before the code is written, not in the PR.

Measuring: the distribution per reviewer (even a simple indicator like the Gini coefficient is enough), time to first response, PR size. After a quarter I look again to see whether the load is piling up on one or two people again. That usually means a new "single expert" has appeared.