Skip to content

Commit 8b2bdf2

Browse files
NathanFlurryclaude
andcommitted
chore: update progress for US-053
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 335f1b8 commit 8b2bdf2

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

progress.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ PRD: ralph/kernel-hardening (46 stories)
1414
- SharedArrayBuffer removal must happen AFTER bridge bundle loads (applyTimingMitigationFreeze JS), not in Rust inject_globals
1515
- V8 snapshot tests must be consolidated into a single #[test] fn (like execution::tests) — parallel V8 isolate teardown causes SIGSEGV
1616
- v8::CreateParams::snapshot_blob() needs owned data (Deref<Target=[u8]> + Borrow<[u8]> + 'static); use Vec<u8> or StartupData, not &[u8]
17+
- v8::StartupData is not Send/Sync (contains *const i8) — store snapshot blobs as Arc<Vec<u8>> for cross-thread sharing; SnapshotCache.get_or_create() returns Arc<Vec<u8>>
1718
- ExternalReference { function: callback.map_fn_to() } — MapFnTo trait converts Rust fn to extern "C" FunctionCallback
1819
- ivm-compat shim adds .applySync/.applySyncPromise to Rust-registered functions; .apply() works via Function.prototype.apply (no shim needed)
1920
- @secure-exec/v8 is ESM — use `fileURLToPath(import.meta.url)` for __dirname, not `require()` or `__dirname` global
@@ -2674,3 +2675,15 @@ PRD: ralph/kernel-hardening (46 stories)
26742675
- 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
26752676
- `Allocated` trait is not re-exported from v8 crate — use equivalent trait bounds directly in function signatures
26762677
---
2678+
2679+
## 2026-03-19 - US-053
2680+
- Added SnapshotCache struct with Mutex-guarded Vec<CacheEntry> and LRU eviction
2681+
- get_or_create() hashes bridge code with SipHash (std DefaultHasher), returns cached Arc on hit, creates snapshot on miss
2682+
- LRU moves accessed entries to end on hit; evicts front (oldest) when at max_entries capacity
2683+
- Blob stored as Arc<Vec<u8>> instead of Arc<StartupData> for Send+Sync compatibility
2684+
- 4 new test parts in consolidated snapshot test: cache hit (same Arc), cache miss (different Arc), LRU eviction, concurrent access (4 threads all get same Arc)
2685+
- Files changed: crates/v8-runtime/src/snapshot.rs
2686+
- **Learnings for future iterations:**
2687+
- v8::StartupData contains *const i8 raw pointer — not Send/Sync. Store snapshot blobs as Arc<Vec<u8>> (via .to_vec()) for cross-thread sharing
2688+
- SnapshotCache holds mutex during snapshot creation (~20ms) — acceptable since it happens once per bridge code variant
2689+
---

scripts/ralph/prd.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,8 @@
897897
"Typecheck passes"
898898
],
899899
"priority": 53,
900-
"passes": false,
901-
"notes": "Spec: docs-internal/specs/v8-startup-snapshot.md. Mutex hold time during snapshot creation (~20ms) is acceptable — happens once per variant."
900+
"passes": true,
901+
"notes": "Spec: docs-internal/specs/v8-startup-snapshot.md. Blob stored as Arc<Vec<u8>> (not Arc<StartupData>) because v8::StartupData contains raw pointers that are not Send/Sync. LRU moves accessed entries to end on hit. 4 new test parts: cache hit same Arc, cache miss different Arc, LRU eviction, concurrent access."
902902
},
903903
{
904904
"id": "US-054",

0 commit comments

Comments
 (0)