·StoryRoll

The Deploy That Forgot to Tell Bing

On August 24 two of our best blog posts started losing their Bing readers. Google traffic held steady. Nothing on the pages had changed. Bing had simply stopped looking.

On October 10 I merged a workflow that tells it where to look. This is the story of the part I got wrong four times.

The easy half

IndexNow is a protocol: you POST a list of changed URLs, and Bing and its friends recrawl in minutes instead of weeks. I wanted that after every production deploy. So a GitHub workflow now listens for the deploy-succeeded event, diffs content/blog, and submits every changed post.

That part took an afternoon. The hard question was the diff. Changed since what?

The baseline

The obvious answer is the previous commit. It is also wrong, because deploys fail. If deploy 12 fails and deploy 13 succeeds, the previous commit is deploy 12's, and whatever it changed is never submitted.

So the baseline became the last workflow run that actually succeeded, found by run id (the API's timestamps tie within a second). Everything since that run gets submitted. A failed deploy is skipped and never becomes the baseline. Neither does a manual run, because its commit may not be live yet.

I replayed this against the real history, including all 9 failed production deploys on record. It behaved.

Four rounds

I ran an adversarial review on it four times. Each round found a different way to drop a post.

Round one: a failed deploy could swallow the changes it carried. Round two: a submission IndexNow rejected could do the same, if the job still counted as a success. Round three: deleted and renamed posts were never submitted at all, which matters because the next change retired a post behind a redirect, and Bing needs to see the old URL to learn it moved. Round four: if the very first submission failed, no baseline existed to recover from.

Each got a fix and a regression test. A rejected submission now fails the job. A deletion or slug change sends the old URL as well as the new one. With no earlier success, the script submits the whole live sitemap, 271 URLs, once.

The cost

It is about one billed CI minute per production deploy. At our recent pace that is somewhere between 30 and 190 minutes a month, and most runs end with "nothing to submit." I'll take it.

The gap

A fifth review round found one more. Say a submission fails, and then a later deploy changes the same post again, so its slug goes original, then temporary, then final. The recovery run sends original and final. It never sends temporary.

The same goes for a post added and deleted entirely between two successful submissions: nobody ever tells Bing it existed.

Fixing either needs per-deploy URL state stored somewhere durable, for a sequence that takes a failed submission plus two edits in one window. A search engine can still find a missed URL by crawling, and crawling also reveals when it is gone. I wrote the case down in the PR and shipped without it.

A post added and deleted between two good submissions never gets sent, and I decided not to fix that.

S

Written by StoryRoll

Founder of StoryRoll. Building AI-powered tabletop RPGs.

Share:Share on X

Related Posts