Skip to content

fix(cli): flush tracing guards on all remaining application-level exit sites - #6714

Merged
bug-ops merged 1 commit into
mainfrom
fix/6709-guard-flush-bypass-sites
Jul 28, 2026
Merged

fix(cli): flush tracing guards on all remaining application-level exit sites#6714
bug-ops merged 1 commit into
mainfrom
fix/6709-guard-flush-bypass-sites

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Summary

Follow-up to #6698/#6708 — closes the last application-level std::process::exit sites that bypassed TracingGuards::drop's flush-on-drop logic. The issue named two sites (src/bootstrap/config.rs:27, seven in src/commands/bench.rs), but review turned up 16 more instances of the same pattern reachable from run() after init_tracing.

Rather than threading a bespoke exit-signal type through each site, this unifies on plain anyhow::Result + ? propagation everywhere: load_config_or_default now returns Result<Config, ConfigLoadError> instead of exiting internally, and all 18 callers (including bench.rs's 7 sites) use ?/anyhow::bail! so an ordinary Err return unwinds and flushes tracing_guards via normal drop. No new machinery, less code than the original approach.

Verified: zero application-level std::process::exit calls remain in src/ outside tracing_init.rs's own sanctioned flush primitives.

Closes #6709

Test plan

  • cargo +nightly fmt --check
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings
  • cargo clippy --profile ci --workspace --all-targets --features bench -- -D warnings (separate bench matrix entry)
  • cargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins — 15312/15312 passed
  • RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"
  • cargo test --doc --workspace --features "desktop,ide,server,chat,pdf,scheduler"
  • 8 new tests covering the previously-untestable error branches (config parse failure, handle_url_open error path, 6 in bench.rs)
  • gitleaks protect --staged --no-banner --redact

@github-actions github-actions Bot added documentation Improvements or additions to documentation bug Something isn't working size/L Large PR (201-500 lines) labels Jul 28, 2026
…t sites

std::process::exit skipped TracingGuards::drop's flush-on-drop logic at
every std::process::exit call site reachable from run() after
init_tracing, the same bug class as #6696/#6697/#6698/#6708. Rather than
threading exit-signal types through each site, unify on plain anyhow
Result propagation: load_config_or_default now returns
Result<Config, ConfigLoadError> instead of exiting internally, and every
caller (18 total, including the 7 exit sites in commands/bench.rs) uses
plain ? so an ordinary Err return unwinds and flushes tracing_guards via
normal drop.

Closes #6709
@bug-ops
bug-ops force-pushed the fix/6709-guard-flush-bypass-sites branch from f968eb3 to 04d716d Compare July 28, 2026 20:44
@bug-ops
bug-ops enabled auto-merge (squash) July 28, 2026 20:44
@bug-ops
bug-ops merged commit 29327a8 into main Jul 28, 2026
43 checks passed
@bug-ops
bug-ops deleted the fix/6709-guard-flush-bypass-sites branch July 28, 2026 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation size/L Large PR (201-500 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

runner.rs: load_config_or_default and commands/bench.rs exit sites still bypass guard-flush

1 participant