One price row changed nine pages: put a page budget in front of your static deploy
One price row changed nine pages: put a page budget in front of your static deploy On 19 November a single row in prices.json — one model's input and output price — reached the build for a 137-page static site. The pre
One price row changed nine pages: put a page budget in front of your static deploy
On 19 November a single row in prices.json — one model's input and output price — reached the build for a 137-page static site. The pre-deploy gate stopped the upload with a number I did not expect:
9 pages differ from live (1 content, 8 volatile), limit is 3
One row in, nine URLs out. One of those nine was the updates feed, which had a real change worth shipping. The other eight had a new dateModified, a new "last checked" date, and a "completed checks" counter that had gone from 61 to 62.
The price did not change on those eight pages. The generator just touched them.
How a page changes without changing
The site is a static build: a Python script reads several JSON files and emits an HTML string per route; the Worker serves those strings from a bundle. Every page embeds a few build-time values:
- a
dateModifiedin the JSON-LD block - a visible "last checked 2026-11-18" line
- a "61 completed checks" counter in the footer
Any of those values makes a page "new" to your diff, your sitemap lastmod, and your deploy. When a shared value like the top-level updated date moves, every page's string moves with it, even if 130 of them are identical in content.
You can tell yourself the file changed because the build wrote it. That is the thing you want the gate to decide for you.
The wrong comparison
My first version of the check fetched live pages with curl and diffed them against the build output. Six pages compared, six pages different. I was one step away from holding every deploy forever.
The reason: the served HTML is not the HTML in the bundle. The response has an injected script tag, and server-side code strips the ad slot div before sending. Compare served output to build output and you get a diff on nearly every page, in the same two places.
The fix was to compare against the exact artifact I upload. This deploy injects two string maps into a Worker bundle — HTML (route to page HTML) and FILES. I extract the live maps from the running bundle.js, extract the build maps from the new build, and compare route by route. Same input type on both sides, so a diff means the page really differs.
One night's run, after the fix: 147 mapped pages, 142 byte-identical, 5 differing only in a date and a counter, 0 differing in content. The scary reading was gone. The old check had been measuring two different objects.
Three outcomes, one counter
The classifier normalises the values that change without content, then compares:
VOLATILE = [
(re.compile(r"\bchecked \d{4}-\d{2}-\d{2}\b"), "checked <DATE>"),
(re.compile(r"\b\d+ completed checks\b"), "<N> completed checks"),
(re.compile(r"\b\d{4}-\d{2}-\d{2}\b"), "<DATE>"),
]
def classify(live_html, build_html):
if live_html == build_html:
return "identical"
if normalize(live_html) == normalize(build_html):
return "volatile" # dates, counters, check counts only
return "content" # text, prices, markup
Two details matter more than the regex list.
The first is that volatile is not "safe". It still costs a deploy, a new sitemap date, and a recrawl of a page that says the same thing. On a site with 137 URLs and few inbound links, that cost is real: the sitemap says "everything changed today", which is another way of saying the sitemap says nothing.
The second is that normalisation must not hide the numbers you sell. The regex list for this site covers dates and counters, not prices. A price difference is a content difference by construction, because prices are the product.
The gate
The deploy script now runs the diff as a dry run and refuses to continue unless all of these hold:
- every changed page is classified
- no page has a content diff unless each one was reviewed and the run passes an explicit allow flag
- no new routes and no missing routes
- changed pages are within the current page budget — 3 per round while the site is in a quiet period
The budget is the part I would keep even without a freeze. A deploy that touches 9 pages when you meant to touch 1 is a bug in the generator, not a feature of the deploy. Without the counter, you find out from Search Console six weeks later.
Output of a blocked round looks like this:
same 138, volatile 0, content 1; new pages 0, missing pages 0
BLOCK: 1 page has content diffs (/ai-api-updates); review and pass --allow-content-diffs
That is a gate that can be argued with. The alternative, "looks fine to me", cannot.
What this does not do
It does not tell you whether a page is worth indexing. A site can pass this gate every day and still have most of its 137 URLs unindexed, which is where this one is. Page-level quality, duplicate clusters, and internal links are separate checks with separate numbers.
It does not see client-side changes. If your HTML string is identical but your JS bundle rewrote the page at runtime, this check reports identical. Compare the bundle too if your site renders on the client.
It assumes the build is deterministic. Any random ID, timestamp, or unordered JSON serialisation in the output will show up as content on every page and make the gate useless. Sort your keys first.
Checklist if you want to copy this
- Compare build output against the artifact you deploy, not against HTTP responses.
- Normalise dates and counters, and nothing else.
- Count changed pages, and set a budget for a normal change.
- Fail on new and missing routes as loudly as on content diffs.
- Keep the diff output next to the deploy record, so "what did this deployment touch" has an answer in a file.
The price site this came from is AI API Cost Calc. The gate is about 120 lines of Python that run before upload, and it has blocked more deployments than it has allowed — which is the point.
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.