mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
This is a step in the direction of being able to process messages one at a time rather than in a batch. Individual message processing will be required to respect protocols (like update) that need message processing that is ordered with respect to other commands. Additionally we lay the groundwork for async updates and outcome polling. A summary of what changed: - Write update.Update as a protocol state machine that encapsulates all message processing, validation, event writing, and metric emission related to an update. - Make explicit the set of "Provisional" state transitions wherein the Update has recieved and reacted to a protocol message but cannot make externally observable changes like returning update outcomes to RPC callers until it knows that changes have been written to stable storage. - The effect package is introduced as a utility to buffer and later apply or cancel a set of effects. - With more responsibility in the Update type, UpdateRegistry is simplified. - UpdateRegistry can restore its state (mainly in-flight Accepted updates) from MutableState. - Update message validation is moved into the update package. - UpdateRegistry differentiates between having incomplete updates (which prevents a workflow from closing) and having messages to send (which may trigger the creation of a new workflow task) - Removed a chunk of processing from workflowTaskHandler that is now encapsulated in the Update state machine, allowing task handling to be more decoupled from update protocol semantics.