Spec explorer: fix SxExpr rendering bugs, add drill-in UX, Playwright tests

Fix 3 OCaml bugs that caused spec explorer to hang:
- sx_types: inspect outputs quoted string for SxExpr (not bare symbol)
- sx_primitives: serialize/to_string extract SxExpr/RawHTML content
- sx_render: handle SxExpr in both render-to-html paths

Restructure spec explorer for performance:
- Lightweight overview: name + kind only (was full source for 141 defs)
- Drill-in detail: click definition → params, effects, signature
- explore() page function accepts optional second arg for drill-in
- spec() passes through non-string slugs from nested routing

Fix aser map result wrapping:
- aser-special map now wraps results in fragment (<> ...) via aser-fragment
- Prevents ((div ...) (div ...)) nested lists that caused client "Not callable"

5 Playwright tests: overview load, no errors, SPA nav, drill-in detail+params

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-01 23:46:13 +00:00
parent b3718c06d0
commit 6e885f49b6
9 changed files with 447 additions and 217 deletions

View File

@@ -0,0 +1,22 @@
(defhandler
spec-detail
:path "/sx/api/spec-detail"
:method :get
:returns "element"
(&key)
(let
((filename (helper "request-arg" "file" ""))
(def-name (helper "request-arg" "name" "")))
(if
(or (= filename "") (= def-name ""))
(div
:class "text-sm text-stone-400 p-2"
"Missing file or name parameter")
(let
((d (spec-explore-define filename def-name)))
(if
d
(~specs-explorer/spec-explorer-define-detail :d d :filename filename)
(div
:class "text-sm text-stone-400 p-2"
(str "Definition '" def-name "' not found in " filename)))))))