Skip to content

Add Node.js and .NET telemetry SDKs - #822

Open
RamonArjona4 wants to merge 1 commit into
user/ramonarjona4/telemetry-04-rust-sdk-ffifrom
user/ramonarjona4/telemetry-05-language-sdks
Open

Add Node.js and .NET telemetry SDKs#822
RamonArjona4 wants to merge 1 commit into
user/ramonarjona4/telemetry-04-rust-sdk-ffifrom
user/ramonarjona4/telemetry-05-language-sdks

Conversation

@RamonArjona4

@RamonArjona4 RamonArjona4 commented Aug 12, 2026

Copy link
Copy Markdown
Member

Summary

Adds the Node.js and .NET telemetry surfaces over the reviewed native contract: presenter-driven consent, policy-aware status, withdrawal, per-run options for one-shot and state-aware execution, generated wire types, parity checks, tests, and final SDK/product documentation.

This is PR 5 of 5 and depends on the Rust SDK/C ABI in PR 4.

Stack

Order Change PR
1 Normative privacy and telemetry documentation #818
2 Consent and policy foundation #819
3 Stable config and executor integration #820
4 Rust SDK and C ABI #821
5 Node.js and .NET SDKs #822

Review only this PR's diff; prerequisite behavior is in the PR above.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

Comment thread README.md Outdated
action is required to keep it disabled.

Omitting either (the default) turns telemetry off entirely. On non-Windows platforms all telemetry functions are no-ops.
Those settings are necessary but not sufficient: on Windows, explicit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those settings

which?

- **MXC owns its own consent state.** It must never read or infer from the Windows system telemetry consent. The consent store is a per-user JSON file; the policy is `HKLM\SOFTWARE\Policies\Mxc` → `AllowTelemetry` (`REG_DWORD`).
- **One definition, distributed to the bindings.** The Rust `ConsentState` / `PolicyState` enums are the source of truth; the FFI, C#, and TypeScript layers marshal the same strings. `scripts/check-telemetry-policy-parity.js` fails if the four `PolicyState` spellings drift apart and runs in the versioning checks workflow.
- **Test isolation.** The consent store and the policy key are process-global, each behind its own mutex. Use `wxc_common::telemetry::test_support::TelemetryTestEnv` whenever a test needs both; constructing `PolicyKeyGuard` and `LocalAppDataGuard` directly in the same test risks a lock-order deadlock. Both overrides are `cfg(debug_assertions)`-gated, so the smoke test refuses to run against a release binary. The `wxc_common` `test-support` feature re-exports the policy override for downstream crates' integration tests (`mxc_ffi` uses it) and must stay a dev-dependency-only feature.
- **Read-only queries must never be able to crash the host.** `NeedsConsentPrompt`/`needsTelemetryConsentPrompt` and `GetPolicy`/`getTelemetryPolicy` fail closed on *any* failure and never throw — including a non-`Success` FFI status, which covers a caught panic. The consent *read* and *write* still throw, because their callers must distinguish "not decided" from "could not read" and "did not persist"; when they do, they raise only the binding's documented exception type (`MxcException`), wrapping anything unexpected rather than letting a raw type escape.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Read-only queries must never be able to crash the host.

Copilot is just seething for a reason to crash us :P

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be overkill/paranoid? I'm concerned that the agent might drop in code where telemetry leads to an uncaught failure.

Comment thread sdk/dotnet/README.md Outdated
- When the policy is `Blocked`, `NeedsConsentPrompt()` returns `false`,
because asking for permission an administrator has already refused is a
meaningless question. Word any UI as "telemetry is unavailable on this
device" rather than blaming the user's own choice.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of copy-pasta from other places.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

Copilot AI balanced review requested due to automatic review settings August 13, 2026 04:57
@RamonArjona4
RamonArjona4 requested review from a team August 13, 2026 04:57
@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 Aug 13, 2026

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.

Pull request overview

Adds stable telemetry consent, policy, and per-run controls to the Node.js and .NET SDKs over the native telemetry contract.

Changes:

  • Adds presenter-driven consent and fail-closed policy APIs.
  • Propagates telemetry through one-shot and state-aware execution.
  • Adds tests, parity/codegen checks, and SDK documentation.

