Dual-checkpoint policy engine for delivery suppression decisions.
Call evaluate/2 at two points in the dispatch pipeline:
- Planning time (before dispatch): pass
opts: []— checks channel preference only. - Perform time (inside dispatcher, after delivery loaded): pass
check_read_state: delivery.delay_fallback.
Returns:
{:ok, :proceed}— delivery should proceed to the adapter.{:suppress, reason_atom}— delivery should be suppressed.reason_atomis a plain atom (:channel_disabled,:already_read). Persist asAtom.to_string(reason_atom)on the delivery row.
Policy extensibility
A policy_module config key is reserved for custom host-app policy (quiet hours, rate limits):
config :chimeway, :policy_module, MyApp.NotificationPolicyThis hook is not dispatched to in Phase 3 — it is the documented extension point for future phases. Custom policy is additive; Chimeway's built-in preference and read-state checks always run first.
Summary
Functions
Evaluates delivery policy and returns a proceed or suppress decision.
Functions
@spec delivery_category(Chimeway.Delivery.t()) :: String.t() | nil
@spec evaluate( Chimeway.Delivery.t(), keyword() ) :: {:ok, :proceed} | {:suppress, atom()} | {:defer, map()}
Evaluates delivery policy and returns a proceed or suppress decision.
Options:
check_read_state:(boolean, default false) — when true, checks if the associated in-app notification has been read (read_at is not nil). Used for delayed fallback paths.