Skip to content

Use typed payloads for state-aware dispatch - #1123

Open
Gudge (MGudgin) wants to merge 1 commit into
user/gudge/version_specific_config_parsers_phase9afrom
user/gudge/version_specific_config_parsers_phase9b
Open

Use typed payloads for state-aware dispatch#1123
Gudge (MGudgin) wants to merge 1 commit into
user/gudge/version_specific_config_parsers_phase9afrom
user/gudge/version_specific_config_parsers_phase9b

Conversation

@MGudgin

@MGudgin Gudge (MGudgin) commented Sep 8, 2026

Copy link
Copy Markdown
Member

This PR replaces raw state-aware backend JSON with typed operations and checked engine-side binding, preserving exact contracts, configuration presence, backend defaults, and diagnostic behavior. It implements Phase 9b / 9.5 of the version-specific parser plan.

Details

  • Make the operation the single phase/routing authority and bind lifecycle and streaming requests after existing execution gates.
  • Introduce runtime-owned WSLC provision configuration and preserve shared normalization with an independent test-only legacy reference.
  • Remove production source/raw-payload retention and reparsing, and project policy identities from typed configuration.
  • Add binding, parser, SDK/FFI, and API-removal regressions; correct three WSLC structural-rejection assertions and document the architecture and acceptance evidence.

Tests

Local post-squash results:

  • cargo test -p wxc_common --lib: 1,146 passed; cargo test -p wxc_common --doc: 7 passed. CLI tests: 62 passed; backend state-aware tests: IsolationSession 31, Windows Sandbox 52, WSLC 30 passed.
  • Engine/FFI and Rust SDK state-aware suites passed separately with default, isolation_session, wslc, and combined features.
  • From src, cargo fmt --all -- --check, cargo check -p wxc_common -p wxc -p mxc_engine -p mxc-sdk -p mxc_ffi --all-targets, and cargo clippy -p wxc_common -p wxc -p mxc_engine -p mxc-sdk -p mxc_ffi --all-targets -- -D warnings passed across the Windows feature matrix.
  • Exact-contract, rolling-schema, and SDK wire-type codegen gates passed. The three corrected WSLC rejection cases passed with and without --debug (six case executions).
  • Linux/macOS default-feature cargo check --all-targets cross-target checks passed; these are not native test-execution results.

Full Phase 9.5 acceptance remains pending. Native Linux/macOS test execution and successful live state-aware lifecycle evidence for IsolationSession, Windows Sandbox, and WSLC are still outstanding. Existing CI does not execute all the required native Rust state-aware suites; skipped live suites are not counted as passing.

The recorded host limitations and implementation evidence are in the migration inventory. The three outdated WSLC start/stop error-code assertions noted by the earlier live run are corrected in this PR; that does not substitute for successful live provisioning and teardown.

Microsoft Reviewers: Open in CodeFlow

@MGudgin
Gudge (MGudgin) requested a review from a team as a code owner September 8, 2026 21:51
@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 8, 2026
Gudge (MGudgin) pushed a commit that referenced this pull request Sep 8, 2026
This PR updates the version-specific parser plan with the agreed Phase 9.5 design, its published implementation status, and the remaining migration and retirement boundaries.

Details

* Record engine-side binding, runtime-owned payloads, presence semantics, independent equivalence evidence, and the shared normalization split.
* Define native-platform, feature-matrix, diagnostic, artifact, and live-lifecycle acceptance gates without treating skipped suites as passing.
* Clarify Phase 10's additive and atomic-cutover boundaries and require complete rolling parser/builder oracle retirement in Phase 11 after replacement coverage exists.
* Update the published stack through Phase 9.5 PR #1123 while keeping its outstanding acceptance work explicit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f590357d-aa38-479e-a106-5f0ae03b3d65
@MGudgin
Gudge (MGudgin) requested a review from a team September 9, 2026 19:46
@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/version_specific_config_parsers_phase9b branch from 01b0528 to 2ae06e7 Compare September 9, 2026 20:21
@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/version_specific_config_parsers_phase9b branch from 2ae06e7 to d8eee5c Compare September 10, 2026 17:29
Copilot AI balanced review requested due to automatic review settings September 10, 2026 17:29

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

🔵 Needs a closer look

It is a cross-cutting parsing/routing/dispatch refactor with acknowledged pending live lifecycle validation evidence across backends and platforms.

Review tier: Lite
Findings: None

What changed in this PR

This PR refactors state-aware lifecycle dispatch to remove production use of raw backend JSON payloads and instead route via a typed StateAwareOperation, with engine-side checked binding into backend-typed requests. It fits into MXC’s Phase 9b/9.5 version-specific parsing plan by tightening the executor’s internal contract between exact parsing, normalization, routing, and backend dispatch—while preserving external wire contracts and diagnostic behavior.

