2.3 Behavioral Models: What May Happen?

A structural model holds a system still; a behavioral model lets it move. It suppresses most of what a component is and keeps what it may do over time — the states a job may occupy, the transitions permitted between them, and the orderings those transitions allow or forbid. Where a dependency graph answers what is connected to what?, a behavioral model answers a question that only arises once time is admitted: what may happen, and in what order?

2.3.1 The Canonical Move: States, Transitions, and Executions

Engineering has represented behavior this way for a long time. A finite-state machine names the legal states of a system and the transitions between them; a labeled transition system adds the events that label those transitions; statecharts add hierarchy and concurrency so that large behaviors stay legible11. David Harel, “Statecharts: A Visual Formalism for Complex Systems,” Science of Computer Programming 8, no. 3 (1987): 231–74, https://doi.org/10.1016/0167-6423(87)90035-9.; a temporal specification describes a property of whole executions rather than of any single state. These forms differ in expressiveness, but they share one reduction: they keep the states and the transitions, and they discard the code that implements each one.

That reduction is what makes behavior checkable. A job-processing service described only through its handlers, database writes, and retries hides the very question an engineer most needs to ask — can the system reach a state it should never occupy? The same service, reduced to a handful of states and the transitions between them, turns that question into one a person or a tool can actually answer (Figure 2.3-1).

Canonical behavioral model: reduce an implementation to states and transitions A behavioral opener. A neutral implementation slab reduces to a state model: IDLE starts RUNNING, which finishes to DONE or fails to FAILED. A struck-through dashed arc marks the forbidden direct IDLE-to-DONE transition (no skipping RUNNING). Caption: Question, Semantics, Typical analysis. Blue ground marks the behavioral family. Behavioral model — what may happen, in what order? IMPLEMENTATION handlers · retries writes · logging … reduce to IDLE RUNNING DONE FAILED start finish fail no such transition (no skipping) Question: What may happen, and in what order? Semantics: node = a legal state; edge = a permitted transition; a path = an admitted execution. Typical analysis: reachability, safety, liveness.
Figure 2.3-1. The behavioral move: states and transitions. A model keeps the legal states and the permitted transitions and discards the code; the transition it omits — here the skip from IDLE straight to DONE — is the behavior it forbids. Its analyses search for a reachable bad state or a required event that never arrives.

A node is a legal state; a directed edge is a permitted transition; a path through the graph is an execution the model admits. The key content is often negative: the transitions the model omits are exactly the behaviors it declares illegal. Once behavior is explicit, the questions form a progression from local to global — is this single transition legal? is this state reachable at all? can a legal execution reach a forbidden state? can the system deadlock? must some event eventually occur? The first are safety questions, which a single bad execution refutes; the last is a liveness question, which no finite good execution can establish, because the failure is the system running forever without the required event. A model can make either expressible, and the choice of check — transition validation, reachability search, invariant checking, or temporal model checking22. Christel Baier and Joost-Pieter Katoen, Principles of Model Checking (MIT Press, 2008). — follows from the shape of the property rather than from a preference for one method.

A behavioral model does not make the system behave. It makes the behavior something one can reason about before it runs.

2.3.2 DocAble: Recovery Ordering

DocAble has one behavioral obligation whose violation is quiet and expensive. When a job falls back to a recovery path, the durable artifact and the database record that points at it must be written in the right order: the record may not name an artifact that has not yet been published. Reduced to its states, that concern is a small model.

MODEL CARD

Recovery-ordering model · Behavioral

The recovery lifecycle runs through several states, but the obligation lives in two of them. An artifact is first written locally (FALLBACK_STAGED) and only later published to durable storage (FALLBACK_UPLOADED). The record may advance to DB_UPDATED only from the durable state. Figure 2.3-2 draws the ordering, and the fact that matters is the edge that does not exist: there is no direct FALLBACK_STAGED → DB_UPDATED transition, so the record can never point at a merely-staged, not-yet-durable artifact. Local staging and durable publication are different states, and the whole obligation rides on keeping them apart.

