Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/Versioning.Checks.Job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ jobs:
- name: Check PSEC generated contract (provenance + drift)
run: node scripts/versioning/check-psec-codegen.js

- name: Check generated Windows bindings
working-directory: src
run: |
cargo test --locked -p mxc_windows_bindgen generate_bindings
git diff --exit-code -- mxc-sdk/src/windows/bindings.rs mxc-sdk/build/windows/bindings.rs mxc-sdk/src/backends/isolation_session/bindings/bindings.rs testing/wxc_test_proxy/src/windows/bindings.rs

- name: Check telemetry policy binding parity
run: node scripts/check-telemetry-policy-parity.js

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ full lifecycle against the OS-side Isolation Session API: provision an
agent user, start a session, run the script (capturing stdout / stderr /
exit code into `ScriptResponse`), then stop the session and deprovision the
agent. All of this happens through
Rust bindings auto-generated from a private WinMD; the OS-side API is gated
Rust bindings generated from the public `windows-default` metadata; the OS-side API is gated
on an internal Windows feature flag.

This implementation is a **one-shot runner** — every `wxc-exec`
Expand Down Expand Up @@ -94,10 +94,8 @@ invocations, without changing the manager's interface. See

| File | Purpose |
|---|---|
| `src/mxc-sdk/build/isolation_session_bindings/README.md` | WinMD provenance, version-coupling notes |
| `src/mxc-sdk/build/isolation_session_bindings/GENERATION_INFO.toml` | Machine-readable provenance (`windows-bindgen` version, target `windows` crate version, generated date) |
| `src/tools/mxc_windows_bindgen/` | Generator and API filters; dependencies pinned in the workspace |
| `src/mxc-sdk/Cargo.toml` | Declares the `isolation_session` feature and Windows dependencies |
| `src/mxc-sdk/build/build_isolation_session_bindings.rs` | Verifies `windows` crate version matches the recorded provenance |
| `src/mxc-sdk/src/backends/isolation_session/bindings/mod.rs` | Re-exports the generated module |
| `src/mxc-sdk/src/backends/isolation_session/bindings/bindings.rs` | Generated by `windows-bindgen` (committed) |
| `src/mxc-sdk/src/backends/isolation_session/common/` (`one_shot.rs`, `manager.rs`, etc.) | `IsolationSessionManager` + `IsolationSessionRunner` |
Expand Down Expand Up @@ -188,42 +186,17 @@ full drain budget.

## Bindings Workflow

**Why a private WinMD.** The OS-side API ships its WinMD as part of an
internal Windows OS build (the exact file name and provenance are recorded
in `GENERATION_INFO.toml`). There is no public NuGet or release distribution
today. MXC stores generated Rust bindings in the workspace and tracks their
provenance.

**Future direction.** The OS API is expected to land in the public Windows
SDK eventually, at which point the `windows` crate (auto-generated from
the public Windows SDK metadata) will pick it up automatically. When that
happens, MXC can drop this private bindings crate and consume the API
through the standard `windows` crate dependency. That milestone is
currently far off — the private bindings remain the working approach for
the foreseeable future.

**Generated bindings are committed.**
`src/mxc-sdk/src/backends/isolation_session/bindings/bindings.rs` is a checked-in artifact.
The WinMD itself is **not** committed (binary, frequently updated). All
provenance lives in `GENERATION_INFO.toml`.

**Regeneration.** When the OS-side API changes (or the consumed OS build
moves), the bindings must be regenerated by a Microsoft engineer with
access to the private WinMD. `windows-bindgen` X.Y generates code that
targets the `windows` X.Y crate, so a regenerator must use a
`windows-bindgen` release whose major.minor matches the workspace
`windows` crate. The generated bindings and the Rust code in this repo use
the `Windows.AI.IsolationSession.Preview` namespace (for example,
`IsoSessionOps`) — that is the naming to use when diagnosing regeneration or
version-coupling issues. The build-time check below catches the most common
slip — bumping the workspace `windows` crate without regenerating — by
comparing the workspace version against the recorded `target_windows_crate`.

