works.iterative.workflow

Members list

Type members

Classlikes

final case class Affordance(command: String, available: Boolean, description: GuardDescription, reason: Option[UserMessage])

One command offered (or withheld) in the entity's current state.

One command offered (or withheld) in the entity's current state.

Value parameters

available

whether the gated requires guard passes for the caller's context

command

the transition's CommandMatch label — the same trigger key decide matches on

description

the transition's unstripped requires.describe tree — always the full declared guard, regardless of the auth policy the availability was computed under

reason

for an unavailable affordance, the DFS-first data-guard message of the failure — the same message decide would return as Rejection.Invalid; None when available, and None under AuthEnforcement.Enforce when the failure is pure-auth (no data message to show)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Affordances

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Construction-time authorization policy for WorkflowInterpreter.decide.

Construction-time authorization policy for WorkflowInterpreter.decide.

Not a per-call flag: chosen once when the interpreter is wired to an EngineDefinition. Skip performs no auth enforcement; Enforce is reserved for applications that enforce roles.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class CommandMatch[Command](label: String, matcher: PartialFunction[Command, Unit])

A named command matcher — "which command" as a named PartialFunction matcher.

A named command matcher — "which command" as a named PartialFunction matcher.

Chosen over string triggers (drift), sample events (fixture drift), and ClassTag/TypeTest (breaks on parameterless enum cases, of which Poptávka has many). label is both the edge label and the projection's trigger key.

Value parameters

label

stable identifier for this command match; used as the edge label / trigger key

matcher

partial function defined exactly on the commands this match accepts

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
final case class EngineDefinition[R, State, Entity, Command, Event](stateOf: Entity => State, transitions: List[Transition[R, State, Entity, Command, Event]])

The runtime definition consumed by WorkflowInterpreter.decide.

The runtime definition consumed by WorkflowInterpreter.decide.

Value parameters

stateOf

the entity→state projection (e.g. for Poptávka: _.stav)

transitions

the transition table; order is preserved and load-bearing — first-applicable wins, mirroring an orElse chain

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class EventShape[Event](label: String, matcher: PartialFunction[Event, Unit])

The declared event-type skeleton for an outcome.

The declared event-type skeleton for an outcome.

The conformance harness asserts set-equality between an outcome's declared emits shapes and what its real emit produces.

Value parameters

label

stable identifier for this event shape

matcher

partial function defined exactly on the events this shape matches

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait Guard[R, S]

A composable guard over entity state S.

A composable guard over entity state S.

Each guard carries:

  • describe — a renderable GuardDescription tree (consumed by diagram export)
  • check — a pure evaluation against a GuardContext

