Share the telemetry-consent test harness between wxc_common and mxc_ffi
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:
- Add a
test-supportfeature towxc_common. - Gate
telemetry::consent::test_supporton#[cfg(any(test, feature = "test-support"))]and make itpubrather thanpub(crate). - Add
wxc_common = { workspace = true, features = ["test-support"] }tomxc_ffi's[dev-dependencies]. - Delete the duplicate harness from
mxc_ffiand 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.
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 · ◷
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.