PR Review Guide
Not all changes carry the same risk. Focus review effort where it matters most.
The Challenge
Terra is developed with heavy AI assistance, which means high commit volume, frequent PRs, and lots of changed files. Reviewing every line of every PR isn’t realistic. This guide establishes a risk-based approach so a senior engineer can stay involved in ~1 hour/week.Risk Tiers
Tier 1 — Always Review Carefully
Changes to these files affect security, data integrity, or access control:- Does it maintain existing security invariants?
- Are there tests for the changed behavior?
- Could it create a privilege escalation path?
- Does it deny by default on failure?
Tier 2 — Scan for Patterns
Important but lower risk. A pattern-level review is usually sufficient:- Uses
supabaseAdminfrom@/lib/supabase(not new clients) - Uses
loggerfrom@/lib/logger(notconsole.log) - Server actions start with auth guard (
requireAdmin,checkFormAccess) - Returns
ActionResult<T>type - No PII in log messages
Tier 3 — Trust CI
Low-risk changes. Trust the tests and lint:PR Template
Including the risk tier in the PR description lets the reviewer know how much
time to spend before opening the diff.
Approval Criteria
Tier 1 (security-affecting):- Reviewer has read the changed files
- New behavior has test coverage
- No regressions in security tests
- CI green
- Explicit approval required
- PR description accurate
- Follows established patterns
- CI green
- Approval or 24h without objection
- CI green
- No security files touched
- Can merge after CI
Weekly Cadence
| Day | Activity | Time |
|---|---|---|
| Monday | Review any Tier 1 PRs | 30-60 min |
| Wednesday | Quick scan of open Tier 2 PRs | 15-30 min |
| Friday | Check CI, pnpm audit, scan merged PRs | 15 min |
Signals to watch for
- New migration file — always review (hard to reverse)
- Changes to auth-guards, middleware, or team.ts — review permission logic
- New server action — verify it uses auth guards
- Dependency updates — run
pnpm audit
Getting Started
If you’re reviewing Terra for the first time:- Read the Production Review overview for architecture context
- Run the test suite:
pnpm --dir apps/terra test - Walk through Security and Data Protection
- Check Known Gaps for what’s incomplete
- Set up GitHub notifications for Tier 1 file changes