Skip to main content

validate_response

Function validate_response 

Source
pub fn validate_response(
    interaction: &Interaction,
    response: &InteractionResponse,
    channel: ResolutionChannel,
    actor: &ActorContext,
    conversation_id: &ConversationId,
    current_revision: CaseRevision,
    now: DateTime<Utc>,
) -> Result<AcceptedResponse, InteractionRejection>
Expand description

Pure validation of a client response against the stored interaction (spec §15.5).

Checks, in order: identity (id, account, conversation → NotFound), status (AlreadyResolved / NotActive), expiry, revision binding (Stale), payload integrity (PayloadCorrupt), the resolution channel against the stored TextResolutionPolicy (ChannelNotAllowed), option existence (UnknownOption), free-form rules.

channel says how the answer arrived: ResolutionChannel::Click for a structured client response, the text channels when the runtime resolved typed text to an option. It is carried into the accepted response and from there into the CommandOrigin, because an inferred “yes” and a click are not the same authority (I12, I20).