Skip to content

Add 0.6 configuration contract adapter - #835

Merged
Gudge (MGudgin) merged 1 commit into
mainfrom
user/gudge/version_specific_config_parsers_phase3
Aug 13, 2026
Merged

Add 0.6 configuration contract adapter#835
Gudge (MGudgin) merged 1 commit into
mainfrom
user/gudge/version_specific_config_parsers_phase3

Conversation

@MGudgin

@MGudgin Gudge (MGudgin) commented Aug 12, 2026

Copy link
Copy Markdown
Member

This PR adds the typed adapter from exact 0.6.0-alpha contract requests to the current wxc_common wire model.

Details

  • Adds the contract-crate dependency and a version-scoped adapter with exhaustive source and destination mappings.
  • Preserves optional-field presence, canonical compatibility aliases, and explicit absence for later-version fields.
  • Adds expected-wire and current-wire equivalence coverage for representative requests, proxies, enums, and aliases.

Tests

  • cargo fmt --all -- --check
  • cargo check -p wxc_common
  • cargo clippy -p wxc_common --all-targets -- -D warnings
  • cargo test -p wxc_common
Microsoft Reviewers: Open in CodeFlow

@MGudgin
Gudge (MGudgin) requested a review from a team as a code owner August 12, 2026 23:46
@azure-pipelines

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

@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/version_specific_config_parsers_phase3 branch from e6d82e0 to 8903f5c Compare August 12, 2026 23:51
Copilot AI balanced review requested due to automatic review settings August 12, 2026 23:51

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 exact 0.6.0-alpha contract adapter into the canonical wxc_common wire model.

Changes:

  • Adds exhaustive contract-to-wire mappings.
  • Preserves aliases, optional sections, and later-version field absence.
  • Adds comprehensive mapping and equivalence tests.
Show a summary per file
File Description
src/Cargo.toml Registers the contract crate dependency.
src/Cargo.lock Records the new dependency edge.
src/core/wxc_common/Cargo.toml Adds the contract crate to wxc_common.
src/core/wxc_common/src/lib.rs Exposes the internal adapter module.
src/core/wxc_common/src/config_contract_adapters/mod.rs Declares the versioned adapter.
src/core/wxc_common/src/config_contract_adapters/v0_6.rs Implements and tests the 0.6 adapter.

Review details

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

  • Files reviewed: 5/6 changed files
  • Comments generated: 0
  • Review effort level: Balanced

Base automatically changed from user/gudge/version_specific_config_parsers_phase2 to main August 12, 2026 23:57
This PR adds the typed adapter from exact 0.6.0-alpha contract requests to the
current wxc_common wire model.

Details

* Adds the contract-crate dependency and a version-scoped adapter with
  exhaustive source and destination mappings.
* Preserves optional-field presence, canonical compatibility aliases, and
  explicit absence for later-version fields.
* Adds expected-wire and current-wire equivalence coverage for representative
  requests, proxies, enums, and aliases.

Tests

* `cargo fmt --all -- --check`
* `cargo check -p wxc_common`
* `cargo clippy -p wxc_common --all-targets -- -D warnings`
* `cargo test -p wxc_common`

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: da2ef4f8-31d6-4979-bd6b-fb822b25b694
@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/version_specific_config_parsers_phase3 branch from 8903f5c to 7741e74 Compare August 12, 2026 23:57
use mxc_config_contract::published::v0_6_0_alpha as contract;
use mxc_config_contract::ContractVersion;

fn convert_version(value: contract::Version) -> &'static str {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I saw these conversion helpers and immediately thought they might be a good fit for the From/Into traits. Since these are infallible conversions between the contract and wire types, we could implement From<contract::X> for wire::X, which would simplify the nested conversions quite a bit when converting from request to MxcConfig:

Self {
    // ...
    containment: containment.into_option().map(Into::into),
    process: Some(process.into()),
    lifecycle: lifecycle.into_option().map(Into::into),
    process_container: process_container.into_option().map(Into::into),
    lxc: lxc.into_option().map(Into::into),
    filesystem: filesystem.into_option().map(Into::into),
    fallback: fallback.into_option().map(Into::into),
    network: network.into_option().map(Into::into),
    ui: ui.into_option().map(Into::into),
    // ...
}

So if we implement From<contract::Request> for wire::MxcConfig, I think we could remove into_wire entirely aswell and have callers just use request.into(). What do you think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, only saw this comment after I'd merged. Looking into this now.

@MGudgin
Gudge (MGudgin) merged commit ff6d018 into main Aug 13, 2026
22 checks passed
@MGudgin
Gudge (MGudgin) deleted the user/gudge/version_specific_config_parsers_phase3 branch August 13, 2026 18:34
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