WorkflowInterpreter

works.iterative.workflow.WorkflowInterpreter

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def decide[R, State, Entity, Command, Event](defn: EngineDefinition[R, State, Entity, Command, Event], auth: AuthEnforcement)(ctx: GuardContext[R, Entity], command: Command): Either[Rejection, Seq[Event]]

Runs the three-stage interpreter — match, gate, classify → emit — against defn under auth, for the given ctx and command.

Runs the three-stage interpreter — match, gate, classify → emit — against defn under auth, for the given ctx and command.

  1. '''Match''': among transitions where t.from == defn.stateOf(ctx.entity) and t.on.accepts(command), find the first whose gated applicableWhen passes. No match and an applicableWhen failure both collapse to Left(Rejection.Unhandled).
  2. '''Gate''': evaluate the gated t.requires and t.requiresPayload(entity, command). On failure, collapse the merged GuardFailure: a data message ⇒ Left(Invalid(m)); otherwise ⇒ Left(Unauthorized(label)).
  3. '''Classify → emit''': Right(t.classify(entity, command).emit(entity, command)).

gate applies the auth policy per call: Skip rewrites auth leaves away via Guard.stripAuth, Enforce leaves the guard intact. The interpreter never folds events — it returns the domain Seq[Event] as-is; folding into the aggregate stays in the shell.

Attributes