Skip to content

v0.12.0

Choose a tag to compare

@github-actions github-actions released this 06 Nov 14:51
· 20 commits to main since this release
Immutable release. Only release title and notes can be modified.
fafc3e3

Added

  • max_fires and backoff on every. max_fires stops an every after a number of fires in the current step visit. backoff grows the gap after each fire, taking a duration tuple or :exponential like retry's backoff, and both schedulers compute it from AshWorkflow.Entities.Retry.delay_ms/2. Either option adds a <step>_<every>_fires integer column, so run mix ash.codegen on AshPostgres. An every without them is unchanged.
  • mix ash_workflow.gen.approval adds an approval workflow to a resource: a sibling approval resource with pending, approved, rejected, cancelled and an optional overdue step, a decision resource, quorum routing, and policies that stop a requester approving their own request. Who may open a request and who may approve live in generated Checks.CanRequest and Checks.CanApprove modules, which deny everyone until the application fills them in. See the approval recipe.
  • mix ash_workflow.gen.expiry adds an expiry workflow to a resource: a sibling expiry resource with active, expired and an optional expiring step, whose deadlines read expires_at and move when the expiry is renewed. The subject gains has_one :expiry, an expired? calculation and a :set_expiry update action, which creates the subject's expiry or renews the one it has. A subject with no expiry never expires. The generated Changes.SetExpiry change does the same work on any other subject action, taking an expires_in: option such as {365, :day} where the action has no :expires_at argument. --default-expiry 365d adds that change to the subject's changes block for every create, which then fails until Checks.CanCreate lets the creating actor through. Who may create an expiry and who may renew one live in generated Checks.CanCreate and Checks.CanRenew modules, which deny everyone until the application fills them in. See the expiry recipe.
  • mix ash_workflow.gen.dormancy adds a dormancy workflow to a resource: a sibling dormancy resource with active, dormant and an optional archived step, driven by a last_activity_at that a record_activity action moves and a reactivate action resets. The subject gains has_one :dormancy, a dormant? calculation, and a change on its create actions that runs the generated Changes.StartDormancy, so each new subject starts its own dormancy. The generated Changes.RecordActivity records activity from whichever subject actions the application adds it to. Who may create a dormancy directly and who may reactivate one live in generated Checks.CanCreate and Checks.CanReactivate modules, which deny everyone until the application fills them in. See the dormancy recipe.
  • mix ash_workflow.gen.sync adds a sync workflow to a resource: a sibling sync resource with syncing, synced and failed steps, whose :push action is retried with --max-attempts and --backoff and moves back to syncing on a resync. The subject gains has_one :sync, a synced? calculation, and two changes in its changes block. Changes.StartSync starts a sync on every subject create. Changes.RequestSync stamps resync_requested_at on every subject update, or only when a --fields field changes, and a fire_at timeout on synced and failed resyncs on that stamp, so a request made during a push runs once the push settles. Who may create a sync directly and who may resync one by hand live in generated Checks.CanCreate and Checks.CanResync modules, which deny everyone until the application fills them in. See the sync recipe.
  • mix ash_workflow.gen.transition_log accepts a workflow resource generated earlier in the same Igniter run, before it has compiled, by reading its source. A resource on disk that fails to compile is still reported as an issue.
  • mix ash_workflow.gen.publication adds a publication workflow to a resource: a sibling publication resource with draft, scheduled, published and unpublished steps, which goes live at publish_at and, with --with-unpublish-at, comes down at unpublish_at. The subject gains has_one :publication and a published? calculation. Who may create a publication and who may schedule, publish and unpublish one live in generated Checks.CanCreate and Checks.CanPublish modules, which deny everyone until the application fills them in. See the publication recipe.
  • mix ash_workflow.gen.review adds a review workflow to a resource: a sibling review resource with in_review, changes_requested, approved, rejected and an optional overdue step, a decision resource that records each round, and policies that stop a requester reviewing their own work. A subject has at most one open review. Who may open a review and who may review live in generated Checks.CanRequest and Checks.CanReview modules, which deny everyone until the application fills them in. See the review recipe.
  • mix ash_workflow.gen.invitation adds an invitation workflow to a resource: a sibling invitation resource with sent, accepted, declined, revoked and expired steps, whose deadline reads expires_at and moves when the invitation is resent. Who may invite and who may accept live in generated Checks.CanInvite and Checks.CanAccept modules, which deny everyone until the application fills them in. See the invitation recipe.
  • mix ash_workflow.gen.verification adds a verification workflow to a resource: a sibling verification resource with submitted, verifying, needs_review, verified and rejected steps, whose automatic :verify action retries up to --max-attempts times before the verification moves to review. The subject gains has_many :verifications, has_one :latest_verification and a verified? calculation. Who may submit a verification and who may decide one in review live in generated Checks.CanSubmit and Checks.CanReview modules, which deny everyone until the application fills them in. See the verification recipe.
  • mix ash_workflow.gen.deletion adds a deletion workflow to a resource: a sibling deletion resource with requested, purging, purge_failed, restored and deleted steps. A grace period after requested_at moves a request to purging, which runs a :purge action with retries and moves to purge_failed when they run out. The subject gains has_one :deletion and a pending_deletion? calculation. What a purge erases lives in a generated Changes.Purge change, which fails every purge until the application fills it in. Who may request and who may restore live in generated Checks.CanRequest and Checks.CanRestore modules, which deny everyone until the application fills them in. See the deletion recipe.
  • mix ash_workflow.gen.acknowledgement adds an acknowledgement workflow to a resource: a sibling acknowledgement resource with pending, acknowledged and an optional overdue step, holding one request per person per subject, which only that person may acknowledge. Who may open a request lives in a generated Checks.CanRequest module, which denies everyone until the application fills it in. See the acknowledgement recipe.

Fixed

  • A create action that upserts onto an existing row no longer appends an :initial row to the transition log, emits the workflow's signals or calls AshWorkflow.Scheduler.notify_state_change/2. The row stays in the step it was in. AshWorkflow.Changes.RecordEvent skips all three when the returned record carries upsert_action: :update metadata, or upsert_skipped: true metadata from an upsert_condition that did not match. This covers Ash.create/2 and Ash.bulk_create/4. The [:ash_workflow, :transition] span still emits :stop, because its :start event fires before the data layer reports whether the row was inserted. Ash sets upsert_action on ETS and Mnesia from 3.29, which ash_workflow already requires. AshPostgres sets it from 2.10.0 on PostgreSQL 17 and later, and from 2.13.1 on every PostgreSQL version. With an older AshPostgres, an upsert onto an existing row is still logged.
  • Transition and timeout actions that AshWorkflow.Transformers.AddActions generates on a workflow resource with a pre_check_with identity now set require_atomic? false. Ash adds a before_action for such an identity, so the generated actions failed with MustBeAtomic. Those actions now run non-atomically on that resource.