Skip to content

Consolidate Rust SDK crates into one publishable package - #1390

Merged
Branden Bonaby (bbonaby) merged 22 commits into
mainfrom
user/bbonaby/crate-consolidation
Oct 6, 2026
Merged

Branden Bonaby (bbonaby) merged 22 commits into
mainfrom
user/bbonaby/crate-consolidation

Conversation

@bbonaby

@bbonaby Branden Bonaby (bbonaby) commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

📖 Description

  • Consolidates the Rust SDK's internal engine, contracts, shared runtime, telemetry, PTY support, build support, learning-mode logic, and backend implementations into the single publishable mxc-sdk package.

  • Reduces the crates.io publication requirement for mxc-sdk from 22 publishable crates to 1:

    Before After
    Publishable crates required to publish mxc-sdk 22 1
    Total workspace crates required to build mxc-sdk 23 1

    Before consolidation, mxc-sdk depended on 21 separately publishable internal crates and the non-publishable isolation_session_bindings build crate. Those internal dependencies are now Rust modules inside mxc-sdk, so the published SDK has no local crate dependencies.

  • Renames the consolidated shared module from wxc_common to mxc_common. The embedded exact-contract module is named mxc_contract and retains the v0.9, v1.0, and development v1.1 contracts.

  • Keeps deliberate process and package boundaries intact: mxc_ffi, thin executor packages (wxc, lxc, and mxc_darwin), host helpers, test tools, and language SDKs remain separate.

  • Publishes the Windows Sandbox daemon/guest and WSLC daemon as mxc-sdk Cargo [[bin]] targets. WSLC remains gated by the wslc feature.

  • Updates schema generation, bindings generation, versioning checks, documentation, and GitHub/Azure CI selectors for the consolidated module paths.

Final Rust workspace layout (crate marks a directory with its own Cargo.toml; module marks code compiled as part of mxc-sdk):

<repo-root>/src/
├── Cargo.toml                         # workspace manifest, not a crate
├── Cargo.lock
├── rust-toolchain.toml
├── mxc-sdk/                           # crate (published): the Rust SDK
│   ├── build/                         # build-script modules and staged inputs
│   │   ├── isolation_session_bindings/
│   │   ├── nanvix_binaries/
│   │   └── wslc_common/
│   └── src/
│       ├── backends/                  # backend modules, not crates
│       ├── bin/                       # mxc-sdk [[bin]] targets
│       ├── configs/                   # configuration modules
│       ├── policy/                    # public policy modules
│       ├── core/                      # internal modules, not crates
│       │   ├── learning_mode_core/
│       │   ├── learning_mode_windows/
│       │   ├── mxc_common/
│       │   ├── mxc_contract/
│       │   ├── mxc_engine/
│       │   ├── mxc_pty/
│       │   ├── mxc_schema_support/
│       │   ├── mxc_telemetry/
│       │   ├── plm/
│       │   └── process_security_environment_spec/
│       └── lib.rs
├── ffi/
│   └── mxc_ffi/                       # crate (not published)
├── host/
│   ├── plm/                           # crate (not published)
│   ├── wxc_host_prep/                 # crate (not published)
│   └── wxc_winhttp_proxy_shim/        # crate (not published)
├── testing/
│   ├── fuzz/                          # crate (not published), excluded from workspace
│   ├── unix_test_proxy/               # crate (not published)
│   ├── wxc_test_driver/               # crate (not published)
│   ├── wxc_test_proxy/                # crate (not published)
│   └── wxc_ui_probe/                  # crate (not published)
├── tools/
│   ├── lxc/                           # crate (not published): thin executor
│   ├── mxc_darwin/                    # crate (not published): thin executor
│   ├── mxc_diagnostic_console/        # crate (not published)
│   ├── mxc_schema_gen/                # crate (not published)
│   └── wxc/                           # crate (not published): thin executor
└── core/mxc_config_contract/          # exact-contract fixtures, not a crate

🔗 References

  • No linked issue.