**`build.rs` version check.** `isolation_session_bindings/build.rs` reads
the expected `windows` crate version from `GENERATION_INFO.toml`
(`target_windows_crate`) and compares against the actual workspace
`Cargo.lock`. A mismatch panics the build with a message naming both
versions and stating that the bindings must be regenerated.
`src/mxc-sdk/src/backends/isolation_session/bindings/bindings.rs` is committed
and generated from the `Windows.AI.IsolationSession.Preview` members selected
in `src/tools/mxc_windows_bindgen/isolation-session.txt`, using the public
`windows-default` package. The generator and metadata versions are pinned
in `src/Cargo.toml` and `src/Cargo.lock`; no private WinMD is needed.

See the [Windows bindings workflow](../../../build-and-test/pull-requests.md#windows-bindings)
for regeneration. Repository consistency regenerates the bindings and checks
for drift. Runtime availability still depends on the host's OS-side API;
published metadata does not make an unsupported Windows build capable of
running IsolationSession.

## v0.1 Scope

Expand Down Expand Up @@ -372,7 +345,7 @@ The following were observed during VM testing and are accepted for v0.1.

| Risk | Mitigation |
|---|---|
| Bindings tied to a specific OS API version | `GENERATION_INFO.toml` records the `windows-bindgen` version and target `windows` crate version; `build.rs` panics if the workspace `windows` crate drifts from the recorded `target_windows_crate`. Regeneration is a manual step performed by a Microsoft engineer with WinMD access |
| Bindings tied to a specific OS API version | Generator and public metadata versions are pinned in the Rust workspace; CI checks generated output for drift, and the backend checks host feature availability |
| OS API not present on older Windows builds | the IsolationSession feature is OS-side; runner reports a clean error when the activation factory fails. Feature-unavailable test exercises this on CI |
| New Cargo feature increases coupling | The `isolation_session` feature is off by default in the workspace; default builds and existing CI are unaffected |
| Manual VM testing required | The OS-side service has the same constraint for any consumer (it rejects network-logon tokens). Automated suite covers what it can without the OS-side service |
Expand All @@ -394,8 +367,6 @@ The following were observed during VM testing and are accepted for v0.1.
- Standard Rust toolchain.
- `cargo build --features isolation_session` to build the feature into
`wxc-exec`. Default builds skip it — no impact on existing workflows.
- A private WinMD only when **regenerating** bindings. As long as the OS
API hasn't changed, no regen is needed.

## End-User Experience

Expand Down
24 changes: 24 additions & 0 deletions docs/development/build-and-test/pull-requests.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,30 @@ these aggregate checks alongside the existing required checks:
Until that update, a failed independent suite can fail the workflow without
being independently merge-blocking.

### Windows bindings

MXC commits focused `windows-bindgen` output for the SDK runtime, SDK build
script, IsolationSession, and test proxy. The generator and bundled
`windows-default` metadata are pinned in `src/Cargo.toml` and `src/Cargo.lock`.
Generation works on Windows, Linux, and macOS; no local
Windows SDK or private metadata file is required.

From `src`, run:

```text
cargo test --locked -p mxc_windows_bindgen generate_bindings
```

Add native API selections to the matching `runtime.txt`, `build.txt`,
`isolation-session.txt`, or `test-proxy.txt` filter under
`src/tools/mxc_windows_bindgen`, then regenerate. Select only the members you call,
such as `Type::{Method, OtherMethod}` or `ENUM::Variant`.
Review and commit all changed generated files with their callers.

Repository consistency reruns generation and fails if any of the four outputs
differs. Updating `windows-core`, `windows-collections`, or `windows-future`
also requires checking generated-code compatibility with the pinned generator.

### Host-only validation

Windows builds first run host-only regression checks for loopback command
Expand Down
Loading
Loading