Repository navigation
fix(ci): let the Ladle build load SWC on Workers Builds - #236
Conversation
Every wemeditate-design build since 2026-11-13 died with ERR_SWC_NATIVE_CACHE before Ladle ran: @swc/core's native addon refuses a cache directory with an ancestor another user can write, and the Workers build image now fails that rule for both ~/.cache and /tmp. The same lockfile built there on 2026-11-07. ladle:build now sets SWC_NATIVE_BINDING_CACHE_SKIP_SECURITY_CHECK=1 when WORKERS_CI is set, which Workers Builds injects and nothing else here does. Only the ancestor check goes; the addon still verifies its payload, and the check stays on locally and in gate. It has to be a script prefix: Ladle loads SWC before it reads any config file. GitHub's runners and macOS pass the check, so a guard pins the prefix; nothing else would notice it going. Closes #233 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-web | 7bcb31d | Commit Preview URL Branch Preview URL |
Nov 15 2026, 07:10 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
wemeditate-design | 7bcb31d | Commit Preview URL Branch Preview URL |
Nov 15 2026, 07:10 PM |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The diff is the size of its ticket: one env prefix, the doc #233 asked for, and a guard. Nothing here should be removed, and I found nothing missing.
I checked the mechanism against SWC's source rather than the body's account of it. secure_cache_root (crates/swc_native_addon/src/platform/unix.rs) compares env::var_os("SWC_NATIVE_BINDING_CACHE_SKIP_SECURITY_CHECK") to exactly "1", so the empty string ${WORKERS_CI:+1} leaves behind is not an opt-out. The claim that the check stays on locally and in gate holds.
The two CI boxes in the test plan are already satisfied on 7f017e77, so #233's acceptance criteria are met.
Findings
consider— package.json:17 — the fix reaches the Worker only while its dashboard build command stayspnpm ladle:build, which the repo records nowhere.consider— docs/cloudflare-previews-ci.md:85 — the SahajAtlasWeb@swc/corebump moves that repo into the carrier that caused this bug.
What was checked
@swc/core1.16.21 from the registry: the carrier and its env var live in the platform binding, and the opt-out is an exact"1"match.Workers Builds: wemeditate-designissuccess.Smoke (ladle)discoveredhttps://ffd9d96e-wemeditate-design.contact-c66.workers.dev, got HTTP 200 and ran 4 tests. I fetched that host myself: Ladle shell, a populated/meta.json, therobots.txtrefusal.- The new section's claims:
.ladle/config.mjsexists, and nothing else in the repo setsWORKERS_CI. - Ladder on the one new file:
tests/guards/is this repo's existing home for a guard, no other test readspackage.json, and the harm is measured, not hypothetical. It holds. docs/cloudflare-previews-ci.mdwhole: the new section matches the file's shape and repeats none of it.wrangler.design.jsonccarries no build command of its own.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
The SWC opt-out reaches the wemeditate-design Worker only through the ladle:build script, and that Worker's build command is set in the Cloudflare dashboard rather than in this repo. A bare `ladle build` there would build without the prefix and die again, and nothing in the repo would catch it. crawler-refusal.ts survives the same change by emitting its files from the Vite build, so the two couplings read alike and are not. The doc now says which is which, under the ⚠ it already uses for couplings that leave the repo. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Mg9rjZUcjwh6nvqmeJs26X
|
Both critic threads answered. Pushed as
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
Every
wemeditate-designbuild since 2026-11-13 has failed withERR_SWC_NATIVE_CACHEbefore Ladle runs. Since 1.16.12,@swc/core's native addon unpacks itself into a cache directory, and it refuses any directory with an ancestor another user can write. The Workers build image now fails that rule for both~/.cacheand/tmp. The same lockfile built there on 2026-11-07, so the change is on Cloudflare's side.ladle:buildnow setsSWC_NATIVE_BINDING_CACHE_SKIP_SECURITY_CHECK=${WORKERS_CI:+1}. That is1only on Workers Builds, which injectsWORKERS_CI. The check stays on locally and ingate. Only the ancestor check is skipped, and SWC still verifies the addon's payload..ladle/config.mjs.tests/guards/ladle-swc-cache.test.tspins the prefix. GitHub's runners and macOS both pass SWC's check, so nothing else would notice it being removed. I watched the guard fail before adding the prefix.docs/cloudflare-previews-ci.mdrecords the cause.sydevs/SahajAtlasWeb gets the same prefix, plus an
@swc/corebump from its 1.16.2 pin to 1.16.21 to match this repo.Closes #233
Test plan
pnpm ladle:buildpasses locally, with and withoutWORKERS_CI=1.Workers Builds: wemeditate-designpasses on this PR, since the change touchespackage.json, a watched path.Smoke (ladle)passes and names a…-wemeditate-design.<acct>.workers.devaddress.🤖 Generated with Claude Code