Repository navigation
Generate the preview index and redirects.json in one script - #162
Conversation
generate-preview-root.py replaces generate-preview-index.sh. Besides index.html, it now writes redirects.json at the preview root, for the Cloudflare redirects sync Worker: every pr-NNN preview's redirects.json moved under its directory, with 302s, in the form Cloudflare's replace-list-items call takes, so the Worker can load it as is. Its first item records the revision: preview.wafer.space/revision redirects to the site commit that wrote it, and its comment is git describe for the preview repository commit that holds it, so the numbers only go up. It builds both files and only then writes them, so a failure leaves the previous pair in place. The workflows run it from the site checkout, with the template next to it, instead of copying the script and the template into the preview repository, and pass the site commit in PREVIEW_SOURCE_COMMIT. Against the current preview repository, index.html differs from the shell script's only where that showed a plain pr-NNN directory as "PR #NNN: pr NNN": it replaced the dashes before checking for a title, so the check never matched. Those now read "PR #NNN Preview", as intended. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018aHXTpnku3VjT9FFpoBEuy
|
📋 Previous verification results (archived) Click to view archived verification results from 2026-10-24T07:35:04.000Z❌ Preview Site Verification FAILEDPreview Site Verification ReportPR: #162 1. Basic Connectivity ✅
2. Content Verification
3. Multi-Page Asset VerificationDiscovering all pages in the site...
4. Link and Asset Verification (muffet)Running comprehensive muffet validation...
Summary: 0 Linked sites with invalid TLS certificates (warning only):
5. Performance Check
6. Mobile Responsiveness
Summary❌ Some verification checks failed 🔍 Automated verification • Run ID: 40074303422 • 2026-10-24T07:35:03.442Z ⏰ This verification result has been archived by Run ID: 40074303422 • A newer verification is available below |
|
📋 Previous verification results (archived) Click to view archived verification results from 2026-10-24T07:37:18.000Z❌ Preview Site Verification FAILEDPreview Site Verification ReportPR: #162 1. Basic Connectivity ✅
2. Content Verification
3. Multi-Page Asset VerificationDiscovering all pages in the site...
4. Link and Asset Verification (muffet)Running comprehensive muffet validation...
Summary: 0 Linked sites with invalid TLS certificates (warning only):
5. Performance Check
6. Mobile Responsiveness
Summary❌ Some verification checks failed 🔍 Automated verification • Run ID: 40074303422 • 2026-10-24T07:37:18.174Z ⏰ This verification result has been archived by Run ID: 40074303422 • A newer verification is available below |
🚀 Preview Deployment Ready!
This preview will be automatically updated when you push new commits to this PR. Browse all previews: https://preview.wafer.space ⚡ Deployed to custom domain • Preview will be removed when PR is closed |
|
📋 Previous verification results (archived) Click to view archived verification results from 2026-10-24T07:59:22.000Z❌ Preview Site Verification FAILEDPreview Site Verification ReportPR: #162 1. Basic Connectivity ✅
2. Content Verification
3. Multi-Page Asset VerificationDiscovering all pages in the site...
4. Link and Asset Verification (muffet)Running comprehensive muffet validation...
Summary: 0 Linked sites with invalid TLS certificates (warning only):
5. Performance Check
6. Mobile Responsiveness
Summary❌ Some verification checks failed 🔍 Automated verification • Run ID: 40074303422 • 2026-10-24T07:59:21.954Z ⏰ This verification result has been archived by Run ID: 40077616424 • A newer verification is available below |
The preview list is loaded into Cloudflare as one replace call, so a single bad entry from one pull request's redirects.json could stop every preview's redirects loading. Entries now keep only the fields this sets (source, target, status and the preserve flags), need an absolute http(s) target, and a source already seen in that preview is skipped. The preview's own wafer.space/revision item, which only describes that preview, is left out, and a comment is kept only if it's a string. Both files now cover the same previews: a pr-NNN directory without an index.html, or with a number out of range, no longer adds redirects. They're listed in PR number order rather than as strings, and an empty index shows its "No active PR previews" message by un-hiding it, as the inserted script ran before the element it looked for existed. A failing git describe now prints git's error, and the docstring says when the revision numbers only go up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018aHXTpnku3VjT9FFpoBEuy
The generator writes the preview site's shared index.html and redirects.json, and the latter now feeds a Cloudflare list, where a revision number that jumps ahead would stop later lists loading. Preview deploys now run the base branch's copy of the script and its template rather than the pull request's, falling back to the pull request's only while the base branch doesn't have the script yet. The shell script and template copy that deploys used to commit to the preview repository root are deleted on the next deploy or cleanup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018aHXTpnku3VjT9FFpoBEuy
|
| Status | Preview URL | Issue |
|---|---|---|
| 🟡 Partial | View Preview | Git commit hash verification failed - deployment may be outdated |
The preview has been deployed but content verification is incomplete. The site may still be propagating or there may be loading issues.
Manual verification recommended: https://preview.wafer.space/pr-162/
⚡ Deployed to custom domain • Preview will be removed when PR is closed
❌ Preview Site Verification FAILEDPreview Site Verification ReportPR: #162 1. Basic Connectivity ✅
2. Content Verification
3. Multi-Page Asset VerificationDiscovering all pages in the site...
4. Link and Asset Verification (muffet)Running comprehensive muffet validation...
Summary: 0 Linked sites with invalid TLS certificates (warning only):
5. Performance Check
6. Mobile Responsiveness
Summary❌ Some verification checks failed 🔍 Automated verification • Run ID: 40077616424 • 2026-10-24T08:27:59.867Z |
Summary
First step of the Cloudflare redirects sync for previews. The redirects Worker loads the
preview_wafer_spaceBulk Redirect list fromhttps://preview.wafer.space/redirects.json, and nothing writes that file yet. This PR has every preview deploy and cleanup write it, together with the index page, from one script. It doesn't call the Worker: the Worker's cron loads the file every five minutes..github/scripts/generate-preview-root.pyreplacesgenerate-preview-index.sh. It buildsindex.htmlandredirects.jsonand only then writes both, so a failure leaves the previous pair in place.pr-preview.ymlandcleanup-previews.ymlrun it from the site checkout, with the template next to it, instead of copying the script and the template into the preview repository. They pass the site commit inPREVIEW_SOURCE_COMMIT.redirects.json. Everypr-NNN/redirects.json(from the redirect list plugin in List every redirect for Cloudflare Bulk Redirects, with its revision #157) moved under its preview:wafer.space/<path>becomespreview.wafer.space/pr-NNN/<path>, targets onhttps://wafer.spacefollow it, and the status becomes 302. Its first item is the revision the Worker requires:preview.wafer.space/revision→ the site commit, with a comment ofgit describefor the preview repository commit that will hold the file, so the numbers only go up. The preview repository's first commit is taggedv0.0. Malformed entries are skipped with a warning.pr-NNNdirectory as "PR #NNN: pr NNN", because it replaced the dashes before checking for a title. Those now read "PR #NNN Preview", as intended.Testing
Against a clone of the preview repository, compared with the old shell script plus the redirects generator from #158:
redirects.jsonis byte for byte the same. It starts with the revision item, followed by the lists of the two previews that have one (fix: website page organisation #126 and List every redirect for Cloudflare Bulk Redirects, with its revision #157).index.htmlis the same apart from the title fix above.This PR's own preview deploy runs the new script, so it writes the first
https://preview.wafer.space/redirects.json.🤖 Generated with Claude Code
https://claude.ai/code/session_018aHXTpnku3VjT9FFpoBEuy