You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Enforce probe coverage for every backend and isolation tier - #1491
Make it impossible to add a containment backend or isolation tier without deciding whether the host probe reports it, and prove that decision against the real reporting code.
backend_registry is the single source of truth: every registration declares ProbeCoverage::Detected(&[target_os]) or NotDetected(reason). Vm and MicroVm are recorded as undetected, making a previously silent probe gap explicit.
The platform reporting functions take their host checks as parameters, so tests can force every check to pass. Two gates then run the production reporting path: every backend declared detected on the current target must be emitted, and a NotDetected one must not be. Registering a backend as detected without adding a branch to available_backends() fails.
probe.rs derives its canonical tier list from IsolationTier::ALL instead of a hand-written array, and gains a test that every tier is reachable from select_tier.
platform.rs drops its duplicate wire-name table and builds available_methods from wire_name() rather than raw literals.
Behavior change
The gate found a real gap: Hyperlight runs on Linux under KVM (resolve_hyperlight, tools/lxc), but available_backends() only reported it on Windows. It is now reported on Linux too, when the hyperlight feature is built on x86_64 and /dev/kvm is readable and writable.
This affects the available_backends() array and lxc-exec --available-backends only. platform_support() is unchanged, and the Node SDK's Linux consumer scans that payload for the bubblewrap entry alone, so the added entry is inert there. No wire type, field, or name changed.
Rescoped from the original ask: with backend_registry's exhaustive match already in place, compile-time enforcement plus unit tests cover this without a new CI job.
Each gate was confirmed to fail on a simulated regression (reverted):
Registering Vm as Detected(&["windows"]) fails with vm is registered as detected on windows, but the probe never reports it even with every host check passing.
Removing the BFS rung from select_tier fails with select_tier can never report "appcontainer-bfs"; the probe tier ladder is missing a rung.
Dropping a backend from the canonical table fails the registry set-equality test.
Not covered locally: --features hyperlight --target x86_64-unknown-linux-gnu cannot build here (the ring build script needs a Linux C cross-toolchain), so the Linux KVM branch is compiled only by CI's Linux x64 Hyperlight build. Its cfg and call path match the existing resolve_hyperlight call site exactly.
Two mxc_common::filesystem_canonical tests fail on this machine for lack of symlink privileges; unrelated and pre-existing.
Address review feedback on #1491:
- ProbeCoverage::Detected was inert metadata. Add an exhaustive
host_detector() mapping in probe.rs and a test requiring Detected to name
a detector and NotDetected to have none, so a backend cannot be registered
as detected without a branch in available_backends().
- Correct the wslc test-plan bullet: availability comes from
wslc_common::is_available() (WSL2 plus the WSLC runtime), not from
resolving wslcsdk.dll.
Fix the Repository consistency check: check-dotnet-api-parity.js read tier
wire names from probe.rs's CANONICAL_TIERS, which this branch removed. Read
the isolation_tiers! ladder in fallback_detector.rs instead, so the parity
check compares against the canonical declaration rather than a test mirror.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25b86546-f178-4ab4-bda2-7443aa01f541
This updated follow-up list still describes Windows Sandbox, IsolationSession, and LXC detection as future work, but available_backends() already invokes all three detectors and this PR registers them as Detected. Remove those completed items so the plan agrees with the implementation and the new coverage declarations.
The probe-coverage gate compared a declaration against another declaration: a
backend registered as Detected only had to name a detector string, which a
typo could satisfy. Make the gate run the production reporting code instead.
ProbeCoverage::Detected now names the target_os values a backend is detected
on. The platform reporting functions take their host checks as parameters, so
tests can force every check to pass and assert that each backend declared
detected on the current target is actually emitted, and that a NotDetected one
still is not. Registering a backend as detected without adding a branch to
available_backends() now fails.
Also drop the completed windows_sandbox, isolation_session, and lxc detector
items from the plan doc's follow-up list and gap tables, which no longer match
the code.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25b86546-f178-4ab4-bda2-7443aa01f541
Hyperlight is also runnable on Linux: resolve_hyperlight() gates it with hyperlight_common::is_kvm_available() (run.rs:475-499), and the Linux x64 CI build enables the feature. Restricting coverage to Windows makes the Linux invariant test ignore Hyperlight, so available_backends() can keep omitting a backend that the host can run. Include linux here and wire the feature/architecture-gated KVM check through linux_backends_with.
Document Linux KVM probe in Hyperlight detector summary
This detector summary omits Linux's existing is_kvm_available() probe, even though Hyperlight is supported on Linux as well as Windows. Document both OS-specific probes so the plan does not imply that Hyperlight coverage is Windows-only.
Hyperlight runs on Linux under KVM, but available_backends() only reported it
on Windows, so the probe omitted a backend the host can run. Registering it as
detected on Windows alone also kept the Linux coverage test from catching that.
linux_backends_with() now takes a hyperlight availability input, and
hyperlight_host_available() resolves WHP on Windows and KVM on Linux behind the
same feature and x86_64 gates that resolve_hyperlight() uses.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25b86546-f178-4ab4-bda2-7443aa01f541
This test compares two manually maintained registry-derived lists, so it still passes if a new ContainmentBackend variant is omitted from both. The exhaustive registration() match only forces an arm; an accidental arm pointing to an existing index also passes every registry test and gives the new backend another backend's metadata. Derive an ALL list and the registry from the enum's single declaration (for example, with a macro), or add an enum-derived exhaustive list and assert that each variant maps to a registration whose backend equals that variant.
Require exact equality between declared and reported target sets
src/mxc-sdk/src/core/mxc_engine/probe.rs:427
This checks only that the declared set is a subset of the reported set. If a backend remains reported on Linux but "linux" is accidentally removed from its Detected targets, both this test and the NotDetected test still pass, so the registry is not actually the source of truth for per-target coverage. Compare the two sets for equality so undeclared reporting fails too.
The reason will be displayed to describe this comment to others. Learn more.
This test bypasses the production detector wiring. It still passes if linux_backends() uses the wrong detector or argument. Please test the production path with one detector enabled at a time.
The reason will be displayed to describe this comment to others. Learn more.
The new tests check the reporting branches, but still bypass the real detector assignments in linux_backends() and the Windows path. For example, setting the production Hyperlight result to false would leave them passing. Please run the single-detector tests through the production assignment path so they catch a disconnected or wrongly assigned detector.
The reason will be displayed to describe this comment to others. Learn more.
Linux CI does not run these probe or registry tests. Windows CI cannot test Linux-only code. Please run these tests in the default and x64 Hyperlight Linux jobs.
The reason will be displayed to describe this comment to others. Learn more.
This test checks nothing when available_backends() returns an empty list. Please use backends_with_host_checks_passing() so the test always checks reported backends.
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
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.
📖 Description
Make it impossible to add a containment backend or isolation tier without deciding whether the host probe reports it, and prove that decision against the real reporting code.
backend_registryis the single source of truth: every registration declaresProbeCoverage::Detected(&[target_os])orNotDetected(reason).VmandMicroVmare recorded as undetected, making a previously silent probe gap explicit.NotDetectedone must not be. Registering a backend as detected without adding a branch toavailable_backends()fails.probe.rsderives its canonical tier list fromIsolationTier::ALLinstead of a hand-written array, and gains a test that every tier is reachable fromselect_tier.platform.rsdrops its duplicate wire-name table and buildsavailable_methodsfromwire_name()rather than raw literals.Behavior change
The gate found a real gap: Hyperlight runs on Linux under KVM (
resolve_hyperlight,tools/lxc), butavailable_backends()only reported it on Windows. It is now reported on Linux too, when thehyperlightfeature is built on x86_64 and/dev/kvmis readable and writable.This affects the
available_backends()array andlxc-exec --available-backendsonly.platform_support()is unchanged, and the Node SDK's Linux consumer scans that payload for thebubblewrapentry alone, so the added entry is inert there. No wire type, field, or name changed.🔗 References
Resolves #769
Rescoped from the original ask: with
backend_registry's exhaustive match already in place, compile-time enforcement plus unit tests cover this without a new CI job.🔍 Validation
From
src/:cargo fmt --all -- --check— passedcargo clippy -p mxc-sdk --all-targets -- -D warnings— passedcargo test -p mxc-sdk --lib -- mxc_engine— passed, 106 testscargo test -p mxc-sdk --lib --features tier2_bfs -- mxc_engine::probe mxc_engine::backend_registry— passed, 24 testscargo check -p mxc-sdk --lib --target x86_64-unknown-linux-gnu— passedcargo check -p mxc-sdk --lib --profile test --target x86_64-unknown-linux-gnu— passedFrom the repository root:
node scripts/check-dotnet-api-parity.js— passedEach gate was confirmed to fail on a simulated regression (reverted):
VmasDetected(&["windows"])fails withvm is registered as detected on windows, but the probe never reports it even with every host check passing.select_tierfails withselect_tier can never report "appcontainer-bfs"; the probe tier ladder is missing a rung.Not covered locally:
--features hyperlight --target x86_64-unknown-linux-gnucannot build here (theringbuild script needs a Linux C cross-toolchain), so the Linux KVM branch is compiled only by CI's Linux x64 Hyperlight build. Its cfg and call path match the existingresolve_hyperlightcall site exactly.Two
mxc_common::filesystem_canonicaltests fail on this machine for lack of symlink privileges; unrelated and pre-existing.✅ Checklist
Cargo.lock, thedependency-feed-checkcheck passes📋 Issue Type
Microsoft Reviewers: Open in CodeFlow