Repository navigation
fix(tauri): fail pending Marlin requests when the reader exits (+ run cargo test in CI) - #174
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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::Senderinpending_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 correspondingsend_and_wait()rx.awaitthen 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 toChannelClosedand 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 viasetup-rust, so this PR adds aRun Rust testsstep (npm run test:rust) — these tests now run and gate in CI.Test
fail_all_pending_closes_in_flight_receiversregisters a pending request and asserts the receiver goes fromEmptytoClosedafterfail_all_pending(). (The reader-exit wiring is a one-line call verified by inspection;ChildStdoutcan't be faked in a unit test.)