Files
rose-ash/shared/static/wasm/sx/harness.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

304 lines
9.3 KiB
Plaintext

(sxbc 1 "b3cae03948f7a615"
(code
:bytecode (51 1 0 128 0 0 5 51 3 0 128 2 0 5 1 5 0 51 6 0 1 7 0 51 8 0 1 9 0 51 10 0 1 11 0 51 12 0 1 13 0 51 14 0 1 15 0 51 16 0 1 17 0 51 18 0 1 19 0 51 20 0 1 21 0 51 14 0 1 22 0 51 23 0 1 24 0 51 14 0 1 25 0 51 18 0 1 26 0 51 16 0 1 27 0 51 16 0 1 28 0 51 29 0 1 30 0 51 31 0 1 32 0 51 16 0 1 33 0 51 14 0 1 34 0 51 35 0 1 36 0 51 14 0 1 37 0 51 38 0 1 39 0 51 16 0 1 40 0 51 16 0 1 41 0 51 14 0 1 42 0 51 16 0 1 43 0 51 14 0 1 44 0 51 14 0 65 27 0 128 4 0 5 51 46 0 128 45 0 5 51 48 0 128 47 0 5 51 50 0 128 49 0 5 51 52 0 128 51 0 5 51 54 0 128 53 0 5 51 56 0 128 55 0 5 51 58 0 128 57 0 5 51 60 0 128 59 0 5 51 62 0 128 61 0 5 51 64 0 128 63 0 5 51 66 0 128 65 0 5 51 68 0 128 67 0 5 51 70 0 128 69 0 5 51 72 0 128 71 0 5 51 74 0 128 73 0 5 51 76 0 128 75 0 5 51 78 0 128 77 0 5 51 80 0 128 79 0 50)
:constants (
"assert"
(code :arity 2
:bytecode (16 0 52 0 0 1 33 17 0 16 1 6 34 4 0 5 1 2 0 52 1 0 1 32 1 0 2 50)
:constants (
"not"
"error"
"Assertion failed"))
"assert="
(code :arity 3
:bytecode (16 0 16 1 52 1 0 2 52 0 0 1 33 28 0 16 2 6 34 15 0 5 1 4 0 16 1 1 5 0 16 0 52 3 0 4 52 2 0 1 32 1 0 2 50)
:constants (
"not"
"="
"error"
"str"
"Expected "
", got "))
"default-platform"
"current-user"
(code
:bytecode (2 50)
:constants ())
"csrf-token"
(code
:bytecode (1 0 0 50)
:constants (
"test-csrf-token"))
"app-url"
(code :arity 2
:bytecode (1 0 0 50)
:constants (
"/mock-app-url"))
"frag"
(code :arity 3
:bytecode (1 0 0 50)
:constants (
""))
"sleep"
(code :arity 1
:bytecode (2 50)
:constants ())
"local-storage-set"
(code :arity 2
:bytecode (2 50)
:constants ())
"set-cookie"
(code :arity 3
:bytecode (2 50)
:constants ())
"url-for"
(code :arity 2
:bytecode (1 0 0 50)
:constants (
"/mock-url"))
"create-element"
"request-path"
(code
:bytecode (1 0 0 50)
:constants (
"/"))
"config"
"set-attr"
"set-text"
"remove-child"
"fetch"
(code :arity 2
:bytecode (1 0 0 1 1 0 1 2 0 1 3 0 1 4 0 3 65 3 0 50)
:constants (
"status"
200
"body"
""
"ok"))
"query"
(code :arity 3
:bytecode (52 0 0 0 50)
:constants (
"list"))
"add-class"
"get-element"
"now"
(code
:bytecode (1 0 0 50)
:constants (
0))
"abort"
"action"
(code :arity 3
:bytecode (1 0 0 3 65 1 0 50)
:constants (
"ok"))
"remove-class"
"append-child"
"request-arg"
"emit-dom"
"local-storage-get"
"get-cookie"
"make-harness"
(code :arity 1
:bytecode (16 0 52 0 0 1 33 6 0 20 1 0 32 9 0 20 1 0 16 0 52 2 0 2 17 1 1 3 0 52 4 0 0 1 5 0 16 1 1 6 0 1 7 0 65 0 0 1 8 0 65 0 0 1 9 0 2 65 3 0 65 3 0 50)
:constants (
"nil?"
"default-platform"
"merge"
"log"
"list"
"platform"
"state"
"cookies"
"storage"
"dom"))
"harness-reset!"
(code :arity 1
:bytecode (16 0 1 1 0 52 2 0 0 52 0 0 3 5 16 0 1 3 0 1 4 0 65 0 0 1 5 0 65 0 0 1 6 0 2 65 3 0 52 0 0 3 5 16 0 50)
:constants (
"dict-set!"
"log"
"list"
"state"
"cookies"
"storage"
"dom"))
"harness-log"
(code :arity 2
:bytecode (16 0 1 1 0 52 0 0 2 17 2 16 1 52 2 0 1 33 5 0 16 2 32 11 0 51 4 0 1 1 16 2 52 3 0 2 50)
:constants (
"get"
"log"
"nil?"
"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"
"op"))))
"harness-get"
(code :arity 2
:bytecode (16 0 1 1 0 52 0 0 2 16 1 52 0 0 2 50)
:constants (
"get"
"state"))
"harness-set!"
(code :arity 3
:bytecode (16 0 1 2 0 52 1 0 2 16 1 16 2 52 0 0 3 5 2 50)
:constants (
"dict-set!"
"get"
"state"))
"make-interceptor"
(code :arity 3
:bytecode (51 0 0 1 2 1 0 1 1 50)
:constants (
(code :arity 1 :upvalue-count 3
:bytecode (16 0 52 0 0 1 33 7 0 18 0 48 0 32 122 0 1 2 0 16 0 52 3 0 1 52 1 0 2 33 13 0 18 0 16 0 52 4 0 1 48 1 32 93 0 1 5 0 16 0 52 3 0 1 52 1 0 2 33 22 0 18 0 16 0 52 4 0 1 16 0 1 2 0 52 6 0 2 48 2 32 55 0 1 7 0 16 0 52 3 0 1 52 1 0 2 33 31 0 18 0 16 0 52 4 0 1 16 0 1 2 0 52 6 0 2 16 0 1 5 0 52 6 0 2 48 3 32 8 0 18 0 16 0 52 8 0 2 17 1 18 1 1 10 0 52 9 0 2 17 2 20 11 0 16 2 1 12 0 16 0 1 13 0 16 1 1 14 0 18 2 65 3 0 48 2 5 16 1 50)
:constants (
"empty?"
"="
1
"len"
"first"
2
"nth"
3
"apply"
"get"
"log"
"append!"
"args"
"result"
"op"))))
"install-interceptors"
(code :arity 2
:bytecode (51 1 0 1 0 1 1 16 0 1 4 0 52 3 0 2 52 2 0 1 52 0 0 2 5 16 1 50)
:constants (
"for-each"
(code :arity 1 :upvalue-count 2
:bytecode (18 0 1 1 0 52 0 0 2 16 0 52 0 0 2 17 1 20 2 0 18 0 16 0 16 1 48 3 17 2 20 3 0 18 1 16 0 16 2 49 3 50)
:constants (
"get"
"platform"
"make-interceptor"
"env-bind!"))
"keys"
"get"
"platform"))
"io-calls"
(code :arity 2
:bytecode (51 1 0 1 1 16 0 1 3 0 52 2 0 2 52 0 0 2 50)
:constants (
"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"
"op"))
"get"
"log"))
"io-call-count"
(code :arity 2
:bytecode (20 1 0 16 0 16 1 48 2 52 0 0 1 50)
:constants (
"len"
"io-calls"))
"io-call-nth"
(code :arity 3
:bytecode (20 0 0 16 0 16 1 48 2 17 3 16 2 16 3 52 2 0 1 52 1 0 2 33 11 0 16 3 16 2 52 3 0 2 32 1 0 2 50)
:constants (
"io-calls"
"<"
"len"
"nth"))
"io-call-args"
(code :arity 3
:bytecode (20 0 0 16 0 16 1 16 2 48 3 17 3 16 3 52 1 0 1 33 4 0 2 32 9 0 16 3 1 3 0 52 2 0 2 50)
:constants (
"io-call-nth"
"nil?"
"get"
"args"))
"io-call-result"
(code :arity 3
:bytecode (20 0 0 16 0 16 1 16 2 48 3 17 3 16 3 52 1 0 1 33 4 0 2 32 9 0 16 3 1 3 0 52 2 0 2 50)
:constants (
"io-call-nth"
"nil?"
"get"
"result"))
"assert-io-called"
(code :arity 2
:bytecode (20 0 0 20 2 0 16 0 16 1 48 2 1 3 0 52 1 0 2 1 5 0 16 1 1 6 0 52 4 0 3 49 2 50)
:constants (
"assert"
">"
"io-call-count"
0
"str"
"Expected IO operation "
" to be called but it was not"))
"assert-no-io"
(code :arity 2
:bytecode (20 0 0 20 2 0 16 0 16 1 48 2 1 3 0 52 1 0 2 1 5 0 16 1 1 6 0 20 2 0 16 0 16 1 48 2 1 7 0 52 4 0 5 49 2 50)
:constants (
"assert"
"="
"io-call-count"
0
"str"
"Expected IO operation "
" not to be called but it was called "
" time(s)"))
"assert-io-count"
(code :arity 3
:bytecode (20 0 0 16 0 16 1 48 2 17 3 20 1 0 16 3 16 2 52 2 0 2 1 4 0 16 1 1 5 0 16 2 1 6 0 16 3 1 7 0 52 3 0 7 49 2 50)
:constants (
"io-call-count"
"assert"
"="
"str"
"Expected "
" to be called "
" time(s) but was called "
" time(s)"))
"assert-io-args"
(code :arity 4
:bytecode (20 0 0 16 0 16 1 16 2 48 3 17 4 20 1 0 20 2 0 16 4 16 3 48 2 1 4 0 16 2 1 5 0 16 1 1 6 0 16 3 52 3 0 1 1 7 0 16 4 52 3 0 1 52 3 0 8 49 2 50)
:constants (
"io-call-args"
"assert"
"equal?"
"str"
"Expected call "
" to "
" with args "
" but got "))
"assert-io-result"
(code :arity 4
:bytecode (20 0 0 16 0 16 1 16 2 48 3 17 4 20 1 0 20 2 0 16 4 16 3 48 2 1 4 0 16 2 1 5 0 16 1 1 6 0 16 3 52 3 0 1 1 7 0 16 4 52 3 0 1 52 3 0 8 49 2 50)
:constants (
"io-call-result"
"assert"
"equal?"
"str"
"Expected call "
" to "
" to return "
" but got "))
"assert-state"
(code :arity 3
:bytecode (20 0 0 16 0 16 1 48 2 17 3 20 1 0 20 2 0 16 3 16 2 48 2 1 4 0 16 1 1 5 0 16 2 52 3 0 1 1 6 0 16 3 52 3 0 1 52 3 0 6 49 2 50)
:constants (
"harness-get"
"assert"
"equal?"
"str"
"Expected state "
" to be "
" but got ")))))