-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: flatten cell module structure and rename Command to Cell #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
lthibault
wants to merge
20
commits into
master
Choose a base branch
from
refactor/flatten-cell-module
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
- Add ChannelReader: AsyncRead implementation for mpsc receivers - Add ChannelWriter: AsyncWrite implementation for mpsc senders - Add create_channel_pair() helper for bidirectional channels - Add comprehensive unit tests for async streaming - All tests passing with full async/await support
- Define wetware:streams package with connection resource - Connection resource provides get-input-stream-handle and get-output-stream-handle - create-connection function to instantiate connection resources - Returns u32 handles for use with WASI stream APIs
- Export streams module for stream adapters - Add streams_test module for unit tests
- Add bindgen! macro to generate bindings from WIT interface - Add data_stream_channels to ComponentRunStates for channel storage - Add guest_to_host_rx field for host-side receiver access - Add Builder::with_data_streams() API for enabling data streams - Add DataStreamHandles struct for host access to channels - Implement add_streams_to_linker() with full resource integration: * create-connection: Creates connection resource with WASI streams * get-input-stream-handle: Returns input stream handle from connection * get-output-stream-handle: Returns output stream handle from connection - Add Proc::guest_output_receiver() for host to read guest output - Streams are added to WASI resource table and exposed to guests - Full async support throughout the implementation
- Add type aliases for complex channel tuple types (DataStreamChannel, DataStreamChannelPair, ChannelPair) - Use inline format args in panic messages - Replace vec! with arrays in test code - All clippy warnings resolved, tests passing
- Move proc.rs from cell/ to src/ (low-level WASM process execution) - Move streams.rs from cell/ to src/ (stream adapters utility) - Move executor.rs to cell.rs and rename Command/CommandBuilder to Cell/CellBuilder - Move Loader trait into cell.rs - Update all imports across the codebase - Remove old cell/ directory structure This reorganization better reflects the architecture where: - Proc = low-level WASM execution primitive - Cell = higher-level abstraction that orchestrates one or more procs - streams = shared utility module
- Fix format string in loaders.rs: use positional placeholders instead of field access - Add missing PathBuf import - Fix HostPath::new to use correct parameter name - Fix HostPath instantiation in main.rs to use new() with PathBuf
- Rename spawn() method to start() for better clarity - Update call site in cli/main.rs
- DataStreamChannel -> GuestChannels (3 channels for guest) - DataStreamChannelPair -> ChannelSet (complete 4-channel set)
mikelsr
approved these changes
Dec 21, 2025
Why: The “bidirectional” stream was effectively one-way—handles dropped the guest→host receiver and Proc only exposed a borrowed receiver that couldn’t outlive run(self). Hosts couldn’t read guest output (Capnp/Protobuf/etc.) while the guest booted. What: - Make DataStreamHandles own the guest→host receiver and expose take_guest_output_receiver() so hosts can move it into long-lived async tasks. - Remove Proc’s borrowed receiver and rely solely on the handles to avoid lifetime traps. - Wire with_data_streams() into Command::spawn via spawn_with_streams(); return the join handle plus handles, keep them alive for the run, and drain guest output if unused. - Add a full-duplex regression test in src/cell/proc.rs to prove host→guest and guest→host delivery via the returned handles. - Simplify channel plumbing by dropping unused builder/proc receiver fields.
- Move proc.rs from cell/ to src/ (low-level WASM process execution) - Move streams.rs from cell/ to src/ (stream adapters utility) - Move executor.rs to cell.rs and rename Command/CommandBuilder to Cell/CellBuilder - Move Loader trait into cell.rs - Update all imports across the codebase - Remove old cell/ directory structure This reorganization better reflects the architecture where: - Proc = low-level WASM execution primitive - Cell = higher-level abstraction that orchestrates one or more procs - streams = shared utility module
- Rename spawn() method to start() for better clarity - Update call site in cli/main.rs
- DataStreamChannel -> GuestChannels (3 channels for guest) - DataStreamChannelPair -> ChannelSet (complete 4-channel set)
- Remove stray `let Cell {` that broke `Cell::start` compilation
- Fix `HostPath` read borrow to preserve error context
- Avoid double-ownership of `guest_to_host_rx` while keeping host/guest async streams intact
# Conflicts:
# src/proc.rs
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.
This PR reorganizes the cell module structure by flattening the nested directory and renaming types to better reflect the architecture where cells orchestrate one or more procs.
🟠 Merge after #26. Ready for initial review.
Changes
Module Structure
cell/proc.rs→src/proc.rs- Low-level WASM process execution primitivecell/streams.rs→src/streams.rs- Stream adapters utility modulecell/executor.rs→src/cell.rs- Cell abstraction that orchestrates procscell/streams_test.rs→src/streams_test.rs- Tests moved to top levelcell/mod.rs- No longer needed with flattened structureType Renaming
Command→Cell- Better reflects that cells are higher-level abstractionsCommandBuilder→CellBuilder- Consistent with Cell namingLoadertrait moved intocell.rs(cells need loaders)Import Updates
proc.rsnow usescrate::{streams, Loader}cell.rsusescrate::proc::Builder as ProcBuilderloaders.rsusescrate::Loader(re-exported from lib.rs)cli/main.rsupdated to usecell::CellBuilderArchitecture Clarity
This reorganization makes the architecture clearer:
Proc= Low-level WASM execution primitive (single WASM instance)Cell= Higher-level abstraction that can orchestrate one or more procsstreams= Shared utility module for async readers and writers