Skip to content
Sequence & interaction templates

Teaching Case — Answered on One Branch Only

Every branch of the `alt` has arrows in it, so every branch looks answered. One of them is not: on the retry path the service never replies to the client that called it, and the client waits forever. This is the check that most needs narrowing to be worth having — written as "the call was made outside the fragment and answered inside it" it fires on the commonest correct pattern in the notation, so it fires only when at least one branch fails to answer a call the fragment inherited.

Template previewSequence & interaction
Lookup with retry6 messages · deepest 2 openaltoutcome · hitmisslookup(id)read(id)rowfound(row)read(id)emptyClientLookup serviceStoreNothing here contradicts itself, and 1 thing is probably not what was meant — over 3 lifelines and 6messages.WARN`Client` calls `Svc` before the alt on line 9, and the call is answered on 1 of its 2 paths; it is left unansweredunder `miss`. Every branch has arrows in it, so every branch looks answered.INFO3 lifelines, 6 messages, 1 fragment. 3 synchronous calls, 2 answered; the deepest point of the interaction has 2calls open at once. Every message states whether it is a call, a reply or a fire-and-forget, so the stack above wassimulated rather than guessed at.OK16 of the 17 checks ran over every instance of their subject and found nothing: misdirected-reply, orphan-reply,unreturned-call, deadlock, after-destroy, before-create, double-create, double-destroy, par-interference,guard-overlap, guard-incomplete, activation-claim, unused-participant, undeclared-lifeline, duplicate-id,fragment-unclosed.

Make it your own.

sequence "Lookup with retry"

participant Client
participant Svc     "Lookup service"
database    Store   "Store"

Client -> Svc         : lookup(id)

alt on outcome : "hit","miss"
  when "hit"
    Svc   -> Store    : read(id)
    Store reply Svc   : row
    Svc   reply Client: found(row)
  when "miss"
    Svc   -> Store    : read(id)
    Store reply Svc   : empty
end