mxc icon indicating copy to clipboard operation
mxc copied to clipboard

Share the telemetry-consent test harness between wxc_common and mxc_ffi

Open RamonArjona4 opened this issue 4 months ago • 2 comments

Description of the task

src/ffi/mxc_ffi/src/lib.rs carries its own copy of the telemetry-consent test harness — a CONSENT_ENV_LOCK mutex and a LocalAppDataGuard that redirects the consent store to a temp directory — duplicating the equivalent harness in src/core/wxc_common/src/telemetry/consent.rs.

This is structural rather than an oversight: wxc_common::telemetry::consent::test_support is #[cfg(test)] pub(crate), so it is not compiled into wxc_common when that crate is built as a dependency, and mxc_ffi therefore cannot reference it.

Sharing it requires exposing the harness behind a cargo feature:

  1. Add a test-support feature to wxc_common.
  2. Gate telemetry::consent::test_support on #[cfg(any(test, feature = "test-support"))] and make it pub rather than pub(crate).
  3. Add wxc_common = { workspace = true, features = ["test-support"] } to mxc_ffi's [dev-dependencies].
  4. Delete the duplicate harness from mxc_ffi and re-point its consent tests at the shared one.

The feature must stay off by default so the harness never reaches a shipping build.

Additional context

Raised as a Low finding during the adversarial review of the telemetry consent work, and noted again in docs/telemetry/telemetry-consent-design.md §12 under "Known gaps". Test-only scaffolding, no shipped behavior at risk — but it is duplicated logic across crates, which the consent work otherwise set out to eliminate.

RamonArjona4 avatar Jul 27 '26 22:07 RamonArjona4

Triage complete.

  • Labels applied: Area-Build-Rust
  • Assigned: @bbonaby (Rust build)

This is a Rust refactoring task to expose wxc_common's telemetry-consent test harness behind a test-support cargo feature so mxc_ffi can share it instead of duplicating it. Needs-Triage has been removed.

Generated by 🏷️ Issue Triage for #690 · 23.7 AIC · ⌖ 5.59 AIC · ⊞ 6.4K · ◷

github-actions[bot] avatar Jul 27 '26 22:07 github-actions[bot]

Addressed by the landed telemetry stack. PR #819 added the opt-in wxc_common/test-support feature, and PR #821 exposed the shared wxc_common::telemetry::test_support::TelemetryTestEnv, enabled it for mxc_ffi dev tests, and redirected the FFI consent tests to that shared harness. The remaining local FFI wrapper only owns the temporary directory; it no longer duplicates the consent lock or LocalAppDataGuard.

RamonArjona4 avatar Sep 22 '26 00:09 RamonArjona4