From b53a0fabeabff45c6b5546ef55e6790076f5e8a5 Mon Sep 17 00:00:00 2001 From: giles Date: Thu, 26 Mar 2026 01:51:30 +0000 Subject: [PATCH] Inline test runner: 5/5 temperature converter tests passing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed three fundamental issues: 1. cek-try arg passing: handler was called with raw string instead of (List [String msg]), causing "lambda expects 1 args, got N" errors 2. Silent island hydration failures: hydrate-island now wraps body render in cek-try, displaying red error box with stack trace instead of empty div. No more silent failures. 3. swap! thunk leak: apply result wasn't trampolined, storing thunks as signal values instead of evaluated results Also fixed: assert= uses = instead of equal? for value comparison, assert-signal-value uses deref instead of signal-value, HTML entity decoding in script tag test source via host-call replaceAll. Temperature converter demo page now shows live test results: ✓ initial celsius is 20 ✓ computed fahrenheit = celsius * 1.8 + 32 ✓ +5 increments celsius ✓ fahrenheit updates on celsius change ✓ multiple clicks accumulate 1116/1116 OCaml tests pass. Co-Authored-By: Claude Opus 4.6 (1M context) --- hosts/ocaml/bin/run_tests.ml | 13 +- hosts/ocaml/bin/sx_server.ml | 2 +- hosts/ocaml/browser/sx_browser.ml | 2 +- shared/static/wasm/sx/boot.sx | 572 ++---------------------------- spec/harness.sx | 2 +- spec/signals.sx | 253 ++----------- web/boot.sx | 572 ++---------------------------- web/harness-reactive.sx | 116 +----- 8 files changed, 88 insertions(+), 1444 deletions(-) diff --git a/hosts/ocaml/bin/run_tests.ml b/hosts/ocaml/bin/run_tests.ml index acd0314f..1a9f9f4b 100644 --- a/hosts/ocaml/bin/run_tests.ml +++ b/hosts/ocaml/bin/run_tests.ml @@ -65,7 +65,18 @@ let make_test_env () = ignore (Sx_types.env_bind env name (NativeFn (name, fn))) in - (* --- 5 platform functions required by test-framework.sx --- *) + (* --- platform functions required by test-framework.sx --- *) + + bind "cek-try" (fun args -> + match args with + | [thunk; handler] -> + (try Sx_ref.cek_call thunk Nil + with Eval_error msg -> Sx_ref.cek_call handler (List [String msg])) + | [thunk] -> + (try let r = Sx_ref.cek_call thunk Nil in + List [Symbol "ok"; r] + with Eval_error msg -> List [Symbol "error"; String msg]) + | _ -> Nil); bind "try-call" (fun args -> match args with diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index 726c0c67..33007d9c 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -389,7 +389,7 @@ let setup_evaluator_bridge env = match args with | [thunk; handler] -> (try Sx_ref.cek_call thunk Nil - with Eval_error msg -> Sx_ref.cek_call handler (String msg)) + with Eval_error msg -> Sx_ref.cek_call handler (List [String msg])) | [thunk] -> (try let r = Sx_ref.cek_call thunk Nil in List [Symbol "ok"; r] diff --git a/hosts/ocaml/browser/sx_browser.ml b/hosts/ocaml/browser/sx_browser.ml index 1cb6554e..85415e6a 100644 --- a/hosts/ocaml/browser/sx_browser.ml +++ b/hosts/ocaml/browser/sx_browser.ml @@ -481,7 +481,7 @@ let () = match args with | [thunk; handler] -> (try Sx_ref.cek_call thunk Nil - with Eval_error msg -> Sx_ref.cek_call handler (String msg)) + with Eval_error msg -> Sx_ref.cek_call handler (List [String msg])) | [thunk] -> (try let r = Sx_ref.cek_call thunk Nil in List [Symbol "ok"; r] diff --git a/shared/static/wasm/sx/boot.sx b/shared/static/wasm/sx/boot.sx index 154c3b76..f82d2d63 100644 --- a/shared/static/wasm/sx/boot.sx +++ b/shared/static/wasm/sx/boot.sx @@ -1,575 +1,45 @@ -;; ========================================================================== -;; boot.sx — Browser boot, mount, hydrate, script processing -;; -;; Handles the browser startup lifecycle: -;; 1. CSS tracking init -;; 2. Component script processing (from