AIM Process and Trigger Semantics (Normative Reference)
Normative details for AIM v8.0 multi-step processes and case deadlines: cases, decision forks (continues:), Event waits and races, ### Ends on, collection steps (for each), timed waits (after: / until), and interrupting deadlines (### Ends). Load this module when modelling or realizing complex workflows. Core summary lives in specification.md (§4.4, §4.7).
Process execution, cases, races, loops, and timed waits (§4.4)#
Rules.
- A step. One numbered item is one step. The position sets the order, not the written number, and an indented line continues the step above. A step's edge tokens are its operations, and they keep the step's index in the graph.
- A step with no edges is a human step. Every projection of the process shows it.
- A step whose only operations are
reads,mutatesoremitsis work the Process performs itself. producesandneedssay what a step makes and what it cannot be done without (§4.11). They add no operation: a step whose only edges are these, with or withoutsatisfies, is performed as a human step is.- A step's words describe the work. They never say who performs it (§4.5).
- Several operations in one step. Several
invokesin one item are one step. Where they are the outcomes of a deciding Operation, they are exclusive alternatives. Otherwise they are unordered joint work that MAY run concurrently. The next step is the join, and it MUST NOT begin until all of them have completed. A parallel branch of several steps is a Process or a promoted process of its own, invoked jointly from one step. Joint work is not a race: where "the first to complete wins" between operations is a real commitment, the step's words say so and the procedure is verified (§12). A race between Events is a wait on several Events (below). - Which step comes next. The next step follows by position, whatever was emitted, unless a decision ends the branch (below). Only
invokesandemitslead along an edge;reads,mutates,produces,needsandsatisfieslead nowhere. An emitted Event continues the branch at its subscribers: a subscriber without steps is the next work on that branch, and a subscriber with steps starts a separate run. An Event nobody subscribes to ends only that branch. A Trigger anchored on an Event arms a timer and continues nothing. - A step that decides. A step that invokes a deciding Operation (§4.3) carries the fork. After its edges it names the outcomes that go on to the next step:
2. Check feasibility — [invokes](aim:sales#Operation:CheckFeasibility) — continues: Feasible, SpecialCut.- A named outcome goes on to the next step after its own consequence. Several MAY continue. Each name MUST be an outcome of the decision the step invokes.
- An outcome that is not named ends with the consequence in its own Decides bullet.
continues:MAY be left out when exactly one outcome declares no consequence of its own. That outcome continues.- The next step is the continuation of an outcome that goes on, so that outcome MUST NOT declare it again.
- If no outcome goes on, the deciding step is the last, and every outcome declares its continuation.
- The names stand on the step and not on the Operation, because one decision may continue differently in another process.
- Loops. A correcting outcome may invoke work that invokes the decision again. That cycle is legal while the Steps stay the linear procedure. A correction loop is bounded by a deadline Trigger that is anchored on the start of that part of the process and disarmed by the confirming Event. When it expires it ends the loop: it invokes work that leaves the loop or disables the correction. A deadline that only reminds or escalates does not bound a loop. A bound by count has no syntax of its own: a Record that counts the attempts and a deciding Operation with the outcomes Retry and Exhausted express one.
- A Process before its steps. A Process with a Summary and no Steps is named and not yet worked out. It has an address and may be invoked from a step, as a sub-process handed over by name. Its missing steps are the informational condition of a sequence with no entry point, never a hard error.
- A case. A case is one run of one process, whether a Process facet or a promoted process. An entry starts it: an actor that invokes the process, a Trigger, a subscription at its top, or a step of another case that invokes it.
- A child case. A step that invokes a process starts a child case. The step completes when the child case ends, which is the join. A run that an emitted Event starts, at a subscriber with steps, is a separate case and not a child.
- An item run. A step over a collection (below) runs once for each item. The record of an item run is the item, a row or a list element. An item run is part of its case and not a case of its own.
- The Events of a case. An Event belongs to the case that emitted it and to every case whose record its Payload references (§4.6). An Event that references an item's row belongs to that item run. A child case's Events are the child's, unless they reference the parent's record.
- One order. A case keeps every Event that belongs to it in one order, from the moment the case began. The realization keeps that order, and "first" always means first in it. Two Events that arrive together are ordered by it and are never left undefined.
- Hearing and taking. A wait hears every Event of its case since the case began. It takes the earliest Event of its kind that belongs to it and that no other wait of the same case has taken. A wait that is reached after its Event arrived therefore takes it and continues at once, and two waits in a row on the same Event wait for two occurrences. The wait of an item run takes Events of its item. Two waits that nothing tells apart take in the order in which they were reached.
- Ending. A case ends by its last step, by an Event under
Ends on, or by a deadline's### Ends(§4.7). The child cases its steps started end with it at once, and their own cleanup does not run. Item runs end with their step. A step of the ended case that waited for a child case never completes. A separate case that an Event started is not affected. A child case that ends by itself, by its last step, its ownEnds onor its own deadline, completes the parent's step.
- Waiting for an Event. A step whose operation is
subscribesis a wait. The case pauses at that step and continues with the next step when the wait takes an Event of its case: one emitted within the case, or one that carries the case's own record in its Payload, as aref(...)to it. A subscription outside Steps, at the top of a Process or an Operation, is an entry point that starts a run.needsis no wait: a step that waits for an Output to arrive waits on the Event that announces it (§4.11). A wait has no limit of its own; a deadline Trigger states one (§4.7). Keeping a wait alive over time is realization. - A race. A step with several
subscribeswaits for whichever of those Events comes first in the case's order. That Event ends the wait, and this step does not take the others:4. Wait for the customer's answer — [subscribes](aim:sales#Event:OfferAccepted), [subscribes](aim:sales#Event:OfferDeclined) — continues: OfferAccepted.- After the edges,
— continues: <Event>, <Event>names the Events that go on to the next step, by facet name, as outcomes are named. On any waiting step, each name MUST be an Event the step subscribes to. - An Event that is not named ends the case at this step. Its own subscribers elsewhere still run, as for any Event.
- Without
continues:, every one of the Events goes on: the step waited for any of them. - A race is for two things of which the case wants the first. An Event that must end the case whenever it comes is written once, under
Ends on, and never as a side of a race. A race takes the earliest Event in the case's order, so a readiness that came early would win over a cancellation that came later.
- After the edges,
- What ends a case.
### Ends on, or top-level## Ends onon a promoted process, lists Events in the form a Trigger's Schedule uses,- [<intent>#Event:<Name>]. Each address MUST be an Event. When such an Event of the case takes its place in the case's order, the case ends there, at once: nothing after it in the order advances the case, no step starts, no wait completes, and its child cases and item runs end with it. There is no cleanup. The Event is already the record of what happened, and whatever must happen on ending is the work of its emitter. TheEnds onof a child case ends the child only; a parent that must end on the same Event lists it itself. A deadline that ends the case is §4.7,### Ends. - A step over a collection.
<n>. <words> — for each [<address>] [as <input>] [in order | in order of [<field address>]] — <edges>.- The collection is a list field of the case's record,
<intent>#Record:<Name>.<field>with alist(...)type, or a Record whose rows belong to the case,<intent>#Record:<Name>with aref(...)field to the case's record. Where that Record references the case's record through several fields, the one that is meant MUST be named:[<intent>#Record:<Name> by <field>]. - Selected once. The items are what the collection holds when the step starts. Items added or removed afterwards do not join or leave the step.
- Order. A list keeps its order. Rows have none of their own, so a step over a Record runs its items jointly unless
in order of [<field address>]names a field of that Record to order by.in orderalone is allowed for a list and is a hard error for a Record. A list of parts may also be orderedin order ofa field of the part. - Jointly or one after another. Items are joint work and MAY run concurrently.
in orderandin order ofrun them one after another. The next step is the join: it begins when every item has completed. An empty collection completes the step at once. - The item is the operation's Input. The invoked operation declares an Input field that takes the item: a scalar of the list's item type, a
ref(...)to the Record's row, or apart(...)of its shape. Where several Input fields could take it,as <input>MUST name the one that does. With exactly one,asmay be left out. - A failed item fails the step. The step is complete when every item has completed. An item whose operation did not complete leaves the step incomplete, and the case goes to
### On Errorfor that step, as for any failed step. - Completed is not succeeded. The outcomes of a deciding operation apply to each item and carry their consequences for that item. They never branch the case, so
continues:MUST NOT be written on a step over a collection. What the outcomes of all items amount to is decided by the next step, an operation that reads what the items recorded:7. Poll every station — for each [launch#Record:Countdown.stations] as station — [invokes](aim:launch#Operation:PollStation), then8. Go/No-Go — [invokes](aim:launch#Operation:PollGoNoGo) — continues: Go.
- The collection is a list field of the case's record,
- A timed wait.
— after: <n> <unit>or— until [<address>]delays the start of a step. It is written after the edges and beforecontinues:, and a step carries one of the two, never both:3. The board conducts the review — [invokes](aim:program#Operation:ConductReview) — after: 10 business-days — continues: Proceed.after:counts from the moment the step is reached, in the units of a Trigger's Schedule:minutes,hours,days,business-days,weeks,monthsoryears.monthsandyearscount as §4.3 counts them.untilnames adateordatetimefield of the case's record. Adatetimeis the instant it holds, and adateis the start of that day in thetimezonein reach. A moment that is already past waits not at all.- The due instant is resolved when the step is reached, and it is kept. A later change to the field does not move a wait that exists. Moving it is an explicit act: a new run, or a step that waits again.
- Where the field has no value when the step is reached, the case waits at the step until the field is written, and that write schedules it.
- Both forms count in the
timezoneand thecalendarin reach (§4.7). - A step that carries a timed wait and no edges is a wait and not a human step.
- A timed wait is bounded as any wait is, by a deadline (§4.7). Keeping the timer alive is realization.
- A promoted Process. Promoted under the universal rule (§4.0) with
nature: process. It is invoked and triggered by its namespace (§5). - Expects and Criteria on a Process. The Expects check of a Process (§4.3) is evaluated when the case starts, before the first step. A Process holds nothing in between: a value that must still hold at the moment of a write is guarded by the Operation that writes, or by the Constraints of the Record (§4.2). The Criteria of a Process read rows and the clock when the decision is reached, after its steps.
Trigger deadlines, time zones, and case-ending cleanup (§4.7)#
Rules.
- What uses a Trigger. Schedules, polling, SLAs, escalation windows, expiries and recurring obligations all use this facet. An escalation ladder is chained deadlines. An expiry is a deadline triggering a revocation.
- Which kind. Event-anchored timing is
deadline. Calendar recurrence isschedule. - The performer. Work a Trigger starts still owes a performer (§4.5).
- The
unlessclause. Theunlessclause is prose, and no parser evaluates it. It binds the realization all the same: a deadline whoseunlessholds MUST NOT fire. Where disarming must be verifiable, it SHOULD name an Event the fulfilling operation emits, so the graph can check that Event and its emitter. - The calendar and the clock are intent. Every schedule and deadline counts in the
timezonein reach: the intent's own frontmatter, else the nearest ancestor's.business-dayscounts the working days of thecalendarin reach (§16).- Company closures are a requirement in the owner's words, and deadlines respect them.
- The duration and its anchor are intent too.
- How dates are computed and stored, and the holiday tables, are realization.
- A deadline belongs to its case. A deadline is armed per case. Only its
unlessEvent of that case disarms it (an Event belongs to a case as in §4.6).- The anchoring Event again in the same case restarts the timer from the new Event: one timer per case, never two.
- Any other policy — count from the first anchor, keep several timers — is stated in the Trigger's Summary, normatively, and the realization follows it.
- A deadline that ends the case. A deadline with
### Ends(- the case) does the following when it expires for a case:- It interrupts the case at once: no Event advances it, no step starts, no wait completes, and nothing of the case runs but what the deadline triggers.
- It runs the triggered work as the cleanup. The cleanup records what must be recorded and moves the case's record where a State requires.
- It ends the case when the triggered work completes, after which it hears no further Events.
- If the triggered work does not complete, it leaves the case interrupted. A realization MUST show it as such — a question for the owner, never silent. Recovery is explicit: the realization offers to run the triggered work again or to end the case by hand, and neither happens on its own. A case ended by hand with its triggered work incomplete carries the run-time finding cleanup incomplete, kept and shown with the case; it is a fact of that run, not a diagnostic of the graph, and no static check reports it.
- Child cases and item runs end with the case (§4.4, A case), at once, and their own cleanup is not run.
- Other deadlines and single steps.
unlessdisarms a deadline with### Endsas it disarms any deadline. A deadline without### Endsstarts work and interrupts nothing. Ending a single step is not expressible: a deadline anchored on a case's start cannot tell which step it governs.