Menu

The File on My Server Was Not the File in My Repo
πŸ“°

The File on My Server Was Not the File in My Repo

DEV Community: phpΒ·Bryan HamiltonΒ·9 days ago
#4ODDnI2R
#devto#dev#repo#file#worker
Long article (645 words) β€” no AI summary yet.
Reading 0:00
15s threshold

My repo lied to me for weeks. Two deploy guards caught it. This is the story of why I now dump server bytes before I trust a source file.

The setup

I run my portfolio on a one-shot patch worker pattern: every change ships as a small PHP worker that does a dry run, checks its needles, backs up, patches, verifies, and deletes itself. It's the closest thing a one-person team has to a second set of eyes.

Last week one article was serving the generic OG preview card instead of its own. The cards come from og.php . I have a repo for that tool. I'd built workers against that repo before. I knew the code cold.

Two guards, two aborts

Worker one used exact anchors from the repo source: find this function, patch inside it.

// needle from the repo source $needle = 'function bh_og_build_card(' ; if ( substr_count ( $src , $needle ) !== 1 ) { abort ( 'needle not found' ) ; // ← this fired }

Enter fullscreen mode

Exit fullscreen mode

Zero matches. Fine - code drifts.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.