Repository navigation
Make Node V1 APIs idiomatic - #1398
Conversation
Use Promise-returning plain-verb names for asynchronous execution, process waiting, and telemetry consent APIs, and update tests and documentation. Co-authored-by: Copilot <[email protected]>
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
| get warnings(): readonly string[]; | ||
| get outputMetadata(): ExecutionMetadata | undefined; | ||
| waitAsync(): Promise<WaitResult>; | ||
| wait(): Promise<WaitResult>; |
There was a problem hiding this comment.
which part? you mean having to await the function? or it not having Async at the end of the name? Looking at https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function as a reference I don't see them adding async to the names
There was a problem hiding this comment.
sry, i meant the first part - awaiting a fucntion specically called wait().
i thought it should be awaiting a function called join or something
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
Refactors the Node V1 SDK surface to be more idiomatic by making previously “sync vs async” split APIs consistently Promise-based, renaming *Async APIs to plain verbs, and updating the surrounding tests/docs accordingly.
Changes:
- Removed duplicate “blocking” and
*Asyncvariants; primary operations likerun,spawn,runInContainer,spawnInContainernow return Promises. - Renamed
MxcProcess.waitAsync()towait(), and updated usage across unit/integration tests. - Renamed telemetry consent APIs to non-
*Asyncnames and updated docs/references.
| File | Description |
|---|---|
| sdk/node/tests/unit/telemetry.test.ts | Updates tests to use renamed telemetry consent APIs. |
| sdk/node/tests/unit/state-aware.test.ts | Migrates lifecycle tests to Promise-based runInContainer/spawnInContainer and wait(). |
| sdk/node/tests/unit/state-aware-types.test.ts | Updates type-level tests for Promise-based runInContainer. |
| sdk/node/tests/unit/sandbox-process.test.ts | Renames waitAsync() usage to wait() in process tests. |
| sdk/node/tests/unit/inprocess-run.test.ts | Updates one-shot run/spawn tests to Promise-only APIs and validates removed exports. |
| sdk/node/tests/integration/wslc-state-aware.test.ts | Updates WSLC lifecycle E2E tests to Promise-based APIs and wait(). |
| sdk/node/tests/integration/wslc-e2e.test.ts | Updates WSLC one-shot E2E tests to run()/spawn() Promise APIs. |
| sdk/node/tests/integration/windows-process-container.test.ts | Removes runAsync/spawnAsync coverage and updates wait() calls. |
| sdk/node/tests/integration/test-helpers.ts | Switches helper to call run() instead of runAsync(). |
| sdk/node/tests/integration/native-streaming.test.ts | Renames internal streaming interface method to wait(). |
| sdk/node/tests/integration/macos-seatbelt.test.ts | Updates to awaited spawn() and wait(). |
| sdk/node/tests/integration/linux-bubblewrap.test.ts | Updates commentary to refer to run routing. |
| sdk/node/tests/integration/isolation-session-state-aware.test.ts | Migrates tests to async runInContainer/spawnInContainer and wait(). |
| sdk/node/tests/integration/common.test.ts | Collapses dry-run rejection tests to Promise-based operations. |
| sdk/node/src/v1/telemetry.ts | Renames exported telemetry consent functions to non-*Async names. |
| sdk/node/src/v1/operation-options.ts | Updates option doc comments to reflect removed *Async APIs. |
| sdk/node/src/v1/lifecycle.ts | Makes state-aware spawnInContainer*/runInContainer* Promise-only; removes sync path. |
| sdk/node/src/v1/index.ts | Updates V1 exports to remove *Async and export renamed telemetry APIs. |
| sdk/node/src/v1/container.ts | Makes run/spawn Promise-only and removes sync implementations. |
| sdk/node/src/v1/container-process.ts | Renames waitAsync() to wait() and updates related messaging. |
| sdk/node/src/index.ts | Updates top-level example to use run() Promise API. |
| sdk/node/README.md | Updates README examples and API descriptions for Promise-only APIs and wait(). |
| sdk/node/CHANGELOG.md | Updates changelog bullets to reflect new Promise-only API surface. |
| docs/wsl/wsl-container-getting-started.md | Updates docs example to use awaited spawn() and wait(). |
| docs/state-aware-lifecycle/mxc-state-aware-sandbox-api.md | Updates API tables/examples to Promise-only Node APIs. |
| docs/state-aware-lifecycle/mxc-state-aware-sandbox-api-overview.md | Updates capability matrix for Node Promise-only APIs. |
| docs/reference/node/v1/types.md | Updates reference types for wait() and updated comments. |
| docs/reference/node/v1/api.md | Updates API reference entries to Promise-only and renamed telemetry functions. |
| docs/lxc-support/lxc-backend.md | Updates wait call naming in LXC docs example. |
| docs/isolation-session/state-aware-typescript.md | Updates lifecycle TypeScript docs for Promise-only APIs. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const child = spawn(request); | ||
| child.standardOutput?.on('data', (data) => process.stdout.write(data)); | ||
| try { | ||
| const outcome = await child.waitAsync(); | ||
| const outcome = await child.wait(); | ||
| console.log('Exit:', outcome.exitCode); | ||
| } finally { | ||
| child.dispose(); |
| const result = runInContainer(isolation, { command: 'echo' }); | ||
| const exitCode: number = result.exitCode; | ||
| const exitCode: number = (await result).exitCode; | ||
| runInContainer(wslc, { command: 'echo', network: {} }); |
Bring the prototype onto the MXC 1.0 SDKs: the consolidated mxc-sdk crate (microsoft#1390), the v1 ContainerRequest surfaces in Rust, Node and .NET, exact JSON FFI ingress, and Promise-based Node v1 APIs (microsoft#1398). Shared files take upstream as-is. The previous SDK wiring (mxc-sdk re-exports, mxc_ffi exports, Node and .NET wrappers, and their tests) targeted the retired SandboxPolicy surfaces and is removed here; the following commits port the store into mxc-sdk's internal policy_store module and rebuild the bindings on the v1 requirements API from spec f7a450c. The catalog crate under src/core/mxc_policy_store is left outside the workspace until that port. Co-authored-by: Copilot <[email protected]>

📖 Description
*Asyncexecution APIs; renameMxcProcess.waitAsync()towait().🔗 References
None.
🔍 Validation
npm run typecheck— passed, including the packed integration build.npm test— one unrelated environment-specific probe test failed because the local native library does not exportmxc_probe_request_json_with_error.✅ Checklist
Cargo.lock, thedependency-feed-checkcheck passes (see docs/pull-requests.md)📋 Issue Type
GitHub Actions runs the PR validation build automatically. The ADO pipeline
(
MXC-PR-Build) is the Azure version of the PR pipeline, kept in parity with the GitHubActions build; it runs on merge to
main, and Microsoft reviewers with write access can trigger iton a PR with
/azp run. See docs/pull-requests.md.If the
dependency-feed-checkcheck fails on a new dependency, the crate must be added tothe feed before the PR can pass. See docs/pull-requests.md
for the steps.
Microsoft Reviewers: Open in CodeFlow