Yeda AI Tips · #101

Español

Review the Tests First, Split Big Diffs

Stop reading the code first in review. Read the tests before the implementation. The tests tell you what the change is supposed to do — intent, edge cases, and coverage — before you judge how it does it. And with AI assistants generating bigger diffs faster than ever, the second half of the tip matters just as much: watch the size, and split anything that outgrows one logical change.

Why tests first

An implementation shows you how; tests show you what and why. Reading them first gives you a spec to review against instead of reverse-engineering intent from the code:

This mirrors how Google's guide recommends navigating a change anyway: read the description, then the main files first, because the big parts give context to everything else. For most changes, the tests are that context.

The size ladder

Review quality degrades with diff size — SmartBear's study of Cisco code reviews found reviewers catch 70–90% of defects when reviewing 200–400 lines over 60–90 minutes, and effectiveness drops fast beyond that. Google's own guideline: 100 lines is usually a reasonable change, 1,000 is usually too large.

Diff sizeVerdictWhat to do
~100 linesEasyReview in one sitting, tests first
200–400 linesWorkable ceilingOne logical change, ≤500 lines/hour pace
~1,000 linesToo largeSplit before requesting review

Line count isn't the only axis: 200 lines in one file reads fine; the same 200 lines spread across 50 files usually doesn't.

Three ways to split

  1. Stack small changes. Write one small change, send it for review, and immediately start the next one based on the first. You keep moving while reviewers work, and each link in the chain stays reviewable.
  2. Split by file group. Ship the schema or interface change in one diff, the code that uses it in a follow-up. Reviewers can approve the contract before wading into the call sites.
  3. Cut vertical slices. For a feature, land one thin end-to-end path — UI to storage — then widen it. Each slice is independently testable and demoable, which also means its tests are readable as a spec.

Power-user moves

Resources

Building an AI feature? Yeda AI designs, audits, and ships production LLM systems.

Talk to us · Read the blog