From b135cb5f5e90bc661fa83f08835c8899b9cc2ccc Mon Sep 17 00:00:00 2001 From: BenStullsBets Date: Tue, 30 Jun 2026 15:02:29 -0700 Subject: [PATCH] fix(deploy): redirect the bare legacy root too (/* splat misses the empty case) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add an explicit /human-experience-simulator/ → /human-machine-strata/ 301 (the subpath splat doesn't match the trailing-slash root). Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/test_build_static.py | 1 + tools/build_static.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/tests/test_build_static.py b/tests/test_build_static.py index b798044..9f354a3 100644 --- a/tests/test_build_static.py +++ b/tests/test_build_static.py @@ -29,6 +29,7 @@ def test_build_emits_frontend_baked_json_and_only_referenced_media(tmp_path): redirects = (out / "_redirects").read_text() assert "/ /human-machine-strata/ 308" in redirects assert "/human-machine-strata /human-machine-strata/ 308" in redirects + assert "/human-experience-simulator/ /human-machine-strata/ 301" in redirects assert "/human-experience-simulator/* /human-machine-strata/:splat 301" in redirects # baked JSON matches the API shape diff --git a/tools/build_static.py b/tools/build_static.py index 4c8065b..3a4db51 100644 --- a/tools/build_static.py +++ b/tools/build_static.py @@ -73,6 +73,10 @@ def _write_redirects(out: Path, seg: str) -> None: f"/{seg} /{seg}/ 308\n", ] if LEGACY_APP_PATH and LEGACY_APP_PATH != seg: + # Exact root (trailing slash) first — the `/*` splat does NOT match the empty + # case, so the bare /legacy/ needs its own rule. Then the splat for subpaths, + # then the no-trailing-slash form. + lines.append(f"/{LEGACY_APP_PATH}/ /{seg}/ 301\n") lines.append(f"/{LEGACY_APP_PATH}/* /{seg}/:splat 301\n") lines.append(f"/{LEGACY_APP_PATH} /{seg}/ 301\n") (out / "_redirects").write_text("".join(lines))