Repository navigation
Description
A native app that passes no list to App::args parses its command line with Rune's dev parser in every build. App::try_run calls Args::parse(). extra_args, is_headless, run_windows and the hot path read the process's arguments the same way. So a release binary:
- obeys
--snap,--script,--traceand--help; - exits with code 2 on a malformed value, such as
--size large, or a file named like a flag that a launcher or shell passes.
Separately, tooling::interaction::gate turns interaction timing on in any build when OTEL_EXPORTER_OTLP_ENDPOINT names a loopback address. A collector set up for another tool on the user's machine then starts stack sampling and span export in a shipped app that never asked for it.
Fix
096405f0 is one commit on dev 14e3c5d, on branch safety-release-dev-surface of Entrpi/rune.
- One decision.
tooling::dev_surfacedecides whether Rune's dev surface is on. A debug build always has it. A build without debug assertions has it only when one of these is true:- the app calls the new
rune::dev_tooling()first inmain, so it holds forrun,run_windows,extra_argsandis_headlessalike; RUNE_DEV=1is set. This is Rune's own variable, and nothing sets it by accident.
- the app calls the new
- Without it, Rune parses no process argument: every argument goes to
extra_argsuntouched, so nothing Rune reads can exit the process. With it, the parser is unchanged, including--helpand exit code 2. - An app's own list passed with
App::argsorrun_windows_with_argsis Rune's in any build, because the app chose it. - Interaction timing. The gate reads its environment through a pure
gate::wanted_in(var, debug, opted_in, headless). Without the dev surface it ignores the OTEL endpoint.RUNE_PERF=1still turns timing on in any build, andRUNE_PERF=0still wins. - Non-UTF-8 arguments. The process's arguments are read with
args_os, so one that isn't valid UTF-8 reaches the app with replacement characters instead of panicking. - The repo's own tooling drives optimised builds with Rune's flags, so it now sets
RUNE_DEV=1. That covers:perf_binary, and through it the bench and native-pacing scripts;- kit-diff, motion-audit, snap-ui, text-goldens and real-frames;
- the cursed-settings capture scripts;
- the release and perf commands in the READMEs, and the site snippet cut from one.
- Examples that guessed headless mode by scanning the arguments themselves now ask
rune::is_headless(): live-values, overlay, video-tiles and launcher. - README. The rune README says how to drive an optimised build, and it has one table of every
RUNE_*variable read outside tests, with its effect and the builds that read it. A changelog fragment is added.
RUNE_DEV=1 is the one deviation from "the app opts in": without it, the repo's benchmark and snapshot scripts could not drive a --profile perf build of an app that doesn't call dev_tooling().
Tests
tooling/dev_surface_tests.rscovers:- the decision for each build kind, environment and opt-in;
gate::wanted_inover a fake environment;- the argument split with and without the dev surface.
tests/dev_surface_release.rsis ignored by default, because it buildsexamples/dev_surface.rsin release. It checks that:- the release binary keeps
--snap, a malformed flag and--helpfor the app, and exits 0; RUNE_DEV=1makes--snaprender, and so doesrune::dev_tooling()with bothApp::runandrun_windows;- opted in, a malformed flag exits with code 2, as in a debug build.
- the release binary keeps
On macOS (Apple silicon), the documented test command, cargo test -p rune -p rune-kit --features rune-kit/markdown --no-fail-fast, passes with this branch and the other three safety branches merged on dev 14e3c5d: 2,786 passed, 0 failed. Dev alone gives 2,749 passed, 0 failed. The four branches are safety-secure-fields, safety-hostile-content, safety-gpu-failures and safety-release-dev-surface; they merge cleanly except for one import line in image.rs. cargo check --workspace --all-targets and scripts/file-size.sh pass. The ignored tests/dev_surface_release.rs passes too.
Filed together with #586, #587 and #588, the other safety fixes from the same review.
Activity
Hona commentedon Nov 24, 2026
Fixed on
devin #1775 (652950bb1).Popular Rust UI frameworks gate developer tooling behind a compile-time switch (
debug_assertionsor an off-by-default Cargo feature) rather than parsing host CLI flags or ambient environment variables in shipped release builds: Tauri (crates/tauri-runtime-wry/src/lib.rs,any(debug_assertions, feature = "devtools")), GPUI (crates/gpui/src/element.rs,any(feature = "inspector", debug_assertions)), Iced (debug/testerfeatures), Bevy (dev/trace_*features), and Electron's build-time fuses all follow this pattern, and OpenTelemetry'sOTEL_EXPORTER_OTLP_ENDPOINTconfigures an enabled exporter rather than auto-starting tracing in a shipped app.Release builds without Rune's
tooling(orhot) feature now skip process flag parsing incrates/rune/src/tooling/args.rs(passing every argument untouched toextra_args(), decoding OS arguments lossily so non-UTF-8 arguments do not panic, and returningfalsefromis_headless()) and ignore an ambientOTEL_EXPORTER_OTLP_ENDPOINTincrates/rune/src/tooling/interaction/gate.rsunlessRUNE_PERF=1is set. Debug builds, release builds withtooling, and explicitApp::args/run_windows_with_argslists keep parsing Rune's flags.