All courses

Verifying before you accept a change

Apply a fixed acceptance routine before committing: check the summary against the diff, run it yourself, scan for shortcuts, and make sure you could explain it. Scale how deep you look with the risk of the change.

Builds on: Running and trying the result yourself, Spotting bad shortcuts in a change, What you stay responsible for

Read it card by card Start the whole course

The agent says it's done. Now what?

You asked the agent to add a CSV export to your sales script. It replies: ◂ Agent: Added `--csv` export in `src/cli.py` and `src/export.py`. Tests pass. You're about to type `git commit`. You've learned several separate checks. Which ones do you run, in what order? And does a one-word typo fix deserve the same effort as this?

Four checks, four different holes

Each check catches what the others miss: - Comparing the summary with the diff finds changes nobody mentioned. - Running it finds behaviour that reading can't show. - A shortcut scan finds code that looks finished but isn't. - Asking yourself "could I explain this?" finds the parts you skimmed. Go through them in a fixed order, so tiredness can't skip one. How *deeply* you check depends on risk: how bad a mistake would be, and how quickly you'd notice it. For a one-word typo, a glance at the diff answers all four at once.

The acceptance routine

Before `git commit`: 1. **Summary vs diff**: every claim has a change, and every changed file is explained. 2. **Run it**: realistic input, one edge case, the tests. 3. **Shortcuts**: hardcoded values, empty `except`, disabled checks, one-input special cases, `TODO`s. 4. **Explain**: you can say what each change does and why. Any miss: don't commit until it's resolved. **Depth**: wording or typo → a glance at the diff covers it. Normal logic → all four. Data deletion, money, logins, many files → every line, extra edge cases, a second reviewer.

The CSV export, checked

1. **Summary vs diff**: `git status --short` also lists `.flake8`, which the summary never mentioned. 2. **Run it**: on June's real file it prints `Wrote 0 rows to out.csv`. The tests passed, but the feature doesn't work. 3. **Shortcuts**: the `.flake8` diff tells the linter to ignore two kinds of warning. That is a disabled check. 4. **Explain**: you can't say why `export.py` skips rows with blank dates. Verdict: no commit yet. ▸ You: Export writes 0 rows for data/june.csv. Why does export.py skip rows with blank dates? Why did .flake8 change? Undo that.

What the commands showed

`git status` revealed the unmentioned `.flake8`. Note that plain `git diff` would not show the new, untracked `src/export.py` at all. Reading the `.flake8` diff showed the silenced warnings. Only running the command showed the empty output.
$ git status --short
 M .flake8
 M src/cli.py
?? src/export.py
$ git diff .flake8
--- a/.flake8
+++ b/.flake8
@@ -1,2 +1,3 @@
 [flake8]
 max-line-length = 88
+extend-ignore = E501,F401
$ python src/cli.py data/june.csv --csv
Wrote 0 rows to out.csv

Remember

Before every commit: check the summary against the diff, run it yourself, scan for shortcuts, and make sure you could explain it. Scale the depth with risk. A typo needs a glance at the diff. Deleting data, money or logins need every line, extra edge cases and a second reviewer.

On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.