fix(ci): binaryen tools cache also needs lib/ — bin-only restore broke every post-process

The binopt cache from b4cb10b saved only binaryen-hoist-build/bin, but the
tools dynamically link lib/libbinaryen.so, so the first cache HIT (run
28585074335) failed all 7 tools' finalize with a loader error. Cache bin/ +
lib/, bump the key to binopt-v2 (Ubicloud never re-saves an exact-key hit, so
the poisoned v1 entry can't be repaired in place), and make the
BINARYEN_TRUST_PREBUILT guard exec both tools with --version instead of -x
existence checks so an incomplete restore falls through to a source build.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NTxTrY9on6A8gLvogFbGiy
This commit is contained in:
Viktor Vaczi 2026-07-02 14:29:20 +02:00
commit e01256b54d
2 changed files with 18 additions and 10 deletions

View file

@ -22,12 +22,16 @@ if [ ! -f "${SRC}/src/passes/HoistCppCatches.cpp" ]; then
exit 1
fi
# CI fast-path: the workflow cache-restores bin/ keyed on the exact submodule SHA and
# sets this var on a hit, so the restored binaries are authoritative — skip cmake+ninja.
# Never set it locally when iterating on the pass: uncommitted source edits would be
# silently ignored (the SHA key can't see them).
# CI fast-path: the workflow cache-restores bin/ + lib/ keyed on the exact submodule
# SHA and sets this var on a hit, so the restored binaries are authoritative — skip
# cmake+ninja. Trust only if both tools actually RUN: the binaries dynamically link
# lib/libbinaryen.so, so an existence check alone passes on an incomplete restore
# (bin/ without lib/ shipped a red main, run 28585074335) while --version proves the
# loader resolves everything. Never set the var locally when iterating on the pass:
# uncommitted source edits would be silently ignored (the SHA key can't see them).
if [ "${BINARYEN_TRUST_PREBUILT:-0}" = "1" ] \
&& [ -x "${BUILD}/bin/wasm-opt" ] && [ -x "${BUILD}/bin/wasm-emscripten-finalize" ]; then
&& "${BUILD}/bin/wasm-opt" --version >/dev/null 2>&1 \
&& "${BUILD}/bin/wasm-emscripten-finalize" --version >/dev/null 2>&1; then
echo "Using prebuilt Binaryen tools (BINARYEN_TRUST_PREBUILT=1): ${BUILD}/bin" >&2
echo "${BUILD}/bin/wasm-opt"
exit 0