These are notes, not a framework. They come from a view I hold strongly: the hardest pull request to review is not the broken one. It is the one that passes every check and is still wrong for the codebase.

Picture it. A junior sends a PR for a new “apply coupon” feature. It runs. The demo is fine. But the discount rules sit inside the controller, the same percentage calculation is pasted in three places, and there are no tests. What do you do?

First, decide what you are protecting

A review has two jobs that people mix up. One is protecting the codebase. The other is growing the person. If you only do the first, you become a gatekeeper and the junior learns to guess what you like. If you only do the second, bad code ships with a smile. Know which job each comment is doing.

My rule, and it is an opinion: block on things that are costly to undo later, and merely suggest the rest. Costly to undo means public API shapes, database schema, data that is being written in a wrong format, security holes, and missing tests on money logic. Cheap to undo means variable names, internal method layout, a slightly clumsy loop.

Sort the problems in this PR

Business logic in the controller: this is a real problem, but a medium one. It means the discount rule cannot be tested without spinning up the web layer and cannot be reused from a batch job. Ask for the rule to move into a service or domain class. Block on it only if the team has already agreed on that layering; otherwise explain and request it.

Duplicated calculation: this is the one I would insist on. Three copies of a money formula will drift. Someone fixes rounding in one place, and now the cart shows ₹499.00 while the invoice says ₹498.99. One function, one place.

No tests: for a discount calculation, block. Not because tests are a ritual, but because the next person to change it has nothing to tell them they broke something. For a trivial getter I would not.

Naming, formatting, small style points: leave these to a linter. If a human is typing “add a space here” in review, the team has not automated what it should have.

How to write the comment

Comment on the code, never on the person. “This calculation appears in three places” is a fact. “You duplicated code” is a verdict. Say why, in one sentence, with the future consequence: “if the rounding rule changes we need to remember all three.”

Mark your comments by weight. Many teams prefix with something like “must:” and “nit:” or “optional:”. A junior who gets twenty unmarked comments cannot tell which two matter, and will either fix everything in fear or ignore everything in fatigue.

Ask questions when you are not sure. “What happens if the coupon is applied twice?” teaches more than “handle double application”, and sometimes the author has an answer you had not thought of.

Talk, then write

If a PR needs a structural rewrite, comments on lines are the wrong tool. Fifteen minutes on a call, or at a desk, sketching where the logic should live, beats forty threaded comments and a day of back-and-forth across time zones. Then let the junior make the change. Do not rewrite it yourself and push over their branch; they will merge it and learn nothing.

Also say what is good. “The edge case for expired coupons is handled well” costs nothing and tells them which instincts to repeat. This is not flattery; it is information.

When you should not hold the line

Sometimes the honest answer is to merge. If a production incident is waiting on the fix, merge the working version, and open a tracked follow-up ticket for the refactor with an owner and a date. The danger is that “later” quietly means never, so write the ticket before you click merge, not after.

Another case is when your preference is only a preference. If their structure differs from yours but is internally consistent and testable, let it through. Seniors who demand their own style in every PR burn goodwill and slow the team down. Ask yourself: if I joined this team next month and saw this code, would I be able to change it safely? If yes, approve.

The review is also a process problem

If juniors keep sending PRs like this one, the review is catching a failure that happened earlier. Maybe nobody told them where business rules belong. Maybe there is no example module to copy. Maybe the PR is too big: a reviewer facing 1,200 changed lines will skim, so ask for smaller ones. Fix the cause with a short design note or a pairing session before the coding starts, and the review gets lighter on its own.

Speed matters too. A PR that waits two days for review teaches the author that feedback is a tax. Aim to respond within the working day, even if the response is “I will look properly tomorrow morning.”

One last opinion, and you may disagree: approving with comments is usually better than requesting changes for non-blocking issues. It says “I trust you to handle these”, and trust is what makes a junior start asking for reviews early instead of hiding half-finished work.

Figures and names in the examples are illustrative.

Leave a Reply

Trending