🔍 Validation

  • Passed: final GitHub Actions Build matrix for Windows x64/ARM64, Linux x64/ARM64, and macOS ARM64.
  • Passed: Windows, Linux, and macOS lint jobs; SDK unit/integration jobs; package, versioning, dependency-feed, Hyperlight, MicroVM, and LXC validation.
  • Passed: Rust and JavaScript/TypeScript CodeQL analysis and the repository CodeQL gate.
  • Passed: cargo fmt --manifest-path src\Cargo.toml --all -- --check
  • Passed: cargo check --manifest-path src\Cargo.toml --workspace --all-targets
  • Passed: cargo clippy --locked --manifest-path src\Cargo.toml -p mxc-sdk --all-targets --all-features -- -D warnings
  • Passed: the v0.9, v1.0, development v1.1, and version-boundary mxc_contract_* integration-test targets with --features schema-gen
  • Passed: cargo check --locked --manifest-path src\Cargo.toml -p mxc-sdk --bins --features wslc
  • Passed: Linux all-target Clippy for mxc-sdk, lxc, unix_test_proxy, and mxc_ffi
  • Passed: Windows ARM64 workspace cross-target check with all features
  • Passed: macOS package/lint selectors and the public Seatbelt streaming/PTY integration target
  • Passed: node scripts\versioning\check-contract-codegen.js
  • Passed: node scripts\versioning\check-schema-versions.js
  • Passed: node scripts\versioning\check-rust-toolchain-sync.js
  • Passed: cargo publish --dry-run --locked --manifest-path src\Cargo.toml -p mxc-sdk --registry crates-io
    • Reached the upload step and aborted without uploading, as expected for a dry run.
    • No yanked-dependency warnings after updating chacha20 to 0.10.2 and spin to 0.12.3.
  • Passed: locked Cargo metadata and cargo package -p mxc-sdk --locked --allow-dirty --list, including the staged WSLC SDK package.
  • Updated the Azure macOS build to preserve the same pre-consolidation test boundary; the ADO PR pipeline was not manually triggered.
  • Host-dependent backend workloads were not run locally; PR validation covered the supported hosted build/test matrices.

✅ Checklist

📋 Issue Type

  • Bug fix
  • Feature
  • Task

GitHub Actions runs the PR validation build automatically. The ADO pipeline
(MXC-PR-Build) is the Azure version of the PR pipeline, kept in parity with the GitHub
Actions build; it runs on merge to main, and Microsoft reviewers with write access can trigger it
on a PR with /azp run. See docs/pull-requests.md.

If the dependency-feed-check check fails on a new dependency, the crate must be added to
the feed before the PR can pass. See docs/pull-requests.md
for the steps.

Move backend and core libraries into the single publishable mxc-sdk crate, retain executable and FFI boundaries, and include the Windows Sandbox and WSLC sidecars as binary targets. Update workspace consumers, build tooling, package assets, and documentation.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 433e5b70-c2bd-496d-9b8d-bd2085bb2706
Rename the consolidated exact-contract module and integration tests to mxc_contract, update registry and CI paths, and document how mxc-sdk Cargo binary targets are built. Ensure the WSLC binary feature activates its tar dependency.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 433e5b70-c2bd-496d-9b8d-bd2085bb2706
Run the renamed v1.0 and v1.1 contract integration tests instead of referencing the nonexistent v0.10 target in GitHub and ADO validation.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 433e5b70-c2bd-496d-9b8d-bd2085bb2706
@bbonaby
Branden Bonaby (bbonaby) requested review from a team and a balanced review from Copilot October 5, 2026 17:29
@bbonaby
Branden Bonaby (bbonaby) requested a review from a team as a code owner October 5, 2026 17:29
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Several macOS CI and Azure pipeline paths still select packages removed by the consolidation, causing package-resolution failures.

Review effort: Balanced
Findings: 4 High severity · 1 Medium severity

Open (5)
What changed in this PR

Consolidates Rust SDK internals, backends, build helpers, contracts, and tests into the publishable mxc-sdk crate while retaining executable and FFI boundaries.

Changes:

  • Moves internal crates and backend modules into mxc-sdk.
  • Migrates exact-contract fixtures, adapters, and integration tests.
  • Updates build tooling, documentation, and CI package references.
