Skip to content

Commit 0c5725b

Browse files
NathanFlurryclaude
andcommitted
chore: update progress for US-052
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 274431b commit 0c5725b

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

progress.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ PRD: ralph/kernel-hardening (46 stories)
1212
- 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
1313
- V8 code caching: use `v8::script_compiler::compile()` (not `Script::compile()`) with `Source` + `CompileOptions`; generate cache via `UnboundScript::create_code_cache()`; resource name in ScriptOrigin is required
1414
- SharedArrayBuffer removal must happen AFTER bridge bundle loads (applyTimingMitigationFreeze JS), not in Rust inject_globals
15+
- V8 snapshot tests must be consolidated into a single #[test] fn (like execution::tests) — parallel V8 isolate teardown causes SIGSEGV
16+
- v8::CreateParams::snapshot_blob() needs owned data (Deref<Target=[u8]> + Borrow<[u8]> + 'static); use Vec<u8> or StartupData, not &[u8]
17+
- ExternalReference { function: callback.map_fn_to() } — MapFnTo trait converts Rust fn to extern "C" FunctionCallback
1518
- ivm-compat shim adds .applySync/.applySyncPromise to Rust-registered functions; .apply() works via Function.prototype.apply (no shim needed)
1619
- @secure-exec/v8 is ESM — use `fileURLToPath(import.meta.url)` for __dirname, not `require()` or `__dirname` global
1720
- Claude binary at ~/.claude/local/claude — not on PATH by default; skip helpers must check this fallback location
@@ -2657,3 +2660,17 @@ PRD: ralph/kernel-hardening (46 stories)
26572660
- docs.json navigation uses flat page slugs relative to docs/ root (e.g., "process-isolation" not "docs/process-isolation")
26582661
- Existing docs use mermaid diagrams, tables, and code blocks for different explanation styles
26592662
---
2663+
2664+
## 2026-03-19 - US-052
2665+
- Implemented external_refs() in bridge.rs returning &'static ExternalReferences via OnceLock with sync_bridge_callback and async_bridge_callback
2666+
- Created snapshot.rs with create_snapshot(bridge_code) and create_isolate_from_snapshot(blob, heap_limit_mb)
2667+
- create_snapshot returns Result<StartupData, String>, rejects blobs >50MB
2668+
- create_isolate_from_snapshot uses generic bound (Deref<Target=[u8]> + Borrow<[u8]> + 'static) for blob parameter
2669+
- 5 consolidated tests: non-empty blob, restored isolate JS execution, heap limit respect, size under limit, 3 sequential restores
2670+
- Files changed: crates/v8-runtime/src/bridge.rs, crates/v8-runtime/src/snapshot.rs (new), crates/v8-runtime/src/main.rs
2671+
- **Learnings for future iterations:**
2672+
- V8 ExternalReference union field `function` expects FunctionCallback type — use `.map_fn_to()` from MapFnTo trait to convert Rust function signatures
2673+
- v8::CreateParams::snapshot_blob() requires `impl Allocated<[u8]>` which is `Deref<Target=[u8]> + Borrow<[u8]> + 'static` — &[u8] doesn't satisfy this; use owned types (Vec<u8>, StartupData, Box<[u8]>)
2674+
- Snapshot tests must be consolidated into a single #[test] function (same as execution::tests) to avoid V8 global state SIGSEGV when test runner runs tests in parallel
2675+
- `Allocated` trait is not re-exported from v8 crate — use equivalent trait bounds directly in function signatures
2676+
---

scripts/ralph/prd.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -880,8 +880,8 @@
880880
"Typecheck passes"
881881
],
882882
"priority": 52,
883-
"passes": false,
884-
"notes": "Spec: docs-internal/specs/v8-startup-snapshot.md. ExternalReferences must be 'static (OnceLock). create_blob() consumes the isolate. Use v8::Isolate::snapshot_creator(Some(&EXTERNAL_REFS), None) not SnapshotCreator::new()."
883+
"passes": true,
884+
"notes": "Spec: docs-internal/specs/v8-startup-snapshot.md. external_refs() uses OnceLock with sync_bridge_callback and async_bridge_callback. create_snapshot() returns Result<StartupData, String> with 50MB limit check. create_isolate_from_snapshot() takes generic blob (impl Deref<Target=[u8]> + Borrow<[u8]> + 'static). 5 consolidated tests: non-empty blob, restored isolate JS exec, heap limit, size under limit, 3 sequential restores."
885885
},
886886
{
887887
"id": "US-053",

0 commit comments

Comments
 (0)