Lesson 3: The bounded change, reviewed hunk by hunk
Objective
The starter passes all nine tests through a sequence of bounded changes,
and you can explain every diff the agent produced without reading the
solution first.
Why this lesson exists
This is the lesson people skip — and the one that builds the actual skill.
Letting Agent mode rewrite the file in one shot teaches you nothing and
gives you a diff you cannot honestly review. Supervising small diffs, each
pinned to a contract line, is how the code stays yours. Cursor’s
accept/reject diff flow exists for exactly this.
The lesson
Start a fresh Agent chat (a finished task’s chat carries stale context)
and say:
“Work through TASK.md against starter/report_tool.py. One failing test
group at a time: JSON loading, then validation isolation, then rounding,
then atomic writes, then the end-to-end tests. After each group, run
python verify.py starter and show me the diff before continuing.”
Hold it to the contract’s boundaries:
- Only
starter/report_tool.py changes. If a diff touches tests/,
solution/, or scenario/, reject it and ask why.
- No new imports outside the standard library — and no import that is not
needed by the change being made.
- Each change should move toward one contract line. Reject drive-by
refactors (“while I was here I renamed…”).
- If the agent wants to change a test, the answer is no. Tests are the
contract; the code moves.
Review deliberately. When the agent proposes an edit, Cursor shows it as a
diff — read every hunk before accepting. When it proposes a terminal
command, read it: python verify.py starter is safe; pip install
anything is a stop sign. A diff you cannot explain is a diff you reject.
Expect the failing count to drop group by group: 7 → 5 → 4 → 3 → 2 → 0.
Exercise
Pick one hunk the agent produced — ideally the validation-isolation
change — and explain it back in the chat: “line N does X; that satisfies
contract line Y.” If you cannot, ask the agent to walk you through its own
diff before accepting the next change.
Checkpoint
Run python verify.py. This checkpoint’s code appears only when
the starter suite is green. You pass the lesson when you can answer:
- How many turns did the bounded change take, and what made each turn
bounded?
- Which diff or command did you reject or narrow, and why?
- Point at the hunk that implements “isolate invalid rows with reasons” —
where is it?
Expected evidence
A green python verify.py starter run, and your hunk-by-hunk explanation
of the change that earned it.