Reviewed changes

Copilot reviewed 33 out of 38 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/scripts/run_telemetry_consent_smoke_test.ps1 Normalizes the consent smoke test.
src/core/wxc_common/src/telemetry/policy.rs Normalizes telemetry policy source.
sdk/node/tests/unit/wire-conformance.test.ts Checks telemetry wire conformance.
sdk/node/tests/unit/telemetry.test.ts Tests Node consent APIs.
sdk/node/tests/unit/state-aware.test.ts Tests state-aware telemetry propagation.
sdk/node/tests/unit/sandbox.test.ts Tests one-shot telemetry options.
sdk/node/src/types.ts Promotes telemetry configuration.
sdk/node/src/telemetry.ts Implements Node consent APIs.
sdk/node/src/state-aware.ts Relays state-aware telemetry.
sdk/node/src/state-aware-types.ts Updates telemetry documentation.
sdk/node/src/state-aware-helper.ts Builds top-level telemetry envelopes.
sdk/node/src/sandbox.ts Adds per-invocation telemetry options.
sdk/node/src/index.ts Exports telemetry APIs.
sdk/node/src/helper.ts Applies one-shot telemetry overrides.
sdk/node/src/generated/wire.ts Updates generated stable wire types.
sdk/node/src/generated/telemetry-consent-wire.ts Adds generated consent wire types.
sdk/node/README.md Documents Node telemetry usage.
sdk/node/package.json Runs telemetry unit tests.
sdk/dotnet/README.md Documents .NET telemetry usage.
sdk/dotnet/Microsoft.Mxc.Sdk/TelemetryPolicyState.cs Defines policy states.
sdk/dotnet/Microsoft.Mxc.Sdk/TelemetryConsentState.cs Defines consent states.
sdk/dotnet/Microsoft.Mxc.Sdk/TelemetryConsent.cs Defines consent models.
sdk/dotnet/Microsoft.Mxc.Sdk/StateAwareTypes.cs Adds lifecycle telemetry options.
sdk/dotnet/Microsoft.Mxc.Sdk/SandboxPolicy.cs Adds one-shot telemetry opt-in.
sdk/dotnet/Microsoft.Mxc.Sdk/Native/NativeLibraryResolver.cs Improves native profile resolution.
sdk/dotnet/Microsoft.Mxc.Sdk/MxcTelemetry.cs Implements .NET consent APIs.
sdk/dotnet/Microsoft.Mxc.Sdk/MxcLifecycle.cs Propagates lifecycle telemetry.
sdk/dotnet/Microsoft.Mxc.Sdk/MxcException.cs Preserves underlying exceptions.
sdk/dotnet/Microsoft.Mxc.Sdk/Microsoft.Mxc.Sdk.csproj Builds profile-specific native libraries.
sdk/dotnet/Microsoft.Mxc.Sdk/ErrorCode.cs Adds consent-write failure code.
sdk/dotnet/Microsoft.Mxc.Sdk.Tests/MxcTelemetryTests.cs Tests .NET consent and policy behavior.
sdk/dotnet/Microsoft.Mxc.Sdk.Tests/MxcLifecycleTests.cs Tests lifecycle telemetry envelopes.
scripts/versioning/check-telemetry-consent-codegen.js Verifies generated consent artifacts.
scripts/check-telemetry-policy-parity.js Checks cross-language policy states.
README.md Documents stable telemetry behavior.
docs/telemetry/telemetry-policy.md Normalizes administrative policy docs.
.github/workflows/Versioning.Checks.Job.yml Adds telemetry parity checks.
.github/copilot-instructions.md Records telemetry architecture and commands.

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

Comment thread sdk/node/src/telemetry.ts Outdated
presenter: TelemetryConsentPresenter,
) => Promise<TelemetryConsentMaintenanceResponse>;

const CONSENT_REQUEST_TIMEOUT_MS = 30_000;
Comment thread sdk/dotnet/Microsoft.Mxc.Sdk/Microsoft.Mxc.Sdk.csproj
Comment thread sdk/node/src/types.ts

