Skip to content

chore(build): move the Ladle playground to Cloudflare Workers #279

Closed

Description

@sydevs-bot

Summary

design.sahajatlas.com is served by the Cloudflare Pages project sahajatlas-design,
built from this repo by pnpm ladle:build into build/. Move it to Cloudflare Workers
static assets
and delete the Pages project once the replacement is verified working.
Nothing embeds this address, so it is the cheapest place to learn how a Workers move
behaves — and three facts that only a live Worker can settle are read off it here, before
any sibling move is started.

Goal context

Child 1 of 5 of #266, and its deliberate rehearsal. It produces the
three live findings the later children are planned against, the public/_headers ACAO rule
sydevs/SahajCloud#913 depends on, and the branch_excludes recipe the We Meditate library
move reuses.

Approach

Repo-side (this is the PR)

1. A wrangler config for the design Worker. The repo has none today (verified: no
wrangler* file at any depth). Two Workers will eventually build from this one repo, so
give this one a distinct filename — wrangler.design.jsonc — and name the Worker
sahajatlas-design, which keeps continuity with the Pages project name, public/robots.txt:3
and the docs, and stays tellable from the app's future sahajatlas Worker.

  • assets-only: no main
  • assets.directory = build (pnpm ladle:build is ladle build && pnpm assert:maps ../build;
    scripts/assert-no-sourcemaps.mjs:36-38 records build/ as this target's output)
  • assets.not_found_handling = "single-page-application"
  • preview_urls: true
  • a previews block even if empty — cloudflare/wrangler-action throws without one
    (Preview checks build on GitHub Actions SahajCloud#903's Technical notes, ensure-config.ts:167,212). Confirm the exact key
    against the Workers configuration docs through the cloudflare-docs MCP before writing it;
    child 4 is what actually needs it.

⚠ The Worker's preview host is <preview>-<worker>.<subdomain>.workers.dev. sahajatlas-design
therefore contains sahajatlas as a prefix, exactly as the two Pages projects do today. A later
check must match the worker-name label segment, not a domain suffix —
scripts/get-cloudflare-preview-url.test.ts:49-55 already pins that boundary for the Pages
shape. Record the constraint for child 4; do not rename to work around it.

2. Add wrangler as a devDependency. None today (checked package.json and
pnpm-lock.yaml). 4.149.0 is current; 4.135.0 is the floor for wrangler preview delete,
which finding 2 below needs, and Workers Builds uses the Wrangler version in package.json.

3. public/_headers — ask for ACAO deliberately. Workers static assets add no
Access-Control-Allow-Origin; their only defaults are Content-Type, Cache-Control, ETag
and CF-Cache-Status. Pages adds ACAO * to every asset, which is why
design.sahajatlas.com/robots.txt carries it today although public/_headers pins ACAO on only
three patterns: /assets/* (:15), /auto.js (:36), /embed.js (:40).
sydevs/SahajCloud#913 depends on a library's assets being readable cross-origin.

⚠ Do not simply add ACAO to the existing /* block. public/_headers:55-57 records that
the platform applies every matching rule and joins repeated values with a comma, so a second
ACAO rule would serve Access-Control-Allow-Origin: *, * on /assets/*, /auto.js and
/embed.js — an invalid value that breaks the #91 font case. The invariant to hold is that
exactly one ACAO rule matches any given path: lift the header to one site-wide rule and leave
the three existing blocks their Cache-Control only. tests/smoke/cache-headers.smoke.test.ts:63-71
asserts access-control-allow-origin === '*' exactly, so a comma-joined value fails a live spec
rather than shipping.

⚠ public/_headers is copied into both build outputs (AGENTS.md:293-295), so whatever you
write also reaches the Pages app. Pin today's behaviour, do not widen it — Pages already
serves ACAO * on every asset, so making it explicit changes no observable behaviour on
sahajatlas.com. Say in the file's comment why the rule exists: it is a Pages default that
Workers does not provide, and a rendering requirement rather than a nicety.

4. ⚠ Do not delete public/_redirects:7 (/* /index.html 200) in this ticket. That file
is shared by both build outputs and sahajatlas.com is still on Pages and depends on it
(tests/smoke/spa-fallback.smoke.test.ts). Instead measure on the live design Worker whether
a _redirects splat suppresses public/_headers's /* X-Robots-Tag: noindex on a rewritten
deep link — redirects run before headers on Workers — and record the result. Child 5 deletes the
line.

5. The sahajatlas-design doc sweep. Rewrite in the past tense. The full inventory, verified
at c4b6b8a:

File:line What it says now
AGENTS.md:65 the Deploy table row, "Cloudflare Pages — sahajatlas (app) plus sahajatlas-design (Ladle)"
AGENTS.md:269-280 "Two Cloudflare Pages projects … both on the current Node 22 build image", the two bullets, and "there is no wrangler config or _routes.json" — which this PR falsifies
AGENTS.md:293-295 public/ copied into both outputs, "so all three files also govern sahajatlas-design"
AGENTS.md:333 "Use the cloudflare-docs MCP for Cloudflare Pages questions"
docs/architecture.md:106-115 "two Cloudflare Pages projects", and "The repo carries no wrangler config and no _routes.json"
docs/testing.md:219-220 the 16-spec non-vacuity measurement, recorded against sahajatlas-design.pages.dev — the address this ticket deletes
docs/environment.md:81-84 "sahajatlas-design (the Ladle playground): do NOT add them"
docs/mcp-setup.md:29-32 "This app deploys to Cloudflare Pages (projects sahajatlas and sahajatlas-design)"
README.md:184-187 "Two Cloudflare Pages projects build from this repo"
public/robots.txt:3, :31 the shared-policy note, and the runbook line naming sahajatlas-design.pages.dev
scripts/assert-no-sourcemaps.mjs:34-38 "This repo ships two Cloudflare Pages projects"
scripts/get-cloudflare-preview-url.mjs:84-88, :237-240 the sibling sahajatlas-design Pages check run used as corroborating timing evidence, and the slug comment that tells our run from it. That check run stops existing when the Pages project is deleted

scripts/get-cloudflare-preview-url.test.ts:55, :247, :328 name the string
sahajatlas-design.pages.dev as pinned test fixtures (the refused sibling, the hostname
boundary). They are literals under test, not claims about live infrastructure, so they stay —
account for them explicitly rather than editing them.

docs/rules/code-comments.md forbids dropping a ⚠ line, a #NNN breadcrumb or a cross-repo
pointer. Compress; do not clear-cut.

Attended (Cloudflare dashboard, DNS, or the Cloudflare API)

No cloud run can perform any of these. A run that picks this ticket up does the repo-side
phase, opens the PR, and hands back with this list.

  • Create the Worker, connect the repo, build command pnpm ladle:build, output build/,
    the wrangler config path. This project carries no build-time variables (both design
    projects have none, and vars in a wrangler config is runtime-only). Read the first build
    log for the Node and pnpm it actually used
    : .node-version is 22.17.0 and package.json:6
    pins [email protected], while the Workers build image defaults to Node 24.18.0 and pnpm 10.11.1,
    and whether it honours .node-version is undocumented. AGENTS.md:269-270 currently claims
    both projects run "on the current Node 22 build image" — the log is what replaces that claim.
  • Keep preview builds on, and set branch_excludes / path_includes on the Builds trigger
    through POST/PATCH /accounts/{id}/builds/triggers. The dashboard cannot express either —
    it offers only a production branch. Read today's watch paths off the sahajatlas-design
    Pages project before deleting it (the Cloudflare dashboard holds them, not this repo), mirror
    them, and exclude gh-readonly-queue/*. Switching previews off altogether is explicitly refused
    by Our Cloudflare Pages sites move to Cloudflare Workers, at no extra cost #266 — it would re-create the We Meditate check's silent green that child
    2 exists to close.
  • The rollback drill, with clock times. Write down the single action that puts the address
    back, perform it, confirm the old site answers again, then move the address forward a second
    time. All three steps recorded with their times.
  • Move the address, run Our Cloudflare Pages sites move to Cloudflare Workers, at no extra cost #266's four-part "verified working" gate, then
    delete the Pages project. ⚠ Take the hostname off Pages and confirm it gone first:
    otherwise deleting the project takes the DNS record the new site depends on, and the address
    goes dark on the day it was declared working.

Interfaces

Provides

  • The three live findings below, which children 2, 3 and 4 are planned against.
  • The public/_headers ACAO rule design.sydevelopers.com shows every project's component library in one place SahajCloud#913 depends on.
  • The _redirects-versus-not_found_handling measurement child 5 acts on.
  • The branch_excludes recipe child 2 reuses, and the watch-path list read off the Pages project
    before it is deleted.
  • The re-measured 16-spec non-vacuity number, which docs/testing.md:219-220 loses its subject
    for the moment this ticket deletes sahajatlas-design.pages.dev.

Consumes nothing. This is the first child.

Phases

  1. Repo-side, one PR: the wrangler config, the wrangler devDependency, the public/_headers
    ACAO rule, and the doc sweep. Pushable and reviewable on its own — it changes no live site,
    because no Worker exists yet.
  2. Attended Cloudflare work, in the order listed above: create the Worker and read the first
    build log → the Builds trigger API call → the three findings and the two measurements → the
    rollback drill → the address move and the four-part gate → delete the Pages project. A run
    stops after phase 1 and hands this list back.

Acceptance criteria

Repo-side

  • wrangler.design.jsonc exists: no main, assets.directory = build,
    assets.not_found_handling = "single-page-application", preview_urls: true, a
    previews block, and the Worker named sahajatlas-design.
  • wrangler is a devDependency at 4.149.0 or later (floor 4.135.0).
  • public/_headers serves Access-Control-Allow-Origin: * for every path, and exactly one
    ACAO rule matches any given path — no path can receive a comma-joined value.
  • public/_redirects is byte-identical to main.
  • Every sahajatlas-design occurrence in the repo is either rewritten in the past tense or
    accounted for as a pinned test fixture. The inventory above is the closed list.
  • AGENTS.md and docs/architecture.md no longer claim this repo carries no wrangler
    config, and no longer describe two Cloudflare Pages projects.
  • docs/testing.md:219-220 cites the re-measured number against design.sahajatlas.com
    rather than an address that no longer exists.
  • No ⚠ line, #NNN breadcrumb or cross-repo pointer was deleted by the sweep.
  • No file under .claude/ was written.

The findings this ticket exists to produce — each written into
#266's Technical notes block

  • 1. Cloudflare's own name for a Workers build check run, and whether Workers Builds
    posts one to GitHub at all.
    .github/workflows/production-smoke.yml:15-16 is triggered by
    check_run: [completed] and nothing else bar workflow_dispatch, so if none is posted that
    lane has no automatic trigger and child 4 needs a different one. Record also whether the
    name identifies which Worker built
    : :40 tells the app's Pages build from the playground's
    by the name alone, so a name that does not carry the Worker's would let a design deploy fire
    the atlas production lane once child 4 rewrites that filter.
  • 2. Whether a preview of an assets-only Worker can be created and then taken down
    (npx wrangler preview delete --name <preview>), and that its address then shows nothing.
    The whole build order rests on this: Maintainers can mock up a goal's new screens with Claude, from the components we already have SahajCloud#910's promise that a mockup can be
    removed depends on it.
  • 3. Whether a Worker route can sit in front of a live Pages CNAME, or whether the
    hostname must come off Pages first and the address go dark in between.
  • The _redirects measurement: whether a _redirects splat suppresses
    public/_headers's /* X-Robots-Tag: noindex on a rewritten deep link on Workers.
  • The non-vacuity measurement, taken BEFORE the Pages project is deleted: the number of
    this repo's 16 live-site smoke specs that fail against the new design.sahajatlas.com,
    written into both Our Cloudflare Pages sites move to Cloudflare Workers, at no extra cost #266 and docs/testing.md.

Attended, performed by a person

  • The Worker builds from this repo with pnpm ladle:build into build/, and the first build
    log's Node and pnpm versions are written into Our Cloudflare Pages sites move to Cloudflare Workers, at no extra cost #266.
  • Preview builds are still on, and branch_excludes / path_includes are set through the
    Builds trigger API, mirroring the Pages watch paths and excluding gh-readonly-queue/*.
    A push to a branch the rules exclude starts no build.
  • The rollback drill was performed, and the single rollback action, the old site answering
    again, and the second forward move are all recorded with clock times.
  • design.sahajatlas.com opens its component list in a browser, with readable text in
    Raleway rather than a fallback font.
  • The hostname was removed from the Pages project and confirmed gone before the project
    was deleted, and the Worker holds the address in its own right.
  • The sahajatlas-design Pages project is deleted, and it is recorded in
    Our Cloudflare Pages sites move to Cloudflare Workers, at no extra cost #266 that there is now no way back other than building a site from
    scratch.
  • No outage window was booked, and Our Cloudflare Pages sites move to Cloudflare Workers, at no extra cost #266 records the one-line reason:
    nothing embeds this address, so no partner page loses anything.

Verification checklist

Repo-side — runnable cold

  • pnpm install && pnpm lint && pnpm typecheck && pnpm test:run — all green.
  • pnpm ladle:build exits 0 and build/index.html exists.
  • npx wrangler --version prints 4.149.0 or later.
  • grep -c '^ Access-Control-Allow-Origin' public/_headers returns 1 (the prose at :5
    mentions the header too, so anchor the match to an indented rule line).
  • git diff --stat origin/main -- public/_redirects prints nothing.
  • grep -rn 'sahajatlas-design' . --exclude-dir=node_modules --exclude-dir=.git — every hit
    matches the inventory table above, and each is either past tense or a named test fixture.
  • git diff origin/main -- '*.md' public/ scripts/ | grep -E '^-.*(⚠|#[0-9]{2,3})' — every hit
    is a line reflowed or rewritten rather than dropped, confirmed one by one against the +
    side of the same hunk.
  • git diff --name-only origin/main | grep '^\.claude/' prints nothing.

Against the live Worker — a person runs these

  • curl -sI https://design.sahajatlas.com/ | grep -i access-control-allow-origin returns
    exactly * (not *, *).
  • curl -sI https://design.sahajatlas.com/this-does-not-exist | grep -i x-robots-tag — record
    whether noindex is present. That answer is the _redirects measurement.
  • PREVIEW_URL=https://design.sahajatlas.com pnpm test:smoke — record how many of the 16
    specs fail. tests/smoke/_helpers/preview.ts:9 is where that variable is read.
  • Open https://design.sahajatlas.com in a browser: the component list renders, in Raleway.
  • Push a commit to the Worker's production branch, then list the check runs on that commit
    and record each one's name and app slug. Confirm none of them satisfies
    .github/workflows/production-smoke.yml:37-41's if, so a design deploy cannot fire the
    atlas production lane.
  • Push a branch, find its preview host, npx wrangler preview delete --name <preview>, then
    curl -si <that host> and record what it answers.
  • Attempt a Worker route over the live Pages CNAME and record what happens, before the
    hostname is moved.
  • curl -sI https://sahajatlas.com/embed.js | grep -iE 'access-control-allow-origin|cache-control'
    after the PR deploys to the Pages app — ACAO is exactly *, and Cache-Control still
    max-age=0, must-revalidate. This is the shared-file check for the site this ticket does
    not move.

Notes

  • .claude/workflow.json:25 reads "deployTarget": "Cloudflare Pages (sahajatlas, sahajatlas-design)".
    It goes partly stale here, it is a protected path, and no cloud run can write it — a run that
    tries waits out its lease having written nothing. It is corrected by an attended edit at child 5,
    and it is deliberately not an acceptance criterion here.
  • ⚠ .claude/workflow.json:14 → securityReview.triggerPattern matches no wrangler config. So
    the one file deciding what the Worker serves, what it rewrites and which headers reach a host page
    would escape the security review that vite.config.ts and package.json already fire. Read at
    c4b6b8a, the pattern names neither wrangler* nor public/, so public/_headers escapes it
    too. Attended, exactly like deployTarget above: the file is a protected path, no cloud run
    can write it, and this is deliberately not an acceptance criterion. One attended edit settles
    both of this repo's configs — this ticket's wrangler.design.jsonc and the app's, which
    chore(build): serve the atlas app from a Cloudflare Worker #280 adds. ci(preview): move the Ladle site to Workers and fail on no preview WeMeditateWeb#184 records the same finding for its own copy,
    whose pattern anchors on ^wrangler\.toml.
  • Deleting the sahajatlas-design Pages project removes a check run that
    scripts/get-cloudflare-preview-url.mjs:84-88 cites as corroborating timing evidence
    (a median
    41 seconds ahead of our own). The script's own comment already says neither that run nor the bot
    comment is load-bearing alone, and runProject (:244) simply stops matching it, so no spec
    and no CI gate breaks — the prose is what goes stale. Child 4 deletes the subsystem outright.
  • No docs/embedding.md or CHANGELOG.md entry is owed by this ticket. The ACAO rule makes
    explicit a header Pages already serves on every asset, so no host can observe a change on
    sahajatlas.com, and nothing embeds design.sahajatlas.com. Child 5 owns the embed guide.
  • chore(build): cut every client over to sahajatlas.com and retire the legacy hosts #252 (under Sahaj Atlas is ready for launch #255) plans its own edit to
    public/_redirects and to docs/embedding.md. Whichever of the two lands second reconciles.
  • wrangler is a dev-scope dependency, so the shared Dependency Review gate — which fails only
    on an added dependency with a high or critical runtime advisory — does not bear on it.
  • The siblings are not filed yet, so they are named by description rather than by number. In
    build order: this ticket, then the We Meditate library move (sydevs/WeMeditateWeb), then the
    atlas app Worker, then the atlas preview lane, then the sahajatlas.com cutover.
    Our Cloudflare Pages sites move to Cloudflare Workers, at no extra cost #266's Technical notes table carries the order.

Activity

  1. added theissue type on Oct 11, 2026
  2. added
    proposal
    on Oct 11, 2026
  3. moved this from Revising to Proposed in SYDevelopers Technical Roadmapon Oct 11, 2026
  4. removed
    proposal
    on Oct 13, 2026
  5. moved this from Proposed to Approved in SYDevelopers Technical Roadmapon Oct 13, 2026
  6. added
    bot:working
    on Oct 13, 2026
  7. sydevs-bot commented on Oct 13, 2026

    @sydevs-bot
    ContributorAuthor

    🤖 no session running

    recent dispatches
    • 13:28Z implement · attempt 1 · session · done
    • 13:28Z implement · attempt 1 · session

    Written by the sydevs dispatcher. Sessions never edit this comment.

  8. removed
    bot:working
    on Oct 13, 2026
  9. Ardnived commented on Oct 14, 2026

    @Ardnived
    Contributor

    Attended phase complete: design.sahajatlas.com serves from the sahajatlas-design Worker as a Custom Domain, and the Pages project is deleted. Findings, measurements, rollback times and the cutover timeline are recorded on the parent: #266 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    High

    Hold Until

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions