A web app lets people edit prices in a long list of items. People keep the page open for hours, often overnight, and come back to it. Each price edit is saved first. Then a second call pushes the new price to a third party.

One release made that second call safer. It was tested, and it worked. It still locked out everyone with the page open from before the deploy.

Key facts

  • One release added a sign-in check to the push call on the server, and the client code that sends the token.
  • Tabs opened before the deploy kept running the old code, with no token. Every price push from them was refused with HTTP 401.
  • Refusals went from about 0.25 an hour to 271 in the next 7 hours. The next day, 106 more on that one route, from at least 8 accounts, every one “missing token”.
  • The fix that reached the old tabs was on the server.

What changed

The push call had never checked who was calling. One release closed that gap with two halves. On the server, a guard: no valid sign-in token means HTTP 401. On the client, the code that attaches the token. Tested together, they worked.

Who still ran the old page

A deploy replaces the server, not the pages already open. A browser tab keeps the JavaScript it loaded until someone reloads it.

So after the deploy there were two clients in the wild, and only one of them had the key:

PageOld server (no guard)New server (guard on)
Old tab (no token)WorksRefused: 401, no token
New tab (sends token)Works: token sent, ignoredWorks

Testing covers a new tab on the new server. The deploy creates an old tab on the new server, and nobody tests that pair.

What people saw

From an old tab, a price edit looked normal. It saved. Then a warning said the third party “did not take” the price, with no reason after it.

The third party was never called; our own server refused first. But the warning named only the third party, so people asked each other in a community group whether the third party was having problems. It is the same trap as a throttle we passed on as our own error, turned around: our error, read as someone else’s.

Nothing was lost. The edit itself was saved every time. Only the push was refused.

Why no reason showed

The server did send a reason. The old page read the message from a field called errorMessage. The new 401 body carried its sentence in a field called message. Same sentence, different key, so the old page printed nothing. A sketch, with made-up names:

// Old page: the only field it reads.
if (!res.ok) showWarning('Not taken. ' + (body.errorMessage || ''));

// 401 body, first version: the old page finds nothing.
{ "message": "Your sign-in needs a refresh. Reload the page, sign in if asked, then try again." }

// 401 body, fixed: same sentence under both keys.
{
  "message": "Your sign-in needs a refresh. Reload the page, sign in if asked, then try again.",
  "errorMessage": "Your sign-in needs a refresh. Reload the page, sign in if asked, then try again."
}

The first fix missed

The first repair was a web release. The page learned to read message on a 401, and to reload itself when it noticed it was out of date.

That code only exists in tabs loaded after that release. The tabs with the problem never load new code. Refusals went on. A reload trick has the same blind spot as a chunk-reload guard on a busy deploy day: it only helps the pages that already have it.

The numbers

Before the deploy, the API refused about 0.25 requests an hour. In the 7 hours after it, 271.

Then refusals were logged by reason. The next day counted 106 more on that one route, from at least 8 accounts. Every one was “missing token”, none “invalid token”. Expired sessions send a token that fails; old code sends none.

The refusals peaked in the hours when people came back to tabs left open overnight.

For one account: 5 of 5 price edits, each followed 0.25 to 0.35 seconds later by a refusal line on the server. The same account’s edits on the evening before the deploy had gone through, from the same page.

The fix that reached old tabs

For a tab running old code, the server is the only side you can still change. So the repair went there. The 401 body now also carries errorMessage, with the same sentence: “Your sign-in needs a refresh. Reload the page, sign in if asked, then try again.”

The guard itself is not loosened. The old page now tells the user exactly what to do.

One reload ends it for that user. The page’s HTML was already served with no-cache and there is no service worker, so a plain reload gets the current build, which sends the token.

The checklist

Anyone can do these tomorrow:

  • Ship a new requirement in two steps. First the client half: send the token. Wait until old tabs have mostly turned over, or make them reload, then switch the guard on. Or run the guard in report-only mode first and watch how many requests would fail.
  • Treat error bodies as an API with old readers. When you add a new refusal, give it every field that any client still in use reads for its message. Add fields; never rename them.
  • Log refusals by reason from the first minute. Missing, invalid, wrong account. “Missing, never invalid” is what pointed at old code and not at expired sessions.
  • Give the client a version signal before you need it. A version header the old code checks, or a “please reload” answer the old code can show. A reload trick added in the fix arrives too late for the tabs that need it.
  • Count a baseline. The jump from about 0.25 an hour to 271 in 7 hours was only visible because 401s were rare before.

The lesson in one line: a deploy does not replace the clients that are already running. While old tabs live, your server talks to two client versions, and a rule that needs new client behaviour (a token, a header, a field) breaks the old one, even when both halves shipped together.

Common questions

Why not just tell users to reload?

Your only channel into a tab running old code is the answers your server gives it. Putting the reload instruction in the field the old page reads is how you tell those users.

Is report-only mode enough?

It tells you how many requests would fail and from whom, before anyone is refused. You still have to wait until that number is close to zero, or make old tabs reload, before you switch the guard on.

Was anything lost?

No. The price edit itself was saved every time. Only the second call, the push to the third party, was refused.

Melta is free; get it on the App Store or Google Play.