/**
* Telemetry configuration for experimental TraceLogging ETW support.
* Telemetry configuration for TraceLogging ETW support.
Comment thread sdk/node/README.md
`'allowed'` does not grant user consent, while `'blocked'` disables collection
and the consent prompt. An unreadable or missing `policy` field reads back as
`'blocked'`; non-Windows hosts return `'not-applicable'`. See
[`docs/telemetry/telemetry-administrative-policy.md`](https://github.com/microsoft/mxc/blob/main/docs/telemetry/telemetry-administrative-policy.md).
Comment thread sdk/dotnet/README.md
`Allowed` does not grant user consent, while `Blocked` disables collection and
the consent prompt. The policy query fails closed to `Blocked` if the native
library cannot be loaded; non-Windows hosts return `NotApplicable`. See
[`docs/telemetry/telemetry-administrative-policy.md`](../../docs/telemetry/telemetry-administrative-policy.md).

/// <summary>
/// The administrative (MDM / Group Policy) telemetry decision for this machine.
/// See docs/telemetry/telemetry-administrative-policy.md for the admin-facing reference.
Comment on lines +84 to +87
const csharpStates = new Set();
for (const m of parseBody[1].matchAll(/"([a-z-]+)"\s*=>/g)) {
csharpStates.add(m[1]);
}
Copilot AI review requested due to automatic review settings August 13, 2026 05:50

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.

Pull request overview

Copilot reviewed 33 out of 38 changed files in this pull request and generated no new comments.

Suppressed comments (6)

sdk/dotnet/README.md:133

  • The referenced telemetry-administrative-policy.md file does not exist; the policy guide added to the repository is docs/telemetry/telemetry-policy.md. Point this link at the actual document.
`Allowed` does not grant user consent, while `Blocked` disables collection and
the consent prompt. The policy query fails closed to `Blocked` if the native
library cannot be loaded; non-Windows hosts return `NotApplicable`. See
[`docs/telemetry/telemetry-administrative-policy.md`](../../docs/telemetry/telemetry-administrative-policy.md).

sdk/node/README.md:516

  • This link targets telemetry-administrative-policy.md, which does not exist; the administrative policy document in this PR is docs/telemetry/telemetry-policy.md. Update the URL so published package documentation does not lead to a 404.
`'allowed'` does not grant user consent, while `'blocked'` disables collection
and the consent prompt. An unreadable or missing `policy` field reads back as
`'blocked'`; non-Windows hosts return `'not-applicable'`. See
[`docs/telemetry/telemetry-administrative-policy.md`](https://github.com/microsoft/mxc/blob/main/docs/telemetry/telemetry-administrative-policy.md).

sdk/dotnet/Microsoft.Mxc.Sdk/TelemetryPolicyState.cs:8

  • This XML documentation references a nonexistent telemetry-administrative-policy.md; the repository's administrator-facing guide is docs/telemetry/telemetry-policy.md. Correct the path so generated API docs direct users to a real file.
/// <summary>
/// The administrative (MDM / Group Policy) telemetry decision for this machine.
/// See docs/telemetry/telemetry-administrative-policy.md for the admin-facing reference.

sdk/node/src/telemetry.ts:153

  • A presenter may legally throw undefined in JavaScript. In that case this assignment leaves presenterFailure equal to the “no failure” sentinel, so the close handler can resolve the dismissed native response instead of propagating the presenter failure. Track failure with a separate boolean or normalize every caught value to an Error.
    sdk/node/src/telemetry.ts:353
  • This convenience getter discards queryTelemetryConsent().error, so a missing/mismatched executable is indistinguishable from a genuine undecided user. Consent reads are required to surface failures through the binding's documented exception type; only prompt/policy queries should silently fail closed. Check the query result and throw an MxcError when error is present.
    sdk/dotnet/Microsoft.Mxc.Sdk/MxcTelemetry.cs:65
  • Returning Undetermined for native-load failures makes a broken or outdated native installation indistinguishable from a user who has not decided. Consent reads must raise the documented MxcException on infrastructure failures; reserve silent fail-closed behavior for NeedsConsentPrompt and GetPolicy. Wrap this failure as MxcException instead of returning a consent state.
        catch (Exception ex) when (IsNativeLoadFailure(ex))
        {
            ReportFailClosed("GetConsent", "Undetermined", ex);
            return TelemetryConsentState.Undetermined;
        }

yield return Path.Combine(baseDir, "runtimes", RuntimeInformation.RuntimeIdentifier, "native", file);

// Dev layout: walk up looking for the Cargo target dir.
// Dev layout: walk up looking for the Cargo target dir. Probe the

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High (security) — Do not let ancestor Cargo paths shadow the application's packaged native DLL.

This PR moves the walk-up src/target/<profile> probes ahead of baseDir and runtimes/<rid>/native. The resolver accepts the first existing DLL without validating repository ownership, signature, or version. An application under an ancestor where another user can plant src/target/release/mxc_ffi.dll can therefore load that binary before its own version-matched native asset.

Fix: Probe application-local and packaged runtime assets first. Restrict Cargo-layout probing to an explicit developer override or a verified repository root, preferably Debug-only.

/// </summary>
/// <exception cref="MxcException">The exec could not be started.</exception>
public static MxcSandboxProcess ExecInSandbox(SandboxId id, string command)
public static MxcSandboxProcess ExecInSandbox(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

High (backward compatibility) — Preserve the existing public method arities.

ExecInSandbox, ExecInSandboxAsync, StopSandbox, and DeprovisionSandbox replace existing signatures by appending optional parameters. Optional parameters preserve source compatibility only; already-compiled callers reference the old method signatures and will fail with MissingMethodException when the new 0.7.0 assembly is substituted.

Fix: Keep overloads with the original arities and forward them to new overloads accepting options, or ship this as a versioned breaking change.

}

/// <summary>Request consent through an asynchronous host presenter.</summary>
public static Task<TelemetryConsentOutcome> RequestConsentAsync(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium (performance/reliability) — RequestConsentAsync is sync-over-async.

The implementation uses Task.Run around the synchronous FFI call, while the unmanaged presenter trampoline blocks that worker with GetAwaiter().GetResult(). This occupies a thread for the full human interaction and can deadlock when a caller blocks on the returned task while the presenter captures that caller's synchronization context.

Fix: Use a resumable native presenter protocol instead of blocking inside the unmanaged callback. At minimum accept cancellation and document that presenters must not require a captured context.

Comment thread sdk/node/src/telemetry.ts
}

/** Read persisted/effective consent and policy. */
export function queryTelemetryConsent(): TelemetryConsentQuery {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium (performance) — Avoid repeated synchronous child processes for one status snapshot.

queryTelemetryConsent() uses execFileSync, and each convenience getter calls it independently. A settings surface reading consent, policy, and prompt-needed state launches three native processes and can block the Node event loop for up to three five-second timeouts.

Fix: Make the combined query the primary API and reuse one result, or cache a snapshot briefly and invalidate it after request/withdraw.

ParsePolicyState(root.GetProperty("policy").GetString()));
}

