From 45e3582bbb2f3598883bb550a49dcbd15ca0d25e Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 8 Apr 2026 01:50:53 +0000 Subject: [PATCH] Fix WASM FFI smoke test to actually test FFI graceful error The smoke test claimed to verify FFI graceful error handling in WASM but didn't use any FFI - it just printed strings. Now it actually imports a shared library (libc.so.6) and verifies: 1. The WASM shim warns on stderr instead of crashing 2. Execution continues after the import https://claude.ai/code/session_01FUnfimbt8WPySgu54YZJxB --- .github/workflows/wasm.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/wasm.yml b/.github/workflows/wasm.yml index c7ca7bf9..9ae08ae8 100644 --- a/.github/workflows/wasm.yml +++ b/.github/workflows/wasm.yml @@ -75,10 +75,11 @@ jobs: - name: Smoke test - FFI graceful error run: | - # FFI should warn but not crash in WASM - OUTPUT=$(node -- wasm/hemlock.js -e 'print("before"); print("after");' 2>&1) + # FFI imports should warn on stderr but not crash in WASM + OUTPUT=$(node -- wasm/hemlock.js -e 'import "libc.so.6"; print("survived");' 2>&1) echo "Output: $OUTPUT" - echo "$OUTPUT" | grep -q "before" || { echo "FAIL: expected output"; exit 1; } + echo "$OUTPUT" | grep -q "survived" || { echo "FAIL: expected execution to continue after FFI import"; exit 1; } + echo "$OUTPUT" | grep -qi "warning.*ffi\|warning.*wasm\|warning.*shared" || { echo "FAIL: expected FFI warning on stderr"; exit 1; } - name: Test persistent context API run: node tests/wasm/test_persistent_context.js