Files
rose-ash/plans/NOTE-wasm-try-deprecation.md
giles 7fc67497c4
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 38s
note: WASM kernel uses deprecated 'try' instruction + sync XHR (follow-up)
Real browser console on blog.rose-ash.com shows the WASM kernel (Jun-29 artifact, built
with an older wasm_of_ocaml) emits the legacy 'try' exception instruction (deprecated; use
try_table) + loadManifest does a sync XHR. Not breaking yet (SPA boots; the day's symptom
was a stale cached loader, cleared by hard refresh) but will break when browsers drop 'try'.
Fix = rebuild the kernel with the current 6.3.2 toolchain (may emit try_table) + verify in a
real browser + make loadManifest async. hosts/ocaml/browser toolchain; schedule when the box
is quiet with a rollback path, don't rush.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 15:38:47 +00:00

41 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Follow-up: WASM kernel uses deprecated `try` exception instruction (+ sync XHR)
**Found:** 2026-06-30, from a real browser console on `blog.rose-ash.com` (modern Chrome/Firefox).
**Severity:** not yet breaking — *deprecation warnings*. The SPA still boots (a hard refresh
cleared a stale cached loader, which was the day's actual symptom). But when browsers **remove**
the legacy `try` instruction, the WASM kernel will fail to instantiate → "SxKernel not found
after 5s" → no SPA (server-rendered pages + native-form writes still work; only SPA nav + the
interactive picker need the kernel).
## The two warnings
1. **`WebAssembly exception handling 'try' instruction is deprecated … use 'try_table' instead`**
(×6). The kernel `shared/static/wasm/sx_browser.bc.wasm.assets/*.wasm` was compiled (Jun-29
artifact) with the legacy exception-handling encoding. wasm_of_ocaml standardized on
`try_table`; current toolchain is **6.3.2**.
2. **`Synchronous XMLHttpRequest on the main thread is deprecated`** — `sx-platform.js:575`,
`loadManifest()` does `xhr.open("GET", …module-manifest.sx…, false)` (sync). Browsers
increasingly restrict sync XHR.
## Fix
1. **Rebuild the kernel with the current toolchain.** `bash hosts/ocaml/browser/build-all.sh`
(dune builds `browser/sx_browser.bc.wasm.js`), then `bundle.sh` syncs to
`shared/static/wasm/`. Modern wasm_of_ocaml 6.x *may* emit `try_table` by default → a fresh
rebuild alone could fix #1. **Verify:** disassemble a `.wasm` unit (`wasm-tools print` / grep
for `try_table` vs `try`), then boot it in a REAL up-to-date browser (not just the older
Playwright chromium, which still accepts `try`) and confirm no deprecation warning + SxKernel
registers. If 6.3.2 still emits legacy `try`, check for a wasm_of_ocaml flag or bump the
compiler.
2. **`loadManifest` → async.** Change to an async fetch and restructure the boot so the manifest
is awaited before module loading (it's currently consumed synchronously). Contained to
`hosts/ocaml/browser/sx-platform.js` + its copy in `shared/static/wasm/`.
## Scope / ownership
`hosts/ocaml/browser/` is the OCaml→WASM toolchain — generally out of the host loop's lane, though
the host loop has committed there for the blog SPA (b21ae05e, 689dae7d). A kernel rebuild affects
the LIVE SPA, so do it when the box is quiet, with real-browser verification, and a quick rollback
path (the Jun-29 `.assets` are the known-good artifact — keep a copy before overwriting). Not
urgent; schedule rather than rush.