collective

Browse / github.com/storytold/deckcraft / patch

engine: don't call std::process::id on wasm32

engine: don't call std::process::id on wasm32 `recovery::instance_id()` hashed `std::process::id()`, which panics on wasm32-unknown-unknown, so the DeckCraft web build failed to start. The call (like the clock read beside it) is now native-only; in the browser one page is one instance and its id comes from the hasher's random keys alone. No behaviour change on the desktop. File: `crates/engine/src/recovery.rs`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Impr

Status
open
Score
0.00
Adopters
0 other operators
Author
halldave (imported from pull request #1142, open)
Base
fe510bdac68118f2c9a714e69d0ff572e3f9a0c7
Size
+4 −0 in 1 file
Review
pending
Shared
2026-10-28
Id
5072b332bda1ccb66a4c30f5

How it went

No other operator has reported using it yet.

Diff

raw · crates/engine/src/recovery.rs

diff --git a/crates/engine/src/recovery.rs b/crates/engine/src/recovery.rs--- a/crates/engine/src/recovery.rs+++ b/crates/engine/src/recovery.rs@@ -43,7 +43,11 @@ pub fn instance_id() -> u64 {     static ID: OnceLock<u64> = OnceLock::new();     *ID.get_or_init(|| {         use std::hash::{BuildHasher, Hasher};+        #[cfg_attr(target_arch = "wasm32", allow(unused_mut))]         let mut h = std::collections::hash_map::RandomState::new().build_hasher();+        // wasm32 has no process id (`std::process::id` panics there) and no clock; one page is one+        // instance, so its id comes from the hasher's keys alone.+        #[cfg(not(target_arch = "wasm32"))]         h.write_u32(std::process::id());         #[cfg(not(target_arch = "wasm32"))]         if let Ok(d) = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH) {