ci: fail when routing artifacts drift from content/blog - #272
Merged
Merged
Conversation
scripts/generate-redirects.mjs writes public/_redirects, public/_worker.js, public/_routes.json and vercel.json. prebuild regenerates all four during every Pages build, so a stale committed copy never breaks the live site -- which is precisely why the drift is invisible. It went unnoticed twice: #268 was missing from all four files, and #266 was missing from _worker.js (the file that actually holds BLOG_SLUGS and does the routing on Cloudflare). Both were only found by regenerating and diffing by hand. This regenerates in CI and fails if the tree changes, with a message naming the fix. Verified both ways: no diff on current main, and adding one post to content/blog trips it (203 -> 204 slugs). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Deploying website with
|
| Latest commit: |
a893abb
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3b7ec121.website-dab.pages.dev |
| Branch Preview URL: | https://ci-routing-artifact-drift-gu.website-dab.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #271, which fixed the drift by hand. This stops it recurring.
The problem
scripts/generate-redirects.mjswrites four files:public/_redirects,public/_worker.js,public/_routes.json,vercel.json.prebuildregenerates all four during every Pages build, so a stale committed copy never breaks the live site. That is exactly what makes the drift invisible — there is no symptom to notice.It slipped through twice:
kubernetes-observability-in-2026-with-openobserve(#268)inside-kueue-how-kubernetes-decides-what-runs-next(#266)_worker.js_worker.jsis the one that matters most — it holdsBLOG_SLUGSand does the actual routing on Cloudflare ("Pages picks_worker.jsover_redirectswhen both exist"). Both omissions were only found by regenerating and diffing by hand.The guard
One step in
Node.js CI, afternpm ciand beforenpm run build: regenerate, and fail if the tree changed.Fails fast, before the build, and names the fix in the error.
Verified both directions
A guard that cannot fail is worthless, so I checked it actually trips:
git diff --quietover the four paths exits clean on0629337.content/blogtakes it 203 → 204 slugs and the guard reports DIRTY. Simulation cleaned up afterwards; this PR touches only the workflow.This PR's own CI run exercises the new step.
Why not
.gitignoreinsteadvercel.jsonis read by the Vercel platform before the build runs, so it has to stay committed. Once one of the four must be tracked, keeping all four consistent and checked is simpler than splitting the rules.🤖 Generated with Claude Code