Wrong, slow, leaky
Two posts crossed my timeline on the same morning, and I think they’re one idea.
The first was from Clair, an engineer with twenty-odd years of systems work behind them, replying to someone who no longer knew whether to flag readability or “best practice” in code review, since nobody reads generated code by hand anyway. Clair’s answer, roughly translated from Indonesian:
In the agentic era, your architecture can be elaborate or it can be spaghetti. Nobody really cares, especially in early iterations, because rewriting after the fact is relatively cheap. Software today only has to not be wrong, not be slow, and not leak. Guard those three.
The second was from Hugo Montenegro: a two-page prompt that hands a codebase to an agent and asks it to make every state machine explicit, then verify the parts that matter with TLA+ and Lean, and fuzz the rest. Its second page has the best headline I’ve read this month: Prove what matters. Fuzz everything else.
Put them together and you get the point of this post. The thing we build toward is no longer the syntax, the language or the framework. It’s those three properties. And the way you pick tools inside any language is by asking which ones let a machine check them.
The old targets were proxies
For most of my career, getting better at software meant getting better at the text. Learn the idioms. Know the framework’s lifecycle. Argue about folder structure. Have opinions on tabs.
All of that was real skill, but it was standing in for something else. We cared about readable code because a person had to read it to find out whether it was wrong. We cared about clean architecture because a person had to change it next quarter without breaking it. Craft in the text was how we bought confidence in the behaviour.
Agents cut that link. The text is now cheap to produce and cheap to throw away; Clair’s “rewrites are relatively cheap” is just true now. If an agent can regenerate a module in an afternoon, the module’s prose style is not where the value lives.
What doesn’t get cheaper is finding out whether it’s right.
Three things you can’t get from reading
Here’s the uncomfortable part. Wrong, slow and leaky are all properties of behaviour, not of text. You were never really able to see them by reading code. You could guess at them, and with enough experience your guesses got good.
Now there’s too much code for anyone to guess over. Reviewing a 2,000-line agent diff line by line is not a safety practice; it’s a ritual. So each of the three needs something that checks it without a human squinting:
| Must not be | What actually catches it |
|---|---|
| Wrong | Types, property-based tests, model checkers, proofs |
| Slow | Benchmarks with budgets that fail CI, load tests, performance budgets on real pages |
| Leaky | Static analysis, dependency and secret scanning, policies the build enforces (CSP, authz rules as code) |
None of those care what the code looks like. They care what it does. That’s why they survive a rewrite, and the code doesn’t.
- Diff AStopped: a double refund
- Diff BStopped: p95 over budget
- Diff CStopped: a key in the logs
- Diff DShips
Pick what a machine can check
So here’s the rule I’ve started using, whatever stack I’m in: when there are two ways to do something, prefer the one a machine can verify.
It sounds abstract. In practice it’s a ladder, and you climb only as high as the risk demands.
- Make illegal states unrepresentable. In TypeScript that’s strict mode and discriminated unions instead of
isLoading && !error && data. In Rust it’s enums and the borrow checker. In Python it’s type hints that pyright actually enforces. This is the cheapest proof there is: the compiler runs it on every save. - Test properties, not examples. One example test says “this input gives that output.” A property test says “for every input, this stays true”, and lets a library hunt for the counterexample: fast-check, Hypothesis, proptest. Agents are very good at writing these, and very good at writing example tests that prove nothing, so ask for the first kind.
- Model-check the concurrency. Double charges, webhook races, two tabs fighting over one session. Tests almost never find these because the bad interleaving is rare. TLA+ explores every interleaving of a small model and hands you the exact sequence that breaks.
- Prove the tables. When a status map, a pricing matrix or an eligibility rule must be exhaustive and non-overlapping, a proof assistant like Lean can show it. Hugo’s prompt has a detail I love here: only prove things over tables exported from the real source, and fail CI if they drift. A proof about a copy of your logic proves nothing about your logic.
- 1. Types
- Catches
- States that should be impossible
- Runs
- Every save
- TypeScript
- strict mode, discriminated unions
- Python
- pyright strict, dataclasses
- Rust
- enums, exhaustive match
- 2. Properties
- Catches
- The input nobody thought to test
- Runs
- Every push
- TypeScript
- fast-check
- Python
- Hypothesis
- Rust
- proptest
- 3. Model checking
- Catches
- Races, retries, double sends
- Runs
- When the flow changes
- Any language
- TLA+, checked by TLC
- 4. Proofs
- Catches
- Gaps and overlaps in a table
- Runs
- When the table changes
- Any language
- Lean 4, over tables exported from the code
Most code never needs to leave rung one or two. Hugo’s card says it plainly: apply formal verification “surgically”, where bugs move money, race across webhooks or trap users. Lean on a settings page is cosplay.
This is also why making state machines explicit matters more now, not less. A model checker can’t check a state machine that’s smeared across five components and three booleans. Pulling it into one place isn’t about tidiness for the next human reader; it’s about giving the verifier something to hold.
Where I’d push back
I don’t think architecture stops mattering entirely. It stops mattering to readers. It still matters to verifiers. Spaghetti is fine right up until you need to prove something about it, and then the first step of every proof is untangling it. So I’d amend Clair’s line a little: architecture can be anything a machine can still check.
And “rewrites are cheap” has a condition attached. A rewrite is cheap only if something tells you the new version still isn’t wrong, slow or leaky. Without that, a rewrite is just a fresh set of bugs nobody has met yet. The checks are what make the code disposable.
Which flips the usual picture. The durable asset in a codebase is no longer the code. It’s the types, the properties, the specs, the budgets and the policies: everything that says what must stay true. The code is whatever currently satisfies them.
type Refund =
| { kind: 'none' }
| { kind: 'partial'; cents: number }
| { kind: 'full' };enum Refund {
None,
Partial { cents: u64 },
Full,
}@dataclass(frozen=True)
class Partial:
cents: int
Refund = NoRefund | Partial | Full- Not wrong38 properties hold
- Not slowp95 under budget
- Not leaky0 findings
What changes on a team
If you buy this, a few habits follow:
- Review the checks, not the diff. When an agent opens a PR, the first question is which property, budget or policy proves it works, and whether that check could actually fail.1
- Choose stacks by what they can prove. “Which framework do we know?” matters less than “which one lets a machine tell us we’re wrong, before a customer does?”
- Make “wrong, slow, leaky” literal CI jobs. If one of the three has no check that can go red, you’re not guarding it. You’re hoping.
This site is a small example. Its build fails if a page’s Content Security Policy would block one of its own styles, and if any page is missing its share card. I didn’t write those checks because I enjoy CI. I wrote them so that when an agent restyles the site, the build tells me it leaked something, instead of a reader.
That’s what I think we’re building toward now. Not the right syntax in the right language with the right framework. Software that isn’t wrong, isn’t slow and doesn’t leak, and a machine that can say so.
Footnotes
-
Hugo’s prompt asks every TLA+ spec to ship with a deliberately buggy config that it must reject. It’s a good habit for any check: if you’ve never seen it fail, you don’t know that it can. ↩
Tagged: ai agents, engineering culture, verification