Define and implement explicit, user- and operator-facing error semantics for async/protocol code: handle recoverable/expected mismatches without panicking, make failure outcomes observable, and ensure recovery/retry behavior is bounded and well-specified.

Apply this standard

  1. No panics for expected mismatches: If an input/protocol branch is “unknown/unhandled” but not a security-critical invariant, do not panic!/unhandled!(). Prefer return/ignore with log::warn! (including the offending parameters) and continue.
  2. Async workflows must specify failure outcome: For operations like “save”, “open”, “edit apply”, and “send”, always decide one of:
  3. Prevent retry/restart storms: Any loop that can restart on clean-but-empty/closure states must include an outer backoff or a bounded retry counter.
  4. Add error context to logs/telemetry: When possible, include the error string (or an error code/category) so failures are diagnosable without reproducing.

Concrete examples

Checklist: For any change touching error handling, confirm you can answer (a) what happens on failure, (b) whether it retries/reconciles, (c) how the user/client learns about it, and (d) where the error reason is captured (log/telemetry).