Skip to content

fix(ci): let the Ladle build load SWC on Workers Builds - #236

Merged
Ardnived merged 3 commits into
mainfrom
fix/233-swc-native-cache
Nov 15, 2026
Merged

Ardnived merged 3 commits into
mainfrom
fix/233-swc-native-cache

Conversation

@Ardnived

Copy link
Copy Markdown
Contributor

Summary

Every wemeditate-design build since 2026-11-13 has failed with ERR_SWC_NATIVE_CACHE before 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 ~/.cache and /tmp. The same lockfile built there on 2026-11-07, so the change is on Cloudflare's side.

  • ladle:build now sets SWC_NATIVE_BINDING_CACHE_SKIP_SECURITY_CHECK=${WORKERS_CI:+1}. That is 1 only on Workers Builds, which injects WORKERS_CI. The check stays on locally and in gate. Only the ancestor check is skipped, and SWC still verifies the addon's payload.
  • It has to be a script prefix: Ladle imports SWC at startup, before it reads .ladle/config.mjs.
  • tests/guards/ladle-swc-cache.test.ts pins 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.md records the cause.

sydevs/SahajAtlasWeb gets the same prefix, plus an @swc/core bump from its 1.16.2 pin to 1.16.21 to match this repo.

Closes #233

Test plan

🤖 Generated with Claude Code

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]>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 15, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@Ardnived
Ardnived marked this pull request as ready for review November 15, 2026 18:52
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 15, 2026
@sydevs-bot

sydevs-bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running

recent dispatches
  • 19:00Z address-review · attempt 1 · session · done
  • 19:00Z address-review · attempt 1 · session
  • 18:53Z review-pr · attempt 1 · session · done
  • 18:53Z review-pr · attempt 1 · session

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

@sydevs-bot sydevs-bot moved this from Awaiting to Working in SYDevelopers Technical Roadmap Nov 15, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 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 stays pnpm ladle:build, which the repo records nowhere.
  • consider — docs/cloudflare-previews-ci.md:85 — the SahajAtlasWeb @swc/core bump moves that repo into the carrier that caused this bug.

What was checked

  • @swc/core 1.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-design is success. Smoke (ladle) discovered https://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, the robots.txt refusal.
  • The new section's claims: .ladle/config.mjs exists, and nothing else in the repo sets WORKERS_CI.
  • Ladder on the one new file: tests/guards/ is this repo's existing home for a guard, no other test reads package.json, and the harm is measured, not hypothetical. It holds.
  • docs/cloudflare-previews-ci.md whole: the new section matches the file's shape and repeats none of it.
  • wrangler.design.jsonc carries no build command of its own.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread package.json Resolved
Comment thread docs/cloudflare-previews-ci.md Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Nov 15, 2026
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
@sydevs-bot

Copy link
Copy Markdown
Contributor

Both critic threads answered. Pushed as 7bcb31d.

origin/main merged in cleanly (244fdff), no conflicts. Lean gate green: 952 tests.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 15, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 15, 2026
@sydevs-bot
sydevs-bot enabled auto-merge November 15, 2026 19:10
@Ardnived
Ardnived merged commit 13317c9 into main Nov 15, 2026
12 checks passed
@Ardnived
Ardnived deleted the fix/233-swc-native-cache branch November 15, 2026 19:14
@sydevs-bot sydevs-bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Nov 15, 2026
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.

fix(ci): the wemeditate-design build fails, reddening Smoke (ladle)

3 participants