feat(build): add defaults-without-telemetry feature alias - #2843
Conversation
Cargo cannot subtract a single default feature, so compiling telemetry out meant `--no-default-features` plus a hand-maintained keep-list of the crate's other defaults. That keep-list was already wrong for operators: telemetry is the only default on openshell-server and openshell-driver-vm, but openshell-sandbox also defaults to `bundled-ca-roots`, so a bare `--no-default-features` silently swapped the supervisor onto the platform trust store. Add a `defaults-without-telemetry` alias to each of the three telemetry- carrying binary crates, enumerating every default except `telemetry`. Telemetry-free builds become `--no-default-features --features defaults-without-telemetry` and stay correct as the default set grows. The alias is a keep-list, not a switch. Enabling it on top of the defaults would otherwise produce a telemetry-on binary that reads as telemetry-free, so each crate root carries a `compile_error!` for the `telemetry` + `defaults-without-telemetry` combination. Add `rust:verify:defaults-without-telemetry` to guard both properties: each alias still equals its crate's defaults minus `telemetry`, and the mutual-exclusion error is wired up. The additive-misuse check matches on the `compile_error!` text rather than a nonzero exit code so it cannot pass vacuously on hosts where openshell-driver-vm fails to build for unrelated reasons. `rust:verify:telemetry-off` now builds through the alias. Signed-off-by: Russell Bryant <rbryant@redhat.com>
|
The changes look fine. @drew @johntmyers wdyt? |
|
Label |
|
/ok to test 9d9688a |
|
Label |
PR Review StatusThanks @mrunalp. You said the changes look fine and asked for another look; I checked the complete current-head patch, including the Cargo feature aliases, mutual-exclusion guards, verification script, CI wiring, and documentation. The independent review found no blocking or non-blocking findings. Blocking findings:
Carried findings:
The Gator metadata
|
though I don't see any checks on github in a failing state? Is there something not visible to me? Or does it just need to be re-queued? Let me know if there's something I need to fix! |
Summary
Adds a
defaults-without-telemetryCargo feature alias to the three binary crates that carry telemetry, so compiling telemetry out no longer means hand-maintaining a keep-list of each crate's other default features. Telemetry-free builds become--no-default-features --features defaults-without-telemetry.Related Issue
No accepted issue yet — raising this for maintainer disposition. It came out of a contributor question about whether
--no-default-featuresis a safe stand-in for "disable telemetry." It is not, and that is already a live correctness bug (see Changes), so this is filed as a PR rather than a spike. Happy to open a feature request issue first if the convention should apply here.Changes
Cargo cannot subtract a single default feature, so the documented way to compile telemetry out is
--no-default-featuresplus every other default re-added by hand. That keep-list is already wrong for operators:default--no-default-featuresalso dropsopenshell-server["telemetry"]openshell-driver-vm["telemetry"]openshell-sandbox["telemetry", "bundled-ca-roots"]bundled-ca-rootsFollowing the README today therefore silently swaps the supervisor from bundled Mozilla roots onto the platform trust store. The alias fixes that and stays correct as the default set grows.
defaults-without-telemetrytoopenshell-server,openshell-sandbox, andopenshell-driver-vm, each enumerating its defaults minustelemetry.compile_error!in each crate root fortelemetry+defaults-without-telemetry. The alias is a keep-list, not a switch — without the guard,--features defaults-without-telemetryon its own (no--no-default-features) would compile a telemetry-on binary that reads as telemetry-free.rust:verify:defaults-without-telemetry(tasks/scripts/verify-defaults-without-telemetry.sh), which asserts viacargo metadatathat each alias still equals its crate's defaults minustelemetry, and that the mutual-exclusion error is wired up. The second check matches on thecompile_error!text rather than a nonzero exit code, so it cannot pass vacuously on hosts whereopenshell-driver-vmfails to build for unrelated reasons.rust:verify:telemetry-offat the alias, so CI builds the artifacts the same way the docs tell operators to.branch-checks.yml.README.mdand the Build Features section ofarchitecture/build.md.openshell-corealso defaults totelemetry, but is left alone: every consumer already depends on it withdefault-features = false, so an alias there would be a no-op.Testing
mise run pre-commitmise run testmise run rust:verify:telemetry-offmise run rust:verify:defaults-without-telemetrymise run rust:verify:system-ca-rootsNegative-controlled the drift check by temporarily setting the sandbox alias to
[]; it failed with the expected diff and exit 1, then passed again on restore.Not run:
mise run e2e. This changes build-time feature wiring, not sandbox runtime behavior, and the telemetry-off guard already inspects the resulting binaries.mise run pre-commitpassesrust:verify:*guards rather than#[test]s; feature-set drift andcompile_error!wiring are not observable from inside a compiled test binaryChecklist