reliability · payments · deployment · ecowell · testing · system-design
The Safety Guard That Blocked My Own Deploy
Hours before a demo, the online payment option in our test environment stopped working. The payment gateway settings had been switched off. I turned them back on, redeployed, and the deploy failed.
The failure was not a bug. It was a safety guard doing exactly what it was written to do. This post is about why I now think that is the right behaviour, and what it cost me to learn it.

What the guard does
Our hosted test environment talks to a payment gateway in test mode. Test mode is safe only if several settings agree with each other: the gateway is enabled, a few database flags are on, and the way test payments are allowed is chosen clearly.
There are two ways to allow test payments:
- Open test mode: any test invoice may be paid.
- A fixtures list: only a few exact invoices (a specific organisation, customer and invoice) may be paid.
The start-up guard checks the whole set when the server boots. If the settings do not describe one clear situation, the server refuses to start.
What went wrong
I followed my own recipe: switch the seven related settings back on, with open test mode enabled. But an old fixtures list was still set from an earlier round of testing. The guard saw “pay anything” and “pay only these invoices” at the same time, treated that as contradictory, and rejected the start. The deploy ended in update_failed.
Because the platform only moves traffic to a new version once it starts healthy, nothing broke for users. The old version kept serving. The fix took one step: remove the fixtures list, then redeploy.
Why I would not change the guard
| Approach | When settings contradict | Risk |
|---|---|---|
| Fail closed (what we have) | Server refuses to start, deploy fails loudly | A person has to fix it, usually within minutes |
| Pick one setting silently | Server starts and one setting wins | Nobody knows which rule is live. The wrong one might be the permissive one |
| Warn and continue | Server starts, a log line appears | Logs are rarely read before a demo |
The guard’s tests cover these cases on purpose. An empty list, [], broken JSON, a list with the wrong shape and a mix of incompatible modes must all be rejected. A guard that is only tested on the happy path is just a suggestion.
What I changed afterwards
- A written recipe. The seven settings and the order to set them in now live in one runbook, including “the fixtures list must be unset when open test mode is on”.
- Error messages that name both settings. The guard should say which two values disagree, not just “invalid configuration”. I wrote about why this matters in Error Messages That Tell the Truth.
- A check before a demo. Looking at the settings is now part of the pre-demo list, because the gateway had been switched off by someone and nothing alerted us.

The takeaway
When a system can be configured into two incompatible states, make it refuse instead of guess. A failed deploy costs minutes. A payment setting that quietly picked the permissive option can cost much more.