Skip to content

Add Apple Container config surface - #957

Open
Richie Gomez (richiemsft) wants to merge 9 commits into
mainfrom
feature/apple-container-backend
Open

Add Apple Container config surface#957
Richie Gomez (richiemsft) wants to merge 9 commits into
mainfrom
feature/apple-container-backend

Conversation

@richiemsft

@richiemsft Richie Gomez (richiemsft) commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

📖 Description

Adds the experimental Apple Container configuration surface on the current
0.9.0-alpha development contract:

  • recognizes containment: "apple_container" with explicit experimental
    opt-in;
  • validates required OCI image and optional CPU/memory limits;
  • exposes matching Rust and TypeScript builders and public types;
  • updates generated schema and TypeScript wire artifacts;
  • keeps execution fail-closed with unsupported_containment until the runtime
    backend lands.

Stable schema 0.8.0-alpha remains unchanged and does not include experimental
Apple Container fields.

🔗 References

This is PR 1 of the stacked Apple Container implementation.

🔍 Validation

  • Rust contract tests for stable 0.8 and development 0.9.
  • Rust parser, engine policy, and SDK tests.
  • Node SDK build and targeted Apple Container/wire-conformance tests.
  • Contract, schema, SDK wire-type, schema-version, and config-validation gates.
  • Windows-target Rust compilation.
  • macOS release build and test package matrix.
  • macOS Clippy with warnings denied.

✅ 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.

Microsoft Reviewers: Open in CodeFlow

Recognize typed experimental apple_container requests across the 0.8 contract, Rust and TypeScript builders, and generated artifacts. Keep execution fail-closed until the runtime backend is implemented.

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

Copilot-Session: b062729b-d6f3-47f6-9df0-6c1d5c8a1e5c
@richiemsft
Richie Gomez (richiemsft) requested review from a team and a balanced review from Copilot August 19, 2026 23:13
@richiemsft
Richie Gomez (richiemsft) requested a review from a team as a code owner August 19, 2026 23:13
@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.

Pull request overview

Adds the experimental Apple Container configuration surface while keeping execution fail-closed until runtime support exists.

Changes:

  • Adds Rust and TypeScript config models/builders.
  • Validates Apple Container requests and rejects execution.
  • Updates generated contracts, schemas, and tests.

Reviewed changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/core/wxc_common/src/wire.rs Adds wire types and containment value.
src/core/wxc_common/src/models.rs Adds domain configuration and mappings.
src/core/wxc_common/src/config_parser.rs Validates and parses Apple Container configs.
src/core/wxc_common/src/cmdline.rs Selects POSIX shell semantics.
src/core/mxc-sdk/src/lib.rs Exports the Rust configuration section.
src/core/mxc_engine/src/run.rs Rejects unimplemented execution without fallback.
src/core/mxc_engine/src/policy.rs Adds the Rust request builder.
src/core/mxc_engine/src/lib.rs Re-exports the builder type.
src/core/mxc_engine/src/dispatch.rs Rejects streaming execution.
src/core/mxc_config_contract/tests/v0_8_0_alpha/experimental/apple_container.rs Tests the 0.8 contract.
src/core/mxc_config_contract/tests/v0_8_0_alpha/experimental.rs Registers contract tests.
src/core/mxc_config_contract/tests/v0_8_0_alpha/enums.rs Covers the containment value.
src/core/mxc_config_contract/src/dev/one_shot.rs Adds the dev containment variant.
src/core/mxc_config_contract/src/dev/mod.rs Exports the contract type.
src/core/mxc_config_contract/src/dev/experimental.rs Defines strict one-shot settings.
sdk/node/tests/unit/wire-conformance.test.ts Checks public/wire type parity.
sdk/node/tests/unit/sandbox.test.ts Tests builder and experimental gating.
sdk/node/src/types.ts Adds public TypeScript types.
sdk/node/src/sandbox.ts Implements the TypeScript builder.
sdk/node/src/index.ts Exports the new API.
sdk/node/src/generated/wire.ts Updates generated wire types.
schemas/dev/mxc-config.schema.0.8.0-dev.json Updates the generated dev schema.

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