Changes:

  • Introduces StateAwareOperation + StateAwareInput, and adds checked binding helpers that produce BoundStateAwareRequest<B> for both lifecycle dispatch and streaming exec.
  • Moves WSLC provision configuration to a runtime-owned WslcProvisionConfig and updates WSLC backend + docs accordingly, while keeping legacy/rolling payload extraction as test-only reference.
  • Expands regression coverage across engine/SDK/FFI/tests and updates WSLC state-aware script expectations for structurally rejected fields (now malformed_request).
File Description
tests/​scripts/​run_wslc_state_aware_tests.ps1 Updates expected error codes for start/stop structural rejections (malformed_request).
src/​ffi/​mxc_ffi/​src/​state_aware.rs Adds FFI boundary tests for exact payload diagnostics and typed provision validation reaching backend semantics.
src/​core/​wxc/​src/​main.rs Switches state-aware telemetry/audit identity derivation to typed operation accessors (no raw payload slicing).
src/​core/​wxc_common/​src/​state_aware_wire.rs Replaces the raw/retained-wire input with controlled StateAwareInput (common fields + typed operation).
src/​core/​wxc_common/​src/​state_aware_operation.rs Adds the backend-neutral operation model (phase derived from operation; provision retains backend/config presence).
src/​core/​wxc_common/​src/​state_aware_binding.rs Adds checked binding to backend-typed BoundStateAwareRequest<B> after routing/execution gates.
src/​core/​wxc_common/​src/​state_aware_binding_tests.rs Adds recording-backend tests to validate binding, config presence, validation order, dry-run behavior, and exec topologies.
src/​core/​wxc_common/​src/​state_aware_backend.rs Removes DeserializeOwned constraints from backend associated config types (binding now supplies typed config).
src/​core/​wxc_common/​src/​policy_identity.rs Updates state-aware policy hashing to project only allow-listed typed provision fields and exclude IDs/credentials.
src/​core/​wxc_common/​src/​models.rs Adds runtime-owned WslcProvisionConfig; strengthens equality traits for provision config types; adds conversion tests.
src/​core/​wxc_common/​src/​lib.rs Exposes new state-aware binding/operation modules.
src/​core/​wxc_common/​src/​config_parser/​legacy_state_aware_request.rs Introduces test-only legacy state-aware parsing/extraction for differential characterization and diagnostics reference.
src/​core/​wxc_common/​src/​config_parser/​legacy_payload_reference.rs Adds an independent test-only reference extractor for pre-typed payload behavior.
src/​core/​wxc_common/​src/​config_deserialize.rs Tightens several helper APIs to #[cfg(test)] now that production no longer needs legacy secret-field stripping helpers.
src/​core/​wxc_common/​src/​config_contract_adapters/​dev/​state_aware.rs Exact dev adapters now produce StateAwareInput + StateAwareOperation (no raw payload retention).
src/​core/​wxc_common/​src/​config_contract_adapters/​dev/​state_aware_tests/​common.rs Updates adapter tests to validate common normalization vs legacy rolling reference with operation-derived routing.
src/​core/​wxc_common/​src/​config_contract_adapters/​dev/​state_aware_tests/​start.rs Collapses start tests into shared “no-config phase” assertions aligned with typed operation behavior.
src/​core/​wxc_common/​src/​config_contract_adapters/​dev/​state_aware_tests/​stop.rs Collapses stop tests into shared “no-config phase” assertions aligned with typed operation behavior.
src/​core/​wxc_common/​src/​config_contract_adapters/​dev/​state_aware_tests/​deprovision.rs Collapses deprovision tests into shared “no-config phase” assertions aligned with typed operation behavior.
src/​core/​wxc_common/​src/​config_contract_adapters/​dev/​state_aware_tests/​exec.rs Reworks exec adapter tests to verify typed operation + common fields + legacy parity for allowed sections.
src/​core/​wxc_common/​src/​config_contract_adapters/​dev/​mod.rs Updates dev adapter entry point to return StateAwareInput directly (no source-text threading).
src/​core/​mxc-sdk/​tests/​state_aware.rs Adds SDK boundary tests asserting exact payload error diagnostics and typed provision validation behavior.
src/​core/​mxc_engine/​src/​state_aware.rs Updates engine dispatch to bind typed requests before calling lifecycle/streaming dispatch; strengthens gating tests.
src/​backends/​wslc/​common/​src/​state_aware.rs Switches WSLC provision config associated type to runtime WslcProvisionConfig and updates defaulting/presence tests.
src/​backends/​isolation_session/​common/​src/​state_aware.rs Updates comments/tests to reflect checked binding vs raw experimental deserialization in production.
docs/​wsl/​wslc-state-aware.md Updates architecture notes to reflect runtime-owned WSLC provision config + typed binding pipeline.
docs/​versioning.md Documents typed state-aware dispatch model and its invariants (operation authority, binding, presence preservation).
docs/​version-specific-parser-migration-inventory.md Records Phase 9B acceptance evidence and explicitly notes remaining live acceptance gaps.
docs/​state-aware-lifecycle/​mxc-state-aware-sandbox-api-overview.md Updates overview to reflect exact contracts + typed operations + checked binding (vs wire-model deserialization).
docs/​isolation-session/​state-aware-rust.md Updates isolation-session lifecycle documentation to reflect exact structural rejections and typed provision config behavior.
.github/​copilot-instructions.md Updates repo instructions to reflect exact-contract parsing and typed state-aware adapter/binding architecture.

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

