Files
rose-ash/shared/static/wasm/sx/harness-web.sxbc
giles e0070041d6 Add .sxbc s-expression bytecode format
Bytecode modules are now serialized as s-expressions (.sxbc) in addition
to JSON (.sxbc.json). The .sxbc format is the canonical representation —
content-addressable, parseable by the SX parser, and suitable for CID
referencing. Annotation layers (source maps, variable names, tests, docs)
can reference the bytecode CID without polluting the bytecode itself.

Format: (sxbc version hash (code :arity N :bytecode (...) :constants (...)))

The browser loader tries .sxbc first (via load-sxbc kernel primitive),
falls back to .sxbc.json. Caddy needs .sxbc MIME type to serve the new
format (currently 404s, JSON fallback works).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-27 14:16:22 +00:00

394 lines
13 KiB
Plaintext

(sxbc 1 "b94a32e5b86d6f76"
(code
:bytecode (51 1 0 128 0 0 5 51 3 0 128 2 0 5 51 5 0 128 4 0 5 51 7 0 128 6 0 5 51 9 0 128 8 0 5 51 11 0 128 10 0 5 51 13 0 128 12 0 5 51 15 0 128 14 0 5 51 17 0 128 16 0 5 51 19 0 128 18 0 5 51 21 0 128 20 0 5 51 23 0 128 22 0 5 51 25 0 128 24 0 5 51 27 0 128 26 0 5 51 29 0 128 28 0 5 51 31 0 128 30 0 5 51 33 0 128 32 0 5 51 35 0 128 34 0 5 51 37 0 128 36 0 5 51 39 0 128 38 0 5 51 41 0 128 40 0 5 51 43 0 128 42 0 5 51 45 0 128 44 0 5 51 47 0 128 46 0 5 51 49 0 128 48 0 5 51 51 0 128 50 0 5 51 53 0 128 52 0 50)
:constants (
"mock-element"
(code :arity 3
:bytecode (1 0 0 52 1 0 0 1 2 0 65 0 0 1 3 0 52 1 0 0 1 4 0 16 0 1 5 0 1 6 0 1 7 0 65 0 0 16 1 33 11 0 1 9 0 16 1 65 1 0 32 3 0 65 0 0 16 2 33 11 0 1 10 0 16 2 65 1 0 32 3 0 65 0 0 52 8 0 3 65 6 0 50)
:constants (
"children"
"list"
"listeners"
"event-log"
"tag"
"text"
""
"attrs"
"merge"
"class"
"id"))
"mock-set-text!"
(code :arity 2
:bytecode (16 0 1 1 0 16 1 52 0 0 3 50)
:constants (
"dict-set!"
"text"))
"mock-append-child!"
(code :arity 2
:bytecode (20 0 0 16 0 1 2 0 52 1 0 2 16 1 49 2 50)
:constants (
"append!"
"get"
"children"))
"mock-set-attr!"
(code :arity 3
:bytecode (16 0 1 2 0 52 1 0 2 16 1 16 2 52 0 0 3 50)
:constants (
"dict-set!"
"get"
"attrs"))
"mock-get-attr"
(code :arity 2
:bytecode (16 0 1 1 0 52 0 0 2 16 1 52 0 0 2 50)
:constants (
"get"
"attrs"))
"mock-add-listener!"
(code :arity 3
:bytecode (16 0 1 1 0 52 0 0 2 17 3 16 3 16 1 52 3 0 2 52 2 0 1 33 15 0 16 3 16 1 52 5 0 0 52 4 0 3 32 1 0 2 5 20 6 0 16 3 16 1 52 0 0 2 16 2 49 2 50)
:constants (
"get"
"listeners"
"not"
"has-key?"
"dict-set!"
"list"
"append!"))
"simulate-click"
(code :arity 1
:bytecode (16 0 1 1 0 52 0 0 2 1 2 0 52 0 0 2 17 1 16 1 33 14 0 51 4 0 1 0 16 1 52 3 0 2 32 1 0 2 5 20 5 0 16 0 1 6 0 52 0 0 2 1 7 0 1 2 0 65 1 0 49 2 50)
:constants (
"get"
"listeners"
"click"
"for-each"
(code :arity 1 :upvalue-count 1
:bytecode (20 0 0 16 0 1 2 0 18 0 1 3 0 1 4 0 65 2 0 52 1 0 1 49 2 50)
:constants (
"cek-call"
"list"
"target"
"type"
"click"))
"append!"
"event-log"
"type"))
"simulate-input"
(code :arity 2
:bytecode (20 0 0 16 0 1 1 0 16 1 48 3 5 16 0 1 3 0 52 2 0 2 1 4 0 52 2 0 2 17 2 16 2 33 14 0 51 6 0 1 0 16 2 52 5 0 2 32 1 0 2 5 20 7 0 16 0 1 8 0 52 2 0 2 1 1 0 16 1 1 9 0 1 4 0 65 2 0 49 2 50)
:constants (
"mock-set-attr!"
"value"
"get"
"listeners"
"input"
"for-each"
(code :arity 1 :upvalue-count 1
:bytecode (20 0 0 16 0 1 2 0 18 0 1 3 0 1 4 0 65 2 0 52 1 0 1 49 2 50)
:constants (
"cek-call"
"list"
"target"
"type"
"input"))
"append!"
"event-log"
"type"))
"simulate-event"
(code :arity 3
:bytecode (16 0 1 1 0 52 0 0 2 16 1 52 0 0 2 17 3 16 3 33 18 0 51 3 0 1 0 1 2 1 1 16 3 52 2 0 2 32 1 0 2 5 20 4 0 16 0 1 5 0 52 0 0 2 1 6 0 16 2 1 7 0 16 1 65 2 0 49 2 50)
:constants (
"get"
"listeners"
"for-each"
(code :arity 1 :upvalue-count 3
:bytecode (20 0 0 16 0 1 2 0 18 0 1 3 0 18 1 1 4 0 18 2 65 3 0 52 1 0 1 49 2 50)
:constants (
"cek-call"
"list"
"target"
"detail"
"type"))
"append!"
"event-log"
"detail"
"type"))
"assert-text"
(code :arity 2
:bytecode (16 0 1 1 0 52 0 0 2 17 2 20 2 0 16 2 16 1 1 4 0 16 1 1 5 0 16 2 1 6 0 52 3 0 5 49 3 50)
:constants (
"get"
"text"
"assert="
"str"
"Expected text \""
"\", got \""
"\""))
"assert-attr"
(code :arity 3
:bytecode (20 0 0 16 0 16 1 48 2 17 3 20 1 0 16 3 16 2 1 3 0 16 1 1 4 0 16 2 1 5 0 16 3 1 6 0 52 2 0 7 49 3 50)
:constants (
"mock-get-attr"
"assert="
"str"
"Expected attr "
"=\""
"\", got \""
"\""))
"assert-class"
(code :arity 2
:bytecode (20 0 0 16 0 1 1 0 48 2 6 34 4 0 5 1 2 0 17 2 20 3 0 16 2 1 6 0 52 5 0 2 16 1 52 4 0 2 1 8 0 16 1 1 9 0 16 2 1 10 0 52 7 0 5 49 2 50)
:constants (
"mock-get-attr"
"class"
""
"assert"
"contains?"
"split"
" "
"str"
"Expected class \""
"\" in \""
"\""))
"assert-no-class"
(code :arity 2
:bytecode (20 0 0 16 0 1 1 0 48 2 6 34 4 0 5 1 2 0 17 2 20 3 0 16 2 1 7 0 52 6 0 2 16 1 52 5 0 2 52 4 0 1 1 9 0 16 1 1 10 0 16 2 1 11 0 52 8 0 5 49 2 50)
:constants (
"mock-get-attr"
"class"
""
"assert"
"not"
"contains?"
"split"
" "
"str"
"Expected no class \""
"\" but found in \""
"\""))
"assert-child-count"
(code :arity 2
:bytecode (16 0 1 2 0 52 1 0 2 52 0 0 1 17 2 20 3 0 16 2 16 1 1 5 0 16 1 1 6 0 16 2 52 4 0 4 49 3 50)
:constants (
"len"
"get"
"children"
"assert="
"str"
"Expected "
" children, got "))
"assert-event-fired"
(code :arity 2
:bytecode (20 0 0 51 2 0 1 1 16 0 1 4 0 52 3 0 2 52 1 0 2 1 6 0 16 1 1 7 0 52 5 0 3 49 2 50)
:constants (
"assert"
"some"
(code :arity 1 :upvalue-count 1
:bytecode (16 0 1 2 0 52 1 0 2 18 0 52 0 0 2 50)
:constants (
"="
"get"
"type"))
"get"
"event-log"
"str"
"Expected event \""
"\" to have been fired"))
"assert-no-event"
(code :arity 2
:bytecode (20 0 0 51 3 0 1 1 16 0 1 5 0 52 4 0 2 52 2 0 2 52 1 0 1 1 7 0 16 1 1 8 0 52 6 0 3 49 2 50)
:constants (
"assert"
"not"
"some"
(code :arity 1 :upvalue-count 1
:bytecode (16 0 1 2 0 52 1 0 2 18 0 52 0 0 2 50)
:constants (
"="
"get"
"type"))
"get"
"event-log"
"str"
"Expected event \""
"\" to NOT have been fired"))
"event-fire-count"
(code :arity 2
:bytecode (51 2 0 1 1 16 0 1 4 0 52 3 0 2 52 1 0 2 52 0 0 1 50)
:constants (
"len"
"filter"
(code :arity 1 :upvalue-count 1
:bytecode (16 0 1 2 0 52 1 0 2 18 0 52 0 0 2 50)
:constants (
"="
"get"
"type"))
"get"
"event-log"))
"make-web-harness"
(code :arity 1
:bytecode (20 0 0 1 1 0 16 0 48 2 17 1 20 2 0 16 1 1 3 0 1 4 0 65 0 0 1 5 0 20 6 0 1 7 0 1 8 0 1 5 0 48 3 65 2 0 48 3 5 16 1 50)
:constants (
"make-harness"
"platform"
"harness-set!"
"dom"
"elements"
"root"
"mock-element"
"div"
"id"))
"is-renderable?"
(code :arity 1
:bytecode (16 0 52 0 0 1 33 4 0 3 32 118 0 16 0 52 1 0 1 33 4 0 3 32 105 0 16 0 52 2 0 1 33 4 0 3 32 92 0 16 0 52 3 0 1 33 4 0 3 32 79 0 16 0 52 4 0 1 33 4 0 4 32 66 0 16 0 52 6 0 1 52 5 0 1 33 4 0 4 32 49 0 16 0 52 7 0 1 33 4 0 3 32 36 0 16 0 52 8 0 1 17 1 16 1 52 10 0 1 1 11 0 52 9 0 2 6 33 11 0 5 16 1 52 4 0 1 52 5 0 1 50)
:constants (
"nil?"
"string?"
"number?"
"boolean?"
"dict?"
"not"
"list?"
"empty?"
"first"
"="
"type-of"
"symbol"))
"is-render-leak?"
(code :arity 1
:bytecode (16 0 52 1 0 1 52 0 0 1 6 33 12 0 5 20 2 0 16 0 48 1 52 0 0 1 50)
:constants (
"not"
"nil?"
"is-renderable?"))
"assert-renderable"
(code :arity 2
:bytecode (20 0 0 20 1 0 16 0 48 1 1 3 0 16 1 1 4 0 16 0 52 5 0 1 16 0 52 6 0 1 33 6 0 1 7 0 32 48 0 16 0 52 8 0 1 6 33 26 0 5 16 0 52 10 0 1 52 9 0 1 6 33 11 0 5 16 0 52 11 0 1 52 6 0 1 33 6 0 1 12 0 32 3 0 1 13 0 52 2 0 5 49 2 50)
:constants (
"assert"
"is-renderable?"
"str"
"Render leak in "
": "
"type-of"
"dict?"
" — dict would appear as {:key val} text in output"
"list?"
"not"
"empty?"
"first"
" — list of dicts would appear as raw data in output"
" — non-renderable value would appear as text"))
"render-body-audit"
(code :arity 1
:bytecode (52 0 0 0 17 1 51 2 0 1 1 16 0 52 1 0 2 5 16 1 50)
:constants (
"list"
"for-each"
(code :arity 1 :upvalue-count 1
:bytecode (20 0 0 16 0 48 1 33 88 0 20 1 0 18 0 1 2 0 16 0 52 3 0 1 33 6 0 1 4 0 32 48 0 16 0 52 5 0 1 6 33 26 0 5 16 0 52 7 0 1 52 6 0 1 6 33 11 0 5 16 0 52 8 0 1 52 3 0 1 33 6 0 1 9 0 32 3 0 1 10 0 1 11 0 16 0 52 12 0 1 65 2 0 49 2 32 1 0 2 50)
:constants (
"is-render-leak?"
"append!"
"leak-kind"
"dict?"
"dict"
"list?"
"not"
"empty?"
"first"
"list-of-dicts"
"other"
"value-type"
"type-of"))))
"assert-render-body-clean"
(code :arity 2
:bytecode (20 0 0 16 0 48 1 17 2 20 1 0 16 2 52 2 0 1 1 4 0 16 2 52 5 0 1 1 6 0 16 1 1 7 0 1 8 0 1 9 0 52 3 0 7 49 2 50)
:constants (
"render-body-audit"
"assert"
"empty?"
"str"
"Render body has "
"len"
" leak(s) in "
". "
"render-to-html/render-to-dom render ALL body expressions — "
"put side effects in let bindings, not body expressions."))
"mock-render"
(code :arity 1
:bytecode (16 0 52 0 0 1 33 4 0 2 32 173 0 16 0 52 1 0 1 33 25 0 20 2 0 1 3 0 48 1 17 1 20 4 0 16 1 16 0 48 2 5 16 1 32 139 0 16 0 52 5 0 1 33 29 0 20 2 0 1 3 0 48 1 17 1 20 4 0 16 1 16 0 52 6 0 1 48 2 5 16 1 32 101 0 16 0 52 8 0 1 52 7 0 1 33 4 0 2 32 84 0 16 0 52 9 0 1 33 4 0 2 32 71 0 16 0 52 10 0 1 17 1 16 1 52 12 0 1 1 13 0 52 11 0 2 52 7 0 1 33 4 0 2 32 39 0 20 2 0 20 14 0 16 1 48 1 48 1 17 2 2 17 3 51 15 0 1 2 1 3 17 3 16 3 16 0 52 16 0 1 48 1 5 16 2 50)
:constants (
"nil?"
"string?"
"mock-element"
"TEXT"
"mock-set-text!"
"number?"
"str"
"not"
"list?"
"empty?"
"first"
"="
"type-of"
"symbol"
"symbol-name"
(code :arity 1 :upvalue-count 2
:bytecode (16 0 52 1 0 1 52 0 0 1 33 127 0 16 0 52 2 0 1 17 1 16 1 52 4 0 1 1 5 0 52 3 0 2 33 62 0 16 0 52 6 0 1 52 1 0 1 52 0 0 1 33 41 0 20 7 0 18 0 20 8 0 16 1 48 1 16 0 1 10 0 52 9 0 2 48 3 5 18 1 16 0 52 6 0 1 52 6 0 1 49 1 32 1 0 2 32 38 0 20 11 0 16 1 48 1 17 2 16 2 33 12 0 20 12 0 18 0 16 2 48 2 32 1 0 2 5 18 1 16 0 52 6 0 1 49 1 32 1 0 2 50)
:constants (
"not"
"empty?"
"first"
"="
"type-of"
"keyword"
"rest"
"mock-set-attr!"
"keyword-name"
"nth"
1
"mock-render"
"mock-append-child!"))
"rest"))
"mock-render-fragment"
(code :arity 1
:bytecode (51 1 0 20 3 0 16 0 52 2 0 2 52 0 0 2 50)
:constants (
"filter"
(code :arity 1
:bytecode (16 0 52 1 0 1 52 0 0 1 50)
:constants (
"not"
"nil?"))
"map"
"mock-render"))
"assert-single-render-root"
(code :arity 2
:bytecode (20 0 0 16 0 48 1 17 2 20 1 0 16 2 52 3 0 1 1 4 0 52 2 0 2 1 6 0 16 1 1 7 0 16 2 52 3 0 1 1 8 0 1 9 0 1 10 0 52 5 0 7 49 2 50)
:constants (
"mock-render-fragment"
"assert"
"="
"len"
1
"str"
"Expected single render root in "
" but got "
" element(s). "
"Multi-body let/begin in render-to-html/render-to-dom renders "
"ALL expressions — put side effects in let bindings."))
"assert-tag"
(code :arity 2
:bytecode (20 0 0 16 0 1 3 0 52 2 0 2 16 1 52 1 0 2 1 5 0 16 1 1 6 0 16 0 1 3 0 52 2 0 2 1 7 0 52 4 0 5 49 2 50)
:constants (
"assert"
"="
"get"
"tag"
"str"
"Expected <"
"> but got <"
">")))))