Skip to content

Commit 0548ae2

Browse files
NathanFlurryclaude
andcommitted
chore: update progress for US-063
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a9d7102 commit 0548ae2

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

scripts/ralph/prd.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,8 +1332,8 @@
13321332
"Typecheck passes"
13331333
],
13341334
"priority": 68,
1335-
"passes": false,
1336-
"notes": "Spec: docs-internal/specs/v8-context-snapshot.md Phase 5."
1335+
"passes": true,
1336+
"notes": "create_snapshot() registers all 38 stub bridge functions via register_stub_bridge_fns(), injects default _processConfig and _osConfig via inject_snapshot_defaults(), runs the bridge IIFE, then snapshots the fully-initialized context. Tests verify: stubs and config globals present during IIFE execution (Part 15), getter facade + closures + config reads work through create_snapshot() and are preserved in restored context (Part 16), SnapshotCache works with new create_snapshot (Part 17)."
13371337
},
13381338
{
13391339
"id": "US-064",

scripts/ralph/progress.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,3 +448,22 @@ Started: Wed Mar 18 06:52:02 PM PDT 2026
448448
- Static bridge code can be cached at module level since it's identical across all driver instances and sessions
449449
- Pre-existing test failures: test-suite/node (4 fails from `__name` conflict), runtime-driver/node (228 fails from `__name` conflict), V8 crash/process isolation (3 OOM timeouts)
450450
---
451+
452+
## 2026-03-19 - US-063
453+
- Updated `create_snapshot()` in `snapshot.rs` to create fully-initialized context snapshots
454+
- Added `register_stub_bridge_fns(scope, &SYNC_BRIDGE_FNS, &ASYNC_BRIDGE_FNS)` call before running bridge IIFE
455+
- Added `inject_snapshot_defaults(scope)` to inject default `_processConfig` (cwd="/", env={}, timing_mitigation="off") and `_osConfig` (homedir="/root", tmpdir="/tmp", platform="linux", arch="x64") as frozen, read-only globals
456+
- Default config globals are injected via inline JS evaluation + Object.freeze + define_own_property(READ_ONLY | DONT_DELETE)
457+
- Added 3 new test parts (15-17):
458+
- Part 15: Verifies all 38 stub bridge functions and default config globals are present during bridge IIFE execution
459+
- Part 16: Verifies getter facade, closures, require-like functions, and config reads work through create_snapshot(); verifies restored default context preserves all bridge infrastructure
460+
- Part 17: Verifies SnapshotCache works with the updated create_snapshot()
461+
- Files changed: `crates/v8-runtime/src/snapshot.rs`
462+
- **Learnings for future iterations:**
463+
- V8 snapshot_creator MUST call `create_blob()` before being dropped — early returns (via `?`) cause SIGSEGV in the destructor
464+
- Error handling in `create_snapshot()` must collect errors and return them AFTER `create_blob()`, not via early return
465+
- Bridge IIFE setup code does NOT call bridge functions at the top level (only creates closures/wrappers), so stub functions are safe for snapshot creation
466+
- `_loadPolyfill` is only called inside `require()` at runtime, not during IIFE setup — stubs don't need to handle it
467+
- Pre-existing SIGSEGV when running execution::tests AND snapshot::tests in the same process (V8 inter-test state issue) — run them separately: `cargo test execution::tests -- --test-threads=1` and `cargo test snapshot::tests -- --test-threads=1`
468+
- `inject_snapshot_defaults` uses inline JS evaluation to create config objects (avoids manual V8 object construction)
469+
---

0 commit comments

Comments
 (0)