The Check That Did Nothing

a health check, a vendor change, and the most useful nothing I've shipped

Reconstructed from alert logs, a vendor support thread, and a few database queries. The vendor, the client, and all identifiers are anonymized; the sequence, the numbers, and the technical details are real.

The most important line in a health check is not the one that detects the problem. It is the one that decides what the check is allowed to do about it.

Detection is the fun part. You find the signal, write the probe, watch it light up on a test account, and feel clever. The decision is the boring part: given an answer, what happens next. Do you write to the database? Do you email the user? Do you disconnect anything? And the question that almost never gets asked: what do you do with an answer you have never seen before?

This is about a check I built for the Product's email and calendar sync, the decisions inside it, and a Thursday morning in November when a vendor change turned every Office 365 account red at once and the check, correctly, did nothing.

the check

The Product syncs users' email and calendars through a third-party Vendor that sits in front of Google and Microsoft. The Vendor holds each user's provider grant and keeps it refreshed behind a long-lived account token. Most of the time this is invisible, which is the point.

Sometimes the grant dies. An MFA policy, a password change, an admin revoking consent. When that happens, nothing in the system notices. Every sync call fails and logs. The database still says the user is synced. The settings page still says "Synced". Bookings and drafts fail with generic errors. Weeks later someone stumbles on it, usually the customer.

The check is the backstop. Twice a day, for every connected user, it asks the Vendor whether the grant behind the token is alive. If it is dead, the check writes the disconnected state back so the Product stops lying, and emails the user that they need to reconnect.

The first surprise was that the obvious probe lies. The Vendor's account endpoint answers from its own records. For an Office 365 user whose grant Microsoft had already revoked, it still answered 200 with active: true, while every real call returned token.dead. The real verdict is a field in the response body, and it is only there if you ask the Vendor to ping the provider right now. So the probe asks.

The second part was deciding what the check was allowed to do with what it heard. That took longer than the probe, and it is the part this story is about.

That last one is the choice people would most want to change. I will come back to it.

the morning

At ten in the morning on a Thursday, my phone started going off and did not stop. I was not at my desk. I will leave it there.

By the time I was, the alerting tool had 116 new issues, all opened within about a minute, all the same: the account probe had answered 403 Forbidden. Not 401. Not token.dead. A 403 with a code of forbidden. The check had classified it as an answer it did not understand, reported every user, and skipped them.

A few facts came out in the first minutes:

Nothing on our side had moved. Something on the other side had.

connected is not syncing

The first question was not why. The first question was whether anyone was actually affected.

The check had written nothing, so every one of those users still showed as connected. But "connected", in the Product, is a flag, and a flag says whatever it was last told. That is the whole reason the check exists. It could not answer the question.

What could answer it was data flow. Every time the Vendor delivers a webhook, the Product stamps the user with the time. So I asked the database a different question: since the run, how many Microsoft users have received anything? In the larger region, 67 of 99. The most recent was minutes old. Google and Exchange users were flowing too.

Mail was moving. Whatever was broken, it was not sync.

Then I probed one affected account directly, three ways, with the same token:

This time I printed the whole error body instead of the summary. Inside the Vendor's 403 was Microsoft Graph's original answer:

Authorization_RequestDenied
Insufficient privileges to complete the operation.

The token was fine. The grant was fine. Sync was fine. What Microsoft was refusing was the ping itself. Whatever the Vendor's ping now asked Microsoft for, our grants did not cover it.

In the Vendor's support channel there was a message from earlier that same morning, an update on something I had asked about before:

Confirmed working for Exchange/EWS accounts as well, so you can use it in your cron job to detect invalid credentials.

I sent them the request id of the failing call. Twenty minutes later:

We see some permissions issue in our logs. Working on this.

the dangerous part is the fix

At this point the incident was, by any normal definition, over. No user was affected. The check was failing safe. The Vendor owned the cause.

But a 403 is safe for exactly one reason: the check does not understand it. The moment the Vendor ships a fix, the ping starts answering again. If that fix answers tokenStatus: dead for accounts that lack whatever the ping now wants, the check will understand that perfectly. It will confirm it twice, two seconds apart, and act.

A disconnect is not a flag flip. The user has to sign in to Microsoft again, then turn email sync and calendar sync back on separately. Until they do, nothing syncs. For larger customers, re-authorizing can mean going through their own IT department. It is the kind of cost that lands on someone else's morning.

The emergency stop would catch it, eventually, after the first twenty or so. So I asked the team to turn the check off until the fix is proven with the same three-call probe. A 403 is safe. A wrong "dead" is not.

what I'd do differently

The check did its job. It also showed me three things I would build differently.

The signal that mattered was gated behind the one that broke. The check has a data-flow condition: a connected calendar with no webhook for a day gets reported. But it only runs when the probe succeeds. When the ping broke, the check went blind on the one question that mattered that morning, whether sync was working, and I had to ask the database by hand. Independent signals should be independent.

The report threw away the evidence. When the Vendor answers with an error, the check keeps the status, a short code, and a message. The Vendor's request id and the provider's original error were both in the response body, and the check dropped them. Getting them took a separate probe. The thing the support channel needs first should be in the first alert.

The brake releases itself. The emergency stop protects one run. It counts from zero every time, and nothing remembers that the last run halted. A Vendor that started answering "dead" for every Office 365 account would cost up to twenty users per region before the stop, and twelve hours later, the next twenty. What actually limits it is a human seeing the halt alert. A brake that, once pulled, stays pulled until someone deliberately releases it is a few lines of code and a much better night's sleep.

the nothing

Back to the alerts. A hundred and sixteen of them, in about a minute, on a phone, while I was not at my desk. The obvious improvement is to roll them up into one quiet summary per run.

I don't think so. One quiet summary is a line in a channel nobody reads until Monday. A hundred and sixteen alerts is a person getting up and walking to a keyboard, with every affected account already listed. The loudness was not a bug that morning. It was the feature that put a human on the problem within minutes.

Nothing happened. No user was disconnected, nobody got an email, nobody's mail stopped. That is the result, and it is also the hard part: nothing leaves no trace. Nobody writes up the incident that did not happen.

So I am writing it up.

If you take one thing from this: decide, in advance and in code, what your system is allowed to do with an answer it has never seen before. The answer should almost always be: say so loudly, and do nothing.