Comment thread src/core/wxc_common/src/wire.rs
Comment thread src/core/wxc_common/src/wire.rs
Comment thread sdk/node/src/index.ts
Comment thread src/core/mxc-sdk/src/lib.rs Outdated
Comment thread sdk/node/src/sandbox.ts
@richiemsft
Richie Gomez (richiemsft) marked this pull request as draft August 19, 2026 23:20
Richie Gomez added 2 commits August 19, 2026 16:25
Co-authored-by: Copilot <[email protected]>

Copilot-Session: b062729b-d6f3-47f6-9df0-6c1d5c8a1e5c
Copilot AI review requested due to automatic review settings August 19, 2026 23:30

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.

Pull request overview

Copilot reviewed 26 out of 27 changed files in this pull request and generated no new comments.

Suppressed comments (3)

src/core/wxc_common/src/wire.rs:564

  • These annotations replace the inferred numeric bounds with only a minimum, so the generated schema accepts cpuCount above u32::MAX and memoryMb above u64::MAX, while the new 0.8 contract tests explicitly reject those values and native deserialization fails. Add the corresponding maximum constraints and regenerate the schema so editor/schema validation matches the typed contract.
    #[cfg_attr(feature = "schema-gen", schemars(range(min = 1)))]
    pub cpu_count: Option<u32>,
    /// Requested memory limit in megabytes.
    #[cfg_attr(feature = "schema-gen", schemars(range(min = 1)))]
    pub memory_mb: Option<u64>,

sdk/node/README.md:66

  • Adding apple_container to this statement makes it inaccurate: unlike the other listed experimental backends, the parser explicitly rejects Apple Container unless version is exactly 0.8.0-alpha. Document that exception so users do not expect a 0.7 config plus experimental opt-in to work.
> **Stable schemas document only the non-experimental surface.** Experimental backends (`windows_sandbox`, `wslc`, `microvm`, `hyperlight`, `isolation_session`, `apple_container`), the `experimental.*` block, and state-aware lifecycle live in `0.8.0-dev`. The parser still accepts them when paired with `--experimental` regardless of which schema your config validates against — schema choice affects editor validation, not runtime behavior.

src/core/mxc-sdk/README.md:346

  • This recommendation now includes Apple Container, but the standalone executor uses the changed engine path and also returns UnsupportedContainment; it cannot be used as an alternative. Separate Apple Container from the backends that can be driven through standalone executors and state that its configuration is currently non-executable on every surface.
Any other backend (Windows Sandbox, IsolationSession, MicroVM, Hyperlight, LXC,
Apple Container)
returns an [`Error`] with [`ErrorCode::UnsupportedContainment`]; drive the
standalone executor binaries for those.

@richiemsft
Richie Gomez (richiemsft) marked this pull request as ready for review August 20, 2026 16:37
@azure-pipelines

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

Comment thread schemas/dev/mxc-config.schema.0.9.0-dev.json
Comment thread sdk/node/src/sandbox.ts
Comment thread sdk/node/src/sandbox.ts Outdated
Resolve the 0.8 stable and 0.9 development schema promotion by moving the Apple Container experimental contract to 0.9 while preserving stable 0.8.

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

Copilot-Session: b062729b-d6f3-47f6-9df0-6c1d5c8a1e5c
Co-authored-by: Copilot <[email protected]>

Copilot-Session: b062729b-d6f3-47f6-9df0-6c1d5c8a1e5c

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.

Pull request overview

Copilot reviewed 28 out of 30 changed files in this pull request and generated 3 comments.

Comment thread src/core/mxc-sdk/README.md
Comment thread src/core/wxc_common/src/config_parser.rs
Comment thread src/core/mxc-sdk/src/lib.rs
Copilot AI review requested due to automatic review settings August 26, 2026 16:56

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.

Pull request overview

Copilot reviewed 28 out of 30 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

Previously missed (2) — in code that hasn't changed since the last review.

src/core/mxc_config_contract/src/dev/experimental.rs:105

  • NonEmptyString only rejects "" (primitives.rs:124-129), so an image containing only whitespace passes the exact 0.9 contract and generated schema. The rolling parser and TypeScript builder both trim before validating and reject that same value. Use Apple-image validation that rejects trim-empty input, add the whitespace case, and regenerate the contract artifacts so exact validation agrees with runtime.
pub struct OneShotAppleContainer {
    /// OCI image reference. The image must provide `/bin/sh`.
    pub image: NonEmptyString,

sdk/node/README.md:67

