feat(sdk)!: redesign runtime bootstrap - #1454
Open
appcypher wants to merge 7 commits into
Open
Conversation
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
馃挕 Tip: Enable Workflows to automatically generate PRs for you. |
|
|
|
|
13 tasks
appcypher
added a commit
that referenced
this pull request
Aug 30, 2026
## 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 to `releases/v0.7.0`. ## Description - 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. ## Build Performance | 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. ## Test Plan - [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
|
Too many files changed for review (190 files, 100 file limit). Bypass the limit by tagging |
Replace the prebuilt feature and single-path setup helpers with explicit download-binaries and embed-binaries behavior. Resolve, install, and verify msb plus libkrunfw as one matched pair, while allowing a validated runtime Agentd override. Update the CLI, native SDK bindings, workflows, and documentation to use the paired setup API and fail closed on partial installations.
Allow the global configuration to select an external Agentd payload while preserving MSB_AGENTD_PATH as the highest-precedence override. Forward the selected path to spawned msb processes and fail closed when an explicit payload is missing or invalid. Document the resolution order and cover it with focused tests.
Share Agentd ELF validation between build-time staging and runtime resolution so release builds reject malformed or architecture-mismatched guest payloads before producing artifacts. Point Windows Quality at its downloaded target-matched Agentd when exercising non-embedded runtime tests.
Pass InstallOptions directly to ensure_runtime instead of wrapping it in a one-field EnsureOptions type. Update embedded and Cargo wrapper callers plus the API compatibility test for the smaller setup surface. Clarify runtime and Agentd feature behavior in the setup documentation, and replace the stale Go resolver reference.
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
appcypher
force-pushed
the
appcypher/sdk-runtime-bootstrap
branch
from
August 30, 2026 16:06
126079c to
71cf240
Compare
Pin renamed napi object fields to their public TypeScript names and return concrete sandbox types so generated declarations contain no dangling Rust identifiers. Type-check native/index.d.ts after every native build and from the standard typecheck command to prevent regressions during release packaging.
Keep backend-specific constructors, stream variants, and tests behind their owning feature gates so local-only and cloud-only builds remain valid. Preserve Node release target forwarding through npm lifecycle hooks, enable the Ruby binding backend surface explicitly, and keep Rust integration-test TLS dependencies direct. Rewrite runtime installation assertions around trusted expected paths so CodeQL does not mistake returned test paths for uncontrolled filesystem access.
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
Redesign runtime distribution around explicit
download-binariesandembed-binariesfeatures. Resolve and installmsbpluslibkrunfwas one matched pair, while Agentd can be embedded at build time or supplied throughMSB_AGENTD_PATHor globalpaths.agentdconfiguration at runtime.Description
prebuiltfeature with separate acquisition and embedding controls across the Rust SDK, filesystem crate, runtime crate, CLI, workflows, and development recipes.setup::installand single-path resolvers with pairedresolve_runtime,install_runtime, andensure_runtimeAPIs that are read-only during resolution and fail closed on partial installations.MSB_HOME/{bin,lib}layout, with locking, staged publication, optional digest verification, and no implicit runtime download during ordinary SDK sandbox creation.MSB_EMBED_ARTIFACTS_DIRandMSB_EMBED_RUNTIME_BUNDLE_PATH.MSB_AGENTD_PATHand globalpaths.agentd, with the embedded payload as the default fallback whenembed-binariesis enabled.Test Plan
cargo fmt --all -- --checkMSB_AGENTD_PATH="$PWD/build/agentd" cargo test -p microsandbox-filesystem --no-default-features(621 passed)MSB_AGENTD_PATH="$PWD/build/agentd" cargo test -p microsandbox --lib --no-default-features --features keyring,net(617 passed, 3 ignored)MSB_EMBED_ARTIFACTS_DIR="$PWD/build" cargo test -p microsandbox --lib --no-default-features --features embed-binaries,keyring,net setup::runtimeMSB_HOME=/tmp/msb-api-surface-home MSB_EMBED_ARTIFACTS_DIR="$PWD/build" cargo test -p microsandbox --test api_compatMSB_HOME=/tmp/msb-api-surface-home MSB_EMBED_ARTIFACTS_DIR="$PWD/build" cargo test -p microsandbox --lib setup::runtime::tests --features embed-binariescargo check -p microsandbox --no-default-features --bin microsandboxnpm run typecheckinsdk/node-ts