File Description
.github/​workflows/​{Build.MacOS,Build.Windows,Lint,Versioning.Checks}.Job.yml Updates CI for consolidated tests and paths.
.azure-pipelines/​templates/​{Lint,Mac.Build}.Job.yml Updates Azure pipeline paths and tests.
.gitignore Preserves packaged binaries and WSLC assets.
CONTRIBUTING.md Updates Rust test commands.
docs/​{nanvix-microvm,telemetry}/​** Updates consolidated source locations.
scripts/​{ci,versioning}/​** Updates build and contract locations.
tests/​scripts/​* Updates executor and policy source references.
src/​Cargo.toml Reduces the workspace to consolidated packages.
src/​tools/​** Migrates tools to mxc-sdk and shared build helpers.
src/​testing/​** Migrates test utilities and build dependencies.
src/​host/​** Migrates host tools to consolidated modules.
src/​ffi/​mxc_ffi/​** Routes FFI through mxc-sdk modules.
src/​mxc-sdk/​build/​** Consolidates staging, code generation, and resources.
src/​mxc-sdk/​src/​backends/​** Embeds backend implementations in the SDK crate.
src/​mxc-sdk/​src/​bin/​** Adds Windows Sandbox and WSLC binary targets.
src/​mxc-sdk/​src/​core/​** Embeds engine, contracts, telemetry, PTY, and shared runtime.
src/​mxc-sdk/​src/​policy/​** Updates exact-contract policy imports.
src/​mxc-sdk/​examples/​** Updates examples to consolidated APIs.
src/​mxc-sdk/​tests/​mxc_contract/​** Moves exact-contract tests and fixtures into the SDK.
src/​mxc-sdk/​tests/​*.rs Updates backend and end-to-end integration tests.
Removed internal Cargo.toml files Eliminates former standalone crates from publication closure.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .azure-pipelines/templates/Lint.Job.yml Resolved
Comment thread .github/workflows/Build.MacOS.Job.yml Resolved
Comment thread .github/workflows/Lint.Job.yml Resolved
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 433e5b70-c2bd-496d-9b8d-bd2085bb2706
Copilot AI balanced review requested due to automatic review settings October 5, 2026 18:11
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 433e5b70-c2bd-496d-9b8d-bd2085bb2706

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Relocated path assumptions disable bindings validation and break a parser fixture test.

Review effort: Balanced
Findings: 2 Medium severity · 1 Low severity

Open (3)
Resolved since last review (5)

Comment thread tests/scripts/run_lxc_env_cwd_test.sh Resolved
Copilot AI balanced review requested due to automatic review settings October 5, 2026 18:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The relocated IsolationSession bindings check no longer finds Cargo.lock, silently disabling its version-compatibility enforcement.

Review effort: Balanced
Findings: 2 Medium severity · 3 Low severity

Open (5)

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 433e5b70-c2bd-496d-9b8d-bd2085bb2706
Copilot AI balanced review requested due to automatic review settings October 5, 2026 18:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Contributor documentation still invokes the removed wxc_e2e_tests package, leaving the documented end-to-end workflow unusable.

Review effort: Balanced
Findings: None

Resolved since last review (5)
Previously missed (1)

In code that hasn't changed since last review

Low severity Migrate stale end-to-end commands to mxc-sdk integration targets

CONTRIBUTING.md:243

This updates the unit-test commands, but the end-to-end commands later in this section—and tests/scripts/README.md—still invoke the deleted wxc_e2e_tests package. Following the documented workflow now fails package resolution; migrate those commands to the moved mxc-sdk integration-test targets too.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 433e5b70-c2bd-496d-9b8d-bd2085bb2706
Copilot AI balanced review requested due to automatic review settings October 5, 2026 18:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Contract unit tests are omitted from CI, one tool remains publishable, and documented E2E commands target a removed crate.

Review effort: Balanced
Findings: None

Previously missed (3)

In code that hasn't changed since last review

Medium severity Add mxc-sdk --lib to consolidated contract tests

.azure-pipelines/​templates/​Rust.Build.Job.yml:167

This consolidated contract command omits the mxc-sdk library target, so the schema invariant unit tests under core/mxc_contract do not run with schema-gen. The old package-wide command covered those tests; include --lib here as well as the named integration targets.

Medium severity Include mxc-sdk library tests in schema-gen coverage

.github/​workflows/​Versioning.Checks.Job.yml:49

