Skip to content

Dispatch grouping: internal calculation

Core::DispatchGrouping calculates logical delivery groups from the entries returned by Core::DispatchAssessmentRead for one channel. It is an in-memory, read-only building block: it does not authorize, select, reassess, persist, apply an exclusion policy, create a dispatch, contact a provider or prove any message was delivered. The caller must pass entries from one authorized, validated assessment read and choose the policy explicitly; the entries do not carry or independently verify the channel. Personalized per-recipient content is outside this calculation and must not be silently grouped.

  • per_destination groups by the exact channel-assessed normalized value.
  • per_recipient_destination groups by recipient ID and that value.

Each delivery retains all contributing recipient IDs, destination IDs, reasons and assessments. Distinct destination records with equal normalized values are not lost. Multiple resource-link reasons for one person remain on their contribution. The same address shared by different people creates one delivery under per_destination and one per person under per_recipient_destination. Value comparison respects the channel’s normalized result; Core does not lowercase email local parts or infer identity from a shared destination.

Excluded assessments are returned separately and never added to a delivery; recipients with no active destinations appear in missing_recipient_ids. No rule here decides whether an exclusion or an empty result permits creation. Malformed grouping inputs and unknown policies raise rather than return partial results. Assessment versions and channel-specific reason codes are validated by the upstream ChannelAssessment, not revalidated as a channel policy here. The resulting contact values are sensitive and must not be logged. Arrays are frozen, but this intermediate result is not a persisted immutable snapshot.