Add s-expression wire format support and test detail view

- HTMX beforeSwap hook intercepts text/sexp responses and renders
  them client-side via sexp.js before HTMX swaps the result in
- sexp_response() helper for returning text/sexp from route handlers
- Test detail page (/test/<nodeid>) with clickable test names
- HTMX navigation to detail returns sexp wire format (4x smaller
  than pre-rendered HTML), full page loads render server-side
- ~test-detail component with back link, outcome badge, and
  error traceback display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 23:45:28 +00:00
parent 269bcc02be
commit fec5ecdfb1
5 changed files with 136 additions and 1 deletions

View File

@@ -77,7 +77,15 @@
(if (= outcome "failed") "bg-rose-50"
(if (= outcome "skipped") "bg-sky-50"
"bg-orange-50"))))
(td :class "px-3 py-2 text-sm font-mono text-stone-700 max-w-0 truncate" :title nodeid nodeid)
(td :class "px-3 py-2 text-sm font-mono text-stone-700 max-w-0 truncate" :title nodeid
(a :href (str "/test/" nodeid)
:hx-get (str "/test/" nodeid)
:hx-target "#main-panel"
:hx-select "#main-panel"
:hx-swap "outerHTML"
:hx-push-url "true"
:class "hover:underline hover:text-sky-600"
nodeid))
(td :class "px-3 py-2 text-center"
(span :class (str "inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium "
(if (= outcome "passed") "border-emerald-300 bg-emerald-50 text-emerald-700"
@@ -111,3 +119,30 @@
(div :class "text-center"
(div :class "text-4xl mb-2" "?")
(div :class "text-sm" "No test results yet. Click Run Tests to start."))))
(defcomp ~test-detail (&key nodeid outcome duration longrepr)
(div :class "space-y-6 p-4"
(div :class "flex items-center gap-3"
(a :href "/"
:hx-get "/"
:hx-target "#main-panel"
:hx-select "#main-panel"
:hx-swap "outerHTML"
:hx-push-url "true"
:class "text-sky-600 hover:text-sky-800 text-sm"
"← Back to results")
(span :class (str "inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium "
(if (= outcome "passed") "border-emerald-300 bg-emerald-50 text-emerald-700"
(if (= outcome "failed") "border-rose-300 bg-rose-50 text-rose-700"
(if (= outcome "skipped") "border-sky-300 bg-sky-50 text-sky-700"
"border-orange-300 bg-orange-50 text-orange-700"))))
outcome))
(div :class "rounded border border-stone-200 bg-white p-4 space-y-3"
(h2 :class "text-lg font-mono font-semibold text-stone-800 break-all" nodeid)
(div :class "flex gap-4 text-sm text-stone-500"
(span (str "Duration: " duration "s")))
(when longrepr
(div :class "mt-4"
(h3 :class "text-sm font-semibold text-rose-700 mb-2" "Error Output")
(pre :class "bg-stone-50 border border-stone-200 rounded p-3 text-xs text-stone-700 overflow-x-auto whitespace-pre-wrap"
longrepr))))))