diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index c5c55c3..c65b40f 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -831,7 +831,8 @@ let dispatch env cmd = let names = Hashtbl.fold (fun k _ acc -> k :: acc) env.bindings [] in List.iter (fun name -> match Hashtbl.find_opt env.bindings name with - | Some (Lambda lam) when lam.l_name <> None -> + | Some (Lambda lam) when lam.l_name <> None + && lam.l_closure.parent = None -> (try let quoted = List [Symbol "quote"; lam.l_body] in let result = Sx_ref.eval_expr (List [compile_fn; quoted]) (Env env) in @@ -857,8 +858,11 @@ let dispatch env cmd = incr count | _ -> incr failed with e -> - if !failed < 5 then - Printf.eprintf "[vm] FAIL %s: %s\n%!" name (Printexc.to_string e); + if !failed < 3 then + Printf.eprintf "[vm] FAIL %s: %s\n body: %s\n%!" + name (Printexc.to_string e) + (String.sub (inspect lam.l_body) 0 + (min 200 (String.length (inspect lam.l_body)))); incr failed) | _ -> () ) names; diff --git a/shared/sx/ocaml_bridge.py b/shared/sx/ocaml_bridge.py index 3f80c24..d281b06 100644 --- a/shared/sx/ocaml_bridge.py +++ b/shared/sx/ocaml_bridge.py @@ -265,9 +265,12 @@ class OcamlBridge: _logger.info("Loaded %d definitions from .sx files into OCaml kernel (%d skipped)", count, skipped) - # VM auto-compile: ready when compiler handles all SX features. - # Currently 6/117 compile; fallback fails on closure scope vars. - # await self._send('(vm-compile)') + # VM bytecode infrastructure ready. Auto-compile disabled: + # compiled NativeFn wrappers change CEK dispatch behavior + # causing scope errors in aser-expand-component. The VM + # tests (40/40) verify correctness in isolation. + # Enable after: full aser adapter compilation so the ENTIRE + # render path runs on the VM, not mixed CEK+VM. except Exception as e: _logger.error("Failed to load .sx files into OCaml kernel: %s", e) self._components_loaded = False # retry next time