Repository navigation
Immutable
release. Only release title and notes can be modified.
Added
- Several initial steps. More than one step can set
initial true.AshWorkflow.Transformers.AddStateMachinepasses every initial step to the state machine'sinitial_states, and a create action starts a record in one withchange transition_state(:step). A create that sets no state starts in the first initial step by declaration order. The reachability check inAshWorkflow.Verifiers.ValidateWorkflowstarts from every initial step. A step reached only from a second initial step is no longer reported as unreachable.AshWorkflow.Info.initial_steps/1andAshWorkflow.Entities.Step.find_initials/1list the initial steps, andAshWorkflow.Info.workflow_graph/1, the charts and the Clarity overview mark each of them. everycan fire at a wall-clock time in the record's own time zone, instead of measuring anintervalfrom its last fire.at ~T[09:00:00]names the local time,on [:mon, :tue, :wed, :thu, :fri]names the days, andtime_zone :candidate_time_zonenames the attribute holding the zone, or takes a literal such as"Australia/Sydney". A per-record zone is the case a global cron cannot express: two records in the same step fire at 09:00 in their own zones, at two different instants.AshWorkflow.Verifiers.ValidateEveryrejects aneverydeclaring neither. Firing writes the samelast_fired_fieldcolumn, anduntilstill bounds it againststate_entered_at.intervalalongsideatis a stride: how many local days must separate two fires.onsays which days carry an occurrence and the stride says how many of them to skip, sointerval {14, :days}withon [:mon]is 09:00 every second Monday. A stride must be given in:days, and counts local dates rather than elapsed duration — firing at 09:00 writes the last-fired column microseconds after 09:00, so a duration comparison would find the occurrence exactly one stride later ineligible by that margin and slip the fire a week.AshWorkflow.WallClockcomputes the occurrences behindat. A local time daylight saving skipped still fires that day, at the instant the clock jumped to; a local time that happens twice fires on the first of the two. A missed occurrence fires late rather than being skipped.AshWorkflow.Scheduler.Precisearms its timers from it andAshWorkflow.Calculations.PendingDeadlinesreports the next occurrence from it, so both run on any data layer.AshWorkflow.Scheduler.Obanasks the same question in SQL, with anAT TIME ZONEfragment reading the zone out of each row, soatunder that scheduler needs a SQL data layer.time_zoneaccepts an expression calculation as well as an attribute or a literal, which is how a record reads its zone off a related one:calculate :candidate_time_zone, :string, expr(candidate.time_zone). The calculation must be expression-based, since the zone is read from the trigger's filter —AshWorkflow.Verifiers.ValidateEveryrejects a module calculation, the same checkAshWorkflow.Verifiers.ValidateTimeoutFieldsalready applies to a timeout'sfield.AshWorkflow.Scheduler.Precise.TimelineandAshWorkflow.Calculations.PendingDeadlinesload a calculated zone before reading it.atneeds a time zone database in the host application, such asconfig :elixir, :time_zone_database, Tz.TimeZoneDatabase.AshWorkflow.Verifiers.ValidateEverychecks a literaltime_zoneagainst it at compile time. A record holding a zone the database does not know arms nothing and reports no pending deadline, rather than raising.
Changed
- The unreachable-step error names the initial step it searched from ("not reachable from the initial step :review") rather than "the first step".
AshWorkflow.Verifiers.ValidateWorkflowno longer raises "Only one step can have initial: true".AshWorkflow.Verifiers.ValidateWorkflowrejects a create action whosetransition_statenames a step that is not initial. Before, the create failed at runtime.AshWorkflow.Verifiers.ValidateWorkflowrejects an upserting create action that callstransition_state. ash_state_machine only lets an upsert move to a state that a transition declares for that action, and a workflow declares none for creates.- The unreachable-step error suggests
initial truefor an unreachable step that no other step leads into.