bug(wasm): replay move failures are silently ignored in solitaire_wasm #65

Closed
opened 2026-05-28 01:51:34 +00:00 by funman300 · 0 comments
Owner

Bug

In solitaire_wasm/src/lib.rs, when replaying a game move-by-move, moves that return an Err from the core logic are silently ignored and the replay continues. This masks desync bugs: the WASM replay diverges from the original game without any indication.

Affected file

solitaire_wasm/src/lib.rs

Fix

When a replayed move fails, log the error via web_sys::console::error_1 and either:

  • Return an error to the JS caller so the replay can be flagged as invalid
  • Abort the replay and surface a visible error state in the replay player UI
match game_state.apply_move(mv) {
    Ok(_) => {}
    Err(e) => {
        console_error(&format!("Replay move {:?} failed: {:?}", mv, e));
        return Err(JsValue::from_str("replay_desync"));
    }
}
## Bug In `solitaire_wasm/src/lib.rs`, when replaying a game move-by-move, moves that return an `Err` from the core logic are silently ignored and the replay continues. This masks desync bugs: the WASM replay diverges from the original game without any indication. ## Affected file `solitaire_wasm/src/lib.rs` ## Fix When a replayed move fails, log the error via `web_sys::console::error_1` and either: - Return an error to the JS caller so the replay can be flagged as invalid - Abort the replay and surface a visible error state in the replay player UI ```rust match game_state.apply_move(mv) { Ok(_) => {} Err(e) => { console_error(&format!("Replay move {:?} failed: {:?}", mv, e)); return Err(JsValue::from_str("replay_desync")); } } ```
funman300 added the bugwasm labels 2026-05-28 01:51:34 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: funman300/Ferrous-Solitaire#65