Skip to content

Remove production panics and expects from libtortillas runtime paths #233

Description

@artrixdotdev

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghigh prioGET DONE ASAP!!libtortillasChanges in the libtortillas craterustPull requests that update rust codetui-foundationWork needed before building the Tortillas TUI

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions