SIGN IN SIGN UP

test: pin that re-entrant dispatch is dropped; record why CallbackScope cannot fix it (#63)

Spike result. A re-entrant dispatch (JS -> native -> engine op -> engine fires
-> back into core) hits the outer HOST.borrow_mut() and is DROPPED. The suite
had a test that this does not panic; it had none that a plugin silently misses
the event, which is the part that actually bites.

v8::CallbackScope was investigated as the sanctioned way to get a scope when V8
is already on the stack, and REJECTED. Every NewCallbackScope impl in rusty_v8
149.4.0 needs either the &mut Isolate we do not have, or a live V8 handle
(FunctionCallbackInfo, Local<Context>, PromiseRejectMessage). The re-entrant
dispatch arrives through the C ABI with none of those in hand; reconstructing
one from a stashed raw Isolate pointer would alias a live &mut, which is UB
regardless of V8 permitting nested HandleScopes. The finding is written into the
test doc so it is not re-derived.

The tractable fix is a deferred-dispatch queue drained at the next frame
boundary, double-buffered the way SourceMod's RunFrameHooks swaps its two
queues. It converts a silent drop into a one-frame delay, and it cannot serve
PRE-hooks, which must answer synchronously.

469 passed.
G
Gabriel Hirakawa committed
34068f0cb586e4ad577f5927de75d9202cb983b8
Parent: 946cd6c
Committed by GitHub <noreply@github.com> on 8/1/2026, 6:14:15 AM