Senior engineering practice: review, ADRs, debugging and scoping
Why you care
"Walk me through how you review a pull request" is a standard senior-level interview question because the answer predicts whether you catch the bug that matters or the one that doesn't. A junior reviewer comments on variable names; a senior reviewer traces what happens when the network call times out, whether the new endpoint checks that the caller owns the row it's reading, and whether the PR's claim ("tests pass") has evidence attached. On the job this is the difference between a review that is a formality and a review that is the actual safety net between a bug and production. This card is the index for the chapter: the other five cards (writing decisions down, debugging unfamiliar code, estimating and scoping, arguing for fixes, running incidents) are the deeper, specific skills a reviewer and reviewee both lean on.
Explain like I'm 5
A building inspector and an interior decorator can walk through the same house. The decorator comments on paint color and furniture placement. The inspector checks the load-bearing walls, the wiring behind the switch plates, and whether the exits actually open. Both kinds of comments are real, but only one kind stops the house from collapsing. A senior review is an inspection first; the paint comments can come after, clearly labelled as paint comments.
Core concept
Giving a review well means working in a fixed order, not reading top to bottom and reacting line by line:
- Read for intent first. What problem is this PR solving, and does the diff actually solve it? You cannot spot a wrong fix if you never confirmed what "right" means here.
- Check correctness and security risk explicitly: authentication/authorization on the new code path, injection or unvalidated input, resource cleanup on the failure path, and what happens when a dependency times out or returns something unexpected. This is a checklist, not a vibe; Application threat boundaries: SQLi, SSRF and IDOR and Make PRs and hooks useful safeguards own the specific attack and hook mechanics this check leans on.
- Request evidence, not claims. "Tests pass" is a claim; a pasted test run or a link to a green CI check with the relevant test named is evidence. If the PR touches a failure path, ask for the output that shows the failure path was actually exercised.
- Separate blocking issues from suggestions, and say which is which. A comment with no label reads as a demand. Decide: does leaving this unresolved risk correctness, security, or data loss (blocking), or is it a style/readability preference (suggestion, non-blocking)?
- Respond to disagreement with rationale, not re-assertion. If the author pushes back, either you find the concrete risk you were pointing at (and say what it is), or you concede and move on. "I still think it's wrong" without a reason is not a review comment.
The decision rule: label a comment blocking only if you can name the concrete, observable failure it prevents (an error, a wrong count, a leaked credential, an unauthorized read). If you can't name the failure, it's a suggestion, and it should read like one.
Minimal example Blocking or suggestion, by rule not vibe
def classify(comment):
blocking_signals = ("auth", "sql injection", "secrets", "no error handling", "data loss", "race condition")
text = comment.lower()
if any(sig in text for sig in blocking_signals):
return "blocking"
return "suggestion"
comments = [
"rename this variable to something clearer",
"this swallows the exception with no error handling, we lose failed rows silently",
"could extract this into a helper function",
"this query builds SQL by string concatenation, looks like a sql injection risk",
]
for c in comments:
print(classify(c), "-", c[:40])suggestion - rename this variable to something cleare
blocking - this swallows the exception with no erro
suggestion - could extract this into a helper functio
blocking - this query builds SQL by string concatenIn production Scan a diff for the patterns worth blocking on
A real review tool would use an AST or a linter; this stands in with plain text scanning over a unified diff's added lines, which is enough to show the two most common blocking patterns: a swallowed exception and string-built SQL.
from pathlib import Path
diff_text = (
"+def process_payment(order):\n"
"+ try:\n"
"+ charge(order)\n"
"+ except Exception:\n"
"+ pass\n"
"+\n"
"+def run_query(user_input):\n"
'+ cur.execute("SELECT * FROM orders WHERE id = " + user_input)\n'
"+ return cur.fetchone()\n"
)
Path("pr.diff").write_text(diff_text)
added = [ln[1:] for ln in Path("pr.diff").read_text().splitlines() if ln.startswith("+")]
flags = []
for i, line in enumerate(added):
stripped = line.strip()
if stripped == "pass" and i > 0 and "except" in added[i - 1]:
flags.append((i, "exception swallowed with no logging or re-raise"))
if "execute(" in line and " + " in line:
flags.append((i, "string-built SQL: possible injection risk"))
for lineno, reason in flags:
print(f"line {lineno}: {reason}")
print("blocking issues found before reading a single human comment:", len(flags))line 4: exception swallowed with no logging or re-raise
line 7: string-built SQL: possible injection risk
blocking issues found before reading a single human comment: 2In your world
The situation
A teammate opens a PR that adds a retry wrapper around the Postgres load step in your nightly settlement job. CI is green, the diff is 60 lines, and you have 10 minutes before standup.
What actually breaks
You skim it, leave two comments about variable names, and approve. Three weeks later the retry wrapper's except Exception: pass inside the retry loop quietly eats a psycopg2.OperationalError on connection loss, the job "succeeds" having loaded half the file, and nobody notices until the finance reconciliation flags a short month.
What you'd do on Monday
Before approving anything that touches a failure path, name the two or three concrete things that could go wrong and check the diff against them specifically:
risk_checklist = [
"does every except branch log or re-raise, with no bare pass?",
"does a retry have a cap, so a permanent failure doesn't loop forever?",
"if the retry exhausts, does the job fail loudly instead of continuing with partial data?",
]
diff_summary = "except Exception: pass inside the retry loop, no retry cap, continues after exhausting retries"
for item in risk_checklist:
hit = "pass" in diff_summary and "except Exception" in diff_summary
print(f"- {item} -> {'FAILS, blocking' if hit else 'ok'}")- does every except branch log or re-raise, with no bare pass? -> FAILS, blocking
- does a retry have a cap, so a permanent failure doesn't loop forever? -> FAILS, blocking
- if the retry exhausts, does the job fail loudly instead of continuing with partial data? -> FAILS, blockingImagine you work at GitHub
The numbers
Illustrative: 4,000 PRs/day across an 8-hour review window is 500 PRs/hour. If one careful senior reviewer gives even 15 minutes of real attention per PR, they cover 4 PRs/hour; 50 such reviewers cover 200/hour, less than half the merge rate.
What the Scenario-A answer does here
The Scenario A checklist still works per PR, but "every senior reads every diff by eye for the risk patterns" doesn't scale: at 500 merges/hour, human attention runs out long before the PRs do, and the ones that get rubber-stamped are indistinguishable from the ones that got a real review.
What flips at this scale
At this scale the mechanical half of the checklist (missing error handling, raw SQL concatenation, uncapped retries, required-check status) moves into automated checks that block merge, required via branch protection and CODEOWNERS; a human reviewer's time is spent only on the judgment calls automation can't make, like whether the change actually solves the right problem.
The trade-off you'd defend
I would defend automating the pattern-matching half of review and reserving humans for intent and judgment, trading some false negatives in the automated checks for enough reviewer bandwidth to read for intent at all.
Illustrative figures to make the scale concrete; not GitHub-published numbers.
Gotchas
Stylistic nitpicking blocks a merge
A PR sits unmerged for days over naming or formatting comments, while an actual missing authorization check went uncommented.
No shared convention for labelling comments as blocking versus a suggestion, so every comment reads as a demand.
Explicitly label comments ("blocking:" / "nit:") and agree as a team that only blocking comments gate the merge.
"LGTM" with no evidence attached
A reviewer approves a PR that touches a failure path with no test output or log shown for that path.
The reviewer assumed CI being green covers the risky branch, which it often doesn't for error handling.
Ask for the specific evidence (test name, log line, or a local run) that exercises the risky path before approving it.
Comments silently marked resolved
An author resolves a reviewer's comment with no reply, and the same bug reappears in a later PR.
Resolving a comment is easier than engaging with it, especially under deadline pressure.
Require a reply with a reason (fixed how, or why it's not actually a risk) before a comment can be marked resolved.
Tricky questions
Yes, an approval with no comments means the reviewer found nothing wrong.
It often means the reviewer skimmed. A genuinely thorough review of anything touching money, auth, or a failure path almost always produces at least one question, because those paths are where real systems actually break.
Yes, if the reviewer feels strongly, that's enough to keep blocking.
A blocking comment needs a nameable failure. "I disagree" without naming what breaks is a preference dressed up as a veto; the reviewer either names the concrete risk or downgrades the comment to a suggestion.
Scenario question
You're handed a PR that adds a retry wrapper around a payment call: 400 lines, all CI checks green, and two reviewers already approved with zero comments. What do you do before adding your own approval?
Model answer
I'd treat the clean approvals as a signal to look harder, not softer, especially on a payment path. I'd check the three things that matter here: does every except branch log or re-raise instead of swallowing, is there a retry cap, and does exhausting the retries fail loudly instead of continuing with partial state. I'd ask for the specific test or log evidence that the failure path was exercised rather than trust the green check. If I find a real gap I'd label it blocking and name the concrete failure it causes; if I don't, I'd say explicitly what I checked, so my approval carries information instead of just adding a third rubber stamp.
Interview corner
CommonWhat do you look for first when reviewing a PR?
TrickTwo reviewers already approved a 400-line PR with zero comments. Do you just approve too?
Experience checkTell me about a review comment you made that caught a real production bug.
DesignHow do you keep review quality high when a team is merging dozens of PRs a day?
Memory hook
A review is a building inspection first; the paint comments can come after, clearly labelled as paint.
Label every comment blocking or suggestion by naming the concrete failure it prevents, or it isn't a blocking comment.
Self-check
What makes a review comment "blocking" rather than a "suggestion"?
You can name the concrete, observable failure (an error, a wrong count, a leaked credential, an unauthorized read) that happens if it isn't fixed. If you can't name one, it's a suggestion.
Why is "tests pass" not the same as evidence a risky path works?
A green CI check doesn't tell you which branch of the code actually ran; the reviewer needs the specific test name or log output that exercised the failure path in question.
Why should clean, comment-free approvals on a large diff make you more suspicious, not less?
Large diffs with zero comments usually mean the reviewer skimmed rather than traced the failure paths; a careful review of risky code almost always produces at least one question.
Take a real PR you've reviewed (yours or a teammate's) that touched error handling or an external call. Rewrite your review from scratch using the five-step order in this card, labelling every comment blocking or suggestion with the concrete failure it names. Paste the before (your original comments) and after (the relabelled, ordered review).