SRE-868: Replace cargo:wasm-opt with prebuilt Binaryen in mise config - #9105
Draft
claude[bot] wants to merge 2 commits into
Draft
SRE-868: Replace cargo:wasm-opt with prebuilt Binaryen in mise config#9105claude[bot] wants to merge 2 commits into
claude[bot] wants to merge 2 commits into
Conversation
…alls Every Vercel build spent ~6m54s compiling the wasm-opt crate from source because cargo-binstall finds no prebuilt binary for it. Install wasm-opt from the WebAssembly/binaryen release binaries (aqua backend) instead, keeping version parity (crate 0.116.1 = binaryen version_116). The Docker images keep cargo:wasm-opt: they build natively for linux/arm64, where Binaryen publishes no release asset.
Use mise's github backend to install prebuilt Binaryen release binaries on every platform, including linux/arm64 (aarch64-linux asset shipped since version_131). This removes the cargo:wasm-opt crate build - the last consumer was the Docker images - so wasm-opt is now one tool at one version everywhere: CI, Vercel installs, and Docker image builds. The aqua backend was considered (registry tags are renovate-friendly) but the aqua registry does not support linux/arm64 for binaryen >= 108, which the arm64 Docker builds need. Lock entries are hand-authored from the release page digests and the .sha256 companion assets (verified to match).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Ciaran Morinan, Tim Diekmann · Slack thread
🌟 What is the purpose of this PR?
Before: every Vercel frontend build spent ~6m54s — roughly 75% of the 9-minute install phase — compiling the
wasm-optcrate from source. cargo-binstall can never find a prebuilt binary for it, because the crates.iowasm-optcrate (brson/wasm-opt-rs) publishes no release binaries; the real prebuiltwasm-optbinaries live in WebAssembly/binaryen releases.After:
wasm-optcomes from the prebuilt Binaryenversion_131release binaries on every platform — Vercel installs, CI, and the linux/arm64 Docker image builds (version_131is the first Binaryen release that ships anaarch64-linuxasset). Downloads take seconds, andcargo:wasm-optis removed entirely: one tool, one version, everywhere.How:
"github:WebAssembly/binaryen" = "version_131"uses mise'sgithubbackend to install release assets directly. Theaquabackend was considered first (its registry converts Binaryen'sversion_131-style tags, which keeps renovate updates working, per Bilal) — but the aqua registry constrains binaryen ≥ 108 tosupported_envs: [darwin, amd64]and has no arm64→aarch64 asset-name mapping for linux, soaqua:WebAssembly/binaryenfails on linux/arm64 at any version and can't serve the arm64 Docker builds. An upstream aqua-registry PR adding linux/arm64 support would allow switching back later.The
mise.lockentries are hand-authored for all four platforms (linux-x64,linux-arm64,macos-arm64,macos-x64—version_131publishes assets for all of them). Checksums were taken from the sha256 digests GitHub displays on the release page and cross-checked against the.sha256companion assets (they match for all four). The tarball's nestedbinaryen-version_131/bin/layout is handled by mise's automaticstrip_components+ bin-directory detection, sowasm-optlands onPATHvia mise shims andwasm-packfinds it as before.🔗 Related links
🔍 What does this change?
.config/mise/config.toml: replaces both"aqua:WebAssembly/binaryen" = "version_116"and"cargo:wasm-opt" = "0.116.1"with a single"github:WebAssembly/binaryen" = "version_131".config/mise/mise.lock: removes thecargo:wasm-optand aqua Binaryen entries; addsgithub:WebAssembly/binaryenentries forlinux-x64,linux-arm64,macos-arm64, andmacos-x64(URL + sha256 each)apps/{hash-api,hash-frontend,hash-ai-worker-ts,hash-integration-worker}/docker/Dockerfile: swapcargo:wasm-opt→github:WebAssembly/binaryenin themise install --lockedtool list (these images build for linux/arm64, now covered by theaarch64-linuxasset)apps/hash-frontend/vercel-install.shandapps/petrinaut-website/vercel-install.sh: swapaqua:WebAssembly/binaryen→github:WebAssembly/binaryenPre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
0.116.1); they now use binaryen 131.wasm-packinvokeswasm-optidentically, but the optimizer itself is 15 releases newer.githubbackend tracks release tags verbatim (version_131), unlike the aqua registry's tag conversion — the renovate mise manager may need a check that it picks upversion_...tags for this tool; if not, updates are a one-line manual bump.url_apiasset-id fields (api.github.com for WebAssembly/binaryen is unreachable from the sandbox this was authored in).mise lockon a dev machine would normalize the entries if wanted — CI'smise install --lockedwill tell if the hand-authored form is insufficient.mise installwill download the Binaryen tarball (~86 MB on linux-x64, ~7 MB on macOS).🐾 Next steps
github:WebAssembly/binaryenandcargo:wasm-packcan be dropped altogether.aarch64replacement) support for binaryen ≥ 131, then switch back toaqua:for registry-managed renovate updates.🛡 What tests cover this?
mise install --env ci --jobs 1 --lockedon linux-x64, which installs the tool from the locked URL and verifies its checksum.mise install --locked … github:WebAssembly/binaryenon linux/arm64, exercising theaarch64-linuxlock entry.❓ How to test this?
cargo:wasm-optcompile).github:WebAssembly/binaryenshould install in seconds andwasm-packbuilds should still findwasm-opt.aarch64-linuxasset instead of compiling the crate.