Skip to content

State diagrams

Every file in crates/merlion-render/tests/fixtures/state/. A stateDiagram-v2 lowers to the same layered graph a flowchart uses, so these run through the seven layout phases with no engine of their own (how it works).

The five llm- sources carry the mistakes a language model makes — -> for -->, a transition label with no :, a composite state left open, a stray } — and render through the parser’s repairs (State diagrams).

Quarterly access review Every account moves from collected to retained or revoked. a reviewer takes theaccount the access stays the access is removed Collected UnderReview Retained Revoked
Quarterly access review
Diagram source
---
title: Access review
---
stateDiagram-v2
accTitle: Quarterly access review
accDescr: Every account moves from collected to retained or revoked.
[*] --> Collected
Collected --> UnderReview : a reviewer takes the account
UnderReview --> Retained : the access stays
UnderReview --> Revoked : the access is removed
Retained --> [*]
Revoked --> [*]
click UnderReview href "https://example.com/access-review" _blank
State diagram State diagram, top to bottom. 7 states, 7 transitions. decide (choice) → CallingTool [a tool call is needed]; → Answering [the answer is ready] start → Planning Planning → decide (choice) CallingTool → Observing Answering → end Observing → Planning [feed the result back] Note right of Observing: Each observation is appended to the transcript. a tool call is needed the answer is ready feed the result back Planning CallingTool Answering Observing Each observation isappended to the transcript.
Diagram source
stateDiagram-v2
state decide <<choice>>
[*] --> Planning
Planning --> decide
decide --> CallingTool : a tool call is needed
decide --> Answering : the answer is ready
CallingTool --> Observing
Observing --> Planning : feed the result back
Answering --> [*]
note right of Observing : Each observation is appended to the transcript.
State diagram State diagram, top to bottom. 10 states, 11 transitions. score_gate (choice) → Reject [the score is under 0.5]; → fan_out (fork) [the score is 0.5 or over] fan_out (fork) → Index; → Notify fan_in (join) → Done start → Collect Collect → score_gate (choice) Reject → end Index → fan_in (join) Notify → fan_in (join) Done → end the score is under 0.5 the score is 0.5 orover Collect Reject Index Notify Done
Diagram source
stateDiagram-v2
state score_gate <<choice>>
state fan_out <<fork>>
state fan_in <<join>>
[*] --> Collect
Collect --> score_gate
score_gate --> Reject : the score is under 0.5
score_gate --> fan_out : the score is 0.5 or over
fan_out --> Index
fan_out --> Notify
Index --> fan_in
Notify --> fan_in
fan_in --> Done
Reject --> [*]
Done --> [*]
State diagram State diagram, top to bottom. 11 states, 10 transitions. start → Queued Queued → Running [a runner picks the job up] Running → Passed [every stage is green]; → Failed [a stage exits non-zero] Running: start → Checkout Running: Checkout → Build Running: Build → Test Running: Test → end Running: end Passed → end Failed → Queued [retry] Running Checkout Build Test a runner picks the jobup every stage is green a stage exits non-zero retry Queued Passed Failed
Diagram source
stateDiagram-v2
[*] --> Queued
Queued --> Running : a runner picks the job up
state Running {
[*] --> Checkout
Checkout --> Build
Build --> Test
Test --> [*]
}
Running --> Passed : every stage is green
Running --> Failed : a stage exits non-zero
Failed --> Queued : retry
Passed --> [*]
State diagram State diagram, top to bottom. 7 states, 7 transitions. start → Staged Staged → Canary [promote 5% of the fleet] Canary → Rollout [the error rate stays under 1%]; → RollingBack [the error rate passes 1%] Rollout → Live [every shard runs the new build] RollingBack → Staged [the previous build is back] Live → end promote 5% of thefleet the error rate staysunder 1% the error rate passes1% every shard runs thenew build the previous build isback Staged Canary Rollout RollingBack Live
Diagram source
stateDiagram-v2
[*] --> Staged
Staged --> Canary : promote 5% of the fleet
Canary --> Rollout : the error rate stays under 1%
Canary --> RollingBack : the error rate passes 1%
Rollout --> Live : every shard runs the new build
RollingBack --> Staged : the previous build is back
Live --> [*]
State diagram State diagram, top to bottom. 5 states, 6 transitions. start → Locked Locked → Unlocked [the code matches]; → Alarm [three codes in a row do not] Unlocked → Locked [no motion for 30s]; → end Alarm → Locked [an operator resets the panel] the code matches three codes in a rowdo not an operator resets thepanel no motion for 30s Locked Unlocked Alarm
Diagram source
stateDiagram-v2
[*] --> Locked
Locked --> Unlocked : the code matches
Locked --> Alarm : three codes in a row do not
Alarm --> Locked : an operator resets the panel
Unlocked --> Locked : no motion for 30s
Unlocked --> [*]
State diagram State diagram, top to bottom. 13 states, 12 transitions. start → Idle Idle → Moving [a floor is requested]; → end Moving → DoorsOpen [the car arrives] Moving: start → Accelerating Moving: Accelerating → Cruising Moving: Cruising → Decelerating Moving / Cruising: start → Level Moving / Cruising: Level → Level [pass a floor]; → end Moving / Cruising: end Moving: Decelerating → end Moving: end DoorsOpen → Idle [the doors close] Moving Cruising pass a floor Level Accelerating Decelerating a floor is requested the car arrives the doors close Idle DoorsOpen
Diagram source
stateDiagram-v2
[*] --> Idle
Idle --> Moving : a floor is requested
state Moving {
[*] --> Accelerating
Accelerating --> Cruising
state Cruising {
[*] --> Level
Level --> Level : pass a floor
Level --> [*]
}
Cruising --> Decelerating
Decelerating --> [*]
}
Moving --> DoorsOpen : the car arrives
DoorsOpen --> Idle : the doors close
Idle --> [*]
State diagram State diagram, left to right. 9 states, 7 transitions. start → Ingest Ingest → Store Ingest: start → Fetch Ingest: Fetch → Parse [the payload arrives] Ingest: Parse → end Ingest: end Store → Indexed [the writer commits] Indexed → end Ingest the payload arrives Fetch Parse the writer commits Store Indexed
Diagram source
stateDiagram-v2
direction LR
[*] --> Ingest
state Ingest {
direction TB
[*] --> Fetch
Fetch --> Parse : the payload arrives
Parse --> [*]
}
Ingest --> Store
Store --> Indexed : the writer commits
Indexed --> [*]
State diagram State diagram, top to bottom. 12 states, 11 transitions. start → Active Active → end Active: start → NumLockOff Active: NumLockOff → NumLockOn [EvNumLockPressed] Active: NumLockOn → NumLockOff [EvNumLockPressed] Active: start → CapsLockOff Active: CapsLockOff → CapsLockOn [EvCapsLockPressed] Active: CapsLockOn → CapsLockOff [EvCapsLockPressed] Active: start → ScrollLockOff Active: ScrollLockOff → ScrollLockOn [EvScrollLockPressed] Active: ScrollLockOn → ScrollLockOff [EvScrollLockPressed] Active EvNumLockPressed EvNumLockPressed NumLockOff NumLockOn EvCapsLockPressed EvCapsLockPressed CapsLockOff CapsLockOn EvScrollLockPressed EvScrollLockPressed ScrollLockOff ScrollLockOn
Diagram source
stateDiagram-v2
[*] --> Active
state Active {
[*] --> NumLockOff
NumLockOff --> NumLockOn : EvNumLockPressed
NumLockOn --> NumLockOff : EvNumLockPressed
--
[*] --> CapsLockOff
CapsLockOff --> CapsLockOn : EvCapsLockPressed
CapsLockOn --> CapsLockOff : EvCapsLockPressed
--
[*] --> ScrollLockOff
ScrollLockOff --> ScrollLockOn : EvScrollLockPressed
ScrollLockOn --> ScrollLockOff : EvScrollLockPressed
}
Active --> [*]
State diagram State diagram, top to bottom. 6 states, 6 transitions. start → Queued Queued → Running [picked up by a runner] Running → Passed [every check is green]; → Failed [a check exits non-zero] Passed → end Failed → end picked up by a runner every check is green a check exitsnon-zero Queued Running Passed Failed
Diagram source
stateDiagram-v2
[*] --> Queued
Queued --> Running picked up by a runner
Running --> Passed every check is green
Running --> Failed a check exits non-zero
Passed --> [*]
Failed --> [*]
State diagram State diagram, top to bottom. 8 states, 6 transitions. start → Received Received → Processing [queue the record] Processing: start → Validate Processing: Validate → Enrich Processing: Enrich → end Processing: end Processing: Stored → end 1 transition of the 7 in the source is not drawn. Processing Validate Enrich Stored queue the record Received
Diagram source
stateDiagram-v2
[*] -> Received
state Processing {
[*] --> Validate
Validate --> Enrich
Enrich --> [*]
Received --> Processing queue the record
Processing ==> Stored
Stored --> [*]
State diagram State diagram, top to bottom. 5 states, 4 transitions. start → Open Open → Triaged [an owner takes the issue] Triaged → Closed [the fix ships] Closed → end an owner takes theissue the fix ships Open Triaged Closed
Diagram source
stateDiagram-v2
[*] --> Open
Open --> Triaged : an owner takes the issue
}
--
Triaged --> Closed : the fix ships
Closed --> [*]
State diagram State diagram, top to bottom. 8 states, 6 transitions. start → Ready Ready → Working [start] Working: start → Fetching Working: Fetching → Transforming Working: Transforming → end Working: end Working: Done → end 1 transition of the 7 in the source is not drawn. Working Fetching Transforming Done start Ready
Diagram source
stateDiagram-v2
[*] --> Ready
Ready --> Working : start
state Working {
[*] --> Fetching
Fetching --> Transforming
Transforming --> [*]
Working --> Done : finish
Done --> [*]
State diagram State diagram, top to bottom. 5 states, 5 transitions. start → Drafting Drafting → Review [submit] Review → Published [approve]; → Drafting [request changes] Published → end Note right of Drafting: The author writes the post and can save it as often as they like. submit approve request changes Drafting Review Published The author writes the postand can save itas often as they like.
Diagram source
stateDiagram-v2
[*] --> Drafting
note right of Drafting
The author writes the post and can save it
as often as they like.
Drafting --> Review : submit
Review --> Published : approve
Review --> Drafting : request changes
Published --> [*]
State diagram State diagram, top to bottom. 6 states, 6 transitions. start → Idle Idle → Fetching [refresh] Fetching → Ready Ready → Idle [reset]; → Failed [the request times out] Failed → end refresh reset the request times out Idle Fetching Ready Failed
Diagram source
stateDiagram-v2
[*] -> Idle
Idle ->> Fetching : refresh
Fetching --> Ready
Ready ==> Idle : reset
Ready -.-> Failed : the request times out
Failed --> [*]
State diagram State diagram, left to right. 5 states, 8 transitions. start → Stopped Stopped → Playing [play]; → end Playing → Paused [pause]; → Stopped [stop]; → Playing [seek] Paused → Playing [resume]; → Stopped [stop] play pause resume stop stop seek Stopped Playing Paused
Diagram source
stateDiagram-v2
direction LR
[*] --> Stopped
Stopped --> Playing : play
Playing --> Paused : pause
Paused --> Playing : resume
Playing --> Stopped : stop
Paused --> Stopped : stop
Playing --> Playing : seek
Stopped --> [*]
State diagram State diagram, top to bottom. 5 states, 4 transitions. Waiting for the author → Two approvals are required [submit] Two approvals are required → Published [approve] start → Waiting for the author Published → end Note right of Waiting for the author: The author edits freely until they submit. Note left of Two approvals are required: An approval expires after 14 days. submit approve Waiting for the author Two approvals are required Published The author edits freelyuntil they submit. An approval expires after14 days.
Diagram source
stateDiagram-v2
state "Waiting for the author" as Draft
Review : Two approvals are required
note right of Draft
The author edits freely
until they submit.
end note
note left of Review : An approval expires after 14 days.
[*] --> Draft
Draft --> Review : submit
Review --> Published : approve
Published --> [*]
Order lifecycle State diagram, top to bottom. 7 states, 7 transitions. start → Draft Draft → Submitted [submit] Submitted → Review [queue for an editor] Review → Published [approved]; → Draft [rejected] Published → Archived [retire] Archived → end submit queue for an editor approved rejected retire Draft Submitted Review Published Archived
Order lifecycle
Diagram source
---
title: Order lifecycle
---
stateDiagram-v2
[*] --> Draft
Draft --> Submitted : submit
Submitted --> Review : queue for an editor
Review --> Published : approved
Review --> Draft : rejected
Published --> Archived : retire
Archived --> [*]
State diagram State diagram, top to bottom. 12 states, 13 transitions. risk (choice) → Captured [the risk score is under 40]; → ThreeDS [the risk score is 40 or over] start → Authorizing Authorizing → risk (choice) Captured → end ThreeDS → Captured [verified]; → Declined [abandoned] ThreeDS: start → Challenge ThreeDS: Challenge → Verified [the issuer accepts]; → Abandoned [the shopper leaves] ThreeDS: Verified → end ThreeDS: Abandoned → end ThreeDS: end Declined → end ThreeDS the issuer accepts the shopper leaves Challenge Verified Abandoned the risk score is under40 the risk score is 40 orover verified abandoned Authorizing Captured Declined
Diagram source
stateDiagram-v2
state risk <<choice>>
[*] --> Authorizing
Authorizing --> risk
risk --> Captured : the risk score is under 40
risk --> ThreeDS : the risk score is 40 or over
state ThreeDS {
[*] --> Challenge
Challenge --> Verified : the issuer accepts
Challenge --> Abandoned : the shopper leaves
Verified --> [*]
Abandoned --> [*]
}
ThreeDS --> Captured : verified
ThreeDS --> Declined : abandoned
Captured --> [*]
Declined --> [*]
State diagram State diagram, top to bottom. 6 states, 6 transitions. start → Received Received → Screening Screening → Approved [the record is clean]; → Blocked [a rule flags the record] Approved → end Blocked → end the record is clean a rule flags the record Received Screening Approved Blocked
Diagram source
stateDiagram-v2
classDef terminal stroke-width:2px
classDef risky font-weight:bold
[*] --> Received
Received --> Screening:::risky
Screening --> Approved : the record is clean
Screening --> Blocked : a rule flags the record
Approved --> [*]
Blocked --> [*]
class Approved,Blocked terminal
style Received stroke-dasharray:4 4
State diagram State diagram, left to right. 12 states, 15 transitions. start → Closed Closed → Listen [passive open]; → SynSent [active open]; → end Listen → SynReceived [receive SYN] SynSent → SynReceived [receive SYN]; → Established [receive SYN+ACK] SynReceived → Established [receive ACK] Established → FinWait1 [close]; → CloseWait [receive FIN] FinWait1 → FinWait2 [receive ACK] CloseWait → LastAck [close] FinWait2 → TimeWait [receive FIN] TimeWait → Closed [the 2MSL timer expires] LastAck → Closed [receive ACK] passive open active open receive SYN receive SYN receive SYN+ACK receive ACK close receive FIN receive ACK receive FIN close receive ACK the 2MSL timerexpires Closed Listen SynSent SynReceived Established FinWait1 CloseWait FinWait2 TimeWait LastAck
Diagram source
stateDiagram-v2
direction LR
[*] --> Closed
Closed --> Listen : passive open
Closed --> SynSent : active open
Listen --> SynReceived : receive SYN
SynSent --> SynReceived : receive SYN
SynSent --> Established : receive SYN+ACK
SynReceived --> Established : receive ACK
Established --> FinWait1 : close
Established --> CloseWait : receive FIN
FinWait1 --> FinWait2 : receive ACK
FinWait2 --> TimeWait : receive FIN
CloseWait --> LastAck : close
LastAck --> Closed : receive ACK
TimeWait --> Closed : the 2MSL timer expires
Closed --> [*]