Add private exact contract parsing - #1096
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
7c7f08b to
a9a5c5b
Compare
a9a5c5b to
5a010c8
Compare
There was a problem hiding this comment.
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
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
src/core/mxc_engine/src/policy.rs — On a normal Linux library build, apply_host_process_backend is compiled and calls… |
|
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.
There was a problem hiding this comment.
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
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
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 |
|---|---|
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 |
|---|---|
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 implementsDebug.
5ee920f to
f790ec7
Compare
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
f790ec7 to
aabeb3d
Compare
There was a problem hiding this comment.
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
New issues introduced by this change (3)
| Severity | Finding |
|---|---|
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… |
|
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… |
|
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 |
|---|---|
src/core/mxc_engine/src/policy/exact/v0_6.rs — On macOS this cannot match the rolling builder: the production path resolves Containment::Process… View resolved comment |
|
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 |
| fn map_egress(value: &NetworkEgressSection) -> Result<contract::NetworkEgress, MxcError> { | ||
| Ok(contract::NetworkEgress { | ||
| default: optional!(contract, value.default.map(map_action)), | ||
| allow: optional!( | ||
| contract, |
| 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> { |



📖 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
Tests
cargo fmt --all -- --checkcargo check --workspace --all-targetscargo clippy --workspace --all-targets -- -D warningscargo test --workspacecargo check -p mxc_engine -p mxc-sdk --all-targets --target aarch64-apple-darwinMicrosoft Reviewers: Open in CodeFlow