Recovery-ordering model: three legal states and one forbidden edge Three states in legal order. FALLBACK_STAGED transitions on upload success to FALLBACK_UPLOADED, which transitions when durable state is updated to DB_UPDATED. The load-bearing fact is a forbidden edge: FALLBACK_STAGED may not go directly to DB_UPDATED. Durable state may not name an artifact recovery has not yet published. RECOVERY MODEL FALLBACK_STAGED upload succeeds FALLBACK_UPLOADED durable state updated DB_UPDATED forbidden / absent transition not part of the model The load-bearing fact is the edge that does not exist. The fallback artifact must become durable before database state may refer to it.
Figure 2.3-2. Recovery-ordering model. The fallback artifact must become durable before database state may refer to it. The load-bearing fact is the absent transition from FALLBACK_STAGED directly to DB_UPDATED.

Stated over the model, the property is a reachability claim: DB_UPDATED is reachable only through FALLBACK_UPLOADED. That is a property the model exposes and makes checkable — one can search the transition system for any path into DB_UPDATED that skips durable publication. Whether the running recovery path is held to the ordering — whether a transition table refuses the short-circuit step — is a question of enforcement, and it belongs to Part III. The two layers stay separate here: the model exposes the ordering; a mechanism enforces it. This obligation is a hard one — the machinery refuses the violation rather than merely reporting it — but the refusal is Part III's subject, not the model's.

2.3.3 What the Model Makes Checkable

The recovery model answers a safety question — can a bad state be reached? — and one counterexample would settle it. Not every behavioral obligation has that shape. "Every job eventually reaches a terminal state" is a liveness claim: no successful run proves the system can never stall, so the obligation ranges over infinite executions rather than reachable states, and it needs a different checker. Figure 2.3-3 places the three classes side by side.

Behavioral models expose different classes of properties A single behavioral model of states, transitions, and legal sequences forks into three property questions. A local rule asks whether an edge is legal and is answered by a transition check. A reachable-state question asks whether a state can occur and is answered by a state-space search. A temporal property asks whether something will eventually occur and is answered by temporal model checking. All three converge on evidence about behavior. Same model family; different property, different checker. BEHAVIORAL MODEL states · transitions · legal sequences LOCAL RULE REACHABLE-STATE TEMPORAL PROPERTY is this edge legal? can this state occur? will this eventually occur? transition check state-space search temporal model checking EVIDENCE ABOUT BEHAVIOR Same model family; different property, different checker.
Figure 2.3-3. Behavioral models expose different classes of properties. A transition relation can support local legality checks, reasoning over reachable states, or temporal claims over executions. The appropriate checker follows from the property; richer machinery is not automatically stronger for every question.

The point is not that DocAble should apply every one of these techniques. It is that once behavior has an explicit representation, the right form of reasoning becomes available for each kind of property, and the checker follows from the property rather than from habit. The recovery ordering is itself a sharp slice of a larger behavioral model: a DocAble job carries a full lifecycle — queued, leased, remediating, awaiting-merge, completed or failed — with its own legal transitions. The full lifecycle answers broader workflow questions; the three-state recovery ordering is the sharper reduction for crash-safe publication.

The recovery-ordering model makes an ordering obligation explicit and searchable. It does not, by itself, establish that the implementation realizes the model, prove that this is the right ordering for the product, or decide what should happen when the ordering is violated. It gives engineering a precise object to check and a precise thing to align.

Structural models froze time; this chapter let it flow but assumed a single actor moving through states. The next question is what happens when several actors reach for the same work at once.

Works Cited

  1. Harel, David. “Statecharts: A Visual Formalism for Complex Systems.” Science of Computer Programming 8, no. 3 (1987): 231–74. https://doi.org/10.1016/0167-6423(87)90035-9.
  2. Baier, Christel, and Joost-Pieter Katoen. Principles of Model Checking. MIT Press, 2008.
© James C. Davis, 2026–present