This target selection runs only the seven integration-test binaries, so the contract unit tests moved into mxc-sdk are no longer exercised with schema-gen. In particular, the schema invariant tests in core/mxc_contract/{dev,published/*}/schema.rs require both cfg(test) and this feature; add the library target to preserve the coverage previously provided by cargo test -p mxc_config_contract --all-features.

Low severity Update E2E commands to use mxc-sdk integration tests

CONTRIBUTING.md:243

The consolidation updates the library-test examples but leaves the E2E commands later in this same block selecting the deleted wxc_e2e_tests package. Those documented commands now fail package resolution; switch them to the integration tests hosted by mxc-sdk.

@MGudgin

Copy link
Copy Markdown
Member

We should take this opportunity to rename wxc_common to mxc_common.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 433e5b70-c2bd-496d-9b8d-bd2085bb2706
Copilot AI balanced review requested due to automatic review settings October 5, 2026 19:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The broad cross-platform crate consolidation and unexecuted host-dependent backend workloads warrant final human validation.

Review effort: Balanced
Findings: None

Resolved since last review (1)

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 433e5b70-c2bd-496d-9b8d-bd2085bb2706
Copilot AI balanced review requested due to automatic review settings October 6, 2026 00:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Developer documentation still invokes removed Cargo packages and must be migrated to the consolidated test targets.

Review effort: Balanced
Findings: None

Previously missed (1)

In code that hasn't changed since last review

Low severity Update documentation to use migrated package and test targets

docs/​ci-validation-infrastructure.md:255

The documentation migration is incomplete: README.md:125,141 still selects the removed seatbelt_common and wxc_e2e_tests packages, and tests/scripts/README.md:5,158-168,196 still tells users to run wxc_e2e_tests. These commands now fail package selection; migrate them to mxc-sdk and the moved integration-test targets so the PR's developer guidance remains runnable.

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 433e5b70-c2bd-496d-9b8d-bd2085bb2706
Copilot AI balanced review requested due to automatic review settings October 6, 2026 00:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The broad cross-platform crate and build-boundary migration needs final human review, particularly because host-dependent backend workloads were not executed.

Review effort: Balanced
Findings: None

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 433e5b70-c2bd-496d-9b8d-bd2085bb2706
Copilot AI balanced review requested due to automatic review settings October 6, 2026 00:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The crate-boundary rewrite affects publishing, platform backends, build scripts, CI, and contract compatibility, while host-dependent workloads were not exercised.

Review effort: Balanced
Findings: None

Previously missed (1)

In code that hasn't changed since last review

Low severity Update example command for consolidated mxc-sdk package

src/​mxc-sdk/​examples/​process_container_common_lm_capture.rs:47

This example now belongs to mxc-sdk, but its usage block still says cargo run -p process_container_common --example lm_capture. That package was removed by this consolidation, so the documented command fails package resolution; update it to select mxc-sdk and the new example name (process_container_common_lm_capture).

Co-authored-by: Copilot <[email protected]>

Copilot-Session: 433e5b70-c2bd-496d-9b8d-bd2085bb2706
Copilot AI balanced review requested due to automatic review settings October 6, 2026 01:04
Co-authored-by: Copilot <[email protected]>

Copilot-Session: 433e5b70-c2bd-496d-9b8d-bd2085bb2706

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

The architecture-wide consolidation affects packaging, platform-specific builds, contracts, and host-dependent backends that were not exercised end to end.

Review effort: Balanced
Findings: None

Copilot AI balanced review requested due to automatic review settings October 6, 2026 01:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Runnable documentation and example commands still select crates removed by the consolidation.

Review effort: Balanced
Findings: None

@bbonaby
Branden Bonaby (bbonaby) merged commit 894f4c1 into main Oct 6, 2026
31 checks passed
@bbonaby
Branden Bonaby (bbonaby) deleted the user/bbonaby/crate-consolidation branch October 6, 2026 02:56
Chaz Gordish (ChazGo) pushed a commit to ChazGo/mxc that referenced this pull request Oct 7, 2026
Bring the prototype onto the MXC 1.0 SDKs: the consolidated mxc-sdk crate
(microsoft#1390), the v1 ContainerRequest surfaces in Rust, Node and .NET, exact
JSON FFI ingress, and Promise-based Node v1 APIs (microsoft#1398).

Shared files take upstream as-is. The previous SDK wiring (mxc-sdk
re-exports, mxc_ffi exports, Node and .NET wrappers, and their tests)
targeted the retired SandboxPolicy surfaces and is removed here; the
following commits port the store into mxc-sdk's internal policy_store
module and rebuild the bindings on the v1 requirements API from spec
f7a450c. The catalog crate under src/core/mxc_policy_store is left
outside the workspace until that port.

Co-authored-by: Copilot <[email protected]>
adpa-ms pushed a commit that referenced this pull request Nov 13, 2026
The concurrent one-shot test took its evidence from markers each
session's workload appended to a shared host folder. Those writes
sometimes failed with "Stream was not readable." while the workload
carried on and exited 0, so the test reported a session cut short when
it had run to completion. It also never checked that the sessions
overlapped.

Each workload now prints "X-started", waits in `set /p` for a line on
stdin, and echoes the line back. The harness starts A, B and C one at a
time, then releases B, A and C in turn, waiting for each wxc-exec to
exit before the next release. wxc-exec exits only after its session's
teardown, so each later session is shown to run through every earlier
session's teardown. No session writes a file, so the shared folder and
its ACL grant are gone. The agent-name lookup goes too: #1390 removed
the log line it matched.

Each session starts through Start-Process, which does not pass the
suite's stdout and stderr on to cmd.exe, so a wxc-exec left running
after a timeout cannot keep a caller reading the suite's output
waiting. Stdin comes from a named pipe with a 4096-byte output buffer:
wxc-exec reads stdin only while the workload runs, so without the
buffer a line sent to a session still provisioning or already tearing
down would wait for that step.

On any failure the harness sends ABORT to every session still held, so
each one still ends and tears down normally, and a failing session's
result carries the tail of its output. The exit code reports the
workload, not the teardown: detecting a leaked account stays with the
account check around the isolation-session suites.

Fixes #1650

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 44ff8469-1843-47ee-8b4a-1323cbba2bd0
adpa-ms pushed a commit that referenced this pull request Nov 13, 2026
The concurrent one-shot test took its evidence from markers each
session's workload appended to a shared host folder. Those writes
sometimes failed with "Stream was not readable." while the workload
carried on and exited 0, so the test reported a session cut short when
it had run to completion. It also never checked that the sessions
overlapped.

Each workload now prints "X-started", waits in `set /p` for a line on
stdin, and echoes the line back. The harness starts A, B and C one at a
time, then releases B, A and C in turn, waiting for each wxc-exec to
exit before the next release. wxc-exec exits only after its session's
teardown, so each later session is shown to run through every earlier
session's teardown. No session writes a file, so the shared folder and
its ACL grant are gone. The agent-name lookup goes too: #1390 removed
the log line it matched.

Each session starts through Start-Process, which does not pass the
suite's stdout and stderr on to cmd.exe, so a wxc-exec left running
after a timeout cannot keep a caller reading the suite's output
waiting. Stdin comes from a named pipe with a 4096-byte output buffer:
wxc-exec reads stdin only while the workload runs, so without the
buffer a line sent to a session still provisioning or already tearing
down would wait for that step.

On any failure the harness sends ABORT to every session still held, so
each one still ends and tears down normally, and a failing session's
result carries the tail of its output. The exit code reports the
workload, not the teardown: detecting a leaked account stays with the
account check around the isolation-session suites.

Fixes #1650

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 44ff8469-1843-47ee-8b4a-1323cbba2bd0
adpa-ms pushed a commit that referenced this pull request Nov 14, 2026
The concurrent one-shot test took its evidence from markers each
session's workload appended to a shared host folder. Those writes
sometimes failed with "Stream was not readable." while the workload
carried on and exited 0, so the test reported a session cut short when
it had run to completion. It also never checked that the sessions
overlapped.

Each workload now prints "X-started", waits in `set /p` for a line on
stdin, and echoes the line back. The harness starts A, B and C one at a
time, then releases B, A and C in turn, waiting for each wxc-exec to
exit before the next release. wxc-exec exits only after its session's
teardown, so each later session is shown to run through every earlier
session's teardown. No session writes a file, so the shared folder and
its ACL grant are gone. The agent-name lookup goes too: #1390 removed
the log line it matched.

Each session starts through Start-Process, which does not pass the
suite's stdout and stderr on to cmd.exe, so a wxc-exec left running
after a timeout cannot keep a caller reading the suite's output
waiting. Stdin comes from a named pipe with a 4096-byte output buffer:
wxc-exec reads stdin only while the workload runs, so without the
buffer a line sent to a session still provisioning or already tearing
down would wait for that step.

On any failure the harness sends ABORT to every session still held, so
each one still ends and tears down normally, and a failing session's
result carries the tail of its output. The exit code reports the
workload, not the teardown: detecting a leaked account stays with the
account check around the isolation-session suites.

Fixes #1650

Co-authored-by: Copilot <[email protected]>
Copilot-Session: 44ff8469-1843-47ee-8b4a-1323cbba2bd0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants