Testing

The Edge Cases AI Code Almost Always Misses

Models generalize from typical examples, and typical examples are well-behaved. That's why generated code handles the middle beautifully and falls apart at the edges — the same edges, project after project. Here they are as an attack list you can run against anything you build.

Empties

The most common miss. An empty list renders as a blank void instead of a friendly message; code that reads items[0] crashes when there are no items; a search with no results looks like a frozen page.

Attack: use the app with no data at all. Delete everything and look at every screen.

Extremes

Zero, negative numbers, and values far beyond the expected range. Quantity zero in a cart, a negative price from a bad input, 999,999 items, a number so large it wraps or formats as scientific notation.

Attack: for every numeric input: 0, -1, and something absurdly large.

Text that isn't ASCII-and-short

Names with apostrophes (which also probe your escaping), accented characters, emoji, right-to-left scripts, and a 5,000-character paste into a field designed for ten words. Long unbroken strings are also layout attacks — one long word can shove a mobile layout sideways.

Attack: "O'Brien", "Zoë 🎉", and a paragraph pasted where a word belongs.

Timing and repetition

Double-clicked submit buttons (two orders, two emails), refresh mid-save, actions racing each other, using the back button after a form. Generated code assumes one calm click per intention.

Attack: click everything twice, fast. Refresh at the worst moment you can find.

Connectivity

Slow networks, dropped connections, and requests that fail halfway. The happy path assumes instant success; reality includes a phone in a parking garage.

Attack: throttle the connection, then cut it entirely mid-action, and watch what the UI claims.

Dates and time zones

The classic quiet corruptor: a date that renders one day off depending on time zone, midnight boundaries, and daylight-saving transitions. If your app stores or displays dates, assume this bug exists until proven otherwise.

Attack: set your system clock to another time zone and check every displayed date.

The first and the last

Off-by-one lives at the boundaries: the first item, the last item, the last page of pagination, the final character. Middle items work; edges are where indexes lie.

Where Vibe Coder Playground fits: an attack list is only useful if running it is cheap. The Playground makes each attack a tight loop — run your own build, feed it the hostile input, watch the DOM, network, and state respond, and hot-reload the fix without leaving the page you're breaking.

Ask the model to betray itself

One more trick that works surprisingly well: paste the code and ask, "What inputs would make this fail?" Models are much better at spotting missed edges in existing code than at covering them unprompted. Then run its suggestions — through the list above.

Related: How to test AI-generated code before shipping →