Refine typed Rust lifecycle API - #1255
Gudge (MGudgin) wants to merge 1 commit into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
65268d7 to
70b5186
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Sandbox identity validation returns the wrong established error category, and several new validation signatures lack compile-shape coverage.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Refines the typed Rust lifecycle API into operation-specific functions and request/result types under mxc_sdk::sandbox.
Changes:
- Adds typed lifecycle and validation entry points.
- Introduces opaque
SandboxIdand operation-specific results. - Updates tests and documentation for the new API.
| File | Description |
|---|---|
src/core/mxc-sdk/tests/state_aware.rs |
Tests the revised public API and ID validation. |
src/core/mxc-sdk/src/sandbox.rs |
Adds operation-centric SDK functions. |
src/core/mxc-sdk/src/lib.rs |
Exports the new module and types. |
src/core/mxc-sdk/README.md |
Documents the revised lifecycle API. |
src/core/mxc_engine/src/state_aware.rs |
Implements operation-specific execution and validation. |
src/core/mxc_engine/src/state_aware_sdk.rs |
Defines IDs, requests, options, and result types. |
src/core/mxc_engine/src/lib.rs |
Re-exports the revised engine surface. |
docs/state-aware-lifecycle/mxc-state-aware-sandbox-api.md |
Updates lifecycle architecture documentation. |
docs/state-aware-lifecycle/mxc-state-aware-sandbox-api-overview.md |
Updates the high-level API overview. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
70b5186 to
73609ab
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The documented unknown-prefix error contract conflicts with the tested Rust behavior, and telemetry-option presence lacks regression coverage.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 2
Open (2)
Resolved since last review (2)
73609ab to
2945ff7
Compare
2945ff7 to
8f023a5
Compare
8f023a5 to
593a9ff
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Several engine unit tests still call removed or changed request methods, preventing the test target from compiling.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Resolved since last review (1)
593a9ff to
ae0651f
Compare
This PR refines the direct typed Rust lifecycle surface around explicit sandbox operations while preserving the raw exact JSON compatibility lane. Details * Group typed provision, start, exec, stop, and deprovision calls under `mxc_sdk::sandbox` with matching validation functions. * Add an opaque `SandboxId` and pass identity separately from typed policy. * Move experimental authorization and telemetry preference into `OperationOptions`. * Return distinct `ProvisionResult`, `LifecycleResult`, and `ValidationResult` types. * Classify invalid sandbox identity syntax as `malformed_id`, while documenting Rust's dispatch-time handling of syntactically valid unknown prefixes. * Cover every public validation signature and preserve both true and false telemetry preferences through typed request normalization. * Adapt inherited typed-versus-exact provision tests to option-owned telemetry. * Link typed attached exec through `sandbox::exec_attached` while retaining the raw JSON `exec_attached` compatibility entry point. Tests * `cargo fmt --all -- --check` * `cargo check --workspace --all-targets --all-features` * `cargo test -p mxc_engine --all-features` (151 passed) * `cargo test -p mxc-sdk --test state_aware --all-features` (19 passed) * `cargo clippy --workspace --all-targets --all-features -- -D warnings` * `RUSTDOCFLAGS="-D warnings" cargo doc -p mxc-sdk --all-features --no-deps` * `git diff --check` Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 1d91874d-feea-4a33-b183-67d506ae61b5 Generated-with: gpt-5.6-sol
ae0651f to
357ceea
Compare



This PR refines the direct typed Rust lifecycle transport into an
operation-centric public API under
mxc_sdk::sandbox.Details
sandbox::{provision,start,exec,stop,deprovision}and matchingvalidate_*functions.SandboxIdand keep sandbox identity separate frompolicy and operation options.
are not representable through one broad request type.
structure.
Tests
cargo fmt --all -- --checkmxc_engineandmxc-sdktests passed.mxc-sdkRustdoc tests passed.--no-deps -D warnings.git diff --checkMicrosoft Reviewers: Open in CodeFlow