Sub topic 15
Deciding to accept, revise, or reject
This chapter assumes you can read a Git diff, run unit tests, and have already worked through the earlier review steps: checking intent, reading the diff, hunting edge cases, verifying dependencies, reviewing security, and gathering evidence. Here you turn that evidence into a decision.
Three outcomes, not two
A review ends in one of three decisions.
- Accept: the change meets the requirement, the evidence supports it, and you would merge it from an unfamiliar author.
- Revise: the approach is sound, but specific defects need fixing.
- Reject: the approach is wrong, or fixing it costs more than starting over.
Treating review as accept-or-reject pushes people to accept code that is "mostly fine." Revise is the outcome that handles "mostly fine" honestly.
Decide from evidence
Base the decision on what you observed, not on how confident the code looks. Sort your findings by severity.
| Finding | Typical decision |
|---|---|
| Security flaw, such as SQL injection or a hardcoded secret | Revise at minimum. Reject if the design depends on it. |
| Hallucinated package or API | Revise if a real equivalent exists. Reject if the design relied on it. |
| Failing or missing tests for changed behavior | Revise until tests pass and cover the change. |
| Unhandled edge case | Revise. |
| Style or naming mismatch | Revise, or accept if the linter is clean and the fix is trivial. |
| Change does not match the requirement | Reject, and restate the requirement. |
A single blocking finding is enough to withhold acceptance. Many small findings can also add up to a reject, because each one suggests that others remain unseen.
A worked example
Suppose the assistant wrote this function for "return the average of a list of scores":
def average(values):
return sum(values) / len(values)Your review finds that an empty list raises ZeroDivisionError, and the requirement never said what should happen. The approach is right and the defect is small, so the decision is revise. You fix the function and pin the behavior with tests:
import pytest
def average(values):
if not values:
raise ValueError("values must not be empty")
return sum(values) / len(values)
def test_average_of_numbers():
assert average([2, 4, 6]) == 4
def test_average_of_empty_list_raises():
with pytest.raises(ValueError):
average([])Now there is evidence for the edge case, and it will stay in place when someone changes the function later.
Accept only what you reviewed
Acceptance can be partial. When a change mixes good and bad hunks, stage only the reviewed parts:
git diff --stat
git diff
git add -pgit add -p walks through each hunk and asks whether to stage it. Skipped hunks stay in your working tree, so you can send them back for revision or discard them.
When to revise and when to reject
Revising has a cost. Each round trip with the assistant, or each manual fix, takes time. Use these checks:
- Is the core design correct? If not, reject.
- Can you describe each defect in one sentence? If so, revise.
- Would fixing the defects touch most of the change? If so, reject and regenerate with a clearer prompt.
- Did the failure come from a vague requirement? If so, fix the requirement first, then regenerate.
Record the decision
Leave a short note in the commit message or pull request: what you checked, what you changed, and what you did not verify. If the code is accepted with known limits, say so. This helps the next reader and keeps AI-generated code held to the same standard as any other contribution.
Exercise
An assistant's change passes all existing tests, but your review finds that it builds an SQL query with an f-string from user input. The rest of the change is correct. What is your decision, and what would you do next?
Show answer
Revise. The design is sound and the defect is specific, so switch the query to a parameterized one such as conn.execute("SELECT id, name FROM users WHERE name = ?", (name,)). Add a test that passes "' OR '1'='1" and confirms it returns no rows. Passing tests alone were not enough, because none of them covered injection.