Files
rose-ash/shared/static/wasm/sx/browser.sxbc.json
giles b274e428eb WASM kernel fixes: parse, env sync, iterative CEK, click delegation
Browser kernel:
- Add `parse` native fn (matches server: unwrap single, list for multiple)
- Restore env==global_env guard on _env_bind_hook (let bindings must not
  leak to _vm_globals — caused JIT CSSX "Not callable: nil" errors)
- Add _env_bind_hook call in env_set_id so set! mutations sync to VM globals
- Fire _vm_global_set_hook from OP_DEFINE so VM defines sync back to CEK env

CEK evaluator:
- Replace recursive cek_run with iterative while loop using sx_truthy
  (previous attempt used strict Bool true matching, broke in wasm_of_ocaml)
- Remove dead cek_run_iterative function

Web modules:
- Remove find-matching-route and parse-route-pattern stubs from
  boot-helpers.sx that shadowed real implementations from router.sx
- Sync boot-helpers.sx to dist/static dirs for bytecode compilation

Platform (sx-platform.js):
- Set data-sx-ready attribute after boot completes (was only in boot-init
  which sx-platform.js doesn't call — it steps through boot manually)
- Add document-level click delegation for a[sx-get] links as workaround
  for bytecoded bind-event not attaching per-element listeners (VM closure
  issue under investigation — bind-event runs but dom-add-listener calls
  don't result in addEventListener)

Tests:
- New test_kernel.js: 24 tests covering env sync, parse, route matching,
  host FFI/preventDefault, deep recursion
- New navigation test: "sx-get link fetches SX not HTML and preserves layout"
  (currently catches layout breakage after SPA swap — known issue)

Known remaining issues:
- JIT CSSX failures: closure-captured variables resolve to nil in VM bytecode
- SPA content swap via execute-request breaks page layout
- Bytecoded bind-event doesn't attach per-element addEventListener (root
  cause unknown — when listen-target guard appears to block despite element
  being valid)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 13:33:13 +00:00

1 line
11 KiB
JSON

{"magic":"SXBC","version":1,"hash":"778bbf034e3da838","module":{"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,5,51,55,0,128,54,0,5,51,57,0,128,56,0,5,51,59,0,128,58,0,5,51,61,0,128,60,0,5,51,63,0,128,62,0,5,51,65,0,128,64,0,5,51,67,0,128,66,0,5,51,69,0,128,68,0,50],"constants":[{"t":"s","v":"browser-location-href"},{"t":"code","v":{"bytecode":[20,0,0,20,0,0,20,1,0,48,0,1,2,0,48,2,1,3,0,49,2,50],"constants":[{"t":"s","v":"host-get"},{"t":"s","v":"dom-window"},{"t":"s","v":"location"},{"t":"s","v":"href"}]}},{"t":"s","v":"browser-location-pathname"},{"t":"code","v":{"bytecode":[20,0,0,20,0,0,20,1,0,48,0,1,2,0,48,2,1,3,0,49,2,50],"constants":[{"t":"s","v":"host-get"},{"t":"s","v":"dom-window"},{"t":"s","v":"location"},{"t":"s","v":"pathname"}]}},{"t":"s","v":"browser-location-origin"},{"t":"code","v":{"bytecode":[20,0,0,20,0,0,20,1,0,48,0,1,2,0,48,2,1,3,0,49,2,50],"constants":[{"t":"s","v":"host-get"},{"t":"s","v":"dom-window"},{"t":"s","v":"location"},{"t":"s","v":"origin"}]}},{"t":"s","v":"browser-same-origin?"},{"t":"code","v":{"bytecode":[16,0,20,1,0,48,0,52,0,0,2,50],"constants":[{"t":"s","v":"starts-with?"},{"t":"s","v":"browser-location-origin"}],"arity":1}},{"t":"s","v":"url-pathname"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,1,2,0,16,0,20,3,0,48,0,48,3,1,4,0,49,2,50],"constants":[{"t":"s","v":"host-get"},{"t":"s","v":"host-new"},{"t":"s","v":"URL"},{"t":"s","v":"browser-location-origin"},{"t":"s","v":"pathname"}],"arity":1}},{"t":"s","v":"browser-push-state"},{"t":"code","v":{"bytecode":[16,1,52,0,0,1,33,30,0,20,1,0,20,2,0,20,3,0,48,0,1,4,0,48,2,1,5,0,2,1,6,0,16,0,49,5,32,38,0,20,1,0,20,2,0,20,3,0,48,0,1,4,0,48,2,1,5,0,16,0,16,1,52,7,0,1,16,1,1,9,0,52,8,0,2,49,5,50],"constants":[{"t":"s","v":"empty?"},{"t":"s","v":"host-call"},{"t":"s","v":"host-get"},{"t":"s","v":"dom-window"},{"t":"s","v":"history"},{"t":"s","v":"pushState"},{"t":"s","v":""},{"t":"s","v":"first"},{"t":"s","v":"nth"},{"t":"n","v":1}],"arity":2}},{"t":"s","v":"browser-replace-state"},{"t":"code","v":{"bytecode":[16,1,52,0,0,1,33,30,0,20,1,0,20,2,0,20,3,0,48,0,1,4,0,48,2,1,5,0,2,1,6,0,16,0,49,5,32,38,0,20,1,0,20,2,0,20,3,0,48,0,1,4,0,48,2,1,5,0,16,0,16,1,52,7,0,1,16,1,1,9,0,52,8,0,2,49,5,50],"constants":[{"t":"s","v":"empty?"},{"t":"s","v":"host-call"},{"t":"s","v":"host-get"},{"t":"s","v":"dom-window"},{"t":"s","v":"history"},{"t":"s","v":"replaceState"},{"t":"s","v":""},{"t":"s","v":"first"},{"t":"s","v":"nth"},{"t":"n","v":1}],"arity":2}},{"t":"s","v":"browser-reload"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,20,2,0,48,0,1,3,0,48,2,1,4,0,49,2,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"host-get"},{"t":"s","v":"dom-window"},{"t":"s","v":"location"},{"t":"s","v":"reload"}]}},{"t":"s","v":"browser-navigate"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,20,2,0,48,0,1,3,0,48,2,1,4,0,16,0,49,3,50],"constants":[{"t":"s","v":"host-set!"},{"t":"s","v":"host-get"},{"t":"s","v":"dom-window"},{"t":"s","v":"location"},{"t":"s","v":"href"}],"arity":1}},{"t":"s","v":"local-storage-get"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,20,2,0,48,0,1,3,0,48,2,1,4,0,16,0,49,3,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"host-get"},{"t":"s","v":"dom-window"},{"t":"s","v":"localStorage"},{"t":"s","v":"getItem"}],"arity":1}},{"t":"s","v":"local-storage-set"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,20,2,0,48,0,1,3,0,48,2,1,4,0,16,0,16,1,49,4,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"host-get"},{"t":"s","v":"dom-window"},{"t":"s","v":"localStorage"},{"t":"s","v":"setItem"}],"arity":2}},{"t":"s","v":"local-storage-remove"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,20,2,0,48,0,1,3,0,48,2,1,4,0,16,0,49,3,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"host-get"},{"t":"s","v":"dom-window"},{"t":"s","v":"localStorage"},{"t":"s","v":"removeItem"}],"arity":1}},{"t":"s","v":"set-timeout"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,48,0,1,2,0,20,3,0,16,0,48,1,16,1,49,4,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"dom-window"},{"t":"s","v":"setTimeout"},{"t":"s","v":"host-callback"}],"arity":2}},{"t":"s","v":"set-interval"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,48,0,1,2,0,20,3,0,16,0,48,1,16,1,49,4,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"dom-window"},{"t":"s","v":"setInterval"},{"t":"s","v":"host-callback"}],"arity":2}},{"t":"s","v":"clear-timeout"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,48,0,1,2,0,16,0,49,3,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"dom-window"},{"t":"s","v":"clearTimeout"}],"arity":1}},{"t":"s","v":"clear-interval"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,48,0,1,2,0,16,0,49,3,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"dom-window"},{"t":"s","v":"clearInterval"}],"arity":1}},{"t":"s","v":"request-animation-frame"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,48,0,1,2,0,20,3,0,16,0,48,1,49,3,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"dom-window"},{"t":"s","v":"requestAnimationFrame"},{"t":"s","v":"host-callback"}],"arity":1}},{"t":"s","v":"fetch-request"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,48,0,1,2,0,16,0,16,1,49,4,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"dom-window"},{"t":"s","v":"fetch"}],"arity":2}},{"t":"s","v":"new-abort-controller"},{"t":"code","v":{"bytecode":[20,0,0,1,1,0,49,1,50],"constants":[{"t":"s","v":"host-new"},{"t":"s","v":"AbortController"}]}},{"t":"s","v":"controller-signal"},{"t":"code","v":{"bytecode":[20,0,0,16,0,1,1,0,49,2,50],"constants":[{"t":"s","v":"host-get"},{"t":"s","v":"signal"}],"arity":1}},{"t":"s","v":"controller-abort"},{"t":"code","v":{"bytecode":[20,0,0,16,0,1,1,0,49,2,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"abort"}],"arity":1}},{"t":"s","v":"promise-then"},{"t":"code","v":{"bytecode":[20,0,0,16,1,48,1,17,3,16,2,33,10,0,20,0,0,16,2,48,1,32,1,0,2,17,4,16,4,33,25,0,20,1,0,20,1,0,16,0,1,2,0,16,3,48,3,1,3,0,16,4,49,3,32,12,0,20,1,0,16,0,1,2,0,16,3,49,3,50],"constants":[{"t":"s","v":"host-callback"},{"t":"s","v":"host-call"},{"t":"s","v":"then"},{"t":"s","v":"catch"}],"arity":3}},{"t":"s","v":"promise-resolve"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,1,2,0,48,1,1,3,0,16,0,49,3,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"host-global"},{"t":"s","v":"Promise"},{"t":"s","v":"resolve"}],"arity":1}},{"t":"s","v":"promise-delayed"},{"t":"code","v":{"bytecode":[20,0,0,1,1,0,20,2,0,51,3,0,1,1,1,0,48,1,49,2,50],"constants":[{"t":"s","v":"host-new"},{"t":"s","v":"Promise"},{"t":"s","v":"host-callback"},{"t":"code","v":{"bytecode":[20,0,0,51,1,0,1,0,0,0,18,1,49,2,50],"constants":[{"t":"s","v":"set-timeout"},{"t":"code","v":{"bytecode":[20,0,0,18,0,1,1,0,2,18,1,49,4,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"call"}],"upvalue-count":2}}],"arity":1,"upvalue-count":2}}],"arity":2}},{"t":"s","v":"browser-confirm"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,48,0,1,2,0,16,0,49,3,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"dom-window"},{"t":"s","v":"confirm"}],"arity":1}},{"t":"s","v":"browser-prompt"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,48,0,1,2,0,16,0,16,1,49,4,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"dom-window"},{"t":"s","v":"prompt"}],"arity":2}},{"t":"s","v":"browser-media-matches?"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,20,2,0,48,0,1,3,0,16,0,48,3,1,4,0,49,2,50],"constants":[{"t":"s","v":"host-get"},{"t":"s","v":"host-call"},{"t":"s","v":"dom-window"},{"t":"s","v":"matchMedia"},{"t":"s","v":"matches"}],"arity":1}},{"t":"s","v":"json-parse"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,1,2,0,48,1,1,3,0,16,0,49,3,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"host-global"},{"t":"s","v":"JSON"},{"t":"s","v":"parse"}],"arity":1}},{"t":"s","v":"log-info"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,1,2,0,48,1,1,3,0,1,5,0,16,0,52,4,0,2,49,3,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"host-global"},{"t":"s","v":"console"},{"t":"s","v":"log"},{"t":"s","v":"str"},{"t":"s","v":"[sx] "}],"arity":1}},{"t":"s","v":"log-warn"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,1,2,0,48,1,1,3,0,1,5,0,16,0,52,4,0,2,49,3,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"host-global"},{"t":"s","v":"console"},{"t":"s","v":"warn"},{"t":"s","v":"str"},{"t":"s","v":"[sx] "}],"arity":1}},{"t":"s","v":"console-log"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,1,2,0,48,1,1,3,0,1,5,0,1,7,0,20,9,0,16,0,52,8,0,2,52,6,0,2,52,4,0,2,49,3,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"host-global"},{"t":"s","v":"console"},{"t":"s","v":"log"},{"t":"s","v":"join"},{"t":"s","v":" "},{"t":"s","v":"cons"},{"t":"s","v":"[sx]"},{"t":"s","v":"map"},{"t":"s","v":"str"}],"arity":1}},{"t":"s","v":"now-ms"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,1,2,0,48,1,1,3,0,49,2,50],"constants":[{"t":"s","v":"host-call"},{"t":"s","v":"host-global"},{"t":"s","v":"Date"},{"t":"s","v":"now"}]}},{"t":"s","v":"schedule-idle"},{"t":"code","v":{"bytecode":[20,0,0,51,1,0,1,0,48,1,17,1,20,2,0,20,3,0,48,0,1,4,0,48,2,33,18,0,20,5,0,20,3,0,48,0,1,4,0,16,1,49,3,32,10,0,20,6,0,16,1,1,7,0,49,2,50],"constants":[{"t":"s","v":"host-callback"},{"t":"code","v":{"bytecode":[18,0,49,0,50],"constants":[],"arity":1,"upvalue-count":1}},{"t":"s","v":"host-get"},{"t":"s","v":"dom-window"},{"t":"s","v":"requestIdleCallback"},{"t":"s","v":"host-call"},{"t":"s","v":"set-timeout"},{"t":"n","v":0}],"arity":1}},{"t":"s","v":"set-cookie"},{"t":"code","v":{"bytecode":[16,2,6,34,4,0,5,1,0,0,17,3,20,1,0,20,2,0,1,3,0,20,1,0,20,5,0,1,3,0,48,1,1,6,0,48,2,16,3,1,8,0,52,7,0,2,52,4,0,2,48,2,1,9,0,48,2,17,4,20,10,0,20,11,0,48,0,1,12,0,16,0,1,14,0,20,1,0,2,1,15,0,16,1,48,3,1,16,0,16,4,1,17,0,52,13,0,6,49,3,50],"constants":[{"t":"n","v":365},{"t":"s","v":"host-call"},{"t":"s","v":"host-new"},{"t":"s","v":"Date"},{"t":"s","v":"+"},{"t":"s","v":"host-global"},{"t":"s","v":"now"},{"t":"s","v":"*"},{"t":"n","v":86400000},{"t":"s","v":"toUTCString"},{"t":"s","v":"host-set!"},{"t":"s","v":"dom-document"},{"t":"s","v":"cookie"},{"t":"s","v":"str"},{"t":"s","v":"="},{"t":"s","v":"encodeURIComponent"},{"t":"s","v":";expires="},{"t":"s","v":";path=/;SameSite=Lax"}],"arity":3}},{"t":"s","v":"get-cookie"},{"t":"code","v":{"bytecode":[20,0,0,20,1,0,48,0,1,2,0,48,2,17,1,20,3,0,16,1,1,4,0,20,5,0,1,6,0,1,8,0,16,0,1,9,0,52,7,0,3,48,2,48,3,17,2,16,2,33,22,0,20,3,0,2,1,10,0,20,0,0,16,2,1,11,0,48,2,49,3,32,1,0,2,50],"constants":[{"t":"s","v":"host-get"},{"t":"s","v":"dom-document"},{"t":"s","v":"cookie"},{"t":"s","v":"host-call"},{"t":"s","v":"match"},{"t":"s","v":"host-new"},{"t":"s","v":"RegExp"},{"t":"s","v":"str"},{"t":"s","v":"(?:^|;\\s*)"},{"t":"s","v":"=([^;]*)"},{"t":"s","v":"decodeURIComponent"},{"t":"n","v":1}],"arity":1}}]}}