Skip to content

fix(deps): pin @swc/core to 1.16.2 so the playground builds on Workers - #401

Merged
Ardnived merged 3 commits into
mainfrom
fix/ladle-swc-cache
Nov 13, 2026
Merged

Ardnived merged 3 commits into
mainfrom
fix/ladle-swc-cache

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Why

Every Workers Builds: sahajatlas-design run since 2026-11-13 ~02:39Z failed (#399, #400) with no code change behind it:

Error: Failed to load native binding
SWC native addon: user cache failed: validate cache root /opt/buildhome/.cache: …
fallback cache failed: validate cache root /tmp: cache root has a parent writable by another user
without trusted sticky protection … code: 'ERR_SWC_NATIVE_CACHE'

Ladle compiles through @vitejs/plugin-react-swc → @swc/core. From 1.16.12, the Linux addon ships as a compressed carrier that unpacks itself into a cache directory, and it refuses any directory whose ancestors another user can write. On the Workers build image, which changed on the 13th, that rules out both ~/.cache and /tmp.

What

pnpm.overrides pins @swc/core to 1.16.2, the last release whose .node loads directly. That satisfies plugin-react-swc's ^1.12.11. docs/rules/deployment.md records the pin and when to lift it.

Two earlier attempts on this branch failed on Workers and are superseded:

  • pointing SWC_NATIVE_BINDING_CACHE at /tmp;
  • bumping to 1.16.22, which refuses /tmp there too.

Verified

  • The @swc/core-linux-x64-gnu binaries for 1.15.47 through 1.16.2 carry no cache code; 1.16.12 does (10 MB carrier vs 30 MB plain).
  • Locally, ladle build passes on 1.16.2 with HOME and TMPDIR under a non-sticky world-writable directory, and the lean gate passes.
  • This PR's Workers Builds: sahajatlas-design check passes (build 307a9844).

After merge, #399 and #400 need main merged in for their playground builds to go green.

🤖 Generated with Claude Code

Every sahajatlas-design build since 2026-11-13 02:39Z failed before Ladle
ran: @swc/core unpacks its addon into ~/.cache and refuses a cache root
whose parent another user can write without a sticky bit, which the
Workers build image's /opt/buildhome now is (ERR_SWC_NATIVE_CACHE).
ladle:build points the cache at /tmp, which is sticky; locally SWC falls
back to the user cache when that path is unusable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 13, 2026
@sydevs-bot

sydevs-bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running

recent dispatches
  • 16:07Z address-review · attempt 1 · session · done
  • 16:07Z address-review · attempt 1 · session
  • 16:00Z review-pr · attempt 1 · session · done
  • 16:00Z 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 13, 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

One script line, one spec, one doc paragraph, for a build that broke under the repo rather than because of it. The shape is as small as the problem, and the "why" sits in the file that owns deploy topology.

The gap is upstream. @swc/core is transitive and unpinned by this repo — @vitejs/[email protected] asks for ^1.12.11 — and 1.16.22 shipped 2026-11-05, six releases after 1.16.13. A lockfile bump would leave nothing permanent behind, and the body does not say it was tried. That is the question worth answering before this lands.

The body's proof, the Workers Builds: sahajatlas-design check, was still in progress when this review ran.

Findings

  • should-fix — upstream bump not walked before a permanent script-level workaround · package.json:24
  • consider — the new spec pins the spelling /tmp/, not the property it guards · scripts/wrangler-config.test.ts:144
  • consider — package.json default vs. the sahajatlas-design trigger's variables · package.json:24

What was checked

  • The whole diff (3 files, +12/−1) against the body, plus package.json scripts, scripts/wrangler-config.test.ts, docs/rules/deployment.md and docs/environment.md.
  • Ladder: ladle:build is the only caller of ladle build (ci.yml:43, deployment.md's sahajatlas-design bullet), so one line covers both CI and the design Worker.
  • Upstream: npm view @swc/core → 1.16.22 on 2026-11-05; @vitejs/[email protected] → ^1.12.11; no pnpm.overrides entry for it.
  • No contract surface touched: docs/embedding.md, types:cms paths, public/.
  • Unverified: that @swc/core 1.16.13 reads SWC_NATIVE_BINDING_CACHE. No node_modules here, and no preview in .claude/workflow.json, so the pending Workers build is the only evidence there will be.

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


Generated by Claude Code

Comment thread package.json Resolved
Comment thread scripts/wrangler-config.test.ts Resolved
Comment thread package.json Resolved
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 13, 2026
@sydevs-bot sydevs-bot moved this from Working to Pending in SYDevelopers Technical Roadmap Nov 13, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 13, 2026
@sydevs-bot sydevs-bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 13, 2026
@swc/core 1.16.18 stopped refusing a cache root whose parent another user
can write without a sticky bit, which is what `/opt/buildhome` on the
Workers build image became on 2026-11-13. 1.16.17 still refuses it, and
nothing in this repo pins the version, so the lockfile alone held 1.16.13.

Bumping it to 1.16.22 drops the `SWC_NATIVE_BINDING_CACHE` default from
`ladle:build` and the spec that pinned its spelling, so no future build
carries the workaround. `docs/rules/deployment.md` records the floor
instead.

Verified: `@swc/core` 1.16.13 and 1.16.17 throw `ERR_SWC_NATIVE_CACHE`
under a home whose parent is world-writable without a sticky bit; 1.16.18,
1.16.20, 1.16.21 and 1.16.22 load. `ladle build` completes under that same
home on 1.16.22 with no environment override.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjVvh2nMhkqMLrWkgRd
@sydevs-bot sydevs-bot changed the title fix(ci): keep SWC's native cache out of the Workers build home fix(ci): bump @swc/core past the build image's cache-root refusal Nov 13, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor

One commit, 8342969, answers all three threads.

Adopted the upstream bump. pnpm update @swc/core → 1.16.22 (thread). 1.16.13 and 1.16.17 throw ERR_SWC_NATIVE_CACHE under a world-writable non-sticky home parent; 1.16.18 onward load it, and ladle build completes there with no override.

That reverts the ladle:build default and the spec pinning it, so the other two threads fall away: no spelling left to anchor (thread), no default to place on the trigger (thread). docs/rules/deployment.md records the 1.16.18 floor instead. Title and body refreshed.

Lean gate passes. Security review on the lockfile found nothing.

🤖 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 13, 2026
@sydevs-bot sydevs-bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 13, 2026
@Ardnived Ardnived changed the title fix(ci): bump @swc/core past the build image's cache-root refusal fix(deps): bump @swc/core so the playground builds on Workers Nov 13, 2026
@sydevs-bot
sydevs-bot enabled auto-merge November 13, 2026 16:21
@sydevs-bot

Copy link
Copy Markdown
Contributor

Not required, so not blocking: Workers Builds: sahajatlas-design failed. A preview link in the body may not open until it passes.

🤖 sydevs dispatcher

1.16.22 failed on Workers Builds too: its addon refuses /tmp as well as
~/.cache there, since an ancestor of each is writable by another user.
From 1.16.12 the linux binary is a compressed carrier that must unpack
into such a cache; 1.16.2 is the last release whose .node loads directly,
so an override holds it there until a newer release builds on Workers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Ardnived Ardnived changed the title fix(deps): bump @swc/core so the playground builds on Workers fix(deps): pin @swc/core to 1.16.2 so the playground builds on Workers Nov 13, 2026
@Ardnived
Ardnived disabled auto-merge November 13, 2026 16:27
@Ardnived
Ardnived merged commit d66e50c into main Nov 13, 2026
11 checks passed
@Ardnived
Ardnived deleted the fix/ladle-swc-cache branch November 13, 2026 16:27
@sydevs-bot sydevs-bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Nov 13, 2026
Ardnived added a commit that referenced this pull request Nov 15, 2026
…412)

* fix(deps): lift the @swc/core pin to 1.16.21, matching WeMeditateWeb

The playground held @swc/core at 1.16.2 because every later release died
on the Workers build image with ERR_SWC_NATIVE_CACHE (#401): its addon
refuses a cache directory with an ancestor another user can write, and the
image fails that rule for both ~/.cache and /tmp. Upstream has not moved,
so the pin had no exit (#405).

Route B from #405 lifts it, set in the repo rather than the dashboard:
ladle:build now sets SWC_NATIVE_BINDING_CACHE_SKIP_SECURITY_CHECK=1 when
WORKERS_CI is set, which Workers Builds injects and nothing else does.
Only the ancestor check goes; the payload integrity check stays on, and the
check stays on locally and in CI. 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 wrangler-config.test.ts pins the prefix.

1.16.21 is what WeMeditateWeb's playground resolves under the same prefix
(sydevs/WeMeditateWeb#233), so the two Ladle builds share one compiler.
Only the playground loads SWC, so no sahajatlas-web deploy rides on this.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(docs): cite WeMeditateWeb's PR for the shared SWC prefix

The deployment rule named sydevs/WeMeditateWeb#233, the ticket, not #236, the
PR that adds the prefix there. Nothing but this line couples the two repos, so
a wrong number outlives the PR that introduced it.

#236 is open, so the prefix is proposed there rather than in use. Their main
already resolves @swc/core 1.16.21, so only the prefix clause was premature.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYcLZ56AdrFyykCbKQ

* fix(docs): say why a checkout-local SWC cache root was not taken

The paragraph ruled out ~/.cache and /tmp, the roots SWC picks by itself, and
left #405's route A unanswered. A reader asking "why not point the cache at the
checkout?" found nothing.

The stat #405 recommended was never read, so this records the inference rather
than a measurement: ~/.cache being refused puts the offending ancestor at or
above $HOME, which a checkout under $HOME inherits.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYcLZ56AdrFyykCbKQ

* fix(test): trim the SWC prefix comment to its why

"for every directory it tries" claimed more than #405 measured: the default
cache root and /tmp, never a checkout-local one. The two sentences before the
last one restated docs/rules/deployment.md.

What remains is the reason the test exists — no other lane fails without the
prefix, so nothing else catches its removal.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYcLZ56AdrFyykCbKQ

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

3 participants