Repository navigation
feat(wasi): Phase 8.1b — wasm32-wasip1 server-side WASM support - #152
Merged
Merged
Conversation
…wasm only wasm32-wasip1 (WASI) has no JavaScript engine. The previous cfg gate 'target_arch = wasm32' applied to WASI too, pulling in wasm-bindgen and getrandom's JS path. Narrowed to 'all(target_arch = wasm32, not(target_os = wasi))'. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous wasm32 branch returned Ok(()) immediately, making the binary a no-op under WASI. Add a target_os = wasi branch that opens an in-memory Minigraf database and runs the REPL via stdin/stdout. File-backed storage is out of scope for WASI (in-memory only). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Uses #[cfg(all(target_os = "wasi", test))] to avoid firing in the browser WASM environment where wasm-pack requires #[wasm_bindgen_test] instead. Run via: CARGO_TARGET_WASM32_WASIP1_RUNNER='wasmtime run --dir /tmp' cargo test --target wasm32-wasip1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…smer Previous workflow had a fragile two-job split with artifact upload/download and no Wasmer step. New workflow: build -> WASI unit tests (via CARGO_TARGET_WASM32_WASIP1_RUNNER) -> Wasmtime smoke -> Wasmer smoke, all in one job. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #152 +/- ##
==========================================
- Coverage 90.44% 83.41% -7.03%
==========================================
Files 26 26
Lines 15085 4837 -10248
Branches 562 0 -562
==========================================
- Hits 13644 4035 -9609
+ Misses 1369 802 -567
+ Partials 72 0 -72
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Triple form [:e1 :name "hello"] with keyword :e1 is a valid entity id.
Map form with bare string "e1" is not accepted by edn_to_entity_id.
Under WASI p1, a panic aborts the process (no unwind), so the
expect("transact") on the failing execute() killed the entire test run.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
WASI p1 has no thread support — thread::spawn panics immediately, which under WASI p1 (no unwind) aborts the entire test process. Gate test_concurrent_range_scans_correctness in btree_v6.rs and test_concurrent_reads in cache.rs so they are excluded from the wasm32-wasip1 test binary. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Map form {:db/id "eid-1" :name "Alice"} is invalid — edn_to_entity_id
only accepts keywords or UUID strings. Triple form [:alice :name "Alice"]
uses a keyword entity id which is always valid.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #130.
What
Compiles Minigraf to
wasm32-wasip1with a working in-memory REPL, tested in CI by both Wasmtime and Wasmer.Changes
Cargo.toml: Narrowedtarget_arch = "wasm32"dep/dev-dep blocks toall(target_arch = "wasm32", not(target_os = "wasi"))— preventsuuid'sjsfeature (andwasm-bindgen-test) from applying to WASI targets where there is no JavaScript engine.src/main.rs: Added#[cfg(target_os = "wasi")]branch that opens an in-memory database and runs the REPL. File-backed storage is out of scope for WASI (in-memory only per design decision).src/db.rs: Added#[cfg(all(target_os = "wasi", test))]smoke test, run viaCARGO_TARGET_WASM32_WASIP1_RUNNER..github/workflows/wasm-wasi.yml: Rewrote as a single job: build → WASI unit tests (--libvia Wasmtime runner) → Wasmtime smoke (transact + query, output verified) → Wasmer smoke (transact + query, output verified)..wiki/Use-Cases.md: Added Phase 8.1aBrowserDbusage guide and Phase 8.1b WASI section (build/run/constraints/embedding). Pushed to wiki repo separately.README.md: Updated phase status markers to reflect 8.1a/b complete.Design decisions
FileBackend/WAL through new cfg gates acrossdb.rs,lib.rs,storage/— significant complexity for a use case better served by native binaries. WASI value is as an embeddable library.target_os = "wasi"nottarget_arch = "wasm32": The broader gate also fires for browser WASM (wasm32-unknown-unknown) wherewasm-packrequires#[wasm_bindgen_test]not#[test]. WASI-specific gating keeps targets cleanly separated.cargo test --lib: Integration tests intests/includeconcurrency_test.rswhich usesstd::thread::spawn— unsupported under WASI Preview 1.--libscopes the run to in-crate tests only.Testing sign-off checklist
cargo build --target wasm32-wasip1 --releasesucceeds (CI)cargo test --target wasm32-wasip1 --libpasses via Wasmtime runner (CI)cargo test(native) still passes (CI)cargo build --target wasm32-unknown-unknown --features browserstill passes (CI)🤖 Generated with Claude Code