Sub topic 2
You own the diff: what to trust and what to check
This chapter assumes you know basic Git (branches, commits, diffs, staging), can read code in at least one language, can run your project's tests and linter from the command line, and have used a coding agent at least once.
Why the responsibility stays with you
A coding agent proposes changes. You decide whether they enter the codebase. Once you commit, teammates, CI, and production treat every line as yours. Nobody downstream knows or cares which lines an agent wrote.
Review is more demanding with agents than with human colleagues. A colleague who edits twelve files usually did so for reasons you can ask about. An agent can produce a plausible-looking twelve-file change quickly, and it can be wrong in ways that read as confident. The size and polish of the output tell you nothing about its correctness.
What you can reasonably trust
Some things are low risk, as long as you spot-check them:
- Syntax. The code usually parses and follows the formatting of the files it read.
- Uniform mechanical edits. A rename applied across many call sites is usually consistent. Check a sample, and check that no call site was missed.
- Local conventions. The agent tends to copy patterns from nearby code, such as naming and file layout.
What you must check yourself
The agent's final message is a description of what it intended. The diff is what it did. Treat the message as a claim to test.
| The agent says | Why it is not evidence | What to check instead |
|---|---|---|
| "All tests pass" | It may have run a subset, edited the tests, or skipped them | Run the full suite yourself |
| "I only changed the config loader" | A summary describes intent, not the change set | `git status --short` and `git diff --stat` |
| "I used the existing helper" | The helper may not exist, or may have a different signature | Search for its definition |
| "No behavior change" | Refactors often alter defaults, error handling, or ordering | Read the interface changes and run the code |
A quick way to compare the claim with reality is to list every file that changed, including new ones:
git status --short # includes new, untracked files
git diff --stat # size of change per file
git diff --diff-filter=D --name-only # files the agent deletedgit diff alone does not show untracked files, so a new file the agent created can go unnoticed unless you also run git status.
Where checking fits
Your checks sit between the agent's output and your acceptance. Nothing the agent reports skips them.
Common mistakes in this mindset
- Reading the summary instead of the diff. The summary is shorter, so it is tempting. It is also the least reliable artifact.
- Assuming green means correct. Passing tests only help if the tests were not weakened and cover the changed behavior.
- Reviewing only the files you expected. Files you did not expect to change are where scope creep appears.
- Accepting because the change is large and looks careful. Volume is not quality.
The next chapters turn this mindset into practice. You will scope tasks so there is less to review, start from a clean baseline, and read the diff in a deliberate order.
Exercise
An agent reports, "Renamed the config loader and updated all callers. All tests pass." Name two things the report cannot tell you, and one command for each that lets you find out.
Show answer
It cannot tell you whether the agent touched files beyond the callers (check with git status --short and git diff --stat), or whether tests were skipped or weakened to pass (check with git diff -- tests/, then run the full suite yourself). Running the suite yourself also confirms that "all tests pass" is true for the final working tree.