Skip to content

fix: handle MessagingErr::Saturated at all three match sites#2

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/jirak-math-theorems-harvest-rfii13
Jun 19, 2026
Merged

fix: handle MessagingErr::Saturated at all three match sites#2
AdaWorldAPI merged 1 commit into
mainfrom
claude/jirak-math-theorems-harvest-rfii13

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Problem

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. The default build fails with error[E0004]: non-exhaustive patterns: MessagingErr::Saturated(_) not covered at:

  • ractor/src/actor.rs
  • ractor/src/thread_local/inner.rs
  • ractor/src/actor/derived_actor.rs

Fix

Semantically-correct handling at each site (no todo!()):

  • actor.rs / thread_local/inner.rs (receive-side processing loop): Saturated is a send-side error and cannot occur on the receive side. Treat it like a closed channel (Signal::Kill), mirroring the existing SendErr arm.
  • actor/derived_actor.rs::get_derived (subset-type conversion): deconvert the carried message back to TFrom and re-wrap as Saturated, mirroring the SendErr arm exactly. A DerivedActorRef carrying 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.

Saturated is distinct from SendErr: SendErr/ChannelClosed mean the channel is closed (actor dead); Saturated means 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 ractor130 passed; 0 failed + 13 doctests passed

🤖 Generated with Claude Code


Generated by Claude Code

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
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.

2 participants