Live Verified: My Medal Widget Lied to Me Three Ways. So I Made It Tell the Truth.

Live Verified: My Medal Widget Lied to Me Three Ways. So I Made It Tell the Truth.

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

A debugging story in three acts, ending with a cron job that now does my job for me.


My portfolio homepage has a little medals strip: gold, silver, bronze counts from my Coder Legion profile. Three tiny numbers. A count-up animation, a tooltip, an aria-label. How much trouble can three tiny numbers be?

Three ways. They lied to me three ways.

Lie #1: The scraper undercounted

My live proxy scrapes the profile page and serves the numbers to the browser. One morning it said 51 bronze. The profile said 52. I had shipped a medal count that was wrong in the other direction earlier that week too — the scraper was reading a stale region of the page, so every "live" number it served was actually yesterday's.

Lesson one: a number with a cache in front of it is not a live number. It's a rumor with a timestamp.

Lie #2: The widget lied to itself

The count-up badge has two sources of truth inside one element:

<span class="cl-num-b" data-to="50">49</span>

data-to is where the JavaScript animation stops. The inner text is what no-JS visitors, crawlers, and anyone in the 200ms before the animation runs gets to see. A previous patch had bumped data-to but not the text, so my badge was confidently animating from the wrong number to the right one.

This is the drift that scares me: both values were shipped on purpose, by verified deploys, one day apart. Nobody made a typo. The system just let two fields that must always move together move separately.

So I made it a rule, and put it in my deploy checklist: a count-up's data-to and its inner text are one needle. Patch them as a single unit, and verify the old value is gone — not that the new value is present. "New value exists" passes on a half-patched page.

Lie #3: The typo that survived two deploys

The silver medal tooltip read "1,3 Club". It should have said "1,000 Club". The typo sat there, in plain sight, through two complete medal-sync deploys — patches whose entire job was making those tooltips correct.

Why? Because it was adjacent to text my brain autocorrected. Every verification I did was "does it say 1,000 Club now?" — never "does anything on this line still say 1,3?" My checks were anchored to the change I shipped, so they couldn't see the change I missed.

The fix is boring and it works: character-level residue checks. After every patch, assert the old wrong thing has a count of zero. Not "the new thing is there" — the old thing is gone.

The diagnosis underneath all three

Here's what the medal saga actually was, once I lined up the lies: every one of them lived in a manually-updated static. Scraped by hand, patched by hand, verified by hand. Each patch was careful. The process was still the single point of failure, and I was the process.

So the final deploy of the day didn't fix a number. It removed me.

The stack that ends the saga

Three layers, in the order I trust them:

1. Statics on the page — the count-ups, tooltips, and aria-label as real HTML. Crawlers and no-JS visitors need them. But they're only ever as fresh as the last cron run, and that's fine, because...

2. A cron self-sync — twice a day, a small PHP script fetches my badges page, reads the real tier counts, and patches the statics with the same needle-guarded replaces I was doing by hand. When counts already match, it exits without touching anything (verified idempotent — its first act was a no-op, and I checked). When it does change something, it verifies the old value is gone and logs a receipts row to the public deploy ledger. The machine does the exact chore I kept fumbling, minus the autocorrecting brain.

3. Runtime sync in the browser — a tiny script fetches a cached proxy of the live counts on page load and rewrites the aria-label, tooltips, and count-up targets live. Human visitors get numbers that are minutes old, not hours. This layer exists because a cron is only as fresh as its schedule, and medals don't respect schedules.

The receipts ledger now shows the handoff honestly: medal sync 2/10/51, then medal sync 2/10/52 — auto-sync via cl-sync cron. The last medal patch I will ever make by hand was the second-to-last row.

What I'd tell past me

Three tiny numbers, three classes of lie: a stale source, a drifting pair, an autocorrected typo. Every fix was the same shape — stop trusting what a human re-types and start trusting what the page can prove.

The medal widget still animates when you load the page. It just can't lie to me anymore. Receipts here, deploy ledger on GitHub, and the checklist rules this cost me live in guarded-deploy-workers.

Want more #webdev & #devops deep dives?

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

Part 8 of 9 in Live-Verified

More Posts

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

bryanhamiltondevverified - Nov 15

Cisco's Amy Chang: A Model's "Passport" Doesn't Tell You Where It Actually Came From

Tom Smithverified - Aug 27

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

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

Karol Modelski - Mar 19
chevron_left
3.3k Points • 64 Badges
Rochelle Park, New Jersey, US • bryanhamilton.info
27Posts
35Comments
24Connections
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)

1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!