perf(sdk): streamline local and cloud dependencies - #1479
Merged
appcypher merged 2 commits intoAug 30, 2026
Merged
Conversation
|
Comment on lines
+659
to
660
| #[cfg(feature = "local")] | ||
| pub fn local(&self) -> Option<&crate::backend::SandboxLocalState> { |
There was a problem hiding this comment.
When the Ruby extension builds the SDK with default-features = false and features = ["net", "ssh"], the SSH module calls Sandbox::local() and Backend::as_local() even though this change compiles both methods only with local, causing the Ruby extension and equivalent SDK configurations to fail compilation.
Knowledge Base Used: Restore local SDK feature parity
Prompt To Fix With AI
This is a comment left during a code review.
Path: sdk/rust/lib/sandbox/mod.rs
Line: 659-660
Comment:
**SSH loses local accessors**
When the Ruby extension builds the SDK with `default-features = false` and `features = ["net", "ssh"]`, the SSH module calls `Sandbox::local()` and `Backend::as_local()` even though this change compiles both methods only with `local`, causing the Ruby extension and equivalent SDK configurations to fail compilation.
**Knowledge Base Used:** [Restore local SDK feature parity](https://app.greptile.com/microsandbox/-/custom-context/knowledge-base/superradcompany/microsandbox/-/reverts/rollback_1091-20260703-sdk-local-feature-regressions-e5fe3ef.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Make the Rust SDK's local and cloud backends independently selectable while preserving the existing all-capabilities default. Physically separate runtime client contracts from the VM runner and network configuration models from the host networking engine. Preserve the existing public paths and defaults while allowing lightweight SDK builds to exclude runner-only dependency trees. Move shared API types to microsandbox-types, remove unused direct dependencies, document supported feature combinations, and validate them in CI.
appcypher
force-pushed
the
appcypher/streamline-rust-sdk-deps
branch
from
August 30, 2026 04:23
e4c6b1d to
800e79a
Compare
|
Too many files changed for review (135 files, 100 file limit). Bypass the limit by tagging |
Keep the public TLS configuration path available to lightweight SDK consumers while leaving runtime TLS state behind the engine feature. Point engine internals at their physical module and cover the no-engine module path.
appcypher
added a commit
that referenced
this pull request
Aug 30, 2026
Split the Rust SDK into explicit local and cloud feature surfaces, and keep the existing all-capabilities default. A cloud-only SDK build now avoids the local database, image, migration, metrics, VM runner, and host-network-engine dependency trees. This PR is stacked on #1454 (`appcypher/sdk-runtime-bootstrap`). After - Add `local` and `cloud` SDK features while leaving both enabled by default. - Keep snapshots and image-archive support inside `local`, as requested, instead of exposing product-level features for them. - Make `download-binaries` and `embed-binaries` imply `local`; keep Agentd packaging owned by the `msb` build. - Split `microsandbox-runtime` into physical `client/` and `runner/` trees, preserving its existing default behavior and public paths while letting the SDK compile only the lightweight client contract. - Split `microsandbox-network` into physical `model/` and `engine/` trees, preserving its existing default behavior and public paths while letting the SDK compile only configuration and policy types. - Move `RegistryAuth` and the shared log-level contract into `microsandbox-types` while preserving existing public re-export names. - Remove unused direct dependencies from the SDK, runtime, image, network, metrics, and utils crates. - Document the supported feature combinations and add CI checks for them. The intentional compatibility boundary is limited to internal crates built with `default-features = false`: callers that need the VM implementation must now enable runtime `runner`, and callers that need the host networking implementation must enable network `engine`. Published defaults and the SDK's default behavior remain unchanged. | Metric | Before (#1454) | After (#1479) | Difference | Improvement | | --- | ---: | ---: | ---: | ---: | | Debug build | 66.22s | 44.98s | -21.24s | 32.1% faster | | Release build | 99.40s | 78.37s | -21.03s | 21.2% faster | | Dependencies | 526 | 432 | -94 | 17.9% fewer | | Debug build directory | 2,495,848 KiB | 1,952,260 KiB | -543,588 KiB | 21.8% smaller | | Release build directory | 1,150,812 KiB | 973,772 KiB | -177,040 KiB | 15.4% smaller | Measured on an Apple Silicon Mac using clean target directories, `CARGO_INCREMENTAL=0`, `--locked`, the same local runtime artifacts, and a warm Cargo source cache. Each timing is one clean SDK library build. The cloud-only surface has 230 dependencies and built in 27.60s debug and 44.45s release under the same conditions. - [x] `cargo fmt --all -- --check` - [x] `cargo clippy --workspace --exclude microsandbox-agentd -- -D warnings` - [x] `RUSTDOCFLAGS='-D warnings' cargo doc --workspace --exclude microsandbox-agentd --no-deps` - [x] `cargo check -p microsandbox --no-default-features --features cloud,net` - [x] `cargo check -p microsandbox --no-default-features --features local,net` - [x] `cargo check -p microsandbox-runtime --no-default-features --features client,net` - [x] `cargo check -p microsandbox-network --no-default-features` - [x] `cargo check -p microsandbox-cli --no-default-features` - [x] `cargo test -p microsandbox-network --lib` (486 passed) - [x] `cargo test -p microsandbox-runtime --lib` (137 passed) - [x] `cargo test -p microsandbox --lib --no-default-features --features cloud,keyring,local,net` (620 passed, 3 ignored) - [x] `cargo check` in `sdk/rust/fuzz` - [x] Real macOS microVM boot, guest command execution, stop, and cleanup through the Rust SDK
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.
TL;DR
Split the Rust SDK into explicit local and cloud feature surfaces, and keep the existing all-capabilities default. A cloud-only SDK build now avoids the local database, image, migration, metrics, VM runner, and host-network-engine dependency trees.
This PR is stacked on #1454 (
appcypher/sdk-runtime-bootstrap). After #1454 merges, this PR should be retargeted toreleases/v0.7.0.Description
localandcloudSDK features while leaving both enabled by default.local, as requested, instead of exposing product-level features for them.download-binariesandembed-binariesimplylocal; keep Agentd packaging owned by themsbbuild.microsandbox-runtimeinto physicalclient/andrunner/trees, preserving its existing default behavior and public paths while letting the SDK compile only the lightweight client contract.microsandbox-networkinto physicalmodel/andengine/trees, preserving its existing default behavior and public paths while letting the SDK compile only configuration and policy types.RegistryAuthand the shared log-level contract intomicrosandbox-typeswhile preserving existing public re-export names.The intentional compatibility boundary is limited to internal crates built with
default-features = false: callers that need the VM implementation must now enable runtimerunner, and callers that need the host networking implementation must enable networkengine. Published defaults and the SDK's default behavior remain unchanged.Build Performance
Measured on an Apple Silicon Mac using clean target directories,
CARGO_INCREMENTAL=0,--locked, the same local runtime artifacts, and a warm Cargo source cache. Each timing is one clean SDK library build. The cloud-only surface has 230 dependencies and built in 27.60s debug and 44.45s release under the same conditions.Test Plan
cargo fmt --all -- --checkcargo clippy --workspace --exclude microsandbox-agentd -- -D warningsRUSTDOCFLAGS='-D warnings' cargo doc --workspace --exclude microsandbox-agentd --no-depscargo check -p microsandbox --no-default-features --features cloud,netcargo check -p microsandbox --no-default-features --features local,netcargo check -p microsandbox-runtime --no-default-features --features client,netcargo check -p microsandbox-network --no-default-featurescargo check -p microsandbox-cli --no-default-featurescargo test -p microsandbox-network --lib(486 passed)cargo test -p microsandbox-runtime --lib(137 passed)cargo test -p microsandbox --lib --no-default-features --features cloud,keyring,local,net(620 passed, 3 ignored)cargo checkinsdk/rust/fuzz