Skip to content

Make the library compilable for wasm32-unknown-unknown - #20

Merged
michielbdejong merged 1 commit into
mainfrom
claude/syncables-reflector-issues-q7sio9
Sep 7, 2026
Merged

michielbdejong merged 1 commit into
mainfrom
claude/syncables-reflector-issues-q7sio9

Conversation

@michielbdejong

Copy link
Copy Markdown
Contributor

Summary

Closes #19, which waited on syncables-rs #25 landing first (done: localthought/syncables-rs PRs #26 and #27).

The binary (main.rs) is native-only and stays that way — it opens a real redb file, binds a #[tokio::main] multi-thread runtime, and (via oauth.rs) a local TCP listener for the interactive OAuth callback server, none of which has a wasm32 equivalent inside a browser sandbox. This scopes to the library (config, http, ontology, store), matching how atomic_lib itself ships a separate wasm/ crate around the same core rather than trying to run its server binary in a browser.

  • oauth.rs is #[cfg(not(target_arch = "wasm32"))]; its axum/rand/tokio dependencies move to a target.'cfg(not(target_arch = "wasm32"))'.dependencies section — nothing else in the library needs them.
  • atomic_lib gets its own wasm feature alongside db-redb on wasm32 (that fork's db-redb doc comment already claims wasm support via an in-memory backend).
  • getrandom 0.3 with the wasm_js feature is a direct wasm32-only dependency, plus a new .cargo/config.toml cfg flag it needs in addition to the feature: ulid (via atomic_lib) pulls in rand 0.9 → getrandom 0.3, a different major version than uuid's via syncables.
  • http.rs's Fetch impl and store.rs's Storage impl go ?Send on wasm32, matching the relaxation syncables-rs PR #27 makes to the Fetch/Storage trait definitions themselves (a reqwest-over-fetch() or Storelike-backed future generally isn't Send on that target).

Bumps the syncables git rev to the commit with its own wasm32 fixes. Adds two wasm32 build/clippy checks to CI. Documents all of it in README ("WASM compatibility") and CLAUDE.md.

Test plan

  • cargo build --target wasm32-unknown-unknown --lib
  • cargo clippy --target wasm32-unknown-unknown --lib -- -D warnings
  • cargo build, cargo test (39 passed), cargo clippy --all-targets -- -D warnings, cargo fmt -- --check (native, unaffected)

🤖 Generated with Claude Code

https://claude.ai/code/session_017z9GAjT5LWWqBZFf5o9mNQ


Generated by Claude Code

The binary (main.rs) is native-only and stays that way — it opens a real
redb file, binds a #[tokio::main] multi-thread runtime, and (via
oauth.rs) a local TCP listener for the interactive OAuth callback server,
none of which has a wasm32 equivalent inside a browser sandbox. This
scopes to the library (config, http, ontology, store), matching how
atomic_lib itself ships a separate wasm/ crate around the same core.

- oauth.rs is #[cfg(not(target_arch = "wasm32"))]; its axum/rand/tokio
  dependencies move to a target.'cfg(not(target_arch = "wasm32"))'
  section — nothing else in the library needs them.
- atomic_lib gets its own "wasm" feature alongside db-redb on wasm32
  (that fork's db-redb doc comment already claims wasm support via an
  in-memory backend).
- getrandom 0.3 with the wasm_js feature is a direct wasm32-only
  dependency, plus a new .cargo/config.toml cfg flag it needs in
  addition to the feature: ulid (via atomic_lib) pulls in rand 0.9 ->
  getrandom 0.3, a different major version than uuid's via syncables.
- http.rs's Fetch impl and store.rs's Storage impl go ?Send on wasm32,
  matching the relaxation syncables-rs's PR #27 makes to the Fetch/
  Storage trait definitions themselves (a reqwest-over-fetch() or
  Storelike-backed future generally isn't Send on that target).

Bumps the syncables git rev to the commit with its own wasm32 fixes.
Adds two wasm32 build/clippy checks to CI.

Closes #19.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017z9GAjT5LWWqBZFf5o9mNQ
@michielbdejong
michielbdejong merged commit 4aef40d into main Sep 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make this lib compilable to WASM

2 participants