Lab

Practice labs: work the problem first, then read the answer. Every lab ships with a repo you can clone, production-sized data, and a target you have to hit yourself. The write-up lives in this series too, and it only opens from the problem article.

Articles

1

N+1 Was Never the Bottleneck: 41 Queries Down to 2, Still One Second

A feed endpoint that shows 20 posts takes a full second and hits the database with 41 queries. Apply the standard N+1 advice, get it down to 2 queries, and the latency does not move. This is that problem as it happened, plus the lab.

2

One Payment, Four Ledger Rows: An Idempotency Lab

The code is not wrong and the gateway is not wrong, yet one payment shows up four times in the ledger. Guess why, then make make check green in the lab.

3

The Webhook Arrived Late. The Reconciliation Job Had Already Run.

The webhook path is already idempotent. Then a morning reconciliation job appears, and one payment gets recorded twice from two paths that are both right. Guess where the key is wrong.

4

Every Receipt in This Café Lists the Same Order

Every table's receipt holds the same items, and the total is Rp0 — even though each table ordered exactly one thing. Guess why, then make make check green. A Python scope and mutation lab.

5

A Script That Cannot Say Where It Went Wrong

A script that stops at the first bad line reports only part of the problem. This is what shows up on screen right now.

6

A 6,000-Token Handbook and a 0% Cache Hit Rate

Twenty-four turns, caching switched on, and a bill 21% higher than running with no cache at all. A support agent whose prompt looks static, and the three lines that quietly change it every turn.

For developers who learn by struggling

© 2026 Inva.dev.