← sz3yan.com

#kms ·

The service my code was calling had been deleted three commits ago

I was asked to build a key-management service, and the CLI docs told me exactly which URL it should live at — a URL that returned nothing. Before writing a line of crypto I grepped for who else…

1 min read

I was asked to build a key-management service, and the CLI docs told me exactly which URL it should live at — a URL that returned nothing.

Before writing a line of crypto I grepped for who else mentioned that URL, and found a live, shipping client already calling it on every login, referencing a source file that no longer existed. The endpoint was not unbuilt. It had been deleted along with the app that hosted it, leaving its caller pointing at a hole. git log --diff-filter=D recovered the original implementation, and the job flipped from "write a KMS" to "restore one without breaking the thing already depending on it."

The deleted code's own comments turned out to encode two hard-won constraints: an unauthenticated endpoint that must stay unauthenticated, because the service that consumes it fetches it during boot and guarding it deadlocks cold start; and an auth token that cannot be used, because minting it would require signing it through the very service it authenticates to.

Best detail: the databases and configuration for the deleted service were still provisioned and wired into the running deployment, quietly outliving it. And one word of difference in a key-derivation label between the two historical versions would have made every stored key permanently undecryptable — if the tables had not happened to be empty.

Lesson. Deleting a service does not delete its callers. Before building what looks like greenfield work, search for who already expects it to exist — reading the code someone has already debugged is far cheaper than rediscovering its edges.