Sequence diagrams
Every file in crates/merlion-render/tests/fixtures/sequence/. Participants keep their source order, and every message, note and fragment sits where the source puts it, so a sequence repeats byte for byte without a layout hint.
The five llm- sources carry the mistakes a language model makes, such as a message with no :, a fragment left open or a stray end, and render through the parser’s repairs.
Accessible incident
Section titled “Accessible incident”Diagram source
sequenceDiagram %% The on-call path, from page to all-clear. accTitle: Incident escalation accDescr { A failing health check pages the on-call engineer, who acknowledges within five minutes or the page escalates to the secondary. } participant Probe as Health probe # the /healthz poller, every 10s participant Pager actor Primary as Primary on-call actor Secondary as Secondary on-call
Probe->>Pager: health check failed 3 times in a row Pager->>+Primary: page(sev 2) alt acknowledged within 5 minutes Primary-->>-Pager: ack else no acknowledgement Pager->>Secondary: escalate(sev 2) Secondary-->>Pager: ack end Note over Primary,Secondary: The all-clear closes the incident for bothAgent retry repair
Section titled “Agent retry repair”Diagram source
sequenceDiagram participant Planner participant Executor participant Sandbox@{ "type": "boundary" } participant Model as Judge model
Planner->>Executor: run(plan 3 steps) loop per step Executor->>+Sandbox: exec(step) alt exit 0 Sandbox-->>-Executor: stdout, 40ms else non-zero exit Sandbox--xExecutor: exit 1, stderr Executor->>+Model: repair(step, stderr) Model-->>-Executor: patched step end end Executor-->>Planner: 3 of 3 steps green Note over Planner,Model: A repaired step is rerun once before the plan failsApi retry backoff
Section titled “Api retry backoff”Diagram source
sequenceDiagram autonumber 1 1 participant Client participant Gateway participant Upstream
Client->>+Gateway: GET /v1/reports loop Up to 4 attempts, 100ms doubling Gateway->>+Upstream: GET /reports alt 200 OK Upstream-->>-Gateway: 12 KiB of JSON else 503 Service Unavailable Upstream--xGateway: connection reset Gateway->>Gateway: sleep(backoff) end end break attempts exhausted Gateway-->>Client: 504 Gateway Timeout end Gateway-->>-Client: 200 OKArrow gallery
Section titled “Arrow gallery”Diagram source
sequenceDiagram participant A participant B
A->B: solid, no head A-->B: dotted, no head A->>B: solid, filled head A-->>B: dotted, filled head A<<->>B: solid, filled both ends A<<-->>B: dotted, filled both ends A-xB: solid, cross A--xB: dotted, cross A-)B: solid, async A--)B: dotted, async A-|\B: solid, half top A-|/B: solid, half bottom A-\\B: solid, stick top A-//B: solid, stick bottom A/|-B: reverse half top A\|-B: reverse half bottom A//-B: reverse stick top A\\-B: reverse stick bottomAsync queue fanout
Section titled “Async queue fanout”Diagram source
sequenceDiagram box rgb(232, 240, 254) Ingest participant API participant Queue@{ "type": "queue" } end box transparent Workers participant Thumbnailer participant Indexer end participant Bucket@{ "type": "database" } as Object store
API-)Queue: publish(upload.created) par thumbnail Queue-)Thumbnailer: upload.created Thumbnailer->>Bucket: PUT /thumbs/{id}.webp and index Queue-)Indexer: upload.created Indexer->>Bucket: HEAD /uploads/{id} end Note over Thumbnailer,Indexer: Both consumers ack independently Thumbnailer--)Queue: ack Indexer--)Queue: ackAuth device flow
Section titled “Auth device flow”Diagram source
---title: Device authorisation grant---sequenceDiagram autonumber actor User participant CLI as Device CLI participant Auth@{ "type": "boundary", "alias": "Auth server" } participant Store@{ "type": "database" } as Token store
User->>CLI: merlion login CLI->>+Auth: POST /device/code Auth-->>-CLI: user_code, verification_uri, interval=5s Note over User,CLI: The CLI prints the code and waits
User->>Auth: Opens the verification page and approves loop Every 5s until approved or expired CLI->>+Auth: POST /token (grant_type=device_code) alt still pending Auth-->>CLI: 400 authorization_pending else approved Auth->>+Store: Persist refresh token Store-->>-Auth: ok Auth-->>-CLI: access_token, refresh_token end end CLI->>User: Signed in as user@example.comAutonumber and wrap
Section titled “Autonumber and wrap”Diagram source
sequenceDiagram autonumber 10 5 participant Cron participant Reporter participant Mailer
Cron->>Reporter: build(weekly digest) Reporter->>Reporter: aggregate 14 sources Reporter->>Mailer:wrap: Send the digest to every subscriber of the weekly report Mailer-->>Cron:nowrap: queued 4 812 messages autonumber off Cron->>Reporter: build(daily digest)Checkout order
Section titled “Checkout order”Diagram source
sequenceDiagram actor Customer participant Web as Web app participant API as API gateway participant Bank
Customer->>Web: Place order Web->>API: POST /orders loop Every minute API->>Bank: Authorise payment Bank-->>API: Approved end alt bank declines Bank-->>Web: Declined else bank approves Web-->>Customer: Order confirmed end Note over Customer,Bank: One order, one transactionCi release train
Section titled “Ci release train”Diagram source
%%{init: {"merlion": {"autoTone": false}}}%%sequenceDiagram title Release train participant Dev as Developer participant CI participant Registry@{ "type": "database" } participant Prod as Production
Dev->>CI: push tag v4.2.0 activate CI CI->>CI: cargo test --workspace CI->>CI: cargo clippy -- -D warnings opt benchmarks changed CI->>CI: cargo bench -- --save-baseline v4.2.0 end CI->>Registry: publish merlion-render 4.2.0 deactivate CI Registry-->>Prod: pull 4.2.0 Note left of Dev: The train leaves every ThursdayDb replication
Section titled “Db replication”Diagram source
sequenceDiagram participant Writer participant Primary@{ "type": "database" } participant Wal@{ "type": "queue" } as Write-ahead log participant Replica@{ "type": "collections" } as Read replicas
Writer->>+Primary: BEGIN#59; UPDATE accounts SET balance = balance - 25 Primary->>Wal: append(lsn=4821) Primary-->>-Writer: COMMIT par stream to replicas Wal-)Replica: lsn=4821 and acknowledge the writer Wal--)Primary: flushed(lsn=4821) end Note right of Replica: Replicas serve reads at lsn 4821 once applied Replica-->>Wal: applied(lsn=4821)Llm destroy without message
Section titled “Llm destroy without message”Diagram source
sequenceDiagram participant Supervisor participant Worker participant Log
Supervisor->>Worker: start(batch 7) Worker->>Log: 2400 rows written destroy Worker Supervisor->>Log: batch 7 completeLlm missing colons
Section titled “Llm missing colons”Diagram source
sequenceDiagram participant Mobile participant Sync participant Store
Mobile->>Sync open(session) Sync->>Store read(cursor) Store-->>Sync cursor=8812 Sync-->>Mobile: 41 changes since 8812 Mobile->>Sync: ack(8853)Llm stray sections
Section titled “Llm stray sections”Diagram source
sequenceDiagram participant Browser participant CDN participant Origin
Browser->>CDN: GET /app.js alt cache hit CDN-->>Browser: 200 OK (from edge) else cache miss CDN->>Origin: GET /app.js Origin-->>CDN: 200 OK end else stale while revalidate CDN-->>Browser: 200 OK (stale) end Browser->>CDN: GET /app.cssLlm tool calls
Section titled “Llm tool calls”Diagram source
sequenceDiagram participant User participant Agent participant Tools as Tool runtime participant Search as Search API
User->>Agent: Which release broke the p95? Agent->>Tools: tool_use(search, {"q": "p95 regression"}) Tools->>Search GET /search?q=p95+regression Search-->>Tools: 3 hits Tools-->>Agent: tool_result(3 hits) alt enough evidence Agent->>User: Release 4.2 doubled the p95 else needs another call Agent->>Tools: tool_use(fetch, {"url": "..."}) Tools-->>Agent: tool_result(body) Agent->>User: Release 4.2 doubled the p95Llm unclosed fragments
Section titled “Llm unclosed fragments”Diagram source
sequenceDiagram participant Scheduler participant Worker participant Metrics
Scheduler->>Worker: lease(job 91) loop until the lease expires Worker->>Metrics: heartbeat(job 91) opt backlog over 1000 Worker->>Scheduler: request another worker Worker-->>Scheduler: done(job 91)Notes and boxes
Section titled “Notes and boxes”Diagram source
sequenceDiagram box Aqua Mobile clients actor Rider participant App as Rider app end box rgba(255, 240, 200, 0.6) Dispatch participant Dispatch participant Driver end
Rider->>App: Request a ride Note right of Rider: The pickup pin is <br/>dragged before sending App->>Dispatch: POST /rides Note over Dispatch,Driver: Dispatch holds the offer for 15s Dispatch->>Driver: Offer ride 4471 Driver-->>Dispatch: accepted Note left of Driver: Declining releases the offer to the next driver Dispatch-->>App: driver assigned, ETA 4 minPar over streaming
Section titled “Par over streaming”Diagram source
sequenceDiagram participant Client participant Router participant Model as Streaming model participant Trace@{ "type": "entity" } as Trace collector
Client->>+Router: POST /v1/messages (stream=true) Router->>+Model: forward prompt, 2 400 tokens par_over tokens and telemetry share the wall clock Model--)Router: token deltas Router--)Client: SSE data frames and Router-)Trace: span(ttft=180ms) end Model-->>-Router: stop_reason=end_turn Router-->>-Client: message_stopPayment 3ds
Section titled “Payment 3ds”Diagram source
sequenceDiagram accTitle: Card payment with 3-D Secure accDescr: The checkout service authorises a card, steps up to 3-D Secure when the issuer asks for it, and captures on success. actor Shopper participant Checkout participant PSP as Payment provider participant Issuer
Shopper->>+Checkout: Pay 49.00 EUR Checkout->>+PSP: POST /payments critical authorise the card PSP->>+Issuer: Authorisation request Issuer-->>-PSP: challenge_required option issuer asks for a challenge create participant ThreeDS as 3-D Secure page PSP->>ThreeDS: Redirect the shopper ThreeDS->>Shopper: Enter the one-time code Shopper->>ThreeDS: 483912 destroy ThreeDS ThreeDS-->>PSP: challenge_passed option issuer declines PSP-->>Checkout: declined (insufficient funds) end PSP-->>-Checkout: captured Checkout-->>-Shopper: Order confirmedRate limit
Section titled “Rate limit”Diagram source
sequenceDiagram autonumber 1.05 0.1 actor Caller participant Edge participant Limiter@{ "type": "control" } as Token bucket participant Origin
Caller->>Edge: GET /v1/search Edge->>+Limiter: take(1) alt tokens available Limiter-->>-Edge: allowed, 17 left Edge->>Origin: GET /v1/search Origin-->>Edge: 200 OK Edge-->>Caller: 200 OK else bucket empty Limiter-->>Edge: denied, refill in 800ms Edge--xCaller: 429 Too Many Requests endSaga refund
Section titled “Saga refund”Diagram source
sequenceDiagram participant Orchestrator participant Orders participant Payments participant Inventory
Orchestrator->>+Orders: cancel(order 8812) Orders-->>-Orchestrator: cancelled rect rgb(255, 235, 235) Note over Orchestrator,Inventory: Compensating transactions par refund the card Orchestrator->>+Payments: refund(49.00 EUR) Payments-->>-Orchestrator: refunded and restock the items Orchestrator->>+Inventory: restock(sku A-19, qty 1) Inventory-->>-Orchestrator: restocked end end Orchestrator->>Orders: saga completeViewer links
Section titled “Viewer links”Diagram source
sequenceDiagram participant Runner participant Artifacts link Runner: Logs @ https://example.com/runs/91/logs links Artifacts: {"Bundle": "https://example.com/runs/91/bundle.zip"} properties Runner: {"class": "self-hosted"} details Runner: {"region": "eu-central-1"}
Runner->>Artifacts: upload(bundle.zip, 18 MiB) Artifacts-->>Runner: stored, sha256 4f2a… Runner->>Artifacts: upload(coverage.json, 240 KiB)Websocket session
Section titled “Websocket session”Diagram source
sequenceDiagram participant Browser participant Edge as Edge worker participant Room@{ "type": "control" } as Room object
Browser->>+Edge: GET /ws (Upgrade: websocket) create participant Socket@{ "type": "boundary" } as Socket Edge->>Socket: 101 Switching Protocols Edge->>+Room: attach(sessionId) Room-->>-Edge: joined, 3 peers Socket-)Browser: {"type":"hello","peers":3} Browser-)Socket: {"type":"cursor","x":12,"y":40} Socket-)Room: broadcast(cursor) destroy Socket Browser-xSocket: close(1000) Edge-->>-Browser: session closed