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
"notes": "Added post_restore_script field to Execute IPC message (Rust + TS). Rust session runs it via run_init_script() after bridge fn replacement, before user code. execution-driver.ts sends static IIFE as bridgeCode and composePostRestoreScript() as separate postRestoreScript. Bridge process.ts exposes __runtimeResetProcessState() for mutable state reset (processStartTime, exitCode, exited). Polyfills load lazily via require() — no eager _loadPolyfill calls needed."
- The `from_snapshot` flag is stable for the session lifetime — once set on isolate creation, all subsequent Executes on the same session use the same path
493
493
- Pre-existing test failures: `__name` conflict in runtime-driver/node tests, Python tests (PythonRuntime not a constructor), project-matrix tests — all unrelated to this story
494
494
---
495
+
496
+
## 2026-03-19 - US-065
497
+
- Wired post-restore init script through IPC for context snapshot support
498
+
- Added `post_restore_script` field to Execute IPC message wire format (Rust `ipc_binary.rs` + TS `ipc-binary.ts`)
499
+
- Added `run_init_script()` in `execution.rs` — compiles and runs a short script without code caching
500
+
- Updated `session.rs` to run post-restore script after bridge fn replacement, before user code (returns error on failure)
501
+
- Updated `V8ExecutionOptions` in `session.ts` with optional `postRestoreScript` field
502
+
- Updated `runtime.ts` to send `postRestoreScript` in Execute frame
503
+
- Split `composeBridgeCode()` into static IIFE only; post-restore script sent separately via `composePostRestore()`
504
+
- `composeBridgeCodeForWarmup()` now returns only the static IIFE (snapshot is config-independent)
505
+
- Added `__runtimeResetProcessState()` to bridge `process.ts` — resets `_processStartTime`, `_exitCode`, `_exited` closure variables for snapshot restore
506
+
- Added `__runtimeResetProcessState` type to `runtime-globals.d.ts`
507
+
- `composePostRestoreScript()` now calls `__runtimeResetProcessState()` after `__runtimeApplyConfig()`
508
+
- Polyfills load lazily via `require()` — `_loadPolyfill` is a free variable resolved at call time, works after bridge fn replacement
- Bridge `process.ts` uses `(globalThis as Record<string, unknown>)` cast for dynamic global properties — the bridge tsconfig doesn't include `runtime-globals.d.ts`
512
+
- The release binary (`target/release/secure-exec-v8`) is used by tests if it exists — must rebuild release after wire format changes
513
+
- `_processStartTime` was `const` — changed to `let` to support reset; `_exitCode` and `_exited` already `let`
514
+
- Mutable state resets are a no-op on fresh context (per-Execute `Context::new()` clones snapshot) — only matter for snapshot-restored contexts
515
+
- `_loadPolyfill` is called lazily inside `require()`, not during bridge IIFE setup — no eager polyfill loading needed in post-restore script
516
+
- Wire format change: Execute now has `[bc_len(u32)][bc][prs_len(u32)][prs][user_code(rest)]` — post_restore_script uses u32 length prefix before user_code
0 commit comments