Skip to content

dev: diff a preview deployment against production - #2011

Draft
marcleblanc2 wants to merge 1 commit into
mainfrom
marc/dev/diff-deployments
Draft

marcleblanc2 wants to merge 1 commit into
mainfrom
marc/dev/diff-deployments

Conversation

@marcleblanc2

Copy link
Copy Markdown
Contributor

What

Adds dev/diff-deployments.mjs, a script that fetches every page from a Vercel preview deployment and from production (https://sourcegraph.com/docs by default), normalizes the HTML, and reports which pages differ. Documented in AGENTS.md.

node dev/diff-deployments.mjs --site https://<preview>.vercel.app/docs
node dev/diff-deployments.mjs --site <url> --pages /admin,/cli --limit 50 --concurrency 6

How it works

  • Enumerates the union of both sitemaps, plus /robots.txt, /sitemap.xml, /api/versions, /api/releases, and a known-404 page.
  • Strips noise that differs between any two deployments: <script> tags (RSC payload), data-dpl-id, Turbopack chunk hashes, the Cloudflare cdn-cgi anchor, sitemap <lastmod>. Sitemap <url> blocks are sorted.
  • Strips the /docs basePath only when the two sites serve under different basePaths; when both serve under /docs, a missing prefix is a real bug and is reported.
  • Node builtins + OS diff -u; no new dependencies.
  • Prints a summary; writes the combined unified diff to logs/diff-deployments-<timestamp>.diff when pages differ. Exits 1 on any difference or fetch failure.

Worked example

Run against the preview for #1997 (rebased on main + #1977): 504 identical, 3 differ, 0 failed. All three differences come from #1977's root-relative <img> fix (/sourcegraph-mark.svg/docs/sourcegraph-mark.svg on /integration/browser-extension and /self-hosted/deploy; /aws-ami-marketplace.png/docs/aws-ami-marketplace.png on /self-hosted/deploy/machine-images/aws-ami). The root-relative paths 404 on prod today and the /docs/ ones return 200, so those are fixes. #1997's own commits change nothing in rendered HTML.

An earlier run against the pre-rebase preview flagged 501 pages, all explained by the branch lacking #2001 (per-page canonical) and #1975 (lazy-load images), which confirms the normalizer does not hide <head> or attribute changes.

Fetches every sitemap page from both sites, strips build ids, chunk hashes,
the RSC payload and (when they differ) the basePath, and writes a unified
diff of the pages that still differ to logs/.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0b2e2-a101-7132-b956-da8493ee40b5
Co-authored-by: Amp <amp@ampcode.com>
@vercel

vercel Bot commented Sep 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
sourcegraph-docs Ready Ready Preview Sep 18, 2026 5:21am UTC

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Spell check found 1 issue(s) in this PR

Only findings on lines added by this PR, and in its title and description, are shown.

Pull request description

  • line 13, column 171
    • lastmodlsmod

Please correct the spelling, or add words which are correct to cspell-allow-list.txt.

Run npx cspell@10 --no-progress --dot '**/*' locally to check the full repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant