Skip to content

feat(engine): add available_backends() host-capability probe API - #753

Merged
Huzaifa Danish (huzaifa-d) merged 1 commit into
user/modanish/port-host-detectors-to-rustfrom
user/modanish/available-backends-probe-api
Aug 5, 2026
Merged

feat(engine): add available_backends() host-capability probe API#753
Huzaifa Danish (huzaifa-d) merged 1 commit into
user/modanish/port-host-detectors-to-rustfrom
user/modanish/available-backends-probe-api

Conversation

@huzaifa-d

@huzaifa-d Huzaifa Danish (huzaifa-d) commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

📖 Description

Phase 2 of the backend-support-probe plan (design doc in #717): add the read-only available_backends() host-capability probe API.

available_backends() -> Vec<AvailableBackend> reports only the containment backends the current host can actually run, so a caller can pick a backend at startup without attempting an execution. It is deliberately separate from platform_support() (§7.1): that answers the narrower "which backends can mxc-sdk itself launch?" question, whereas this answers the broader host-capability question and additionally reports each backend''s effective isolation tier.

What''s included (new mxc_engine::probe module, re-exported from mxc_engine and the public mxc-sdk):

  • AvailableBackend { backend: String, tier: Option<String> } — serializes to camelCase JSON ({"backend":"seatbelt"} / {"backend":"processcontainer","tier":"appcontainer-dacl"}); tier is omitted (never null) when the backend has no tier ladder. backend is a canonical Containment wire name; tier is a canonical IsolationTier::as_str() string.
  • available_backends() — per-platform arms reusing the detectors from feat(engine): Rust host-backend detectors + available_backends() probe #725: macOS → seatbelt; Linux → bubblewrap/lxc; Windows → processcontainer (with effective tier) + windows_sandbox + wslc (feature-gated). An empty Vec is a normal result (unsupported platform, or Linux with neither bwrap nor lxc), not an error.
  • select_tier() — a pure precedence fn (base-containerappcontainer-bfsappcontainer-dacl floor), split from the host detectors so it''s unit-testable without a real Windows host or the tier2_bfs feature.

The named tier is a ceiling, not a guarantee: a real request can still land on a weaker tier when policy forces it (e.g. deniedPaths on a host without native deny support). The probe performs none of those policy-dependent checks.

Stacking / scope:

🔗 References

Related to #717 (design doc / plan this implements Phase 2 of).

🔍 Validation

  • cargo fmt --all -- --check — clean
  • cargo clippy --all-targets -- -D warnings — clean on x86_64-pc-windows-msvc and x86_64-unknown-linux-gnu, and under features wslc and tier2_bfs
  • cargo test -p mxc_engine25 passed (incl. 8 new probe tests: serde shape with tier omitted vs present, host + unconditional wire-name drift guards, canonical-tier drift guard, Windows processcontainer-always-with-tier, tier precedence across all combos, non-Windows processcontainer absence). mxc-sdk suites pass.

Reviewed by an independent adversarial pass and against the repo Rust conventions; the unconditional wire-name drift test and the exotic-target #[cfg] gate came out of that review.

✅ Checklist

📋 Issue Type

  • Bug fix
  • Feature
  • Task
Microsoft Reviewers: Open in CodeFlow

Add mxc_engine::probe with the read-only available_backends() API from the backend-support-probe plan (PR #717, Phase 2). Reports only the containment backends the current host can run, each with its effective isolation tier when it has a tier ladder.

- AvailableBackend { backend, tier: Option<String> } serializes to camelCase JSON with tier omitted (never null) when the backend has no tier ladder.
- available_backends() has per-platform arms reusing the landed detectors: macOS -> seatbelt; Linux -> bubblewrap/lxc; Windows -> processcontainer (with effective tier) + windows_sandbox + wslc (feature-gated). Empty Vec is a normal result, not an error.
- select_tier() is a pure precedence fn (base-container -> appcontainer-bfs -> appcontainer-dacl floor), unit-testable without a real host or the tier2_bfs feature.
- Re-exported from mxc_engine and the public mxc-sdk.
- 8 unit tests: serde shape (tier omitted vs present), host + unconditional wire-name drift guards, canonical-tier drift guard, Windows processcontainer-always-with-tier, tier precedence, non-Windows processcontainer absence.

Stacked on the host-detector port (PR #725); the standalone detectors it reuses land there.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

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

@huzaifa-d
Huzaifa Danish (huzaifa-d) merged commit 46b2274 into user/modanish/port-host-detectors-to-rust Aug 5, 2026
1 check passed
@huzaifa-d
Huzaifa Danish (huzaifa-d) deleted the user/modanish/available-backends-probe-api branch August 5, 2026 18:25
@huzaifa-d

Copy link
Copy Markdown
Contributor Author

Folded into #725. This PR''s commits became an ancestor of its base branch (user/modanish/port-host-detectors-to-rust), so GitHub auto-marked it as merged — but the probe was not merged to main; it now ships as part of #725, which carries both the host detectors and the available_backends() probe API. No separate probe PR. Closing out here; the available-backends-probe-api branch is being deleted.

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.

2 participants