private static TelemetryConsentActionResult ParseConsentActionResult(string? value) => value switch

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium (compatibility/maintainability) — Extend parity checks to all consent wire mappings and fail closed on unknown values.

The new parity gate verifies policy strings only. Consent action results and status reasons remain hand-maintained switches with no Rust/C# gate, and unknown values throw JsonException rather than degrading safely like consent state and policy do. A version skew after a successful native write can therefore be reported as a write failure.

Fix: Generate or parity-check ConsentState, ConsentActionResult, and ConsentStatusReason as well; map unknown result/reason values to safe diagnostic outcomes instead of throwing.


it('binds a synchronous presenter decision to the canonical prompt', async () => {
let observedLocale: string | undefined;
_setTelemetryConsentProtocolRunner(async (locale, presenter) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium (test coverage) — Exercise the real Node consent subprocess protocol.

These tests replace defaultConsentProtocolRunner, so they bypass child launch, line framing, fragmented stdout, challenge echo, stdin errors, timeout rearming, presenter/child close ordering, and teardown. The recent timeout fix is therefore not protected by this suite.

Fix: Run the real protocol driver against a controlled fake executor covering fragmented output, slow presenters, malformed responses, early child exit, timeout phases, and cleanup.

/**
* Consent operation to perform.
*/
action: unknown;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium (generated contract) — Preserve the discriminator types in the generated request.

The generator emits action and command as unknown even though it emits the literal TelemetryConsentAction and TelemetryConsentCommand aliases directly above. This weakens the drift oracle for the two fields that distinguish maintenance input from execution config; the codegen gate passes because it faithfully reproduces the same weak output.

Fix: Correct the schema/emitter so these properties reference the generated literal types and add a conformance assertion for them.

* (`wxc_common::ts_emit`). This is a drift oracle, not public API: it is never
* exported from the SDK. The conformance test asserts the hand-written public
* types in `../types.ts` still match these. CI gate:
* `scripts/versioning/check-sdk-types-codegen.js`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low (documentation) — This generated header names the wrong gate and regeneration command.

The actual artifact is checked by check-telemetry-consent-codegen.js and generated with --telemetry-consent-ts; the header instead points to the generic SDK-types gate and regenerates wire.ts.

Fix: Parameterize the generated banner per artifact so contributors can reproduce this file correctly.

impl PolicyKeyGuard {
/// Creates the guard with no policy value set (the unmanaged default).
#[cfg(target_os = "windows")]
// Copyright (c) Microsoft Corporation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low (review integrity) — Remove the line-ending-only rewrites.

policy.rs, docs/telemetry/telemetry-policy.md, and run_telemetry_consent_smoke_test.ps1 contribute 890 added and 890 deleted lines but are content-identical when end-of-line differences are ignored. This obscures the functional diff and rewrites blame for privacy-sensitive code without changing behavior.

Fix: Restore the base line endings for these files and add an appropriate .gitattributes normalization rule to prevent recurrence.

Copilot AI review requested due to automatic review settings August 18, 2026 18:50
@RamonArjona4
RamonArjona4 force-pushed the user/ramonarjona4/telemetry-05-language-sdks branch from c8415af to 2f8f372 Compare August 18, 2026 18:50

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.

Pull request overview

Copilot reviewed 54 out of 58 changed files in this pull request and generated 1 comment.

Suppressed comments (6)

src/core/wxc_common/src/telemetry/events.rs:119

  • This always derives the error event's sandbox_kind from ctx.backend, so callers that resolved a broad SDK request such as process or vm emit paired records with different attribution: MXC.Execution keeps the requested kind, while MXC.Error reports the concrete backend. Pass the request-scoped sandbox kind through the error path as well so both events remain joinable and semantically consistent.
    sdk/dotnet/Microsoft.Mxc.Sdk/SandboxPolicy.cs:41
  • The FFI contract identifies nested telemetry.enabled as canonical and telemetryEnabled only as a legacy compatibility alias (src/ffi/mxc_ffi/src/lib.rs:31-35). Serializing the newly shipped .NET surface through that alias makes new clients depend on the compatibility path; retain the convenience property but project it onto the canonical nested section.
    [JsonPropertyName("telemetryEnabled")]
    public bool? TelemetryEnabled { get; set; }

sdk/node/src/telemetry.ts:376

  • This catch handles every transport/parser failure, including a missing executable, timeout, and malformed child output, but labels all of them as store-unreadable. That reason specifically describes consent-store state and is false for these failures; omit it here and let the diagnostic error distinguish transport failures.
    src/mxc_telemetry/src/lib.rs:358
  • This source-text assertion is self-fulfilling: provider_source includes this test, so the searched str8("mxc.sandbox_kind", sandbox_kind) literal still appears later in the file even if the production MXC.Error field is removed. Bound the extracted event body before the test module or assert captured/decoded event fields instead.
    .github/copilot-instructions.md:228
  • This changes the reference to docs/telemetry/telemetry-policy.md, but that file does not exist; the checked-in policy document is docs/telemetry/telemetry-administrative-policy.md. Keep the existing filename unless this PR also renames the document and updates all remaining SDK links.
- `docs/telemetry/telemetry.md` — telemetry overview; `docs/telemetry/telemetry-consent-design.md` (Windows-only consent design and per-SDK surface) and `docs/telemetry/telemetry-policy.md` (the MDM / Group Policy ceiling)

.github/copilot-instructions.md:333

  • The referenced docs/telemetry/telemetry-policy.md is absent; the repository currently contains telemetry-administrative-policy.md, which the Node.js and .NET README links also use. Point this convention at the existing document or include a coordinated rename.
- **Telemetry consent or policy changes** → update `docs/telemetry/telemetry-consent-design.md` and/or `docs/telemetry/telemetry-policy.md`, and keep `scripts/check-telemetry-policy-parity.js` green across all three bindings

Comment thread sdk/node/src/telemetry.ts
Comment on lines +189 to +195
childStdout.on('data', (chunk: string) => {
if (!presenterActive) {
armIoTimeout();
}
stdout += chunk;
const lines = stdout.split(/\r?\n/);
stdout = lines.pop() ?? '';
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2da373b9-0a51-4aa4-a968-14f05f27b5c7
Copilot AI review requested due to automatic review settings August 18, 2026 19:04
@RamonArjona4
RamonArjona4 force-pushed the user/ramonarjona4/telemetry-05-language-sdks branch from 2f8f372 to d537442 Compare August 18, 2026 19:05

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.

Pull request overview

Copilot reviewed 54 out of 58 changed files in this pull request and generated 1 comment.

Suppressed comments (6)

.github/copilot-instructions.md:333

  • The referenced docs/telemetry/telemetry-policy.md file is absent; the maintained document is telemetry-administrative-policy.md. This checklist would direct future telemetry changes away from the actual policy documentation.
- **Telemetry consent or policy changes** → update `docs/telemetry/telemetry-consent-design.md` and/or `docs/telemetry/telemetry-policy.md`, and keep `scripts/check-telemetry-policy-parity.js` green across all three bindings

sdk/node/src/telemetry.ts:193

  • Every stdout chunk re-arms the timeout before a complete protocol line exists, while the partial line is appended to an unbounded string. A stuck or incompatible child can therefore emit an endless no-newline stream, preventing the timeout forever and growing memory without limit. Bound the frame buffer and treat only complete protocol frames as progress, or enforce an absolute child deadline.
    src/core/wxc_common/src/telemetry/events.rs:119
  • log_error derives this field only from ctx.backend, discarding the request-scoped sandbox kind already computed by emit_state_aware_event (and the one-shot helpers). For requests such as kind process/vm routed to windows_sandbox, the paired MXC.Execution and MXC.Error events therefore report different mxc.sandbox_kind values. Pass the computed sandbox kind through to log_error so both events retain caller attribution.
    sdk/dotnet/Microsoft.Mxc.Sdk/SandboxPolicy.cs:41
  • This serializes the new SDK property through the FFI's legacy compatibility alias telemetryEnabled, even though the native contract and all other surfaces define canonical telemetry as telemetry.enabled (mxc_ffi/src/lib.rs:31-35). Keep TelemetryEnabled as a convenience projection, but serialize the canonical nested section; otherwise the newly introduced public SDK starts on a deprecated wire shape and cannot expose future telemetry fields without another API break.
    [JsonPropertyName("telemetryEnabled")]
    public bool? TelemetryEnabled { get; set; }

sdk/node/src/telemetry.ts:304

  • The parser validates shared fields but never validates the required action discriminator (or that the result is valid for that action). Consequently a status query can accept a well-formed response for request/withdraw and report its effective state—including granted—instead of failing closed on a mismatched native protocol. Pass the expected action into this parser and reject mismatched actions/results.
    .github/copilot-instructions.md:228
  • This path does not exist in the repository; the policy document is docs/telemetry/telemetry-administrative-policy.md. As written, the repository guidance sends contributors to a missing file.

This issue also appears on line 333 of the same file.

- `docs/telemetry/telemetry.md` — telemetry overview; `docs/telemetry/telemetry-consent-design.md` (Windows-only consent design and per-SDK surface) and `docs/telemetry/telemetry-policy.md` (the MDM / Group Policy ceiling)

Comment on lines +18 to +19
<ProjectReference Include="..\Microsoft.Mxc.Sdk\Microsoft.Mxc.Sdk.csproj"
AdditionalProperties="MxcCargoFeatures=dotnetsdk,test-support" />
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.

4 participants