Skip to main content

classify

Function classify 

Source
pub fn classify(err: &AnvilError) -> Disposition
Expand description

Classifies an AnvilError as transient or fatal per FR-82.

Transient (returns Disposition::Retry):

  • I/O errors with io::ErrorKind ∈ {ConnectionRefused, TimedOut, HostUnreachable, NetworkUnreachable, NotFound (DNS NXDOMAIN on Linux), AddrNotAvailable}

Fatal (returns Disposition::Fatal):

  • Authentication failure / host-key mismatch / no-key-found / invalid-config / signing / signature-invalid (user-input errors).
  • Russh protocol errors — re-driving an in-flight handshake is unsafe; see the module-level docs.
  • Other I/O kinds (e.g. PermissionDenied, Interrupted) — conservative default; these are unlikely to recover on retry.

HTTP 429/503 detection (PRD FR-82 also mentions these) is out of scope: Anvil speaks raw SSH; HTTP statuses only surface in ProxyCommand subprocess output, which Anvil doesn’t parse. A future ProxyCommand-HTTP-CONNECT milestone may extend this classifier to handle them.