Learning center

Split a large review between two people without leaving a seam

Divide by question when the change crosses layers, and name one person who reads the calls between the parts. Dividing by folder is faster to arrange, and it leaves the contract between the folders to nobody.

Where a folder split leaks#

Take a change that renames a JSON field from amount to amount_cents. Reviewer A takes api/ and sees a consistent rename. Reviewer B takes web/ and sees a consistent rename, except for one export screen that still reads amount. That screen is unchanged, so it is not in the diff. Neither reviewer has a line to comment on.

This can be shown in a dozen lines:

const api = () => ({ amount_cents: 1250 });          // changed, reviewer A
const list = (r) => (r.amount_cents / 100).toFixed(2); // changed, reviewer B
const exportRow = (r) => (r.amount / 100).toFixed(2);  // unchanged, in no diff
console.log(list(api()), exportRow(api()));

Node prints 12.50 NaN. Every changed line is right.

Choose the split#

ChangeSplit byWho owns the seam
Independent packages, no shared interface changedFolderNobody needed. Confirm with a search for shared imports
API or schema change with several callersProducer, and consumersThe consumer reviewer, who searches all callers and not only changed ones
Migration with application codeData states over timeOne person walks old code with new schema, then new code with old schema
Security-sensitive flow across layersQuestion: authorization, input, loggingWhoever takes authorization follows one request end to end
Generated code and its sourceGenerator input, and a regeneration checkThe person who regenerates and compares

If the seam needs as much context as either half, split the pull request instead.

Write the assignment in the pull request#

Ana: api/ and the schema, at 77d0c2e. Ben: all readers of amount, changed or not. Ben owns the search. Neither of us has reviewed infra/.

Then make the search checkable. Put the command and its result in the comment:

git grep -n '\bamount\b' 77d0c2e -- '*.ts' '*.sql'

A grep proves little in both directions. It misses names that are built at run time, other repositories and stored reports, and it matches unrelated fields. List what it could not reach, such as another repository, and ask its owner.

Combine the two results#

An approval covers the pull request as a whole. GitHub has no notion of approving half, so the first approval can let the change merge while the other half is unread. Either hold approval until both reviewers have written their result, or require two approvals. With code owners, any one owner's approval satisfies an entry, so check that the split and the ownership rules agree.

Worked example#

This example is fictional. Two reviewers split the rename above by folder and both approve. The export then shows NaN. On the next such change they split by producer and consumer. Ben's search returns nine readers, seven of them in the diff. The two unchanged ones are the export screen and a monthly report. He asks for both in the same change, and adds that a partner's integration cannot be searched from here. Its owner becomes the third person in the decision.

If one of you must stop early, hand over coverage by question. Return to handing over evidence.

One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. Eligibility and fair-use terms.

Start free with GitHub

Related reading