Skip to content

fix(tooling): release builds without the tooling feature skip process dev flags and ambient OTEL timing - #1775

Merged
Hona merged 1 commit into
devfrom
fix/589-release-dev-tooling-gate
Nov 24, 2026
Merged

Hona merged 1 commit into
devfrom
fix/589-release-dev-tooling-gate

Conversation

@Hona

@Hona Hona commented Nov 24, 2026

Copy link
Copy Markdown
Member

Fixes #589

Problem

  • In release builds without Rune's tooling feature, Args::parse() and Args::parse_process() (crates/rune/src/tooling/args.rs) still parsed std::env::args() for Rune's developer flags. A shipped app would print Rune's --help and exit 0, exit 2 on a malformed flag value like --size large, fail on --snap, or panic on non-UTF-8 arguments.
  • tooling::interaction::gate::decide (crates/rune/src/tooling/interaction/gate.rs) enabled interaction timing, watchdog stack sampling, and OTLP span export in any build when an ambient OTEL_EXPORTER_OTLP_ENDPOINT pointed at loopback.

Ecosystem convention

Source Release-build rule
Tauri (crates/tauri/Cargo.toml:216, crates/tauri-runtime-wry/src/lib.rs:1472) #[cfg(any(debug_assertions, feature = "devtools"))]; never intercepts std::env::args().
GPUI (crates/gpui/Cargo.toml:36, crates/gpui/src/element.rs:34) #[cfg(any(feature = "inspector", debug_assertions))]; never intercepts std::env::args().
Iced (Cargo.toml:47-53, src/application.rs:190-215) Opt-in debug and tester Cargo features (off by default); never intercepts std::env::args().
Bevy (Cargo.toml:158-165,468-477) Opt-in dev and trace_* Cargo features (off by default); never intercepts std::env::args().
Dioxus Desktop (packages/desktop/src/webview.rs:25,564-570, launch.rs:103) Devtools and hot-reload gated on debug_assertions / devtools feature.
Slint (internal/core/graphics/rendering_metrics_collector.rs:65-78) Never intercepts std::env::args(); only its own SLINT_DEBUG_PERFORMANCE env var opts into release perf metrics.
Electron (docs/tutorial/fuses.md:5-75) & Flutter (docs.flutter.dev/testing/build-modes) Build/package-time gates disable debug CLI flags, ambient env vars, and DevTools in shipped builds.
OpenTelemetry (specification/protocol/exporter.md:24-35, opentelemetry-otlp/src/lib.rs:228) OTEL_EXPORTER_OTLP_ENDPOINT configures an exporter the app enabled; it never auto-enables tracing in a shipped app.

Changes

flowchart LR
  P[Process argv & env] --> G{debug_assertions OR feature tooling/hot?}
  G -- yes --> Parse[Parse Rune dev flags + allow loopback OTEL endpoint]
  G -- no --> Ship[All process args -> extra_args; ignore OTEL unless RUNE_PERF=1]
  E[App::args / run_windows_with_args] --> Explicit[Args::parse_from still parses explicit list]
Loading
  • crates/rune/src/tooling/args.rs: Added dev_tooling_enabled() (cfg!(any(feature = "tooling", feature = "hot", debug_assertions))) and Args::parse_process_argv. When off, Args::parse() and Args::parse_process() skip Rune flag parsing, leave every process argument in extra_args(), and return false from is_headless(). Process arguments are decoded via std::env::args_os() lossily so non-UTF-8 arguments do not panic. Explicit Args::parse_from (App::args, run_windows_with_args) still parses the list the app passed.
  • crates/rune/src/tooling/interaction/gate.rs: Gated ambient loopback OTEL_EXPORTER_OTLP_ENDPOINT auto-enable on dev_tooling_enabled(). Explicit RUNE_PERF=1 still turns interaction timing on in any build, and RUNE_PERF=0 still wins.
  • crates/rune/Cargo.toml, crates/rune/README.md, scripts/native-pacing/README.md, crates/rune/examples/pacing.rs: Documented the release-build rule and added --features tooling to the --profile perf pacing example commands. All other repo scripts and examples that pass Rune flags in release/perf builds already enable tooling (directly, via keys-overlay, or via frame-profile).
  • crates/rune/src/tooling/args_tests.rs, crates/rune/src/tooling/interaction/tests.rs: Added unit tests covering process argument pass-through without tooling (including --help and malformed values), lossy non-UTF-8 decoding, and ignoring ambient OTEL_EXPORTER_OTLP_ENDPOINT without tooling.
  • changelog/unreleased/2026-11-24-release-dev-tooling-gate.md: Added changelog fragment.

Verification

  • Verified new tests fail before the fix and pass after (tooling::args_tests, tooling::interaction, tooling::window_tests, and --test extra_args on Windows).
  • Verified cargo check -p rune --no-default-features --target wasm32-unknown-unknown, cargo check -p rune -p rune-kit --tests on macOS arm64 and Linux aarch64, cargo check -p rune --release on macOS arm64, and scripts/file-size.sh.
  • Not checked: iOS target compile and native display pacing capture.

@Hona
Hona merged commit 652950b into dev Nov 24, 2026
1 check passed
@Hona
Hona deleted the fix/589-release-dev-tooling-gate branch November 24, 2026 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Release builds: a shipped app parses Rune's dev flags and starts interaction timing from an ambient OTEL variable; a fix is on a fork

1 participant