Skip to content

Commit 357d094

Browse files
NathanFlurryclaude
andcommitted
chore: update progress for US-062
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 535da52 commit 357d094

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

progress.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ PRD: ralph/kernel-hardening (46 stories)
77
- V8Runtime (Rust process) is heavyweight — use shared singleton (getSharedV8Runtime) across all NodeExecutionDrivers; each driver creates its own V8Session
88
- Bridge code composition order: ivm-compat shim → config injections → globalExposureHelpers → initialBridgeGlobals → consoleSetup → setupFsFacade → bridgeBundle → bridgeAttach → timingMitigation → requireSetup
99
- 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()
1011
- 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)
1112
- V8 Module::get_module_requests() returns FixedArray — cast elements via data.cast::<v8::ModuleRequest>(), then get_specifier() for import specifier string
1213
- 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
@@ -2832,3 +2833,20 @@ PRD: ralph/kernel-hardening (46 stories)
28322833
- BinaryFrame::BridgeCall/BridgeResponse call_id field type change propagates automatically through destructuring patterns in session.rs and main.rs
28332834
- TS BigInt↔Number conversion via Number(buf.readBigUInt64BE()) and BigInt(frame.callId) works cleanly for counters within Number.MAX_SAFE_INTEGER
28342835
---
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
2842+
- Files changed:
2843+
- crates/v8-runtime/src/host_call.rs — StubFrameSender, StubResponseReceiver, BridgeCallContext::stub(), 2 panic tests
2844+
- crates/v8-runtime/src/bridge.rs — register_stub_bridge_fns()
2845+
- crates/v8-runtime/src/session.rs — pub(crate) SYNC_BRIDGE_FNS/ASYNC_BRIDGE_FNS
2846+
- 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
2851+
- SYNC_BRIDGE_FNS (31) + ASYNC_BRIDGE_FNS (7) = 38 total bridge functions
2852+
---

scripts/ralph/prd.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,8 +1314,8 @@
13141314
"Typecheck passes"
13151315
],
13161316
"priority": 67,
1317-
"passes": false,
1318-
"notes": "Spec: docs-internal/specs/v8-context-snapshot.md Phase 4."
1317+
"passes": true,
1318+
"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."
13191319
},
13201320
{
13211321
"id": "US-063",

0 commit comments

Comments
 (0)