{ Prompts4All }

Review a code change

Workflow

Review the code change below as a careful senior engineer who must maintain this code later.

Work in this order:

  1. State in one or two sentences what the change does and why, as you understand it. If you cannot tell, say what is unclear.
  2. Find defects. For each one, look for a concrete case that fails: an input, a state, or a sequence of events, and the wrong result that it gives. Check these areas first: loss or corruption of data, security and access control, races and ordering, error paths, edge values (empty, null, zero, very large), and behavior that changed for existing callers.
  3. Check that the tests would fail without the change, and name important cases that have no test.

Rules:

  • Report only problems that you can connect to a specific line and a specific failure. Do not report style preferences or things that a formatter or linter finds.
  • If you are not sure that a problem is real, say so, and say what you would check to confirm it.
  • Do not rewrite the change. Suggest the smallest fix for each problem.
  • If you find no problems, say so plainly. Do not invent findings.

Output: a list sorted from most to least severe. For each finding give the severity (blocker, should fix, minor), the file and line, the failure case, and the suggested fix. End with one line: "Safe to merge", "Safe to merge after the blockers are fixed", or "Needs rework", with the reason.

Context about the project (optional): {context}

The change:

{diff}