Skip to main content
ARCHOS 525 BLUEPRINT · /d/dgm_code-state-machines-in-code

Finite State Machines in Code (Explicit Transition Tables & Guards)

6 COMPONENTS · 6 FLOWS · UPDATED 2026-11-24
GITHUB README / PR PREVIEW CARD
[![Finite State Machines in Code (Explicit Transition Tables & Guards) — ArchOS Architecture](https://archos.sageideas.dev/d/dgm_code-state-machines-in-code/opengraph-image)](https://archos.sageideas.dev/d/dgm_code-state-machines-in-code)

*Interactive architecture diagram powered by [ArchOS Studio](https://archos.sageideas.dev/d/dgm_code-state-machines-in-code)*
NOTION / DOCS / CONFLUENCE EMBED
<iframe src="https://archos.sageideas.dev/embed/dgm_code-state-machines-in-code" width="100%" height="580" style="border:1px solid rgba(240,236,225,0.14);border-radius:6px;" loading="lazy" title="Finite State Machines in Code (Explicit Transition Tables & Guards) — Interactive in ArchOS"></iframe>
PORTABLE MERMAID SPEC (GITHUB / NOTION / RFC)
flowchart LR
  client_0["Event / Webhook"]
  n1_1[("Transition Table")]
  n2a_2["Guard & Side Effect"]
  n2b_3[("Atomic CAS Persist")]
  n3_4[("Audit Transition Log")]
  downstream_5["Downstream & OTel"]
  client_0 -->|"1. Lookup · FSM"| n1_1
  n1_1 -->|"2a. Check · Guard"| n2a_2
  n1_1 -->|"2b. CAS state · SQL"| n2b_3
  n2a_2 -->|"3a. Append log · Audit"| n3_4
  n2b_3 -->|"3b. Merge · RAM"| n3_4
  n3_4 -.->|"4. Emit / · OTLP/API"| downstream_5

COMPONENT STACK (6)

  • Event / WebhookSTATELESS
    Payment / Order / Job
  • Transition TableSTATEFUL
    -> Next + Guard
  • Guard & Side EffectSTATELESS
    Validates invariants before move
  • Atomic CAS PersistSTATEFUL
    UPDATE WHERE state=$cur
  • Audit Transition LogSTATEFUL
    Immutable
  • Downstream & OTelSTATELESS
    Consumers, metrics & SLOs

REQUEST & DATA FLOW (6)

  1. Event / Webhook → Transition Table (Lookup)[FSM]
  2. Transition Table → Guard & Side Effect (Check)[Guard]
  3. Transition Table → Atomic CAS Persist (CAS state)[SQL]
  4. Guard & Side Effect → Audit Transition Log (Append log)[Audit]
  5. Atomic CAS Persist → Audit Transition Log (Merge)[RAM]
  6. Audit Transition Log → Downstream & OTel (Emit /)[OTLP/API]
Configure NGINX / Postgres / K8s →60-Sec L4–L7 Diagnostic →