I owe the testing pyramid an apology.

For years I nodded along to it. Lots of fast unit tests at the bottom, fewer integration tests in the middle, a thin tip of end-to-end tests on top. Clean. Sensible. Textbook.

And then I went back to my Laravel project and wrote another feature test that boots the entire framework, migrates a database and fires a real HTTP request. To check one validation rule.

Every. Single. Time.

Twenty years to build. Zero ARR. One customer. Dead. Good luck pitching that to your board.

Unless you were a pharaoh. A god-king with a bottomless treasury and thousands of workers hauling limestone up a ramp. Everybody else had twelve months of runway. So they built with mud bricks. Quick. Cheap. Good enough to live in.

That's our test suite.

The pyramid was never wrong. We just did the maths. A proper unit test: decouple the logic, write the fakes, cover every edge case by hand. A feature test: copy the one above, change a parameter. Guess which one ships your feature this week.

We're not building for eternity.

That was always the quiet justification. Nobody meets Anubis when an edge case slips through. We catch it in production, fix it, ship again.

When you're not a pharaoh, mud bricks aren't laziness. They're a business decision.

Congratulations. You're the god-king now. Your new workforce never sleeps, never strikes, and doesn't even want the free beer.

So far, they've been busy. Shipping features. Paying off technical debt. Walking the extra mile.

Time to send a crew to the test suite.

The crew arrived and found a city.

24,000 mud-brick houses. Each with its own foundations, its own well, its own oven. Built from scratch, every single time, to check whether one window opens.

CI sends in a beefy runner, and the whole city gets inspected in under four minutes. Locally? Nobody walks that city on foot.

And the city keeps growing. The crew doesn't read our guidelines. They look at the house next door and build another one just like it. Faithfully. Tirelessly. Cracks included.

The first house on that street? I built it.

Your test suite is your agent's blueprint.

So we dug out the old blueprint. The one we always had and could never afford.

Turns out the parts we always skipped are exactly the parts the crew loves.

The base is where your unit tests live. Thousands of small, solid blocks. Every edge case, every boundary, every weird input. A human gets bored after five. The crew doesn't. No well, no oven, so each block takes milliseconds to lay.

There's a reason the pyramids are still standing after 4,500 years. It's not the tip.

The middle is where your integration tests live. Fewer blocks, bigger ones. The corridors from the entrance to the burial chamber. Walk the main route. Check where it might cave in. Leave the bricks to the base.

And use real doors. The tombs were full of false ones, painted onto solid rock. Mock everything and you'll walk into a lot of walls.

The tip is where your end-to-end tests live. The capstone. Small, and covered in gold. Only the journeys that really matter: a customer signs up, pays, gets what they paid for. Not every bug QA ever found. Put too much weight on top and the whole thing comes down.

And the old city? Pharaohs had no shame. They tore down whatever their predecessors built and hauled the stone off for their own monuments. Do the same. Those thirty mud houses that all check the same window? Knock them down. One corridor stays. The rest of the bricks go into the base.

Pyramid finished. Now guard it.

Almost every pyramid got robbed eventually. So before you seal yours, send in your own robbers. That's mutation testing: it sabotages your code and checks whether a trap goes off. Every robber who walks out with the gold is a test that guards nothing. (Different mythology, same idea: Teenage Mutant Ninja Tests.)

Robbers aren't the only threat. Sand and wind wear a pyramid down, one grain at a time. Your test suite erodes the same way. One lazy feature test here, one copy-paste there. And the crew copies whatever it sees.

So carve the rules into stone where the crew will read them. Edge cases go in the base. Corridors stay lean. Nobody builds a mud house on the pyramid.

We're still not building for eternity. But when the crew works for free beer, mud bricks stop being a business decision. They're just a habit.

Nice blueprint. Time to pick up a chisel.

So we started small. One of our smaller apps has far too many mud houses for its size, and it needed a cleanup anyway. Killing two ibises with one limestone. In ancient Egypt, that got you executed. Worth the risk.

The first corridor is done. 128 HTTP tests down to 31. The logic moved into 126 unit tests that run in under a tenth of a second. A third fewer robbers walking out with the gold. Now picture that across a city of 24,000 houses.

And the dig turned up a bonus. Most of our CI time wasn't spent building at all. It was spent hauling stone from the quarry: pulling a 1.3 GB image, before a single test ran. Dig anywhere in Egypt and you'll find something you weren't looking for.

So yes, it pays off. What I don't know yet is whether it lasts. Pyramids don't erode in a week. Will the crew keep building to the new blueprint, or slowly drift back to copying the house next door?

And we've only opened one tomb. The others still have mummies in them we haven't met yet.

Sneferu needed a few tries too. Halfway up his second pyramid, the builders realised the slope was too steep and changed the angle on the spot. You can still see the kink today. His son built the Great one.

Worst case, I'll have built a Bent Pyramid.

And I'm fairly sure I'm not the only one living in a mud-brick village. Has anyone started building a pyramid already? And what other "pragmatic" shortcuts in your projects are really just workarounds for a workforce you didn't have?

I'll report back with receipts.

Now if you'll excuse me, I have a crew waiting. They still don't want the beer. More for me.

Pour one out for Anubis.