Share Sentry crash reporting between the Tauri and GPUI shells
Summary
Problem: ANLG-320 Phase 2 requires crash reporting in the GPUI shell with the same consent gating and PII redaction as Tauri. Today the Sentry setup (consent lookup, before_send sanitization, event/breadcrumb filtering, scope tags) is inlined in apps/desktop/src-tauri/src/lib.rs and the redaction lives inside tauri-plugin-tracing, so GPUI had no crash reporting and no way to reuse the vetted redaction without depending on Tauri.
Fix: New shell-neutral crate crates/crash-reporting (anlg-crash-reporting) owning what both shells need:
pub mod consent; // CONSENT_QUERY + from_rows (crash_reporting_consent, falling back to telemetry_consent, missing → false)
pub mod filter; // sentry_event_filter_for / webview-console target filtering (moved from the plugin)
pub mod redaction; // moved verbatim from plugins/tracing (sanitize_sentry_event, RedactingWriter, tests)
pub fn init(Options { dsn, release, release_channel, service_name }, initially_enabled) -> Option<ClientInitGuard>
pub fn enabled() / set_enabled(bool) // the consent AtomicBool, read by before_send/before_breadcrumb
pub fn tracing_layer<S>() -> SentryLayer<S>
- Tauri:
maincallsinit(..., service_name: "desktop")andCrashReportingStatedelegates toset_enabled;tauri_plugin_tracing::redactionis a re-export so existing callers are unchanged. Behavior is identical (same options, tags,ANARLOG_DISABLE_SENTRYopt-out). - GPUI: startup now opens the store, reads consent with
CONSENT_QUERY, callsinit(..., service_name: "desktop-gpui", release: "anarlog-desktop-gpui@<APP_VERSION>"), and installs a registry withEnvFilter+ the Sentry layer + an fmt layer writing throughRedactingWriter. Togglingcrash_reporting_consentin GPUI settings callsset_enabledlive, matching Tauri. Sentry's default panic integration gives GPUI panic reports.
Noted for follow-up (not changed here): both frontends default the consent toggle to true when unset (apps/desktop/src/settings/queries.ts:118, GPUI settings metadata) while the Rust loader treats a missing row as false; both shells now share that exact Rust behavior, so the discrepancy is unchanged but visible in one place.
Verification
cargo test --locked -p crash-reporting(33 passed),cargo clippy --locked -p crash-reporting --all-targets --no-deps -- -D warningscargo test --locked -p tauri-plugin-tracing(14 unit + 6 integration)- ubuntu-24.04 CI-equivalent container:
cargo test --locked -p desktop-gpui(462 passed),cargo clippy --locked -p desktop-gpui --all-targets --no-deps -- -D warnings cargo check --locked -p desktopcould not complete locally: the Linux desktop build fails intauri-plugin-git(no field name on type &BStr,plugins/git/src/operations/local.rs:405) independent of this change; the Tauri wiring is covered by the plugin tests and the native macOS/Windows lanes.- rustfmt/dprint on changed files
Link to Devin session: https://app.devin.ai/sessions/f83ed73d85c648fcbdbd041cd4f15720
Open in Devin Desktop: https://app.devin.ai/desktop/session/f83ed73d85c648fcbdbd041cd4f15720?variant=devin
Requested by: @ComputelessComputer