Skip to content

Add private exact contract parsing - #1096

Open
Gudge (MGudgin) wants to merge 1 commit into
user/gudge/version_specific_config_parsers_phase7bfrom
user/gudge/version_specific_config_parsers_phase7c
Open

Add private exact contract parsing#1096
Gudge (MGudgin) wants to merge 1 commit into
user/gudge/version_specific_config_parsers_phase7bfrom
user/gudge/version_specific_config_parsers_phase7c

Conversation

@MGudgin

@MGudgin Gudge (MGudgin) commented Sep 3, 2026

Copy link
Copy Markdown
Member

📖 Description

This PR adds private exact-contract parsing and test-only versioned policy builders while keeping the rolling parser authoritative for every production entry point.

Details

  • Adds exact one-shot and state-aware version dispatch through the existing shared normalization seams.
  • Adds explicit contract construction primitives, a hidden one-shot bridge, and private v0.6 through v0.9 test builders without implicit public conversion traits.

Tests

  • cargo fmt --all -- --check
  • cargo check --workspace --all-targets
  • cargo clippy --workspace --all-targets -- -D warnings
  • cargo test --workspace
  • cargo check -p mxc_engine -p mxc-sdk --all-targets --target aarch64-apple-darwin
Microsoft Reviewers: Open in CodeFlow

@MGudgin
Gudge (MGudgin) requested a review from a team as a code owner September 3, 2026 15:35
@azure-pipelines

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

@microsoft-github-policy-service microsoft-github-policy-service Bot added the Copilot-Instructions PR modifies Copilot instruction files (.github/copilot-instructions.md or .github/instructions/) label Sep 3, 2026
@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/version_specific_config_parsers_phase7c branch from 7c7f08b to a9a5c5b Compare September 3, 2026 16:24
@MGudgin
Gudge (MGudgin) requested a review from a team September 3, 2026 16:24
Copilot AI balanced review requested due to automatic review settings September 3, 2026 16:46
@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/version_specific_config_parsers_phase7c branch from a9a5c5b to 5a010c8 Compare September 3, 2026 16:46

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

A Linux compile failure and a macOS parity-test failure must be corrected.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 2 High severity

New issues introduced by this change (2)
Severity Finding
High severity src/​core/​mxc_engine/​src/​policy.rs — On a normal Linux library build, apply_host_process_backend is compiled and calls…
High severity src/​core/​mxc_engine/​src/​policy.rs — This parity loop is guaranteed to fail on macOS for 0.6.0-alpha: the rolling builder resolves…
What changed in this PR

Adds private exact-contract parsing and test-only versioned Rust policy builders while retaining the rolling parser for production.

Changes:

  • Adds exact parsing and adapters for versions 0.6–0.9.
  • Adds version-specific policy builders and parity tests.
  • Updates SDK examples and versioning documentation.
File Description
tests/​policy/​request-wslc.json Updates WSLc fixture version.
src/​core/​wxc_common/​src/​config_parser.rs Adds exact parsing and bridge.
src/​core/​wxc_common/​src/​config_contract_adapters/​mod.rs Updates adapter visibility comments.
src/​core/​wxc_common/​src/​config_contract_adapters/​dev/​mod.rs Exposes one-shot adaptation internally.
src/​core/​mxc-sdk/​src/​lib.rs Updates WSLc example version.
src/​core/​mxc-sdk/​README.md Clarifies rolling production parsing.
src/​core/​mxc_engine/​src/​policy/​exact/​v0_9.rs Adds v0.9 exact builder.
src/​core/​mxc_engine/​src/​policy/​exact/​v0_8.rs Adds v0.8 exact builder.
src/​core/​mxc_engine/​src/​policy/​exact/​v0_7.rs Adds v0.7 exact builder.
src/​core/​mxc_engine/​src/​policy/​exact/​v0_6.rs Adds v0.6 exact builder.
src/​core/​mxc_engine/​src/​policy/​exact/​mod.rs Dispatches versioned builders.
src/​core/​mxc_engine/​src/​policy.rs Adds parity tests and fixture updates.
src/​core/​mxc_engine/​Cargo.toml Adds contract test dependency.
src/​core/​mxc_config_contract/​src/​published/​v0_8_0_alpha/​primitives.rs Exposes construction primitives.
src/​core/​mxc_config_contract/​src/​published/​v0_7_0_alpha/​primitives.rs Exposes construction primitives.
src/​core/​mxc_config_contract/​src/​published/​v0_6_0_alpha/​primitives.rs Exposes construction primitives.
src/​core/​mxc_config_contract/​src/​lib.rs Documents typed construction.
src/​core/​mxc_config_contract/​src/​dev/​primitives.rs Exposes development primitives.
src/​core/​mxc_config_contract/​src/​dev/​mod.rs Re-exports NonEmptyVec.
src/​Cargo.lock Records the new dependency.
docs/​versioning.md Documents parser authority boundaries.
docs/​authoring-a-new-feature.md Adds exact-builder parity guidance.
.github/​copilot-instructions.md Documents test-only builders.

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

