1,900 lines, all green, now what?
You asked the agent: *"Add CSV export to the reports page, with filters, permissions and tests."* It worked for 40 minutes. The diff touches 23 files and 1,900 lines. The summary says everything is done, and the tests are green.
You have half an hour before standup. Can you honestly sign off on this? What would you even check first?
Why one big run hides its mistakes
A long run fills the context with files, tool output and failed attempts. Early constraints fade, and that is drift. Each concern gives the agent another spot to reach the proxy signal (tests green) with a shortcut. Each shortcut is buried in a diff you will only skim. Errors also compound: a wrong choice in step 2 gets built on through step 7. **Later cost:** you merge a bug inside a change nobody truly read.
Rules for checkable steps
- **Vertical slice**: a thin piece of real behavior, end to end (request → logic → response). Never one layer at a time.
- **One concern per run**: a feature, a refactor, a dependency bump and a formatting pass each get their own run.
- **A check per step**: a test or command that is green only when this slice works.
- **Reviewable size**: you can read every line in one sitting.
- **Commit between steps**: each commit is a known-good point to return to.
The CSV export, sliced
1. The endpoint returns one report as CSV, with no filters. A test calls the real endpoint. Review, commit.
2. Apply the page's existing filters. Test one filter. Commit.
3. Only users allowed to see the report may export it. Test a refused user. Commit.
4. Stream large reports. Test with many rows. Commit.
Each diff is small enough to read every line. Slice 3 adds just six. If slice 3 goes wrong, you reset to slice 2's commit, not to zero.
Slice 3 fits on one screen
This is the whole diff for slice 3 (HttpResponseForbidden is already imported). With one concern on screen, you can ask the real question: is `is_staff` the rule you meant, or should it be "may this user view report 7"? The test only proves a non-staff user gets a 403. Nothing checks that an allowed user still gets the CSV. **Later cost:** every staff member can export every report, and users allowed to view report 7 are refused. In the 1,900-line version, this check sat in file 14 of 23, and nobody asked.
// Python
--- a/reports/views.py
+++ b/reports/views.py
@@ -12,1 +12,3 @@
report = get_report(report_id)
+ if not request.user.is_staff:
+ return HttpResponseForbidden()
--- a/reports/tests/test_export.py
+++ b/reports/tests/test_export.py
@@ -40,0 +41,4 @@
+def test_export_forbidden(client, user):
+ client.force_login(user)
+ r = client.get("/reports/7/export.csv")
+ assert r.status_code == 403
Small slices, checked and committed
Cut work into thin end-to-end slices, one concern each, each with a check you can run. Review and commit before starting the next. Big runs drift and produce diffs you cannot really read. They hide shortcuts where your review never reaches.
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.