QuickCheck vs. Traditional Testing as a Deterministic Harness in the GenAI Era
Machine-translated from Spanish. Read the original

2026 is supposed to be the year generative AI agents start taking over complex end-to-end workflows. Yet the industry is running into a mathematical wall, that of compound reliability.
Andrej Karpathy dubbed it the march of nines in his conversation with Dwarkesh Patel (October 2025). His thesis, refined over five years leading Autopilot at Tesla, is brutally simple. Each additional “nine” of reliability — going from 90% to 99%, from 99% to 99.9%, and so on — takes roughly the same engineering effort as the one before. That sounds modest, but each nine only cuts the remaining errors to a tenth, so going from 99% to 99.9% costs as much as reaching the first 90%.
Correction (November 25, 2026). The first version said each nine costs as much as all the previous ones combined. Karpathy says the opposite, that each nine costs the same ("Every single nine is the same amount of work"). I found it in a review of the series. The wall is still there, because the effort doesn't go down while the gain keeps shrinking, and he says that in five years at Tesla they got through two or three nines.
The problem with agents is that this reliability compounds multiplicatively. A 10-step workflow where each step has a 95% success rate ends up with an end-to-end reliability of roughly 0.95^10 ≈ 60%. At 90% per step, it would drop to ~35%. In other words, two out of three runs aren’t correct, and the failure can land on any step, even on the same one twice.
Correction (November 25, 2026). The first version ended by saying that failures never land in the same place twice. That doesn't follow from the arithmetic, which assumes each step fails independently, so nothing stops two runs from failing at the same step. I found it in a review of the series. The numbers don't change.
Even so, the industry’s dominant response has been to package “skills” into Markdown files with ever more elaborate prompts, hoping the model doesn’t hallucinate or skip steps. But hope is not an engineering strategy. To run AI-generated code in production we need to drop the prompt-driven feature factory mindset and go back to the foundations, that is, putting probabilistic engines on deterministic rails.
And this is where the debate about how we test software — unit tests, integration tests and QuickCheck — becomes relevant again.
The traditional harness of unit and integration tests as structural scaffolding
In classic development, unit tests validate isolated functions and integration tests make sure components talk to each other. When we bring GenAI into the loop — whether as a copilot or as an autonomous agent — these tests stop being mere validators and become the structural scaffolding that makes delegating code generation viable.
The most interesting case today is Stripe’s Minions system, documented on its engineering blog in February 2026. Stripe has autonomous agents merging more than 1,300 PRs a week with no human-written code — just human review at the end. How do they pull that off at that scale, on a codebase of hundreds of millions of lines of Ruby with Sorbet and in-house libraries that no public LLM ever saw in training?
The answer isn’t a better model. It’s a harness with three tiers of feedback:
- Local linters that run in under 5 seconds on every push. If there’s a syntax error, the agent finds out immediately and fixes it cheaply.
- Selective CI over Stripe’s more than 3 million tests. Running all of them would be impossible, so the system runs only the ones relevant to the modified files.
- A pragmatic iteration cap. If the agent can’t fix a failing test in two attempts, it escalates to a human. Stripe understood that LLMs show diminishing returns when retrying the same problem — a third attempt just burns tokens.
The conceptual key lies in what Stripe calls blueprints, sequences of nodes where some run deterministic code (linters, commits, push) and others run agents in a loop. The LLM’s creativity is bounded by deterministic gates it can’t skip. The agent provides the raw content, but the infrastructure imposes the process.
This is exactly the “putting on rails” I mentioned at the start. And it’s built with the traditional harness — tests, linters, CI — that we already had 20 years ago. So the novelty isn’t the tool, but where it’s placed within the loop.
Still, we can’t ignore that there’s a ceiling. Unit and integration tests are example-based checks (given X, I expect Y). They’re excellent at preventing known regressions, and insufficient when the author of the code is a statistical engine capable of introducing semantic edge cases no human programmer would ever think to write.
Property-based testing, the revenge of formal methods
This is where the academic rigor the industry tends to put off in favor of delivery speed comes in. If we’re going to delegate logic generation to an LLM, we need to test invariants, not just examples. Because while generative models are experts at producing code that compiles and passes the existing tests, they can easily violate domain logic. And that code is the most dangerous kind, because it often even looks correct.
QuickCheck, whose original paper is Claessen and Hughes, ICFP 2000, launched the discipline of property-based testing. The idea is elegant. Instead of writing specific test cases, you write the mathematical and semantic properties the function must always satisfy, and the tool generates hundreds of random inputs to try to break them. When it finds a counterexample, it minimizes it (shrinking) down to its simplest form.
QuickCheck was born in Haskell, but there are now implementations in more than 40 languages, such as Hypothesis (Python), fast-check (TypeScript), ScalaCheck, Kotest, jqwik (Java) or proptest (Rust). That means it isn’t exotic; it’s within easy reach.
So properties stop being an academic curiosity and become our safety contract, above all in validating unexpected states. Property-based testing throws hundreds of randomly generated cases at the agent’s code until it finds the semantic crack no example anticipated.
For example, imagine we ask an agent to implement a function that applies discounts to a shopping cart. The agent returns the following code:
type CartItem = { price: number; quantity: number };
function applyDiscount(items: CartItem[], discountPct: number): number {
const subtotal = items.reduce((acc, i) => acc + i.price * i.quantity, 0);
return subtotal * (1 - discountPct / 100);
}It compiles, and it passes the obvious unit tests:
test("10% off $100 = $90", () => {
expect(applyDiscount([{ price: 100, quantity: 1 }], 10)).toBe(90);
});It’s green. Ready to merge, right? Of course not. Let’s see what happens when we express the domain properties any discount function must satisfy, regardless of the input:
import fc from "fast-check";
// Prices in cents, and discounts of any sign and size: the parameter is a
// `number`, and nothing stops a caller from passing 150 or -20.
const carts = fc.array(fc.record({
price: fc.integer({ min: 0, max: 1_000_000 }),
quantity: fc.integer({ min: 0, max: 100 })
}));
const discounts = fc.integer({ min: -1000, max: 1000 });
// Property 1: the discounted total must never be negative.
test("total is never negative", () => {
fc.assert(
fc.property(carts, discounts, (items, discount) => applyDiscount(items, discount) >= 0)
);
});
// Property 2: a 0% discount must return exactly the subtotal.
test("0% discount is identity", () => {
fc.assert(
fc.property(carts, (items) => {
const subtotal = items.reduce((a, i) => a + i.price * i.quantity, 0);
return applyDiscount(items, 0) === subtotal;
})
);
});
// Property 3: bigger discount ⇒ lower or equal total (monotonicity).
test("discount monotonicity", () => {
fc.assert(
fc.property(
carts,
fc.integer({ min: 0, max: 50 }),
fc.integer({ min: 50, max: 100 }),
(items, low, high) => applyDiscount(items, high) <= applyDiscount(items, low)
)
);
});The first property fails. fast-check finds a counterexample and automatically reduces it (shrinking) to its minimal form:
Property failed after 8 tests
Counterexample: [[{"price":1,"quantity":1}],101]
Shrunk 33 time(s)With a single one-cent item and a 101% discount, the total comes out negative. The agent never validated that discountPct was between 0 and 100, and any discount over 100 produces negative totals — which in production translates into paying the customer to shop. An example-based test only catches it if someone thinks of exactly the “discount greater than 100” case. The property catches it without naming that case, as long as its generator covers everything the parameter accepts, and someone has to think of that too, as the October 30 correction explains.
Correction (October 30, 2026). The first version of this example had a mistake worth telling. The discount generator went from 0 to 100, the same assumption the agent had made, so the first property could never fail. And the counterexample it showed, an empty cart with a 150% discount, gives
-0, which JavaScript considers greater than or equal to zero. I found it while turning this article into code that runs, and the repo has the original version, the corrected one, and a test for each claim. The lesson comes out stronger than it was, because a property is only as good as its generator, and a generator written with the same assumptions as the code can't find what those assumptions hide.
Correction (November 25, 2026). The first version said no example-based test would have caught this and that properties do. That overstated it, because the original generator never found the bug, and it had to be widened to everything a
numberaccepts. I found it in a review of the series. The property's advantage still stands, but it's more modest, because it makes you think about the range of the input rather than about the failing case.
This is exactly the category of bug LLMs systematically introduce, that of locally correct code that violates global domain invariants.
Clean design as a condition of possibility
And there’s an uncomfortable conclusion hidden here. LLMs aren’t the end of software engineering. They’re the end of code as manual labor. What emerges as the valuable discipline is orchestration, clean design and formal methods for running generated code safely.
Building a robust harness for agents — strict state machines, context isolation, automatic in-loop validation, formal properties at the boundaries — requires deep systems thinking. If your system doesn’t have a clear semantic denotation (what each state means, what guarantees each transition offers) and an architecture designed to withstand randomness, AI won’t save you, but will instead accelerate the creation of technical debt at a speed the human team can’t absorb.
Birgitta Böckeler’s work sums up the direction well. She starts from a formula going around, that the agent is the model plus the harness, and argues that building that harness is becoming an ongoing engineering practice rather than a one-time configuration. She herself brings in Ashby’s Law of Requisite Variety, which says your control system needs to have at least as much variety as the system it controls. From it she draws that reducing the agent’s variety — committing it to bounded topologies — makes a comprehensive harness achievable.
Correction (November 25, 2026). The first version presented the link to Ashby as my own reading. It’s Böckeler’s, whose article has a sidebar titled "Ashby's Law" with this same argument for pre-defined topologies. It also credited her with the idea that most of the engineering value is moving into the harness, which she doesn't say. I found it in a review of the series. The argument doesn't change, but the credit is hers.
The transition of the coming years won’t be about who has the best model. It’ll be about who has the most rigorous validation harness. And paradoxically, to master the future of AI-written software we’re going to have to go back to the most formal and functional roots of computer science (types, properties, invariants, state machines, formal methods).
The old comes back. But this time not as academic nostalgia, but as the condition of possibility for code to work in production.
References
- Karpathy, A. & Patel, D. — AGI is still a decade away (Dwarkesh Podcast, October 2025). Transcript
- Stripe Engineering — Minions: Stripe’s one-shot, end-to-end coding agents (February 2026). Part 1 · Part 2
- Claessen, K. & Hughes, J. — QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs (ICFP 2000). DOI · PDF
- Böckeler, B. — Harness Engineering for Coding Agent Users (martinfowler.com). Article
Everything this article claims, in code that runs. Clone it, break it, open an issue.
Ragnagrok/quickcheck-vs-traditional-testingIf this article was useful to you, you can sponsor the blog on GitHub. It helps me keep writing.