The describe tree mirrors the evaluation structure:

  • AndAll (flattened, matching And.check's flat Conjunction accumulation)
  • OrAny (node-level, matching Or.check's node-level Disjunction)

Structural mirroring guarantees the description cannot contradict evaluation.

Combinators:

  • and: accumulates all failing branches flatly into GuardFailure.Conjunction
  • or: node-level; if both branches fail, wraps them in GuardFailure.Disjunction

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class And[R, S]
class Invalid[R, S]
class Or[R, S]
class RequireIdentity[R, S]
class RequireRole[R, S]
class Requirement[R, S]
Show all
object Guard

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
Guard.type
final case class GuardContext[R, S](roles: Set[R], userId: UserId, entity: S)

The context available during guard evaluation.

The context available during guard evaluation.

Value parameters

entity

the current entity state being guarded

roles

the full set of roles held by the calling user, typed as R — the application-supplied role type.

userId

the identity of the calling user (canonical idDO-based UserId)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Renderable description of a guard structure, consumed by Phase 4 diagram export.

Renderable description of a guard structure, consumed by Phase 4 diagram export.

Composed structurally from Guard.describe: AndAll, OrAny, leaves → Leaf. This structural correspondence guarantees the description cannot contradict evaluation.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

The result of a failed guard evaluation.

The result of a failed guard evaluation.

Sum-aware: carries structural information about which guards failed and why. Unauthorized is intentionally a distinct case from Leaf so that callers (e.g. MEDECA-377, MEDECA-378) can distinguish "missing data" from "missing permission" without further refactoring.

  • Leaf — a data guard (Requirement) failed; carries the predicate label and message key
  • Unauthorized — an auth guard (RequireRole or RequireIdentity) failed
  • Conjunction — an And guard: all failing branches accumulated (flat, no nesting)
  • Disjunction — an Or guard: all branches failed (node-level, two elements)

Attributes

Companion
object
Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object GuardFailure

Attributes

Companion
enum
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
final case class Outcome[State, Entity, Command, Event](label: String, to: State, emits: List[EventShape[Event]], emit: (Entity, Command) => Seq[Event])

One deterministic outcome of a Transition.

One deterministic outcome of a Transition.

Co-locates the declared skeleton (to + emits) with the real emit so they change together. emits = Nil with emit = (_, _) => Seq.empty models a no-op success outcome (e.g. Poptávka's NavrhniPL unchanged-VP branch).

Value parameters

emit

real, data/payload-dependent event construction

emits

declared event-type skeleton (Nil for a no-op outcome)

label

unique within its Transition; edge label + witness key

to

declared target state — read by the diagram, verified by conformance

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Predicate[S](label: String, test: S => Boolean)

A named predicate over entity state S.

A named predicate over entity state S.

Value parameters

label

stable, language-independent identifier; used by Guard.describe for diagram export (Phase 4)

test

pure boolean function applied to the entity value

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
enum Rejection

The kernel-local rejection vocabulary returned by WorkflowInterpreter.decide.

The kernel-local rejection vocabulary returned by WorkflowInterpreter.decide.

The application's adapter maps this to its own error type; the kernel itself references no application error type. Unauthorized exists for forward use (AuthEnforcement.Enforce) but is unreachable under SkipstripAuth removes every auth leaf before evaluation.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class Transition[R, State, Entity, Command, Event](from: State, on: CommandMatch[Command], applicableWhen: Guard[R, Entity], requires: Guard[R, Entity], requiresPayload: (Entity, Command) => Guard[R, Entity] = ..., outcomes: List[Outcome[State, Entity, Command, Event]], classify: (Entity, Command) => Outcome[State, Entity, Command, Event])

One (from, command) group of a workflow's engine table.

One (from, command) group of a workflow's engine table.

Groups outcomes that share a from state and a CommandMatch. classify is total by construction, so its outcomes are disjoint, exhaustive, and order-free — the footgun-free alternative to N sibling guarded transitions with hopefully-disjoint applicableWhen. classify cannot reject — rejections live entirely in requires/requiresPayload.

Value parameters

applicableWhen

fail ⇒ try next transition ⇒ eventually Unhandled

classify

total selection of one of outcomes given the real (entity, command)

from

the source state

on

the command matcher this transition group applies to

outcomes

the declared, disjoint outcomes this transition group can classify to

requires

fail ⇒ Invalid(message)

requiresPayload

payload-aware requires, evaluated against (entity, command); defaults to always-pass. The one defaulted additive field landed in Phase 2 so Podání (MEDECA-382) never edits a shipped kernel type.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Transition

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Transition.type
final case class Witness[State, Entity, Command](key: (State, String), outcomeLabel: String, entity: Entity, command: Command)

A witness pins one (transition, outcome) edge of an EngineDefinition to a concrete (entity, command) pair so ConformanceCheck.errors can exercise the real classify/emit/ fold code against the declared shape.

A witness pins one (transition, outcome) edge of an EngineDefinition to a concrete (entity, command) pair so ConformanceCheck.errors can exercise the real classify/emit/ fold code against the declared shape.

Value parameters

command

the command value to run the witness against

entity

the entity value to run the witness against

key

the (from, on.label) transition key this witness targets

outcomeLabel

the declared outcome label expected to be selected by classify

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type