Fix empty code blocks: rename ~docs/code param, fix batched IO dispatch

Two bugs caused code blocks to render empty across the site:

1. ~docs/code component had parameter named `code` which collided with
   the HTML <code> tag name. Renamed to `src` and updated all 57
   callers. Added font-mono class for explicit monospace.

2. Batched IO dispatch in ocaml_bridge.py only skipped one leading
   number (batch ID) but the format has two (epoch + ID):
   (io-request EPOCH ID "name" args...). Changed to skip all leading
   numbers so the string name is correctly found. This fixes highlight
   and other batchable helpers returning empty results.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 18:08:40 +00:00
parent 739d04672b
commit 6f96452f70
58 changed files with 440 additions and 437 deletions

View File

@@ -35,7 +35,7 @@
(span :class "inline-block w-2 h-2 rounded-full bg-red-400")
(span :class "text-sm font-mono text-red-600" ":affinity :auto + IO"))
(p :class "text-red-800 mb-3" "Auto affinity with IO dependency — auto-detected as server-rendered.")
(~docs/code :code (highlight "(render-target name env io-names)" "lisp"))))
(~docs/code :src (highlight "(render-target name env io-names)" "lisp"))))
(defcomp ~affinity-demo/aff-demo-io-client ()
:affinity :client
@@ -44,7 +44,7 @@
(span :class "inline-block w-2 h-2 rounded-full bg-violet-400")
(span :class "text-sm font-mono text-violet-600" ":affinity :client + IO"))
(p :class "text-violet-800 mb-3" "Client affinity overrides IO — calls proxied to server via /sx/io/.")
(~docs/code :code (highlight "(component-affinity comp)" "lisp"))))
(~docs/code :src (highlight "(component-affinity comp)" "lisp"))))
;; --- Main page component ---
@@ -61,7 +61,7 @@
;; Syntax
(~docs/section :title "Syntax" :id "syntax"
(p "Add " (code ":affinity") " between the params list and the body:")
(~docs/code :code (highlight "(defcomp ~affinity-demo/my-component (&key title)\n :affinity :client ;; or :server, or omit for :auto\n (div title))" "lisp"))
(~docs/code :src (highlight "(defcomp ~affinity-demo/my-component (&key title)\n :affinity :client ;; or :server, or omit for :auto\n (div title))" "lisp"))
(p "Three values:")
(ul :class "list-disc pl-5 text-stone-700 space-y-1"
(li (code ":auto") " (default) — runtime decides from IO dependency analysis")