swactor/big-feature-phase/notes/history.md
Claude 2649a54feb feat: platform abstraction layer for wasm32 compilation (Stage 1)
Core swactor now compiles for wasm32-unknown-unknown:
- Added `wasm` feature flag (bundles no_random + web-time)
- Platform-aware Instant: web_time::Instant on wasm, std::time on native
- cfg-gated Runtime::run() and RuntimeHandle (thread::spawn unavailable
  on wasm32 — browser crate provides Web Worker-based alternative)
- Validated: crossbeam-queue, atomics, Mutex, RwLock, thread parking all
  work on wasm32 with atomics target feature
- Updated crates/wasm/ to use new `wasm` feature

Authored by Claude, lovingly guided by Zachery Aaron Shores-Chmielewski
2026-02-13 20:20:09 +07:00

7 lines
1 KiB
Markdown

# Cycle History (append-only)
## Cycle 0 — Research (complete)
Investigated Lunatic, wasmCloud, Actix-wasm attempts. Analyzed core swactor platform deps: 4 blockers (thread spawn, park/unpark, yield, Instant). User confirmed: performance-first, SharedArrayBuffer+wasm-threads, Rust-only actors, all feasible features, future STUN/TURN. Produced constraints.md, research_synthesis.md, 6 feature-stage docs. Next: Stage 1 platform abstraction.
## Stage 1 — Platform Abstraction (complete)
Added `wasm` feature + `web-time` dep. Replaced `std::time::Instant` → `crate::Instant` (cfg-gated re-export). Gated `Runtime::run()` and `RuntimeHandle` for non-wasm. Key finding: only `thread::spawn` needed gating — park/unpark/yield/Mutex/RwLock/atomics/crossbeam all work on wasm32 with atomics. Cleaned unused Mutex import in worker.rs. Updated crates/wasm/ to use `wasm` feature. All native tests pass, wasm32 compilation succeeds. Files changed: Cargo.toml, src/lib.rs, src/runtime.rs, src/worker.rs, crates/wasm/Cargo.toml.