Skip to content

fix(build): drop _redirects from the Ladle build the design Worker deploys - #295

Merged
Ardnived merged 1 commit into
mainfrom
fix/ladle-worker-redirects
Oct 13, 2026
Merged

Ardnived merged 1 commit into
mainfrom
fix/ladle-worker-redirects

Conversation

@Ardnived

Copy link
Copy Markdown
Contributor

Summary

Found while doing #279's attended phase. The first wrangler deploy --config wrangler.design.jsonc failed:

Invalid _redirects configuration:
Line 7: Infinite loop detected in this rule. [code: 100324]

#294 assumed the Worker ignores _redirects. It doesn't: Workers static assets parse it, and the API rejects the Pages SPA rule /* /index.html 200. The Worker already gets that behaviour from assets.not_found_handling, so ladle:build now deletes the file from build/. dist/ and the Pages app are untouched, and public/_redirects's rule is byte-identical (only its comment grew).

check:wrangler can't catch this, because the validation is server-side, so the docs now say so.

Verification

  • pnpm ladle:build → no build/_redirects; _headers and robots.txt still there; pnpm check:wrangler green.
  • A manual wrangler deploy of build/ without the file succeeded, and https://sahajatlas-design.contact-c66.workers.dev serves /, /robots.txt, a deep link and a hashed asset with ACAO *, x-robots-tag: noindex and the expected Cache-Control.
  • vitest run scripts — 99 passed.

Refs #279

🤖 Generated with Claude Code

…ploys

Workers static assets read `_redirects` after all, and the Workers API
rejects `/* /index.html 200` as an infinite loop (code 100324), so the
first `wrangler deploy` of `sahajatlas-design` failed outright. The
Worker already gets the SPA fallback from `not_found_handling`, so
`ladle:build` now deletes the file from `build/`. `check:wrangler`
could not see it: the check runs server-side, past the dry run.

Corrects the docs that said the Worker ignores the file. #279.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying sahajatlas with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5978d99
Status: ✅  Deploy successful!
Preview URL: https://a60201c1.sahajatlas.pages.dev
Branch Preview URL: https://fix-ladle-worker-redirects.sahajatlas.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

@Ardnived
Ardnived merged commit 498b6ff into main Oct 13, 2026
11 checks passed
@Ardnived
Ardnived deleted the fix/ladle-worker-redirects branch October 13, 2026 15:56
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Oct 13, 2026
Ardnived added a commit that referenced this pull request Oct 13, 2026
…ement (#296)

Measured during #279's attended phase:

- The Workers build image honoured .node-version and packageManager
  (nodejs 22.17.0, pnpm 9.15.0), so AGENTS.md's "unverified" goes.
- Workers Builds branch rules refuse prefix wildcards (12002), so
  gh-readonly-queue/* and mockup/* cannot be excluded as on Pages.
- Smoke against design.sahajatlas.com on the Worker: 10 of 17 fail,
  replacing the owed re-run in docs/testing.md.
- robots.txt no longer claims _redirects ships beside it; the Ladle
  build drops that file since #295. This also gives the Worker a
  second, observable production deploy for #266's gate.

Co-authored-by: Claude Opus 5.5 <[email protected]>
sydevs-bot pushed a commit that referenced this pull request Oct 14, 2026
`main` answered this branch's open question while it sat conflicted. #295
measured what I had only narrowed: a Worker reads `_redirects`, and the
Workers API rejects `/*  /index.html  200` as an infinite loop (100324),
so the deploy fails outright rather than shadowing assets. #296 then
measured the first build — the image honours `.node-version` and
`packageManager`, and branch rules refuse prefix wildcards (12002).

Conflicts, both in the half this branch and `main` each rewrote:

- `package.json` — took `main`'s `ladle:build` with its `rm -f`, kept this
  branch's two-config `check:wrangler`.
- `AGENTS.md` § Deployment — took `main`'s measured text wholesale and
  dropped my hedged version of the same facts, then added only what is the
  app's: that `dist/` cannot be cleaned by `pnpm build`.

That last point is the one new thing here. `main` says the app's Worker
move "must drop the line rather than ship it", and `ladle:build` shows the
shape — but `dist/` is not `build/`: the Pages project serving
sahajatlas.com deploys that same directory and needs the splat. So the
deletion cannot live in `pnpm build`. `build:worker` is `build` plus the
same `rm -f`, and it, not `build`, is the app Worker's Builds command.

Verified: `pnpm build` leaves `dist/_redirects` in place, `pnpm
build:worker` removes it. `check:wrangler` cannot catch a regression —
the dry run never reaches the API that rejects the file — so the spec
pins each config to the script that fills its directory, and pins
`pnpm build` as free of the deletion. All three watched fail.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GWfwsqh3etS8AgAGQRFp5s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant