Affordances

works.iterative.workflow.Affordances
object Affordances

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def compute[R, State, Entity, Command, Event](defn: EngineDefinition[R, State, Entity, Command, Event], auth: AuthEnforcement)(ctx: GuardContext[R, Entity]): List[Affordance]

Computes the command affordances for the entity's current state under auth.

Computes the command affordances for the entity's current state under auth.

Mirrors WorkflowInterpreter.decide structurally: the same stateOf projection, the same table order, the same gate policy (Skip rewrites auth leaves away via Guard.stripAuth, Enforce evaluates guards intact), and the same GuardFailure collapse (GuardFailure.firstDataMessage). Affordances therefore read the very Guard objects that decide enforces, so told-vs-enforced drift is structurally impossible.

  • A transition participates only if its gated applicableWhen passes — a command label all of whose transitions fail applicableWhen produces no affordance, matching decide's Rejection.Unhandled for it.
  • For each participating transition, the gated requires decides availability; on failure, reason is the DFS-first data message (under Enforce a pure-auth failure thus yields reason = None).
  • requiresPayload is NOT evaluated — it needs a concrete command, and payload validation surfaces at execution via decide.
  • Affordances are deduplicated by command label in first-seen table order: a label is available when any of its rows is, and the available row represents it; otherwise the first row does.

Attributes