AshWorkflow.Verifiers.ValidateUndo (AshWorkflow v0.6.0)

Copy Markdown View Source

Verifies that undo is coherently configured.

Checks, in order:

  • undo requires a transition_log. Undo reverses a logged row; without a log there is nothing to reverse and no target to rewind to.
  • The log resource must declare a self-referencing belongs_to :undoes, the pointer from an undo row to the row it reverses. Regenerate the log with mix ash_workflow.gen.transition_log if it predates undo.
  • undo requires at least one transition marked undoable?: true, so an undo block that can never fire is a compile error rather than an action that always refuses.
  • undoable?: true requires an undo block, for the same reason in reverse.
  • same_actor? requires belongs_to_actor on the log. Without a recorded actor there is nothing to compare the caller against, and every undo would refuse with :no_actor.

A no-op when the workflow declares neither undo nor any undoable transition.