move TS protobuf logic to Rust using wasi p2 - #658
Draft
davidhewitt wants to merge 4 commits into
Draft
Conversation
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 9308 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
- Coverage 83.39% 83.38% -0.01%
==========================================
Files 235 235 —
Lines 56018 56018 —
Branches 118536 118536 —
==========================================
+ Hits 46713 46710 -3
- Misses 9305 9308 +3
- Partials 3577 3575 -2Generated by Codecov Action |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merging this PR will not alter performance
Comparing Footnotes
|
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.
I have a theory that we should be able to migrate some of the typescript components to Rust for the WASM/browser pathway, and that might help with tracing the WASM module in #629
This is somewhat vibe coded, pushing to get feedback and also to review it myself.
Summary by cubic
Move protobuf decoding and dispatch from TypeScript to Rust and ship a WIT-defined WASI 0.2 component with generated JS bindings. Workers now instantiate precompiled component modules and exchange typed requests/events, removing JS-side framing.
Refactors
worker.dispatchdefined inwit/runtime.wit; Rust returns{status, events}.wit-bindgenin Rust and@bytecodealliance/jcoto wrap the core Wasm and emit JS bindings; split core modules underdist/worker/component/*with checked-in.d.ts.@bjorn3/browser_wasi_shimfor@bytecodealliance/preview2-shim; no host FS/env/network; process exit is denied.ChildEventdecoding and value conversion to Rust using a flat value arena; removed TS wire codec (proto.ts) and JS deframing.ComponentModules(4 coreWebAssembly.Modules) and serve typed dispatch; Node entry runs from.js.Migration
npm run build:wasmbuilds the component;make check-wasm-typesverifies generated declarations; artifacts live underdist/worker/component(monty.component.js+ 4 core.wasm).loadModule()now returns a modules map; usecreateWorkerPool(modules)(wascreateWorkerPool(module)).make test-browserruns the wasm path in headless Chromium.Written for commit cbe8da6. Summary will update on new commits.