Research phase for browser-native swactor runtime: - constraints.md: wasm-threads (SharedArrayBuffer), Rust-only actors, COOP/COEP required, no new modules in src/ - research_synthesis.md: P0-P4 priority ranking, platform dependency analysis, ecosystem comparison (Lunatic, wasmCloud, Actix) - 6 feature-stage docs: platform abstraction → single-worker → multi-worker parallelism → feature parity → transport → DX - Key decision: SharedArrayBuffer + wasm-threads over postMessage isolation (swactor's shared-memory architecture demands it) Authored by Claude, lovingly guided by Zachery Aaron Shores-Chmielewski
46 lines
2.3 KiB
Markdown
46 lines
2.3 KiB
Markdown
## Current Task
|
|
Cycle 0 — Research
|
|
Step: Complete
|
|
Attempt: 1 of 3
|
|
|
|
## Key Files (read these first on resume)
|
|
- `big-feature-phase/TASK.md` — workflow rules
|
|
- `big-feature-phase/notes/constraints.md` — guardrails for in-browser runtime
|
|
- `big-feature-phase/notes/research_synthesis.md` — P0-P4 priority ranking
|
|
- `big-feature-phase/notes/feature-stages/01-platform-abstraction.md` — Stage 1 spec
|
|
- `src/runtime.rs` — thread spawn (line 351), park handles (line 110), Instant (line 205)
|
|
- `src/worker.rs` — backoff loop (lines 495-523), Instant timing (9 calls)
|
|
- `src/delivery.rs` — TickContext.worker_threads (line 246)
|
|
- `src/channel.rs` — crossbeam HybridChannel (validate wasm compilation)
|
|
- `crates/wasm/src/lib.rs` — existing PoC browser runtime
|
|
|
|
## Last Action & Result
|
|
Completed Cycle 0 research phase:
|
|
- Investigated similar projects (Lunatic, wasmCloud, Actix wasm attempts)
|
|
- Analyzed all platform-specific code in core swactor (4 blockers found)
|
|
- User confirmed: Rust-only actors, performance-first, Web Workers, all features, full peer
|
|
- Key decision: SharedArrayBuffer + wasm-threads (not postMessage isolation)
|
|
- Wrote constraints.md, research_synthesis.md, 6 feature-stage docs
|
|
|
|
## Next Action
|
|
Begin Stage 1 (Platform Abstraction Layer) — `notes/feature-stages/01-platform-abstraction.md`:
|
|
1. Add `web-time` dependency to core Cargo.toml
|
|
2. Replace `std::time::Instant` with `web_time::Instant` in runtime.rs and worker.rs
|
|
3. Implement `ParkHandle` abstraction with cfg gates
|
|
4. Gate `Runtime::run()` thread spawning for non-wasm
|
|
5. Validate crossbeam-queue compiles for wasm32 with atomics
|
|
6. Add `wasm` feature flag
|
|
|
|
## Completed This Session
|
|
- [x] Read TASK.md, state.md, history.md (context restart checklist)
|
|
- [x] Investigated similar codebases (Lunatic, wasmCloud, Actix-wasm)
|
|
- [x] Analyzed platform dependencies in core swactor
|
|
- [x] Asked and resolved design questions with user
|
|
- [x] Wrote `notes/constraints.md`
|
|
- [x] Wrote `notes/research_synthesis.md`
|
|
- [x] Created `notes/feature-stages/` with 6 stage docs
|
|
|
|
## Open Questions / Blockers
|
|
- Need to verify crossbeam-queue compiles for wasm32 with atomics (Stage 1 task)
|
|
- Need to find/verify correct `core::arch::wasm32` APIs for memory_atomic_wait/notify
|
|
- Nightly Rust toolchain + wasm32 target needs to be set up in CI
|