Skip to main content

Module interactions

Module interactions 

Source
Expand description

The persistent interaction engine (spec §15, §23 steps C, L and P).

A card is a durable server-owned record, not a model tool call. This module is where the four rules that make that true are enforced against a real store:

  1. Persistence precedes the sentence. InteractionEngine::persist writes every specification the reducer asked for before any block of the response may refer to a card (§15.5). What it could not write is reported in PersistedInteractions::failed, and the caller must then say nothing about a card the user cannot see.
  2. One blocking card per case. A blocking specification goes in through InteractionWriter::insert_replacing_blocking, so the previous occupant is invalidated and the replacement gets a new identifier (§15.6). A Resolving occupant is never replaced: its commands are running.
  3. Resolution is compare-and-set. InteractionEngine::accept validates the client’s answer through core’s validate_response and then moves Active → Resolving through the store’s own compare-and-set. A second click loses that race and comes back as ResponseAdmission::AlreadyAnswered, carrying the record instead of authorizing a second execution (§15.5, I14).
  4. Resolved means committed. A card becomes Resolved only once the command its answer authorized has committed; otherwise it is Failed or restored to Active according to policy. There is no path here that marks a card resolved on the strength of an intention.

§The channel is part of the authorization

validate_response takes a ResolutionChannel, and so does InteractionEngine::accept: a structured click, a typed word that matched a stored alias exactly, and a “yes” the interpreter inferred are three different authorities, and the stored TextResolutionPolicy decides which of them the card admits (§15.7). The channel travels into the CommandOrigin the answer mints, so a replay can say which one happened (I20).

Structs§

AcceptedInteraction
A client answer that passed every §15.5 rule and holds the card in Resolving.
InteractionEngine
Reads, writes and settles persisted interactions (spec §15).
PersistedInteractions
What InteractionEngine::persist managed to write.
ResponseContext
What a client answer is judged against (spec §15.5).

Enums§

ResponseAdmission
What happened to a client answer.

Functions§

derive_interaction_id
Derives the identifier of the card key of turn.
summarize
The summary the reducer needs about one stored card.
summarize_all
The summaries of a set of stored cards, in the order given.