Files

72 lines
3.9 KiB
Markdown
Raw Permalink Normal View History

# Why these thresholds: the empirical grounding
The anchor is **review effort**, not implementation effort: an MR a competent
senior developer can review in about 30 focused minutes. Everything below traces
that anchor to published evidence, so the numbers are not taste.
## The review-budget research
- **SmartBear/Cisco study** (2,500 reviews, 3.2M lines, 10 months — the largest
public code-review study): defect-detection effectiveness peaks at
**200–400 reviewable lines** per change; a productive review session lasts
**60–90 minutes** at a pace of **300–500 lines/hour**. Past ~400 lines,
reviewers are overwhelmed and defect yield collapses.
- **30 minutes × 300–500 lines/hour ≈ 150–250 lines.** Our 200/400 thresholds
therefore sit in the lower half of the research sweet spot — deliberately
stricter than the classic "400-line ceiling".
- Corroborating data (Koalr analysis of review time vs. size): ≤200 changed
lines ≈ 22 minutes; 201–500 ≈ 48 minutes. 30 minutes lands around
250–300 lines — consistent with a 200 comfort / 400 hard ceiling.
- **Google's eng-practices**: "100 lines is usually a reasonable size for a CL,
and 1000 lines is usually too large."
- **Propel Code 2024**: PRs above 1,000 LOC show ~70% lower defect detection and
3× slower approval than 200–400-line PRs.
## What counts — and what never counts
The unit is **reviewable lines**: handwritten logic a reviewer must actually
understand. Excluded everywhere (triage estimates and size gate alike):
- lockfiles, dependency sums
- generated code (`*.pb.go`, `*_pb2.py`, `*.generated.*`, minified bundles, snapshots)
- binary and asset files
- **pure renames/moves** — reviewed by checking provenance and that tests pass,
never line by line
This is why "8 files" is meaningless as a unit: 8 files of comment tweaks is
close to zero reviewable lines; 8 files of rewrite can be 1,500. The count that
predicts review time is understanding-requiring lines, not files.
**One idea per MR** is the second gate: if the title needs an "and", it is two
MRs. A refactor and a behavior change never share one — "make the change easy
(warning: this may be hard), then make the easy change" (Kent Beck). Mechanical
changes get their own MRs because they are reviewed by a different, cheaper
method. Changes that cannot ship half-done go behind a flag or use
expand–migrate–contract, which is what keeps every slice independently
shippable.
## Why judge at triage time
- In the agent era this problem grows: an October 2026 analysis of 381
agent-written PRs found median PR size grew ~3× with AI assistance, large PRs
(≥400 reviewable lines) were ~4× more likely to contain a later-fixed bug, and
review attention thinned as size grew (comment density fell ~20×). The PRs
that need review most get the least.
- ThoughtWorks (Nov 2026) puts **stacked PRs in the Caution ring**: stacking is
"a workaround for poor upfront decomposition; the better habit is to specify,
split, size and deliver work as small, independent units." Judging the issue
*before* code exists is that better habit; the post-hoc splitters
(split-pr, stacksmith, pr-splitter, pr-shrinker) are the safety net.
- Two gates, one honest system: Jev **predicts** at triage time (cheap,
calibrated, advice-only); the deterministic size gate **verifies** on the
branch (free, exact). Predictions about code that does not exist are
fallible — the gate is the ground truth. When they disagree, trust the gate.
## Status of the numbers
The 200/400 thresholds and the question wording are **literature-anchored
defaults**, not calibrated on this user's history — deliberately, because
current session history does not yet represent the target level of work. If a
calibration pass is ever run (hand-labeled past issues, threshold sweep like
OpenRouter's Jev cookbook), this file is where the results and dates go.