Fix signal-add-sub! losing subscribers after remove, fix build pipeline

signal-add-sub! used (append! subscribers f) which returns a new list
for immutable List but discards the result — after signal-remove-sub!
replaces the subscribers list via dict-set!, re-adding subscribers
silently fails. Counter island only worked once (0→1 then stuck).

Fix: use (dict-set! s "subscribers" (append ...)) to explicitly update
the dict field, matching signal-remove-sub!'s pattern.

Build pipeline fixes:
- sx-build-all.sh now bundles spec→dist and recompiles .sxbc bytecode
- compile-modules.js syncs .sx source files alongside .sxbc to wasm/sx/
- Per-file cache busting: wasm, platform JS, and sxbc each get own hash
- bundle.sh adds cssx.sx to dist

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-31 07:36:36 +00:00
parent 5abc947ac7
commit 9ce8659f74
12 changed files with 439 additions and 48 deletions

View File

@@ -15,6 +15,27 @@ cp -r "$OCAML_BUILD/sx_browser.bc.wasm.assets" shared/static/wasm/
echo " WASM loader: $(du -sh shared/static/wasm/sx_browser.bc.wasm.js | cut -f1)"
echo " JS fallback: $(du -sh shared/static/wasm/sx_browser.bc.js | cut -f1)"
echo "=== Sync spec .sx to dist (canonical → dist) ==="
cp spec/signals.sx hosts/ocaml/browser/dist/sx/core-signals.sx
cp spec/render.sx hosts/ocaml/browser/dist/sx/
cp spec/harness.sx hosts/ocaml/browser/dist/sx/
echo " spec → dist: 3 files"
echo "=== Sync web .sx to dist (wasm/sx → dist) ==="
for f in signals.sx deps.sx router.sx page-helpers.sx freeze.sx \
bytecode.sx compiler.sx vm.sx dom.sx browser.sx \
adapter-html.sx adapter-sx.sx adapter-dom.sx \
boot-helpers.sx hypersx.sx harness-reactive.sx harness-web.sx \
engine.sx orchestration.sx boot.sx cssx.sx; do
if [ -f "shared/static/wasm/sx/$f" ]; then
cp "shared/static/wasm/sx/$f" "hosts/ocaml/browser/dist/sx/"
fi
done
echo " wasm/sx → dist: web files synced"
echo "=== Recompile .sxbc bytecode ==="
node hosts/ocaml/browser/compile-modules.js || { echo "FAIL: sxbc compile"; exit 1; }
echo "=== JS browser build ==="
python3 hosts/javascript/cli.py --output shared/static/scripts/sx-browser.js || { echo "FAIL: JS build"; exit 1; }
echo "=== JS test build ==="