DEV Community

Tasleem Akhtar (#Ch)
Tasleem Akhtar (#Ch)

Posted on

The one-line audit script that caught our worst bug: URLs serving the wrong tool

TypeScript 7's speed story is great, but this week reminded me that the cheapest correctness wins usually aren't in the compiler — they're in a 40-line script you run after every deploy.

Our bug: a deploy-tree drift meant some tool URLs served a different tool's page. Titles said one thing, canonicals said another, content was a third. 398 pages, no type error, no test failure, no build warning — every layer was individually "green".

The lesson: type systems verify structure, not agreement. Nothing in the build knew that video-merger.html should contain the string "Video Merger". So we taught it:

# audit_site.py — runs after EVERY deploy, blocks the report if it fails
for page in all_live_pages():
    html  = fetch(page.url)
    title = extract(html, "<title>")
    canon = extract(html, 'rel="canonical"')
    h1    = extract(html, "<h1>")
    assert slug_matches(page.url, title, canon, h1)  # 0 tolerance
Enter fullscreen mode Exit fullscreen mode

398 pages, one HTTP sweep, under a minute. First run after the fix: 398 pages | real problems: 0. Before the fix it would have screamed.

Three rules came out of it:

  1. The audit is a gate, not a report. It runs automatically after every deploy; a red audit blocks the "done" claim — no exceptions, no "I'll check tomorrow".
  2. Rebuild from one truth. The drift came from two build outputs disagreeing. Now one generator, one overlay order, disk-truth sitemaps.
  3. Log it in the open. Every task gets a START/DONE entry in a shared AGENT-LOG.md on main — with two agents (human-assisted) working the same repo, an append-only log beat every meeting we never had.

Fast compilers make iteration cheap. A 40-line agreement checker makes deploying cheap. You want both.

(Tools referenced live here: https://toolfyra.com — the audit covers all 398 of them.)

Top comments (0)