polycratia

"It works on my machine" is almost never a packaging problem anymore. Containers closed that gap years ago.

What survives is that your machine is single tenant and synchronous.

Locally one request runs at a time. Nothing else touches the row you just wrote. The callback shows up after the response you were sitting there waiting for. Latency is effectively zero, so ordering looks like a property of your code instead of a race you happened to win.

Production runs the other way. Two workers pull the same job in the same second. A provider callback lands before your own transaction has committed. A retry arrives while the first attempt is still open. None of that is a config difference, and no amount of environment parity reproduces it.

The third party side is worse, because it looks solved. Sandbox endpoints answer instantly and deterministically. Real KYC providers return pending and flip status later, sometimes out of order, sometimes twice. Payment rails settle on their own schedule, and the settlement you reconcile against is not the response you got at the API edge. Your local run just doesn't visit the states that decide whether your state machine is correct.

So the question I ask about a piece of code isn't "does it run". It's this: what happens if this executes twice in the same instant, what happens if the callback arrives before the write, what happens if it never arrives at all. Those answers are cheap at design time and very expensive once money has moved through the path.

Environment parity is still worth having, I think. But understand what it buys you: determinism. And determinism is precisely the property production doesn't have.

I write up more of these local versus production failure modes here: https://polycratia.com/c/3cd1fc50

When local passes, staging passes, and production still breaks, what do you check first: concurrency, ordering, or the third party?

react

$ new-project --brief

or email hey@polycratia.com