Live Verified: The File on My Server Was Not the File in My Repo

Live Verified: The File on My Server Was Not the File in My Repo

BackerLeader ●2 ●10 ●55
calendar_today ago • schedule3 min read

Live Verified: The File on My Server Was Not the File in My Repo

Two deploy workers aborted back to back last week, and the second one was the fault I want to talk about. Not the guards - the guards worked perfectly. The fault was me, trusting a repo.

Here's the setup. My portfolio generates OG cards - those 1200x630 preview images that show up when a link lands in Slack or a chat. One article was serving the generic engineer card instead of its own, so I went to fix it. I have an og-card repo for this. I'd built the workers against that repo. I knew that code cold.

Worker one used exact anchors from the repo source: find this function, patch inside it. Zero matches. Fine - code moves. Worker two was written layout-agnostic: no functions, no anchors, just structural invariants any version of the file should satisfy. Zero matches.

At that point the guards were telling me something, and I didn't want to hear it. They weren't saying "the file drifted." Two rewrites don't both miss by accident. They were saying "this file is not what you think it is."

The peek

So I shipped a worker that patches nothing. It just reads og.php off the server and dumps it back to me. Cost: five minutes. What came back settled it - the host file was about 3KB of flat procedural PHP with a marker comment I'd never seen, titles loaded from an og-manifest.json, cache keys built from an md5 of slug and title. The repo version had a different structure, different config, different cache layout. Different everything.

The repo wasn't a stale copy of production. It was documentation for a file that had apparently been replaced at some point and never reconciled. Every future patch built from that repo would have failed, and worse - a patch built carelessly enough to "succeed" against it would have overwritten whatever is actually generating my cards right now.

The fix, and the rule it bought

The final worker was a full-file replacement built from the peeked bytes, not the repo: same manifest schema, same cache behavior, same query parameter handling, because all of that is load-bearing on the live host. Its one needle - the marker the peek found - is guaranteed to exist, because it came from the real file instead of my memory of it. Backup, verify, self-delete, row in the receipts ledger. Both aborted workers had cleaned up after themselves, which is the only reason this is a story instead of an incident.

The lesson is now part of the pattern. My deploy rule has always been verify the served bytes, not the receipt - but that rule covered the output side. This week it learned the input side: dump the host bytes first, before any needle is written. A needle guard can only tell you that your assumption failed. It can't tell you what the truth is. Only the real file can do that, and reading it first costs one worker; not reading it costs however many rewrites you spend defending a mental model that was already wrong.

Question for the comments: when you patch production, what are you actually patching against - the repo, or the server? Have you checked lately that they're the same thing?

This one ships with an on-site original: The File on My Server Was Not the File in My Repo.


Evidence, since this series runs on receipts: the change log for my sites lives at the receipts ledger, and the worker pattern that made this safe - token-gated, dry-run first, needle-guarded, aborts instead of guessing, self-deletes after a clean pass - is open-sourced as guarded-deploy-workers.

Want more #devops & #php deep dives?

Join 6,048+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

Part 11 of 11 in Live-Verified

1 Comment

1 vote

More Posts

Delivering Database Changes

Steve Fentonverified - Jul 22

Cloudflare Blocked My Server, So I Made My Visitors' Browsers Do the Fetching

bryanhamiltondevverified - Nov 15

When One Python Process Fails, You Need to See All of Them

Tom Smithverified - Nov 23

The Zero-Net-Loss Fleet & The Mercenary Squad: A Live AI Economy

DEVPlank - Aug 4

FluidCloud's CEO on Why NSX Firewall Rules, Not Disk Copies, Stall VMware Exits

Tom Smithverified - Nov 17
chevron_left
3.6k Points • 67 Badges
Rochelle Park, New Jersey, US • bryanhamilton.info
29Posts
35Comments
27Connections
Full-stack web engineer · PHP & vanilla JS · 25+ years · Founder of The DJ Calendar · Open to work

Related Jobs

View all jobs →

Commenters (This Week)

14 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!