Introduction

A small release on a large marketing site is a trust problem, not a technical one. The change itself was tiny: navigation labels switched to Title Case. The risk was everything around it — many static pages rebuilt, and no one wants to click through all of them, at four breakpoints, to confirm nothing else moved.

Screenshot regression is the usual answer, and it is expensive: a baseline to maintain, flaky diffs from fonts and animations, and a lot of images nobody actually reads. For a text-and-links change there is a cheaper, more convincing proof: compare the two builds as text, explain every difference with a short “replacement table”, and check that the set of links on every page stayed identical.

The result for this release: every changed fragment was explained by the replacement table, and the link check reported no added, no removed and no missing internal links across all pages.

Build twice, keep both outputs

Check out the commit before the change and build it into one folder; check out the commit with the change and build it into another. Both are plain HTML, which is what makes the rest possible.

Before comparing, normalise what changes on every build anyway: build identifiers, hashed chunk names in script and stylesheet paths, anything with a timestamp. Replace each with a fixed placeholder in both outputs. Without this step every page reports a difference, and the real ones are buried.

Diff fragments, not files — and why a global replace lies

The first instinct is to normalise the old build with a global search-and-replace (“apply the intended change to the old HTML, then diff”). It produces false differences. Short replacements (“strategy” → “Strategy”) also hit words that were never part of the change, and the diff fills up with noise that looks exactly like a real bug.

What works is pairing: split both HTML files into small fragments (break after every > and "), run a line diff, and collect the removed fragments and the added fragments separately. Then map each removed fragment through the replacement table and cancel it against the added side. Whatever survives on either side is a change nobody planned.

import difflib, re
from collections import Counter

REPLACEMENTS = [("About us", "About Us"), ("Our services", "Our Services")]  # the intended change only

def fragments(html):
    return re.split(r'(?<=[>"])', html)

def apply_table(fragment):
    for old, new in REPLACEMENTS:
        fragment = fragment.replace(old, new)
    return fragment

def unexplained(old_html, new_html):
    diff = difflib.ndiff(fragments(old_html), fragments(new_html))
    removed, added = Counter(), Counter()
    for line in diff:
        if line.startswith("- "): removed[apply_table(line[2:])] += 1
        if line.startswith("+ "): added[line[2:]] += 1
    return removed - added, added - removed   # both empty = only the intended change

Two details matter. First, normalise what changes on every build anyway (build IDs, hashed chunk names) before diffing, or every page reports a difference. Second, apply the table to the removed side only; the added side is the truth you are checking against.

The script went through a few iterations before the fragment approach settled — the early versions were the global-replace kind, and their false positives are what taught the lesson above.

A label change should not add, remove or break a single link. That is a separate claim from “the text changed as intended”, and it deserves its own check.

For every page in both builds, collect every href and src. For internal links, confirm the target exists in the build (a file, or a folder with an index). Then compare the two sets per page: links that appear only in the new build, links that appear only in the old one, and links in the new build whose target is missing.

The expected report for a text-only release is three zeros per page. Any other number is either a real problem or a planned change that belongs in the replacement table — and either way it is now a sentence someone can read, not a screenshot someone has to squint at.

Grep the added lines for personal data before you push

The diff already isolates what is new. Before pushing, search only the added fragments for things that should never reach a public build: e-mail addresses, internal hostnames, people’s names, local paths.

Searching only the additions, rather than the whole site, keeps the check fast and keeps it honest: the question is “did this release introduce anything?”, not “has the site ever contained anything?”. The second question is worth asking, but separately, and not as a gate on every release.

What to hand to the reviewer

The proof for the reviewer is one table and three numbers:

  • the replacement table — the intended change, written out;
  • how many files were compared;
  • how many unexplained differences remained (the goal is none);
  • how many link changes the link check found (added / removed / missing — the goal is none).

When all of that is clean, the reviewer has a complete argument that only the intended change happened, in a form they can read in a minute.

Screenshots are still the right tool when the change is visual — layout, line breaks, widths at 375, 768, 1024 and 1440. The point is not to abolish them. It is to stop using them to prove things that text can prove better.

Takeaway

A proof that a release is safe is a short description of the intent plus evidence that nothing outside the intent changed. For text and links, that evidence is a fragment diff explained by a replacement table and a link check that reports zeros — cheaper than a screenshot baseline, and far more convincing to the person who has to sign off.