fix: handle MessagingErr::Saturated at all three match sites#2
Merged
Merged
Conversation
The bounded-mailbox backpressure variant `MessagingErr::Saturated(T)` (produced from `tokio::sync::mpsc::error::TrySendError::Full` when a caller uses `try_send` against a bounded mailbox) was added to the enum but three `match` sites were left non-exhaustive, breaking the default build with E0004. - actor.rs / thread_local/inner.rs (receive-side processing loop): Saturated is a send-side error and cannot occur on the receive side; treat like a closed channel (Signal::Kill), mirroring the SendErr arm. - actor/derived_actor.rs (get_derived conversion): deconvert the carried message back to TFrom and re-wrap as Saturated, mirroring the SendErr arm exactly, so bounded-mailbox backpressure propagates with the typed subset message intact. Verified: cargo check -p ractor (default + -F cluster), cargo check -p ractor_cluster, cargo fmt --all, cargo clippy --all -- -D clippy::all -D warnings (clean), cargo test -p ractor (130 + 13 doctests pass). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CcpLeEC3XK8Eye53GKBVvi
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.
Problem
The bounded-mailbox backpressure variant
MessagingErr::Saturated(T)— produced fromtokio::sync::mpsc::error::TrySendError::Fullwhen a caller usestry_sendagainst a bounded mailbox — was added to the enum, but threematchsites were left non-exhaustive. The default build fails witherror[E0004]: non-exhaustive patterns: MessagingErr::Saturated(_) not coveredat:ractor/src/actor.rsractor/src/thread_local/inner.rsractor/src/actor/derived_actor.rsFix
Semantically-correct handling at each site (no
todo!()):actor.rs/thread_local/inner.rs(receive-side processing loop):Saturatedis a send-side error and cannot occur on the receive side. Treat it like a closed channel (Signal::Kill), mirroring the existingSendErrarm.actor/derived_actor.rs::get_derived(subset-type conversion): deconvert the carried message back toTFromand re-wrap asSaturated, mirroring theSendErrarm exactly. ADerivedActorRefcarrying a subset message type now propagates bounded-mailbox backpressure with the typed message intact, so the caller can retry-with-backoff or escalate per their policy.Saturatedis distinct fromSendErr:SendErr/ChannelClosedmean the channel is closed (actor dead);Saturatedmeans the bounded mailbox is at capacity but healthy — a later attempt may succeed.Verification
cargo check -p ractor(default features) ✅cargo check -p ractor -F cluster✅cargo check -p ractor_cluster✅cargo fmt --all✅cargo clippy --all -- -D clippy::all -D warnings— clean ✅cargo test -p ractor— 130 passed; 0 failed + 13 doctests passed ✅🤖 Generated with Claude Code
Generated by Claude Code