From 900de713c3de22f32ae761fea83d002e505b50da Mon Sep 17 00:00:00 2001 From: giles Date: Sat, 28 Mar 2026 18:44:59 +0000 Subject: [PATCH] sx-http: fix serialize_value for client-side parsing + remove debug code serialize_value: lists with symbol head emit (fn args...) not (list fn args). This lets the client SX parser recognise special forms like let, when, cond inside component-defs. Data lists (starting with non-symbols) keep the (list ...) wrapper. Fixes "Undefined symbol: let" WASM error that broke all island hydration. Header island now reaches the JIT evaluator (fails on for-each VM error, not parsing). Geography, SXTP, CEK pages fully rendered. Removed debug logging (ssr-debug, debug dump, debug endpoint). Co-Authored-By: Claude Opus 4.6 (1M context) --- hosts/ocaml/bin/sx_server.ml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index b2f703e3..f82a0df4 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -53,7 +53,14 @@ let rec serialize_value = function | Symbol s -> s | Keyword k -> ":" ^ k | List items | ListRef { contents = items } -> - "(list " ^ String.concat " " (List.map serialize_value items) ^ ")" + (* Lists with a symbol head are call expressions: (fn arg1 arg2). + Lists starting with data values are data: (list 1 2 3). + This distinction matters for the client parser. *) + (match items with + | (Symbol _ | Keyword _) :: _ -> + "(" ^ String.concat " " (List.map serialize_value items) ^ ")" + | _ -> + "(list " ^ String.concat " " (List.map serialize_value items) ^ ")") | Dict d -> let pairs = Hashtbl.fold (fun k v acc -> (Printf.sprintf ":%s %s" k (serialize_value v)) :: acc) d [] in