Parent: #493 Related: #763, #859
Problem
The pinned private heap-snapshot/profile boundary walks an attacker-shaped
JavaScript heap with ReachabilityVisitor.seen, a fixed-seed
AutoHashMapUnmanaged(usize, usize) keyed by raw cell address. Arena-backed VMs
also retain address-to-stable-ID mappings in
CContextGroup.heap_snapshot_ids, another fixed-seed usize map. The same
visitor powers the public ZJSValueIsReachable extension.
A program controls heap width, graph shape, allocation history, and repeated snapshot timing. Predictable pointer hashing can therefore amplify traversal and stable-ID assignment before the host receives any output. #763 secured the snapshot's string interning but did not cover cell identity.
ReachabilityVisitor.roots_seen is a third hash table, but its keys are dense
one-based node indices allocated by the same visitor; hashing is unnecessary.
The private diagnostic inspector's active-path map is excluded because its
recursion depth is already hard-capped at eight.
Required design
- Add one lazy, exact
usizeidentity-map primitive for private C/ABI data, seeded from secure host entropy with no predictable fallback. - Publish the context only after the first backing allocation succeeds; failed entropy/allocation leaves context, count, and capacity empty and retryable.
- Use that primitive for transient reachability cell indexing and persistent arena-cell snapshot IDs. Precise-GC cells must retain their existing relocation-stable odd-ID path and never enter the address table.
- Replace root-index hash membership with dense per-node flags and preserve first-root ordering exactly.
- Keep graph traversal, weak/ephemeron policy, edge ordering, stable IDs, retained-size dominators, output schemas, and C/private ABI ownership exact.
- Do not cap heap width, omit nodes/edges, expose partial output, or substitute linear scans.
Acceptance
- A deterministic legacy
usizecollision family disperses under the new context with exact get/remove behavior. - Entropy failure and first-allocation failure publish no context/table; retry succeeds exactly.
- Root dedup uses dense flags with exact first-root order and OOM cleanup.
- Repeated arena snapshots retain stable even IDs; precise cells retain relocation-stable odd IDs.
- Snapshot V8/GCDebugging/profile outputs, reachability, dominators, and allocation-failure tests pass in Debug, ReleaseSafe, and TSan.
- Full sharded units, public C API, Home/Bun private ABI audits and runtime boundaries pass; Test262 is recorded N/A because this is host-only ABI.
- Commit and closure evidence link exact commands/results.