Problem
A long-running TUI cannot crash because a peer disconnects, metadata parse fails, storage config is invalid, or current directory lookup fails. Several runtime paths still use panic!, unwrap, expect, or assertions for recoverable failures.
Examples from review:
crates/libtortillas/src/engine/mod.rs:176
crates/libtortillas/src/torrent/messages.rs:104
crates/libtortillas/src/torrent/messages.rs:169
crates/libtortillas/src/peer/actor.rs:247
crates/libtortillas/src/peer/actor.rs:628
crates/libtortillas/src/peer/actor.rs:637
Dependency
Blocked by #231 because recoverable failures should map into typed public/internal errors.
Acceptance criteria
- Recoverable runtime failures return errors or emit typed error events instead of panicking.
- Network send/receive failures do not crash actors unnecessarily.
- Invalid frontend operations return typed invalid-state errors.
- Tests cover at least the high-risk panic replacements.
- Remaining
unwrap/expect usages are limited to tests, invariants that are provably impossible, or documented unreachable states.
Problem
A long-running TUI cannot crash because a peer disconnects, metadata parse fails, storage config is invalid, or current directory lookup fails. Several runtime paths still use
panic!,unwrap,expect, or assertions for recoverable failures.Examples from review:
crates/libtortillas/src/engine/mod.rs:176crates/libtortillas/src/torrent/messages.rs:104crates/libtortillas/src/torrent/messages.rs:169crates/libtortillas/src/peer/actor.rs:247crates/libtortillas/src/peer/actor.rs:628crates/libtortillas/src/peer/actor.rs:637Dependency
Blocked by #231 because recoverable failures should map into typed public/internal errors.
Acceptance criteria
unwrap/expectusages are limited to tests, invariants that are provably impossible, or documented unreachable states.