You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- V8Runtime (Rust process) is heavyweight — use shared singleton (getSharedV8Runtime) across all NodeExecutionDrivers; each driver creates its own V8Session
- Rust SYNC_BRIDGE_FNS/ASYNC_BRIDGE_FNS in session.rs must match HOST_BRIDGE_GLOBAL_KEYS from bridge-contract.ts — update both when adding new bridge functions
10
+
- v8::External data in FunctionTemplates causes SIGSEGV during snapshot serialization — for snapshot stubs, use FunctionTemplate::builder(callback).build() without .data()
10
11
- Bridge handler args are spread by host routing (runtime.ts): to pass a single array arg, serialize as [[array]] so handler(...args) gives handler(array)
11
12
- V8 Module::get_module_requests() returns FixedArray — cast elements via data.cast::<v8::ModuleRequest>(), then get_specifier() for import specifier string
12
13
- IPC writes use per-session ChannelFrameSender (crossbeam channel) + one writer thread per connection — never use shared mutex for socket writes; serialize via frame_to_bytes() first
- BinaryFrame::BridgeCall/BridgeResponse call_id field type change propagates automatically through destructuring patterns in session.rs and main.rs
2833
2834
- TS BigInt↔Number conversion via Number(buf.readBigUInt64BE()) and BigInt(frame.callId) works cleanly for counters within Number.MAX_SAFE_INTEGER
2834
2835
---
2836
+
2837
+
## 2026-03-19 - US-062
2838
+
- Implemented BridgeCallContext::stub() in host_call.rs — no-op context that panics if sync_call or async_send is called
2839
+
- Implemented register_stub_bridge_fns() in bridge.rs — registers FunctionTemplates with same sync_bridge_callback/async_bridge_callback but WITHOUT v8::External data (snapshot-safe)
2840
+
- Made SYNC_BRIDGE_FNS and ASYNC_BRIDGE_FNS pub(crate) in session.rs (removed #[cfg(not(test))])
2841
+
- Added tests: stub panic tests in host_call.rs, stub registration on V8 global, bridge IIFE execution + snapshot creation in snapshot.rs
- crates/v8-runtime/src/snapshot.rs — Part 13 (stub registration) and Part 14 (IIFE + snapshot creation) tests
2847
+
- **Learnings for future iterations:**
2848
+
- v8::External data (raw pointers) in FunctionTemplates causes SIGSEGV during V8 snapshot serialization — for snapshot stubs, omit .data() from FunctionTemplate::builder
2849
+
- When stubs have no External data, callback's args.data() returns undefined → try_from::<v8::External> fails → throws V8 exception, which is correct behavior for stubs
2850
+
- Pre-existing SIGSEGV on process teardown after running full cargo test suite (V8 global state cleanup) — not a regression
"notes": "BridgeCallContext::stub() panics on sync_call/async_send. register_stub_bridge_fns() registers FunctionTemplates with same callbacks but no External data (avoids SIGSEGV during snapshot serialization). After restore, stubs are replaced with real functions. SYNC_BRIDGE_FNS/ASYNC_BRIDGE_FNS made pub(crate). Tests: stub panic tests in host_call.rs, stub registration + snapshot creation in snapshot.rs."
0 commit comments