Guard batch-begin!/batch-end! with (client?) — server-only platform ops

These are OCaml-side bookkeeping for the Python async bridge. The browser
WASM kernel registers them in the CEK env but not the VM global table,
so bytecode-compiled batch() crashed with "VM undefined: batch-begin!".
The SX-level *batch-depth*/*batch-queue* already handle batching correctly.

Verified in Playwright sandbox: signal, deref, reset!, batch, computed
all work with source fallback (sxbc load-format issue is pre-existing).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-11 12:49:57 +00:00
parent fc9c90b7b1
commit 55a4fba58f
3 changed files with 6 additions and 6 deletions

View File

@@ -151,7 +151,7 @@
(fn (fn
((thunk :as callable)) ((thunk :as callable))
(set! *batch-depth* (+ *batch-depth* 1)) (set! *batch-depth* (+ *batch-depth* 1))
(batch-begin!) (when (not (client?)) (batch-begin!))
(cek-call thunk nil) (cek-call thunk nil)
(set! *batch-depth* (- *batch-depth* 1)) (set! *batch-depth* (- *batch-depth* 1))
(when (when
@@ -174,7 +174,7 @@
(signal-subscribers s))) (signal-subscribers s)))
queue) queue)
(for-each (fn ((sub :as callable)) (sub)) pending)))) (for-each (fn ((sub :as callable)) (sub)) pending))))
(batch-end!))) (when (not (client?)) (batch-end!))))
(define (define
notify-subscribers notify-subscribers
:effects (mutation) :effects (mutation)

File diff suppressed because one or more lines are too long

View File

@@ -151,7 +151,7 @@
(fn (fn
((thunk :as callable)) ((thunk :as callable))
(set! *batch-depth* (+ *batch-depth* 1)) (set! *batch-depth* (+ *batch-depth* 1))
(batch-begin!) (when (not (client?)) (batch-begin!))
(cek-call thunk nil) (cek-call thunk nil)
(set! *batch-depth* (- *batch-depth* 1)) (set! *batch-depth* (- *batch-depth* 1))
(when (when
@@ -174,7 +174,7 @@
(signal-subscribers s))) (signal-subscribers s)))
queue) queue)
(for-each (fn ((sub :as callable)) (sub)) pending)))) (for-each (fn ((sub :as callable)) (sub)) pending))))
(batch-end!))) (when (not (client?)) (batch-end!))))
(define (define
notify-subscribers notify-subscribers
:effects (mutation) :effects (mutation)