WIP: pre-existing changes from WASM browser work + test infrastructure

Accumulated changes from WASM browser development sessions:
- sx_runtime.ml: signal subscription + notify, env unwrap tolerance
- sx_browser.bc.js: rebuilt js_of_ocaml browser kernel
- sx_browser.bc.wasm.js + assets: WASM browser kernel build
- sx-platform.js browser tests (test_js, test_platform, test_wasm)
- Playwright sx-inspect.js: interactive page inspector tool
- harness-web.sx: DOM assertion updates
- deploy.sh, Dockerfile, dune-project: build config updates
- test-stepper.sx: stepper unit tests
- reader-macro-demo plan update

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 16:40:38 +00:00
parent 10576f86d1
commit c72a5af04d
47 changed files with 5485 additions and 1728 deletions

View File

@@ -361,11 +361,44 @@ let signal_value s = match s with
| _ -> raise (Eval_error "not a signal")
let signal_set_value s v = match s with Signal sig' -> sig'.s_value <- v; v | _ -> raise (Eval_error "not a signal")
let signal_subscribers s = match s with Signal sig' -> List (List.map (fun _ -> Nil) sig'.s_subscribers) | _ -> List []
let signal_add_sub_b _s _f = Nil
let signal_remove_sub_b _s _f = Nil
let signal_deps _s = List []
let signal_set_deps _s _d = Nil
let notify_subscribers _s = Nil
let signal_add_sub_b s f =
match s with
| Dict d ->
(match Hashtbl.find_opt d "subscribers" with
| Some (ListRef r) -> r := !r @ [f]; Nil
| Some (List items) -> Hashtbl.replace d "subscribers" (ListRef (ref (items @ [f]))); Nil
| _ -> Hashtbl.replace d "subscribers" (ListRef (ref [f])); Nil)
| _ -> Nil
let signal_remove_sub_b s f =
match s with
| Dict d ->
(match Hashtbl.find_opt d "subscribers" with
| Some (ListRef r) -> r := List.filter (fun x -> x != f) !r; Nil
| Some (List items) -> Hashtbl.replace d "subscribers" (List (List.filter (fun x -> x != f) items)); Nil
| _ -> Nil)
| _ -> Nil
let signal_deps s =
match s with
| Dict d -> (match Hashtbl.find_opt d "deps" with Some v -> v | None -> List [])
| _ -> List []
let signal_set_deps s d =
match s with
| Dict tbl -> Hashtbl.replace tbl "deps" d; Nil
| _ -> Nil
let notify_subscribers s =
let subs = match s with
| Dict d -> (match Hashtbl.find_opt d "subscribers" with
| Some (ListRef { contents = items }) | Some (List items) -> items
| _ -> [])
| _ -> []
in
List.iter (fun f -> ignore (sx_call f [])) subs;
Nil
let flush_subscribers _s = Nil
let dispose_computed _s = Nil