Chimeway.DeliveryAttempt (chimeway v1.2.0)

Copy Markdown View Source

Ecto schema for chimeway_delivery_attempts — immutable append-only record of each provider call for a delivery. No updated_at — attempts are never mutated.

Attempt identity and classification

  • attempt_number :integer — 1-indexed ordinal of this attempt for its delivery, computed at insert time inside the same Ecto.Multi as the attempt insert and required by the changeset. Deliveries.record_attempt/2 injects the value from the :next_attempt_number Multi step.
  • error_class :string — one of `"temporary""permanent""bounced"` for
    `:failed:rejected:bouncedoutcomes;nilfor:succeeded`. Persisted
    as a plain string with changeset whitelist validation (NOT Ecto.Enum) to match the project's durable string vocabulary.

Summary

Functions

Returns the canonical list of allowed error_class string values. Used by the dispatch executor to validate that the dispatcher only emits whitelisted classifications. "unknown_classification" is the fallback value emitted by classify/1 for unexpected adapter return shapes.

Types

t()

@type t() :: %Chimeway.DeliveryAttempt{
  __meta__: term(),
  adapter_module: term(),
  attempt_number: term(),
  delivery: term(),
  delivery_id: term(),
  error_class: term(),
  id: term(),
  inserted_at: term(),
  outcome: term(),
  provider_message_id: term(),
  provider_response: term()
}

Functions

changeset(attempt, attrs)

error_classes()

@spec error_classes() :: [String.t()]

Returns the canonical list of allowed error_class string values. Used by the dispatch executor to validate that the dispatcher only emits whitelisted classifications. "unknown_classification" is the fallback value emitted by classify/1 for unexpected adapter return shapes.