// Spec before you generate · lesson 04
Edge cases as first-class citizens
The happy path is the easy ten percent. The other ninety, the empty input, the malformed data, the network that drops, the field that arrives null, is where software actually breaks, and it's exactly the part a model skips by default unless you make it a first-class part of the spec.
Left to its own devices, a model builds for the case you described, which is almost always the case where everything goes right. It's optimizing for a coherent, complete-looking answer, and the happy path is the shortest route there. The failures don't show up in the demo, so they don't show up in the generation. Then they show up in production, which is the worst possible place to first meet them.
Why enumerate the failures before you build?
Because you find the bug, or the user does, and only one of those is cheap. Writing an edge-case table up front, condition on the left, expected behavior on the right, forces the failures into the light while they're still free to handle. Empty input does what? Invalid type does what? Null, timeout, duplicate, the second identical request, the value one past the limit? Each row you fill in is a bug that now can't happen, because you decided its behavior on purpose instead of discovering it by accident.
The move that makes it stick
Make the edge cases part of the spec you hand over, not a review you do later. When the model generates against an explicit table of failure conditions, it builds the handling in from the start, where it belongs, instead of you bolting it on after and hoping you caught them all. And write the ones that would actually embarrass you in front of a customer, because those are the ones worth the ink. You're not enumerating every conceivable input. You're naming the failures that matter and deciding their behavior before they get a vote.
The takeaway: the happy path is the small part; enumerate the failures up front and hand them over as part of the spec, so you meet your edge cases in a table instead of in production.