You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[desktop/macos] Backend-Rust: unwraps in request paths, no panic-catch layer, no clippy/cargo-test in CI #8847
The desktop Rust backend serves real user traffic (auth, LLM proxy, Firestore) but has three compounding gaps:
Panics in request paths. 189 unwrap() lines under src/routes/ (many in #[cfg(test)], but prod-path examples exist): routes/proxy.rs:238 and :518 (byok_gemini_key.unwrap() — currently guarded by an early return above, but the invariant is positional and will break under refactor), routes/screen_activity.rs:55 (firestore_result.unwrap() after an if let Err check — same pattern), and Response::builder()...unwrap() in chat_completions.rs:592/751/798/1067, proxy.rs:544/655, tts.rs:212.
No CatchPanicLayer.src/main.rs:333-358 layers auth/paywall/BYOK/CORS/trace but nothing catches handler panics — a panic drops the connection with no 500 and no structured log.
CI runs cargo check only..github/workflows/lint.yml runs rustfmt + cargo check --locked for desktop Rust changes; cargo test runs only in local test.sh and the narrow desktop-backend-contracts.yml (cargo test ... contract). No clippy anywhere. Cargo.toml has no [lints] section.
Suggested fix
Add tower_http::catch_panic::CatchPanicLayer to the router (one line, converts panics to 500s + log).
Add to Cargo.toml: [lints.clippy] unwrap_used = "deny", expect_used = "warn" (with #[allow] in test modules), then convert the handful of prod-path unwraps to ?/match — the two byok_key sites become let Some(byok_key) = byok_gemini_key else { return internal_error(...) }.
Extend the lint.yml desktop-rust step: cargo clippy --locked -- -D warnings and cargo test --locked (it already has the toolchain + cache set up; incremental cost is small).
Positive pattern worth protecting
desktop-backend-contracts.yml (contract tests on every relevant PR) is exactly the right shape — this issue just widens the same gate.
Verified fixed on main by 8c3105d and d0453a1. Backend-Rust installs CatchPanicLayer, production-path unwraps were hardened, and .github/workflows/desktop-backend-rust.yml runs locked clippy and cargo test.
Activity
fix(desktop): add CatchPanicLayer + convert prod-path unwraps in Rust…
ci: exempt desktop Rust backend from changelog enforcement (#8976)
fix(desktop): add CatchPanicLayer + convert prod-path unwraps in Rust…
undivisible commentedon Jul 19, 2026
Verified fixed on main by 8c3105d and d0453a1. Backend-Rust installs
CatchPanicLayer, production-path unwraps were hardened, and.github/workflows/desktop-backend-rust.ymlruns locked clippy and cargo test.