expect() in Startup system and TokioRuntimeResource::default() violate no-panic rule #33

Closed
opened 2026-05-19 18:44:36 +00:00 by funman300 · 0 comments
Owner

Files

  • solitaire_engine/src/font_plugin.rs line 35
  • solitaire_engine/src/resources.rs line 141

Description

Two expect() calls in non-test runtime code violate CLAUDE.md §2.3:

  1. Font::try_from_bytes(...).expect("bundled FiraMono failed to parse") — a corrupted binary or storage error at startup panics the process instead of degrading gracefully.
  2. TokioRuntimeResource::default() calls .expect("failed to build shared Tokio runtime") — on Android, the OS can refuse thread creation under memory pressure, panicking the main thread during plugin setup.

Fix

Replace both with match/? propagation that logs the error and either falls back to a default handle or disables the dependent feature, consistent with the pattern used elsewhere in the engine.

## Files - `solitaire_engine/src/font_plugin.rs` line 35 - `solitaire_engine/src/resources.rs` line 141 ## Description Two `expect()` calls in non-test runtime code violate CLAUDE.md §2.3: 1. `Font::try_from_bytes(...).expect("bundled FiraMono failed to parse")` — a corrupted binary or storage error at startup panics the process instead of degrading gracefully. 2. `TokioRuntimeResource::default()` calls `.expect("failed to build shared Tokio runtime")` — on Android, the OS can refuse thread creation under memory pressure, panicking the main thread during plugin setup. ## Fix Replace both with `match`/`?` propagation that logs the error and either falls back to a default handle or disables the dependent feature, consistent with the pattern used elsewhere in the engine.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#33