  • Adding apple_container to this blanket statement makes it inaccurate: the new parser check requires the config's version to be exactly 0.9.0-alpha, so an Apple Container config using a stable version is rejected even with experimental mode enabled. Call out this exception explicitly.
> **Stable schemas document only the non-experimental surface.** Experimental backends (`windows_sandbox`, `wslc`, `microvm`, `hyperlight`, `isolation_session`, `apple_container`), the `experimental.*` block, and state-aware lifecycle live in `0.9.0-dev`. The parser still accepts them when paired with `--experimental` regardless of which schema your config validates against — schema choice affects editor validation, not runtime behavior.

Comment thread src/core/mxc_config_contract/src/dev/one_shot.rs
Co-authored-by: Copilot <[email protected]>

Copilot-Session: b062729b-d6f3-47f6-9df0-6c1d5c8a1e5c
Copilot AI review requested due to automatic review settings August 26, 2026 17:05

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.

Pull request overview

Copilot reviewed 29 out of 31 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

src/core/mxc_config_contract/src/dev/experimental.rs:105

  • NonEmptyString only rejects "", so this exact contract accepts an image containing only whitespace, while the authoritative parser rejects it via ac.image.trim().is_empty() in config_parser.rs:1369. Use an Apple-image type/deserializer that rejects blank strings (and emits the matching schema constraint), then add a whitespace case to the contract test so the exact contract converges with runtime validation.
    pub image: NonEmptyString,

Comment thread sdk/node/README.md
Co-authored-by: Copilot <[email protected]>

Copilot-Session: b062729b-d6f3-47f6-9df0-6c1d5c8a1e5c
Copilot AI review requested due to automatic review settings August 26, 2026 18:20

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.

Pull request overview

Copilot reviewed 29 out of 31 changed files in this pull request and generated 3 comments.

Comment thread sdk/node/src/sandbox.ts
Comment thread src/core/mxc_config_contract/src/dev/experimental.rs Outdated
Comment thread sdk/node/README.md
@richiemsft
Richie Gomez (richiemsft) marked this pull request as draft August 26, 2026 18:28
@richiemsft

Copy link
Copy Markdown
Contributor Author

converting to draft while I fix the merge conflicts

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

Copilot-Session: b062729b-d6f3-47f6-9df0-6c1d5c8a1e5c
Copilot AI review requested due to automatic review settings August 26, 2026 18:48

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.

Pull request overview

Copilot reviewed 30 out of 32 changed files in this pull request and generated 2 comments.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

src/core/mxc_config_contract/src/dev/one_shot.rs:154

  • This cross-field check only enforces one direction. A request with containment: "process" (or omitted containment) plus experimental.apple_container still passes the exact contract/schema, then fails later in validate_single_backend_section; the same happens when Apple Container is supplied alongside another backend section. Reject experimental.apple_container unless containment is apple_container, and add the equivalent reverse constraint to the generated exact schema so contract validation matches runtime behavior.
        if matches!(
            request.containment.as_ref(),
            Some(Containment::AppleContainer)
        ) && request
            .experimental
            .as_ref()
            .and_then(|experimental| experimental.apple_container.as_ref())
            .is_none()

Comment thread src/core/wxc_common/src/wire.rs Outdated
Comment thread src/core/wxc_common/src/wire.rs
Co-authored-by: Copilot <[email protected]>

Copilot-Session: b062729b-d6f3-47f6-9df0-6c1d5c8a1e5c
Copilot AI review requested due to automatic review settings August 26, 2026 19:00

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.

Pull request overview

Copilot reviewed 30 out of 32 changed files in this pull request and generated no new comments.

Suppressed comments (1)

src/core/wxc_common/src/wire.rs:845

  • This only requires the key to exist; it does not require a non-null Apple Container object. The generated Experimental.apple_container schema is AppleContainer | null, so {"containment":"apple_container","experimental":{"apple_container":null}} passes the rolling schema while present_backend_sections() treats null as absent and the parser rejects it. Add a properties.apple_container constraint referencing #/definitions/AppleContainer alongside required, then regenerate the rolling schema/types and cover the null case.

@richiemsft
Richie Gomez (richiemsft) marked this pull request as ready for review August 26, 2026 19:10
@azure-pipelines

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants