KatInterview

Running a Structured Code Review Under Time Pressure

System DesignModel answer
HardModel answerSystem Designcode reviewengineering fundamentalscommunication

Last updated

Walk through a repeatable framework for producing high-signal PR feedback — prioritized, clearly labeled, and written with minimal context — in roughly 20–30 minutes.

The Scenario

You are given a short code change — a diff, a pull request, or a standalone function — and asked to produce written review comments with minimal back-and-forth. The interviewer hands you the code, gives you a few minutes to read, and then largely goes quiet. The deliverable is the set of comments you would actually leave on a real PR, not a verbal summary.

Walk through your structured approach to producing useful, well-prioritized review feedback under these conditions.

What to Cover

Your answer should concretely address:

  • The categories of issues you scan for (correctness, edge cases, concurrency, security, performance, readability, testing, API design, observability, etc.) and the order you apply them.
  • How you label and prioritize comments so the author immediately knows what is a blocker versus a suggestion versus a minor polish item.
  • Examples of well-written comments — the exact phrasing you would type for a blocker, a suggestion, and a nit.
  • How you handle missing context when you cannot ask the author or look up the ticket.

Constraints and Assumptions

  • Written format, little dialogue. You should narrate your thinking aloud, but the real output is the comments themselves.
  • Time-boxed at ~20–30 minutes. Enough for a careful read and a focused, prioritized set of comments — not an exhaustive line-by-line audit.
  • Limited context. No surrounding codebase, no ticket, no author to ping. Make assumptions explicit rather than stalling.
  • Language-agnostic. The framework should apply regardless of what language appears in front of you.

Clarifying Questions Worth Asking First

Before reading a single line of code, briefly confirm scope:

  • What is the goal of this change — is there a linked ticket or intended behavior I should review against?
  • What style of feedback do you want — line-level comments, an overall summary, or both? Should I flag missing tests?
  • Are there non-functional constraints that matter here — latency budget, PII sensitivity, backward-compatibility requirements?
  • Is this change on a hot path or public API, or internal and low-traffic? That calibrates how strict I should be.
  • What is the team's approval bar — must everything be resolved before merge, or is "approve with comments" acceptable?

Hints

Hint 1

Start with the highest-stakes categories first — correctness and security — before you spend any time on naming or formatting. A beautifully styled function that silently drops data is still a blocker.

Hint 2

Your label system does more work than you might expect. If every comment looks the same weight, the author doesn't know what to fix before merging versus what to address later. Pick explicit prefixes — BLOCKER, SUGGESTION, NIT — and use them consistently.

Hint 3

When context is missing, don't stall and don't guess silently. State your assumption inline ('Assuming this runs in a single-threaded context — if not, see note below') so the author can correct the assumption rather than miss the concern entirely.