Skip to content

docs: redirect gptdiff.255labs.xyz to patchling.app/py/ (off until enabled) - #29

Draft
mikkel wants to merge 3 commits into
mainfrom
docs/gptdiff-redirect-to-patchling-app
Draft

mikkel wants to merge 3 commits into
mainfrom
docs/gptdiff-redirect-to-patchling-app

Conversation

@mikkel

@mikkel mikkel commented Oct 23, 2026

Copy link
Copy Markdown
Member

What

This redirects every page of gptdiff.255labs.xyz to the matching page under https://patchling.app/py/. It's off by default, behind a repository variable.

How gptdiff is served: GitHub Pages. The Deploy Documentation workflow runs actions/deploy-pages and writes public/CNAME. GitHub Pages has no _redirects or server-side redirects. So the deploy job now rewrites the built site into redirect stubs. No Cloudflare or DNS rule is needed.

  • New scripts/gptdiff_redirect_stubs.py public https://patchling.app/py/. It turns every built page into a stub with:

    • <link rel="canonical">;
    • <meta name="robots" content="noindex">;
    • a 0-second meta refresh;
    • location.replace(target + location.search + location.hash), so #anchors survive.

    404.html maps any other request in JS:

    • known pages, with or without a trailing slash or index.html, go to the same path under /py/;
    • unknown paths go to /py/.

    Everything else is removed except CNAME: assets, search index, sitemaps.

  • documentation.yml: a new step after "Ensure CNAME is set", only if vars.GPTDIFF_REDIRECT_TO_PATCHLING_APP == 'true'.

  • The mkdocs source is untouched. patchling.app's build (site: serve patchling-py docs at /py/ and JS docs at /js/ on patchling.app patchling#13) clones this repo and still builds the real docs.

Merge order (don't redirect before /py is live)

  1. site: serve patchling-py docs at /py/ and JS docs at /js/ on patchling.app patchling#13 first: apply its Pages build settings (build command bash scripts/build-site.sh, output dist, PYTHON_VERSION=3.12), then merge. Check that https://patchling.app/py/ and https://patchling.app/py/cli/ load.
  2. This PR can merge any time. Without the variable, the deploy is unchanged and gptdiff keeps serving the real docs.
  3. Switch on: GitHub → 255BITS/patchling-py → Settings → Secrets and variables → Actions → Variables tab → New repository variable. Name GPTDIFF_REDIRECT_TO_PATCHLING_APP, value true. Then Actions → Deploy Documentation → Run workflow on main, or wait for the next push.
  4. Rollback: delete the variable (or set it to anything else) and re-run Deploy Documentation.

#28 (deploy hook) is independent of this PR. Merge order doesn't matter between them.

Tests (local)

  • actionlint 1.7.12 with shellcheck and yamllint on documentation.yml: clean.
  • Offline pytest: 210 passed, 2 skipped, including 3 new tests in tests/test_gptdiff_redirect_stubs.py:
    • path mapping, canonical and meta refresh;
    • the 404.html known list and fallback;
    • only the stubs and CNAME remain.
  • End to end: a real mkdocs build --strict of main (9555eb8) was converted to stubs pointing at a local build of patchling.app (dist/ from Relevance filter: Ember review follow-ups #13). It was served by a server that behaves like GitHub Pages (404.html for unknown paths, /dir → /dir/), and Chromium followed the redirects. All 10 cases landed on the right page:
    • / → /py/
    • /cli, /cli/ and /cli/index.html → /py/cli/
    • /cli/#environment-variables → /py/cli/#environment-variables
    • /api/?q=1#smartapply → /py/api/#smartapply (mkdocs-material's search consumes ?q= on arrival)
    • /examples/basic → /py/examples/basic/
    • /quickstart/index.html#install → /py/quickstart/#install
    • /no/such/page/ → /py/

Search engines see real 404s with a JS and meta redirect, and 200 stubs with rel=canonical plus noindex. A true HTTP 301 would need a Cloudflare redirect rule on 255labs.xyz, if that zone is proxied; this PR changes nothing there.

This branch has not been deployed

No deployments
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