Enable authoritative exact contract dispatch - #1104
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
8a9c31d to
27215d2
Compare
27215d2 to
a47cfe9
Compare
a47cfe9 to
fde5518
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Exact development diagnostics bypass security sanitization, SDK version validation is inconsistent, and authoritative documentation remains outdated.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
src/core/wxc_common/src/config_parser.rs — Making this exact path authoritative sends every 0.9 contract error through… |
|
docs/version-specific-parser-migration-inventory.md — The inventory now says exact dispatch is authoritative, but the primary documentation still states… |
What changed in this PR
Makes exact, version-specific contracts authoritative across request-loading and Rust policy-builder paths.
Changes:
- Routes production parsing through registered exact contracts.
- Retains rolling parsing for characterization tests.
- Updates E2E expectations and migration documentation for structural failures.
| File | Description |
|---|---|
tests/scripts/run_wslc_state_aware_tests.ps1 |
Expects structural filesystem rejection. |
tests/scripts/run_isolation_session_tests.ps1 |
Tests closed one-shot contracts. |
tests/scripts/run_isolation_session_state_aware_tests.ps1 |
Updates structural rejection assertions. |
tests/configs/isolation_session_one_shot_stray_config_rejected.json |
Renames stray-config rejection fixture. |
tests/configs/isolation_session_configid_rejected.json |
Renames configuration-ID rejection fixture. |
src/testing/wxc_e2e_tests/tests/e2e_state_aware.rs |
Tests exact containment rejection. |
src/testing/wxc_e2e_tests/tests/e2e_isolation_session_policy.rs |
Updates UI rejection expectations. |
src/core/wxc/src/main.rs |
Uses exact parsing for probes and tests. |
src/core/wxc_common/src/splice.rs |
Versions command-splicing test input. |
src/core/wxc_common/src/lib.rs |
Removes obsolete dead-code allowance. |
src/core/wxc_common/src/config_parser.rs |
Enables authoritative exact dispatch. |
src/core/wxc_common/src/config_deserialize.rs |
Restricts rolling helpers to tests. |
src/core/wxc_common/src/config_contract_adapters/mod.rs |
Enables production development adapters. |
src/core/mxc_engine/src/policy/network.rs |
Restricts rolling wire helpers to tests. |
src/core/mxc_engine/src/policy.rs |
Routes policy builders through exact contracts. |
src/core/mxc_engine/src/configs/process_container.rs |
Test-gates legacy wire mapping. |
src/core/mxc_engine/Cargo.toml |
Promotes contract crate to runtime dependency. |
src/core/mxc_darwin/src/main.rs |
Uses exact one-shot loading. |
src/core/lxc/src/main.rs |
Uses exact one-shot loading. |
src/backends/lxc/common/src/network_iptables_ga_egress_spec.rs |
Corrects registered test version. |
docs/version-specific-parser-migration-inventory.md |
Records Phase 9 completion and validation. |
Suppressed comments (1)
src/core/wxc_common/src/config_parser.rs:327
- The exact switch now accepts only these four registered spellings, but the public TypeScript builder still treats any semver between the minimum and maximum as valid (for example
0.8.1-alpha), and its state-aware tests explicitly preserve such an override. Those SDK calls therefore build requests that the native layer now guarantees to reject as malformed. Align the SDK version validators/options and tests with the exact registry (state-aware currently only has0.9.0-alpha).
fn parse_exact_mxc_request_json(json: &str, logger: &mut Logger) -> Result<MxcRequest, ParseError> {
match probe_version(json).map_err(exact_version_error)? {
ContractVersion::V0_6_0Alpha => parse_exact_published_one_shot(
json,
logger,
crate::config_contract_adapters::v0_6::into_wire,
),
ContractVersion::V0_7_0Alpha => parse_exact_published_one_shot(
json,
logger,
crate::config_contract_adapters::v0_7::into_wire,
),
ContractVersion::V0_8_0Alpha => parse_exact_published_one_shot(
json,
logger,
crate::config_contract_adapters::v0_8::into_wire,
),
ContractVersion::V0_9_0Alpha => parse_exact_development(json, logger),
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
fde5518 to
493f2c1
Compare
493f2c1 to
c01d0fb
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Node SDK and configuration validation still accept rolling-contract inputs that authoritative exact loading rejects.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 3
New issues introduced by this change (3)
| Severity | Finding |
|---|---|
docs/version-specific-parser-migration-inventory.md — The reported config gate is still validating every document against schema-version.json's… |
|
src/core/wxc_common/src/config_parser.rs — Exact dispatch makes the selected contract authoritative, but the public Node policy builder still… |
|
src/core/mxc_engine/src/policy.rs — This promotes the exact builders to production, but the architecture guidance still describes the… |
Pre-existing issues (2)
| Severity | Finding |
|---|---|
src/core/wxc_common/src/config_parser.rs — Making this exact path authoritative sends every 0.9 contract error through… View comment |
|
docs/version-specific-parser-migration-inventory.md — The inventory now says exact dispatch is authoritative, but the primary documentation still states… View comment |
c01d0fb to
b88f2ad
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
CLI command preprocessing can bypass exact version dispatch, and primary contributor documentation still describes the retired rolling-production architecture.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 4
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/core/wxc_common/src/config_parser.rs — The CLI-command path can bypass this exact dispatch. apply_cli_command probes phase before… |
Pre-existing issues (5)
| Severity | Finding |
|---|---|
src/core/wxc_common/src/config_parser.rs — Exact dispatch makes the selected contract authoritative, but the public Node policy builder still… View comment |
|
docs/version-specific-parser-migration-inventory.md — The reported config gate is still validating every document against schema-version.json's… View comment |
|
src/core/wxc_common/src/config_parser.rs — Making this exact path authoritative sends every 0.9 contract error through… View comment |
|
src/core/mxc_engine/src/policy.rs — This promotes the exact builders to production, but the architecture guidance still describes the… View comment |
|
docs/version-specific-parser-migration-inventory.md — The inventory now says exact dispatch is authoritative, but the primary documentation still states… View comment |
Suppressed comments (1)
docs/version-specific-parser-migration-inventory.md:26
- This records exact dispatch as authoritative, but the repository’s primary versioning guidance still states the opposite:
docs/versioning.md:87-110calls the rolling parser authoritative and the exact builders test-only;docs/schema-codegen.md:8-12,75-78says production still uses rolling;docs/authoring-a-new-feature.md:127-131retains the pre-cutover workflow; and.github/copilot-instructions.md:282describes policy builders as rolling. These instructions now direct contributors to modify or reason about the wrong production contract. Update them as part of the Phase 9 cutover.
Version migration removed 118 of the 125 recorded divergences. The remaining
seven now characterize only the test-scoped rolling parser; authoritative
public loading rejects every document through its exact contract:
b88f2ad to
623aae2
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The SDK version registry lacks synchronization enforcement, and remaining documentation still describes the retired rolling production path.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 5
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
sdk/node/src/types.ts — This new public registry is another handwritten source of truth, but… |
|
docs/versioning.md — The authoritative-parser documentation remains contradictory elsewhere. sdk/node/README.md:67… |
Pre-existing issues (6)
| Severity | Finding |
|---|---|
src/core/wxc_common/src/config_parser.rs — The CLI-command path can bypass this exact dispatch. apply_cli_command probes phase before… View comment |
|
src/core/wxc_common/src/config_parser.rs — Exact dispatch makes the selected contract authoritative, but the public Node policy builder still… View comment |
|
docs/version-specific-parser-migration-inventory.md — The reported config gate is still validating every document against schema-version.json's… View comment |
|
src/core/wxc_common/src/config_parser.rs — Making this exact path authoritative sends every 0.9 contract error through… View comment |
|
src/core/mxc_engine/src/policy.rs — This promotes the exact builders to production, but the architecture guidance still describes the… View comment |
|
docs/version-specific-parser-migration-inventory.md — The inventory now says exact dispatch is authoritative, but the primary documentation still states… View comment |
623aae2 to
2523814
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Public version typing and several compatibility documents still contradict exact registered-version enforcement.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (4)
| Severity | Finding |
|---|---|
sdk/node/src/types.ts — The one-shot public type still accepts any string even though validatePolicyVersion now accepts… |
|
.github/copilot-instructions.md — The exact-schema guidance here conflicts with the unchanged Policy versioning section at line 356,… |
|
docs/playground-limitations.md — This sentence still documents range acceptance, but the new exact dispatcher rejects every spelling… |
|
sdk/node/README.md — The troubleshooting table later in this file (line 444) still documents only “older/newer than… |
Issues resolved since last review (8)
| Severity | Finding |
|---|---|
docs/versioning.md — The authoritative-parser documentation remains contradictory elsewhere. sdk/node/README.md:67… View resolved comment |
|
sdk/node/src/types.ts — This new public registry is another handwritten source of truth, but… View resolved comment |
|
src/core/wxc_common/src/config_parser.rs — The CLI-command path can bypass this exact dispatch. apply_cli_command probes phase before… View resolved comment |
|
src/core/mxc_engine/src/policy.rs — This promotes the exact builders to production, but the architecture guidance still describes the… View resolved comment |
|
src/core/wxc_common/src/config_parser.rs — Exact dispatch makes the selected contract authoritative, but the public Node policy builder still… View resolved comment |
|
docs/version-specific-parser-migration-inventory.md — The reported config gate is still validating every document against schema-version.json's… View resolved comment |
|
docs/version-specific-parser-migration-inventory.md — The inventory now says exact dispatch is authoritative, but the primary documentation still states… View resolved comment |
|
src/core/wxc_common/src/config_parser.rs — Making this exact path authoritative sends every 0.9 contract error through… View resolved comment |
Suppressed comments (1)
docs/versioning.md:109
- The rest of this section still describes the removed rolling behavior: lines 58-63 and 395-400 say versions are optional and major/minor range-matched, and line 478 promises old/new range diagnostics. Exact dispatch instead requires one of four complete registered spellings and emits
Unsupported contract version; update these sections (and the compatibility table indocs/schema.md) so users are not told that versionless or0.6.1-alpharequests are accepted.
The runtime parser and Rust SDK policy builders dispatch through the exact
contract registered for the declared version. The rolling parser and builder
remain only to characterize intentional migration differences and detect
unplanned drift. Corpus validation likewise selects the exact registered schema
2523814 to
7e8ee67
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
A public raw-JSON loader still uses rolling parsing, and version documentation still describes obsolete range-based acceptance.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/core/wxc_common/src/config_parser.rs — Only the file/base64 loader is made test-only here. pub fn load_request_from_json (lines 171–216)… |
Pre-existing issues (4)
| Severity | Finding |
|---|---|
sdk/node/src/types.ts — The one-shot public type still accepts any string even though validatePolicyVersion now accepts… View comment |
|
sdk/node/README.md — The troubleshooting table later in this file (line 444) still documents only “older/newer than… View comment |
|
docs/playground-limitations.md — This sentence still documents range acceptance, but the new exact dispatcher rejects every spelling… View comment |
|
.github/copilot-instructions.md — The exact-schema guidance here conflicts with the unchanged Policy versioning section at line 356,… View comment |
Suppressed comments (2)
docs/playground-limitations.md:149
- This still describes range-based acceptance, but both the exact Rust registry and the new SDK check accept only four exact strings; for example,
0.6.1-alphais within this stated range and is now rejected. Document the registered versions explicitly so the compatibility guidance matches runtime behavior.
The SDK and Rust parser accept `>=0.6, <=0.9`. The schema version does not select the Windows backend — BaseContainer vs AppContainer is resolved at runtime by host capability.
docs/versioning.md:110
- The exact-dispatch description conflicts with this document's remaining version-negotiation text: lines 58–63 and 395–397 still say any
0.6.x–0.9.xversion is accepted and patch/prerelease labels are ignored.probe_versionnow performs an exact registry lookup, so values such as0.6.1-alphaor0.8.0-devare rejected. Update those sections and the Stage 1 diagram to describe exact registered-version selection.
The runtime parser and Rust SDK policy builders dispatch through the exact
contract registered for the declared version. The rolling parser and builder
remain only to characterize intentional migration differences and detect
unplanned drift. Corpus validation likewise selects the exact registered schema
from each document's `version`.
7e8ee67 to
e66ae2f
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unsupported registered-version failures are incorrectly audited as malformed JSON instead of schema violations.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/core/wxc_common/src/config_parser.rs — This branch is still wrapped as ParseError::Decode, so wxc records every unsupported-but-valid… |
Issues resolved since last review (5)
| Severity | Finding |
|---|---|
src/core/wxc_common/src/config_parser.rs — Only the file/base64 loader is made test-only here. pub fn load_request_from_json (lines 171–216)… View resolved comment |
|
sdk/node/README.md — The troubleshooting table later in this file (line 444) still documents only “older/newer than… View resolved comment |
|
docs/playground-limitations.md — This sentence still documents range acceptance, but the new exact dispatcher rejects every spelling… View resolved comment |
|
.github/copilot-instructions.md — The exact-schema guidance here conflicts with the unchanged Policy versioning section at line 356,… View resolved comment |
|
sdk/node/src/types.ts — The one-shot public type still accepts any string even though validatePolicyVersion now accepts… View resolved comment |
e66ae2f to
0b68367
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
A lifecycle parsing error can bypass the required JSON envelope, and versioning documentation remains contradictory.
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/wxc_common/src/config_parser.rs — This pre-deserialization can change the public error route for an otherwise identifiable lifecycle… |
|
docs/schema-codegen.md — This exact-schema statement conflicts with this file's unchanged CI-gates section at lines 114–116,… |
|
docs/versioning.md — The primary schema reference still documents the retired behavior: docs/schema.md:424-446 says… |
Pre-existing issues (1)
| Severity | Finding |
|---|---|
src/core/wxc_common/src/config_parser.rs — This branch is still wrapped as ParseError::Decode, so wxc records every unsupported-but-valid… View comment |
0b68367 to
1f56c09
Compare
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The cross-platform trust-boundary and SDK cutover warrants final human validation despite comprehensive coverage.
Review tier: Balanced
Findings: 2
Pre-existing issues (2)
| Severity | Finding |
|---|---|
src/core/wxc_common/src/config_parser.rs — This pre-deserialization can change the public error route for an otherwise identifiable lifecycle… View comment |
|
src/core/wxc_common/src/config_parser.rs — This branch is still wrapped as ParseError::Decode, so wxc records every unsupported-but-valid… View comment |
Issues resolved since last review (2)
| Severity | Finding |
|---|---|
docs/versioning.md — The primary schema reference still documents the retired behavior: docs/schema.md:424-446 says… View resolved comment |
|
docs/schema-codegen.md — This exact-schema statement conflicts with this file's unchanged CI-gates section at lines 114–116,… View resolved comment |
This PR makes registered version-specific contracts authoritative for production requests and preserves structured rejection diagnostics and output routing. Details * Make exact contract dispatch authoritative for executor loading, probes, state-aware requests, and Rust SDK policy builders; retain rolling helpers only as test oracles. * Preserve pre-parse CLI command splicing, source-aware diagnostics, and shared normalization without changing published contract shapes. * Classify schema-version declaration failures separately from JSON decoding for rejection audits, while keeping pre-discrimination stderr routing. * Preserve state-aware JSON error envelopes when development preflight deserialization rejects duplicate experimental fields. * Align SDK validation, corpus gates, and documentation with exact registered versions while retaining string-typed public one-shot versions. Tests * cargo fmt --all -- --check; cargo check --workspace --all-targets; cargo clippy --workspace --all-targets -- -D warnings. * cargo test -p wxc_common -p mxc_engine -p wxc --lib --bins: 1,187 common, 112 engine, and 62 CLI tests passed. * cargo test -p wxc_common --doc config_parser::load_mxc_request_from_json. * cargo check -p mxc_engine -p lxc --target x86_64-unknown-linux-gnu and cargo check -p mxc_engine -p mxc_darwin --target aarch64-apple-darwin. * Direct built-CLI checks confirmed schema-violation versus malformed-JSON audits, lifecycle duplicate-field JSON envelopes, and one-shot stderr diagnostics. Both new CLI regressions failed before the fixes and pass afterward. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 0f04437d-4a05-487a-b402-4ed4c774e8e0
1f56c09 to
bcc2ac7
Compare
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Exact dispatch is consistently applied across production entry points, SDK builders, validation gates, tests, and documentation, with no unresolved correctness issues found.
Review tier: Balanced
Findings: None
Issues resolved since last review (2)
| Severity | Finding |
|---|---|
src/core/wxc_common/src/config_parser.rs — This pre-deserialization can change the public error route for an otherwise identifiable lifecycle… View resolved comment |
|
src/core/wxc_common/src/config_parser.rs — This branch is still wrapped as ParseError::Decode, so wxc records every unsupported-but-valid… View resolved comment |



This PR changes request parsing to select and enforce the exact registered contract declared by each request.
Details
Tests
cargo fmt --all -- --checkcargo check --workspace --all-targetscargo clippy --workspace --all-targets -- -D warningscargo test --workspacenpm run buildandnpm testinsdk/nodedotnet test --solution Microsoft.Mxc.Sdk.slnxMicrosoft Reviewers: Open in CodeFlow