When an error string you physically deleted from the worker still comes back on a DRY run, you immediately know you're hitting stale opcode/edge caching rather than your new file. Adding a build-hash fingerprint to every worker response is a lifesaver.
The Error Message That Couldn't Exist: Fingerprinting Your Deploys
11 Comments
@[Mara Hollis] This. My version of the same lesson: when a stale copy won't die no matter what, re-upload under a NEW filename with a NEW token - the old copies 404 on a token that doesn't exist in them, so the version proves itself. A build-hash line at the top of every response is the cheaper everyday habit though; adopting that.
Please log in to add a comment.
This is the right instinct — treat the response as the thing under test, not the file on disk. Worth naming the second common cause of "disk is new, behaviour is old" on PHP specifically: OPcache can keep serving the old compiled bytecode even when the file is provably new, especially with validate_timestamps off or a long revalidate_freq — and a cache-busting query param won't touch that, because it's not keyed on the URL. Your version-marker catches both cases, which is exactly why it's the stronger habit: if a fingerprint mismatch survives cache-busting, OPcache (or a CDN/edge layer) is the next place to look. "Three confirmations that were one observation counted three times" is the trap worth framing — a marker that can only exist in the current revision is what collapses it back to one.
@[DunimeTech] OPcache is a great catch and you're right that it's the sneaky one - it's the only layer in the stack where "the file is provably new on disk" and "the runtime is executing something else" can coexist with zero external evidence. On shared hosting you often can't even call opcache_reset() from a worker, so the practical move is exactly what you said: let the fingerprint mismatch tell you the write path is fine and the execution path is stale, then hit the host's own cache-clear (cPanel's OPcache toggle, or in my case just waiting out revalidate_freq).
The "three confirmations, one observation" framing is the part I keep replaying. My DRY run reported the region, the needle count, and the byte delta - but all three were reads of the same in-memory string, so it was one observation wearing three hats. The version marker fixes it at the other end: the thing under test isn't "did my script think it wrote," it's "does the served output contain a string only this revision could have produced." One question, one answer, from outside the process that did the writing.
Worth adding to my own list: a marker proves the runtime file is current, but it can't distinguish WHICH stale layer ate the update - OPcache, FastCGI process cache, or CDN. So the marker is the detector; the layer still needs bisection. Next worker I'm adding an explicit "expected marker vs served marker" diff line to the verify output so the mismatch reports itself instead of me diffing by eye at midnight.
@[bryanhamiltondev] The patch-management version of this is nastier: after you fix a vulnerable include, OPcache can keep executing the old bytecode until revalidate_freq expires, so "patched on disk" and "patched in the running interpreter" quietly disagree — a file-level scanner reads the fix and closes the ticket while the host still serves the hole. Same lesson as your version marker: the thing worth verifying is the served response, not the bytes you wrote. We don't treat a patch as closed until a fresh request with a unique cache-buster shows the fixed behaviour in the response itself.
@[DunimeTech] "Closes the ticket while the host still serves the hole" - exactly it. My addition from the worker side: on shared hosting you can't call opcache_reset(), so the served response isn't just the stronger check, it's the only one you have. And when a stale copy won't die no matter what, new filename + new token beats everything: old copies 404 on a token that never existed in them, so the version proves itself. The residue is scale - a cache-buster proves this request, not the host. My build-fingerprint-in-every-response habit exists to shrink that gap: every response carries its own version, so any request becomes the audit.
Please log in to add a comment.
@[JustOneCX] By eye, honestly. These are one-shot workers - upload, dry run, human reads the output, GO, byte-verify, self-delete. There's no suite left behind to assert anything in.
And your point stands: the dry run caught a real bug last run (a line I expected once existed on three pages, so it refused to write), but a broken abort branch would report a lie about its own failure, and I'd only catch it the same way - reading it.
The write path does assert itself: the worker re-reads the file, byte-compares against what it intended, restores from backup on mismatch. The report path doesn't. A fixture-based self-test that asserts its own report text is the right fix - going in the next one.
@[JustOneCX] Update: the fixture self-test went into the next worker, and it caught a bug on its very first run - in the test itself. The abort-path fixture was "full needle plus trailing junk", but the patcher's contract is count==1, so that's a legitimate patch, not an abort. The test had asserted the wrong expectation, and the self-test correctly reported it. Which is the funny part: the thing that catches lies about failure paths spent its first run catching its own author's lie. Two rules came out of it: abort fixtures must provably LACK the complete needle (truncate it - never needle-plus-junk), and needle-plus-junk becomes its own test asserting the patch path. Both are written up with the worker set here: https://github.com/bryanhamiltondev/guarded-deploy-workers/blob/main/docs/selftest.md - so the report path finally asserts itself, by eye is retired.
Please log in to add a comment.
Please log in to comment on this post.
More Posts
- © 2026 Coder Legion
- Feedback / Bug
- Privacy
- About Us
- Contacts
- You Tube
- Tiktok
- Premium Subscription
- Terms of Service
- Early Builders
More From bryanhamiltondevverified
Related Jobs
- Open Application: Explore Your Future with KunaiKunai · Full time · United Kingdom
- mobile developer for an existing mobile applicationPriority Software · Full time · New York, NY
- Open Application: Explore Your Future with KunaiKunai · Full time · United Kingdom
Commenters (This Week)
Contribute meaningful comments to climb the leaderboard and earn badges!