Your Version Bumps Are Lying to Returning Visitors

Your Version Bumps Are Lying to Returning Visitors

BackerLeader ●2 ●12 ●70
calendar_today • schedule2 min read

Multi-page sites version their CSS and JS with ?v=N cache busters. You edit a file, you bump the version, you ship. Except most bump passes are page-local: the page you touched gets ?v=48, and the other 83 pages keep ?v=33.

Here's the part that took me three months to notice: every stale page still loads the current asset file. The URL just carries an old key. Returning browsers hold their cached copy under that old key - so your deployed code never actually runs there. No error. No warning. Just old JavaScript, executing confidently on pages you believed you updated.

On one ~300-page PHP site, 84 pages had drifted - across three months of ordinary, careful, one-page-at-a-time deploys. /writing/ was two versions behind. A case study was fifteen behind. Nobody noticed, because nothing failed. The pages just... kept old behavior.

Why every audit misses it

You check the page you shipped. It's fine. You check the asset file - it's current. The drift lives in the third place: other pages' references to the asset, which nobody re-checks because they weren't touched.

And the failure is silent by construction. A stale cache key doesn't 404. It doesn't log. It serves yesterday's code from the browser cache, at full speed.

The check that catches it

One PHP file, no dependencies, no network - scan a file tree, group every local / reference by asset, and flag any asset referenced under more than one version key. A bare versionless ref mixed with keyed refs is drift too. Exit 1 on drift, so it gates a pipeline:

bash

php audit.php /var/www/site

assets/js/rack.js

versions seen: 33, 45, 47 (latest: 47)

STALE 33: case-studies/og-card/

STALE 45: writing/three-bugs-in-a-trenchcoat/

Full honesty: the scanner's own first run reported "no drift" on a fixture with planted drift, because I read the version key after stripping the query string. A detector that detects nothing fails green - it looked finished, not broken. (Rehearsing the tool on real bytes before trusting it is a separate post.)

The rule

A version bump is a claim about every page that references the asset, not about the asset. Bump globally or audit the refs - anything between those two is a promise your cache is making on your behalf.

Open source, one file, zero dependencies: github.com/bryanhamiltondev/stale-asset-audit - php audit.php

    [--exclude=a,b] [--json], exit codes CI-friendly.

Want more #webdev & #performance deep dives?

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

Part 1 of 12 in Live-Verified

3 Comments

1 vote
1
0

More Posts

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

How Lighthouse Performance Scores Are Recorded and Calculated

ApogeeWatcherverified - Aug 18

Core Web Vitals Benchmarks for Shopify Stores (2026 Data)

ApogeeWatcherverified - Sep 16

TypeScript Complexity Has Finally Reached the Point of Total Absurdity

Karol Modelski - Apr 23

Sovereign Intelligence: The Complete 25,000 Word Blueprint (Download)

Pocket Portfolio - Apr 1
chevron_left
4k Points • 84 Badges
Rochelle Park, New Jersey, US • bryanhamilton.info
39Posts
43Comments
37Connections
Full-stack web engineer · PHP & vanilla JS · 25+ years · Founder of The DJ Calendar · Open to work

Related Jobs

Commenters (This Week)

1 comment
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!