Skip to content

fix(tauri): fail pending Marlin requests when the reader exits (+ run cargo test in CI) - #174

Merged
CameronBrooks11 merged 3 commits into
mainfrom
fix/marlin-reader-drain-pending
Jun 25, 2026
Merged

CameronBrooks11 merged 3 commits into
mainfrom
fix/marlin-reader-drain-pending

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Bug R1 from the latent-bug audit — and the CI enablement to actually run Rust tests.

Problem

The single stdout reader thread routes each response to the waiting oneshot::Sender in pending_responses. If the subprocess dies / closes stdout (or a read error occurs), the reader loop just exits, leaving every pending sender in the map. The corresponding send_and_wait() rx.await then waits forever (the sender is alive in the map, so it never errors) → the Tauri command never returns → the UI spinner hangs permanently with no error boundary.

Fix

On reader exit, fail_all_pending() drains and drops every pending sender, so awaiting receivers resolve to ChannelClosed and the command returns an error instead of hanging.

CI enablement

The Rust crate had unit tests but CI never ran cargo test (only compile + clippy), and the tauri crate can't be built locally here without system GTK libs. The GUI CI "Test & Build" job already installs those deps via setup-rust, so this PR adds a Run Rust tests step (npm run test:rust) — these tests now run and gate in CI.

Test

fail_all_pending_closes_in_flight_receivers registers a pending request and asserts the receiver goes from Empty to Closed after fail_all_pending(). (The reader-exit wiring is a one-line call verified by inspection; ChildStdout can't be faked in a unit test.)

Note: I couldn't run cargo test locally (tauri needs GTK/glib system libs, not installed per workstation-configs policy). CI now runs it — see the checks on this PR for the real green.

When the subprocess closes stdout (it died) or a read error occurs, the
reader loop left every pending oneshot::Sender in the map, so in-flight
send_and_wait() calls awaited forever and the UI command hung permanently.
Drain and drop all pending senders on reader exit so awaiting receivers
resolve to ChannelClosed. Adds a unit test for fail_all_pending().
The Rust (tauri) crate had unit tests but CI never executed them (only
compiled + clippy). The job already installs the Tauri Linux deps via
setup-rust, so add a 'Run Rust tests' step (npm run test:rust) to actually
run and gate cargo test.
@CameronBrooks11
CameronBrooks11 merged commit e6a644a into main Jun 25, 2026
15 checks passed
@CameronBrooks11
CameronBrooks11 deleted the fix/marlin-reader-drain-pending branch June 25, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant