The Café Replaced Its Espresso Machine. Then Nobody Could Find Their Coffee
The espresso machine at the café was called Gerald. It was a bean-to-cup model: you pressed a button,...
The espresso machine at the café was called Gerald. It was a bean-to-cup model: you pressed a button, and he ground, brewed and steamed the milk, start to finish. Gerald also had a problem.
Every time he finished a drink, a worn valve inside him let out a honk. A loud, wet, offended honk, like a goose being asked to fill in a form. It wasn't in the manual. The technician called it a fault and said he'd get to it eventually.
The regulars worked it out within a week. Honk means your drink is done. Nobody announced this. Nobody put up a sign. Within a month the whole room ran on it. People drifted toward the counter on the honk, collected their cups, drifted away. No tickets, no names shouted, no buzzers. A notification system with 100% adoption, built entirely by accident.
The café is made up. The pattern is real, it has a name (Hyrum's Law), and you have probably caused it.
The day the café got better
The owner bought a new machine. Quiet, fast, with a spec sheet that made Gerald's look like a cry for help. Every documented behaviour was an upgrade: faster warm-up, steadier drinks, less water. It did not honk. The owner ticked every box on the acceptance list and went home happy.
Monday morning, twelve people were hovering at the counter, craning over each other's shoulders and asking the barista, "Is that mine?"
A flat white sat on the pickup shelf for six minutes while the man who ordered it stood two feet away, because nothing told him it existed. Someone asked if the new machine was broken. It wasn't. It was working perfectly, which was exactly the problem.
By Wednesday, a regular named Dennis had appointed himself the machine's replacement honk. Whenever a drink finished, he'd shout "HONK" from his table by the window. People collected their drinks. The line recovered.
Nobody paid Dennis. Dennis was a compatibility layer with a latte habit, and the most important engineer in the building.
The owner finally understood what she had shipped. She had removed a feature. She just hadn't known it was a feature, because it had never been on any list.
So what is Hyrum's Law?
Hyrum Wright, a software engineer at Google, noticed that once enough people use an interface, it stops mattering what the documentation promises. Somebody, somewhere, will depend on every behaviour they can observe. His colleague Titus Winters gave the idea its name, and it shows up in the book Software Engineering at Google. You can read the original wording at hyrumslaw.com, and there's an xkcd about it that every developer has either sent or received.

Gerald's honk was observable, never promised, and fully load-bearing. Your software has honks too:
- the order of results from an endpoint whose docs promise no order
- the exact wording of an error message (someone's regex is reading it right now)
- a price returned as the string
"4.50"instead of the number4.5 - how long a call takes, because someone's cron job only works since your endpoint is slow enough for another job to finish first
- the status code you return for that one weird edge case
- the CSS class on a button that someone's browser extension is hunting for
None of that is in the documented contract. All of it gets depended on anyway.

Big teams have a Gerald too
Go. Before Go 1, the language never defined the order of map iteration, and in practice it differed across hardware platforms. Programmers still came to lean on whatever order they saw, and the Go 1 release notes describe the result: a test could pass on one machine and fail on another. So Go 1 made the order deliberately unpredictable, even when you loop over the same map twice, so that code depending on it breaks early instead of late. The Go team made Gerald's honk much harder to rely on.
Excel. Lotus 1-2-3 treated 1900 as a leap year, which it wasn't. When Microsoft built Excel, it copied the mistake so that Lotus spreadsheets would import with identical dates. Excel still accepts February 29, 1900. Microsoft's own support page says fixing it is technically possible, but it doesn't think the benefits outweigh the costs, and it notes that the WEEKDAY function returns wrong values for dates before March 1, 1900. Forty-odd years of bug-for-bug compatibility. Excel is the café that kept the faulty valve because the regulars had built their mornings around it.
You can't stop the honk. You can make it cheaper.
Five habits that would have saved the owner a very bad Monday, with code you can paste into a scratch file.
1. The Honk Audit
Before Gerald left, somebody should have stood in the café for one morning with a notebook and written down what the room did without being told. Do the same to your API: take one real response and ask what you deliver that you never promised. Read it like a stranger would, ideally one with a regex and a grudge. Field order, number formats, whitespace, header casing, sort order, error text. Every one of those is a possible Gerald.
2. The Golden Test
A characterization test records what your code actually does today. A golden master (or approval) test is one way to capture that behaviour: save the output, then compare future output against it. It's the notebook from the Honk Audit, written as code. And it looks almost too dumb to be useful:
import json
def render_order(order):
return json.dumps({
"id": order["id"],
"status": order["status"],
"total": order["total"],
})
def test_order_json_is_exactly_what_clients_have_always_seen():
# "4.50" is a string. Somewhere, a spreadsheet is relying on that.
order = {"id": 7, "status": "ready", "total": "4.50"}
assert render_order(order) == '{"id": 7, "status": "ready", "total": "4.50"}'

Now somebody opens a tidy-up PR that turns total into a proper number. The output becomes 4.5, the test goes red, and the reviewer has to stop and ask the question that matters: who is parsing this? That pause is the point. The test doesn't forbid the change, it only stops the change from sneaking in. And if it turns out nobody depends on the oddity, retire the test on purpose.
3. The Shuffle
This is the Go move. In café terms, it's a machine that honks at random, so nobody learns to listen for it. If your docs say a list has no guaranteed order, don't hand out a lucky one.
import os
import random
def ready_orders(rows):
rows = list(rows)
if os.environ.get("APP_ENV") != "production":
random.shuffle(rows) # the docs promise no order, so don't provide one
return rows
In dev and CI, shuffling can expose code that assumes a particular order before that assumption reaches a customer. In production the order is left alone, and your input list is never modified. One limit: your outside partners don't run your test mode. For them this is a smell detector, not a shield. Go keeps the order unpredictable in production too, which is a much bolder choice.
One more catch: a random shuffle turns a hidden order dependency into a failure that looks flaky. Make it reproducible. If you use pytest, the pytest-randomly plugin prints a base seed at the start of each run and derives a repeatable random seed for each test from it. If a test fails because of this shuffle, rerun with pytest --randomly-seed=<printed-seed> to replay the run.
4. The Sunset
When a behaviour has to go, don't make it vanish on a Tuesday. Gerald deserved a sign on the door a month ahead: Gerald retires on the 30th. Here is how you will know your drink is ready. HTTP gives you two headers for that sign. There's Deprecation (RFC 9745, published in 2025) and Sunset (RFC 8594). Here is a small helper that builds both:
from datetime import datetime, timezone
from email.utils import format_datetime
def deprecation_headers(deprecated_at, sunset_at, doc_url):
for moment in (deprecated_at, sunset_at):
if moment.utcoffset() is None:
raise ValueError("use timezone-aware datetimes")
deprecated_at = deprecated_at.astimezone(timezone.utc)
sunset_at = sunset_at.astimezone(timezone.utc)
if sunset_at < deprecated_at:
raise ValueError("sunset can't come before deprecation")
return {
"Deprecation": f"@{int(deprecated_at.timestamp())}",
"Sunset": format_datetime(sunset_at, usegmt=True),
"Link": f'<{doc_url}>; rel="deprecation"; type="text/html"',
}
headers = deprecation_headers(
datetime(2026, 12, 3, tzinfo=timezone.utc),
datetime(2027, 6, 30, 23, 59, 59, tzinfo=timezone.utc),
"https://example.com/docs/order-total-is-becoming-a-number",
)
# Deprecation: @1796256000
# Sunset: Wed, 30 Jun 2027 23:59:59 GMT
The first header carries the deprecation date as a Unix timestamp, the second carries the sunset date as a normal HTTP date, and the link points to a page that explains what to do. RFC 9745 says the sunset can't come before the deprecation, so the function refuses to build it that way. It also rejects datetimes without a timezone and converts any other timezone to UTC, which is what these headers need. Treat Sunset as a heads-up, not a shutdown switch: RFC 8594 says clients should read it as a hint, not a guarantee.
Headers only help if clients act on them, and plenty won't. So also log a stable client identifier on every request that still takes the old path, and aggregate by client from those logs. (Avoid raw client IDs as metric labels, since thousands of distinct values make metrics expensive.) That tells you who is still making those requests, so you know who to email. It can't tell you whether they saw the warning. Some teams go further and switch the old behaviour off for a few minutes on a schedule, a "brownout", so that anyone still depending on it shows up in the support inbox early rather than on the final day. In café terms: muting the honk for ten minutes on a Friday and watching who stands there looking confused.
5. The Buzzer
The café never got Gerald's honk back. After a week of Dennis, the owner bought a cheap order buzzer system. This time, it was a documented feature, deliberately added, with a battery.
Whenever you discover a Dennis in your own system, someone holding up a behaviour you never wrote down, write the contract he was missing. Give the honk a name, a test, and a line in the docs. It's less romantic than a goose-shaped valve and far less likely to ruin a Monday.
Nobody misses a faulty valve. A few people do miss the goose.
Gerald is retired now. Dennis got a free coffee and was offered a job title, which he declined.
The manual says what you meant. Your users depend on what you did.
So, what's the Gerald in your system? What did you "clean up" that turned out to be holding the building up, or what are you quietly afraid to touch? Tell me in the comments. I'd like to hear the stories, especially the Dennis ones.
Sumber artikel open-source oleh Shubhra Pokhariya di DEV Community — Baca artikel asli. Topik:
#discuss#api#testing#webdev
Sukai & bagikan artikel ini
Ditulis & Dikurasi Oleh
Shubhra Pokhariya (Open-Source)
Software Engineer yang berfokus pada Next.js, TypeScript, arsitektur backend skalabel, Cloud, dan Applied AI.
Artikel Terkait
Semua artikelYou can't keep gulab jamun in stock: modelling made-to-order products in an online store
Building an online store for a 1960s sweets shop meant rethinking stock, order flow and alerts. Here's the model, with the code.
I built an Android app that teaches you to find exoplanets. Here's everything that broke.
I'm a B.Tech AI & CS student in Pune, and I wanted a project that was more than a to-do app. So I...
Put your Lovable, Bolt or v0 app on a .ng domain (and pay in naira)
An AI builder gets you to a working app fast, and then hands you a folder. This guide covers the part...
How to Remove an Image Background in the Browser (No Upload, No
Most background remover sites ask you to upload your photo to their server. That is slow, and not...

Komentar