@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/version_specific_config_parsers_phase9b branch from d8eee5c to 0b42238 Compare September 10, 2026 17:52
Copilot AI review requested due to automatic review settings September 10, 2026 17:59
@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/version_specific_config_parsers_phase9b branch from 0b42238 to bbb51a6 Compare September 10, 2026 17:59

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

🔵 Needs a closer look

The change rewires core state-aware parsing/binding/dispatch across engine, backends, SDK/FFI, and docs, and the PR notes that full Phase 9.5 live-host lifecycle acceptance is still outstanding.

Review tier: Lite
Findings: None

Copilot AI review requested due to automatic review settings September 10, 2026 18:46
@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/version_specific_config_parsers_phase9b branch from bbb51a6 to 7f6af91 Compare September 10, 2026 18:46
@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/version_specific_config_parsers_phase9b branch from 7f6af91 to 0e26f69 Compare September 10, 2026 18:48

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

🔵 Needs a closer look

It rewires core parsing and dispatch across multiple backends while live lifecycle and native Unix acceptance remain pending.

Review tier: Balanced
Findings: None

Copilot AI review requested due to automatic review settings September 10, 2026 18:49

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

🔵 Needs a closer look

It’s a large cross-cutting refactor of state-aware parsing/binding/dispatch across engine, backends, SDK/FFI, and docs that warrants final human review plus live lifecycle validation evidence.

Review tier: Lite
Findings: 1 Low severity

New issues introduced by this change (1)
Severity Finding
Low severity src/​backends/​wslc/​common/​src/​state_aware.rs — Avoid duplicating WSLC default image string in tests

assert!(cfg.image_tar_path.is_none());
for phase in [None, Some(WslcProvisionConfig::default())] {
let cfg = build_provision_config(&ExecutionRequest::default(), phase).unwrap();
assert_eq!(cfg.image, "alpine:latest");
This PR replaces raw state-aware backend JSON with typed operations and checked engine-side binding, preserving exact contracts, configuration presence, backend defaults, and diagnostic behavior.

Details

* Make the operation the single phase/routing authority and bind lifecycle and streaming requests after existing execution gates.
* Introduce runtime-owned WSLC provision configuration and preserve shared normalization with an independent test-only legacy reference.
* Remove production source/raw-payload retention and reparsing, and project policy identities from typed configuration.
* Add binding, parser, SDK/FFI, and API-removal regressions; correct three WSLC structural-rejection assertions and document the architecture and outstanding acceptance evidence.

Tests

* Common unit tests (1,146), documentation tests (7), CLI tests, and backend state-aware tests passed.
* Engine/FFI and Rust SDK state-aware suites passed separately with default, isolation_session, wslc, and combined features.
* From src, cargo fmt --all -- --check, cargo check -p wxc_common -p wxc -p mxc_engine -p mxc-sdk -p mxc_ffi --all-targets, and cargo clippy -p wxc_common -p wxc -p mxc_engine -p mxc-sdk -p mxc_ffi --all-targets -- -D warnings passed across the Windows feature matrix.
* Exact-contract, rolling-schema, and SDK wire-type codegen gates passed; the three corrected WSLC rejection cases passed with and without --debug.
* Linux/macOS cross-target checks passed. Native Unix test execution and successful live lifecycle acceptance for all three Windows backends remain outstanding; skipped suites are not counted as passing.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 332ec454-d1fa-45d2-a2ad-8e580a12d529
Copilot-Session: f590357d-aa38-479e-a106-5f0ae03b3d65
@MGudgin
Gudge (MGudgin) force-pushed the user/gudge/version_specific_config_parsers_phase9b branch from 0e26f69 to aa53f60 Compare September 10, 2026 18:59
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