Comment thread src/core/mxc_engine/src/policy.rs Outdated
Comment thread src/core/mxc_engine/src/policy.rs Outdated
Copilot AI review requested due to automatic review settings September 3, 2026 17: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

🟡 Changes recommended

The v0.6 exact builder diverges from rolling runtime output on macOS, and the public bridge enum lacks a required common trait.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Balanced
Findings: 2 High severity

New issues introduced by this change (1)
Severity Finding
High severity src/​core/​mxc_engine/​src/​policy/​exact/​v0_6.rs — On macOS this cannot match the rolling builder: the production path resolves Containment::Process
Pre-existing issues (1)
Severity Finding
High severity src/​core/​mxc_engine/​src/​policy.rs — This parity loop is guaranteed to fail on macOS for 0.6.0-alpha: the rolling builder resolves… View comment
Issues resolved since last review (1)
Severity Finding
High severity src/​core/​mxc_engine/​src/​policy.rs — On a normal Linux library build, apply_host_process_backend is compiled and calls… View resolved comment
Suppressed comments (1)

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

src/core/wxc_common/src/config_parser.rs:152

  • This newly public (though doc-hidden) enum lacks Debug, unlike the required trait surface for public Rust types. Deriving it is supported because each contained request type already implements Debug.

Comment thread src/core/mxc_engine/src/policy/exact/v0_6.rs
This PR adds private exact-contract parsing and test-only versioned policy
builders while keeping the rolling parser authoritative for every production
entry point.

Details

* Adds exact one-shot and state-aware version dispatch through the shared
  normalization seams.
* Adds explicit contract construction primitives, a hidden one-shot bridge,
  and private v0.6 through v0.9 test builders without implicit conversions.

Tests

* `cargo fmt --all -- --check`
* `cargo check --workspace --all-targets`
* `cargo clippy --workspace --all-targets -- -D warnings`
* `cargo test --workspace`
* Linux cross-target check and Clippy for `mxc_engine` and `mxc_ffi`
* FFI and C# cross-language golden tests
* macOS cross-target check for `mxc_engine` and `mxc-sdk`

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 651084c2-3d1e-4824-917a-6994d62feba0
@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/version_specific_config_parsers_phase7c branch from f790ec7 to aabeb3d Compare September 3, 2026 18:24
Copilot AI review requested due to automatic review settings September 3, 2026 18: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

🟡 Changes recommended

Important directional-network and WSLC exact-builder paths lack parity tests, and one newly public constructor lacks documentation.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

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

New issues introduced by this change (3)
Severity Finding
Medium severity src/​core/​mxc_engine/​src/​policy/​exact/​v0_8.rs — Add an exact-vs-rolling oracle test for the directional path. The current parity test only supplies…
Medium severity src/​core/​mxc_engine/​src/​policy/​exact/​v0_9.rs — Add a successful exact-vs-rolling parity test for Containment::Wslc with all optional fields and…
Low severity src/​core/​mxc_config_contract/​src/​published/​v0_8_0_alpha/​primitives.rs — This constructor is now public but has no rustdoc, unlike the adjacent public constrained-value…
Issues resolved since last review (2)
Severity Finding
High severity src/​core/​mxc_engine/​src/​policy/​exact/​v0_6.rs — On macOS this cannot match the rolling builder: the production path resolves Containment::ProcessView resolved comment
High severity src/​core/​mxc_engine/​src/​policy.rs — This parity loop is guaranteed to fail on macOS for 0.6.0-alpha: the rolling builder resolves… View resolved comment

Comment on lines +148 to +152
fn map_egress(value: &NetworkEgressSection) -> Result<contract::NetworkEgress, MxcError> {
Ok(contract::NetworkEgress {
default: optional!(contract, value.default.map(map_action)),
allow: optional!(
contract,
Comment on lines +327 to +333
let experimental = match containment {
Containment::Wslc(wslc) => {
contract::OptionalField::present(contract::OneShotExperimental {
test: Default::default(),
windows_sandbox: Default::default(),
wslc: contract::OptionalField::present(map_wslc(wslc)?),
telemetry: Default::default(),

impl<T> NonEmptyVec<T> {
fn new(value: Vec<T>) -> Result<Self, String> {
pub fn new(value: Vec<T>) -> Result<Self, String> {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Copilot-Instructions PR modifies Copilot instruction files (.github/copilot-instructions.md or .github/instructions/)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants