Sub topic 2
Reading the Diff in a Deliberate Order
Assume you know basic Git, can read code, and can run the project's tests, linter, and type checker. Treat the agent's summary as a claim to verify, not as evidence.
Read the Change in Layers
Start with the shape of the change. This prevents an interesting implementation detail from hiding an unwanted file.
- List every changed and untracked file.
- Check the diff statistics and file status.
- Read tests and public interfaces before deep implementation code.
- Read implementation hunks in the context of nearby code.
- Run checks that test the behavior you changed.
git status --short
git diff --stat
git diff --name-status
git diff -- tests/
git diff -- src/config/loader.pyA file list can reveal scope creep. A changed interface can reveal compatibility risk. Tests show the intended behavior. Only then should you spend time on the implementation.
Failure Modes to Look For
Look for behavior, not only syntax.
- Scope creep: unrelated files, formatting changes, or new dependencies appear.
- Invented APIs: the code calls functions, options, or fields that the project does not define.
- Silent behavior changes: error handling, defaults, ordering, or permissions change without a requirement.
- Incomplete paths: the normal case works, but missing files, empty input, retries, or failures do not.
- Duplicated logic: the agent adds a second helper instead of using the existing abstraction.
Compare changed code with nearby conventions. Search for each new symbol and confirm that its callers agree with its signature.
> callout warning > A small diff can still contain a large behavior change. Pay special attention to configuration defaults and error handling.
Make Sure Tests Were Not Weakened
Check test changes separately. Search added lines for skipped tests, broad mocks, weakened assertions, and ignored errors.
git diff -- tests/
git diff -U0 | grep -nE '^+.*(@pytest\.mark\.(skip|xfail)|# noqa|# type: ignore|assert .*True)'A passing suite proves little if the changed test no longer checks the original requirement. Restore weakened tests and fix the production code instead.
Verify the Result Yourself
Run the project's normal checks, then add a focused manual check for the changed path. Include failures and boundary cases, not only the happy path.
pytest
ruff check .
mypy src/Use the commands your project actually defines. Record exact failures. If verification fails, give bounded feedback: name the file, describe the defect, state what must remain unchanged, and request the specific checks to rerun.
Exercise
Why read the file list before reading implementation code?
Show answer
It exposes scope creep and unexpected deletions before implementation details distract you.