Video in progress

Middle 🌿 Git

When you review a colleague's PR, what do you look at?

First why the change was made and whether the approach is right, then bugs, security, transactions and concurrency, and whether there are tests. I leave formatting and style to the linter, and I write comments respectfully and specifically.

📖 Answer

The order matters: if the design is wrong, there is no point commenting on a variable name.

  1. Context. I read the PR description and the task. Did the author understand the problem correctly? Is there a simpler solution?
  2. Correctness. Edge cases: null, an empty list, a repeated request, a timeout. Is @Transactional in the right place, and is no external HTTP call left inside the transaction.
  3. Database. Is the migration backward compatible, will it lock a big table, is there an N+1, is an index needed.
  4. Security. The authorization check, SQL injection, whether personal data leaks into logs.
  5. Tests. If it is a bug fix, is there a test that catches exactly that bug.

When writing a comment: not "this is wrong" but "if orderId is repeated, won't it be charged twice?", as a question, with the reason. Small non-blocking remarks I mark with "nit:", and the author decides.

One more thing: you cannot review a 1000+ line PR well. Asking for such a PR to be split is part of the review too.