{
  "schema_version": 1,
  "diagram_type": "lifecycle",
  "meta": {
    "title": "Profile Switch Lifecycle",
    "quality_profile": "showcase",
    "viewBox": [980, 700]
  },
  "lanes": [
    { "id": "main", "label": "Switch phases (omen-profile switch)" },
    { "id": "fences", "label": "Fences and rollback" },
    { "id": "terminal", "label": "Boot enablement (separate concern)" }
  ],
  "states": [
    { "id": "requested", "type": "start", "label": "Requested", "sublabel": "switch two-dense", "lane": "main", "col": 0, "step": "01" },
    { "id": "validated", "type": "active", "label": "Validated", "sublabel": "limits, haproxy -c, parity", "lane": "main", "col": 1, "step": "02" },
    { "id": "apply", "type": "active", "label": "Apply + health wait", "sublabel": "snapshot; restart; verify", "lane": "main", "col": 2, "step": "03", "width": 118 },
    { "id": "publish", "type": "decision", "label": "Router publish", "sublabel": "journal check; write; restart", "lane": "main", "col": 3, "step": "04", "tag": "last step" },
    { "id": "committed", "type": "success", "label": "Committed", "sublabel": "profile written; fence off", "lane": "main", "col": 4, "step": "05" },
    { "id": "fenced", "type": "waiting", "label": "Fenced", "sublabel": "0 HEARTH jobs; pool free", "lane": "fences", "col": 0, "width": 118, "tag": "TTL 1800 s" },
    { "id": "rolledback", "type": "failure", "label": "Rolled back", "sublabel": "restore_snapshot(); 74B back", "lane": "fences", "col": 1, "width": 118, "tag": "23:59Z journal mismatch" },
    { "id": "poolfenced", "type": "failure", "label": "Pool fenced", "sublabel": "exit 2; manual intervention", "lane": "fences", "col": 2, "width": 118 },
    { "id": "enablement", "type": "neutral", "label": "Unit enablement", "sublabel": "never touched by switch", "lane": "terminal", "col": 0, "width": 110 },
    { "id": "reboot", "type": "external", "label": "Reboot", "sublabel": "starts what is enabled", "lane": "terminal", "col": 1, "width": 110 },
    { "id": "fixed", "type": "neutral", "label": "Fixed 00:14:50Z", "sublabel": "vllm@0/@1 on; 74B off", "lane": "terminal", "col": 2, "width": 110 }
  ],
  "transitions": [
    { "from": "validated", "to": "fenced", "variant": "default", "label": "work + GPU fence", "fromSide": "bottom", "toSide": "left" },
    { "from": "fenced", "to": "apply", "variant": "default", "route": "straight", "fromSide": "top", "toSide": "bottom" },
    { "from": "publish", "to": "rolledback", "variant": "security", "label": "journal mismatch", "route": "straight", "fromSide": "bottom", "toSide": "top", "labelDx": 62 },
    { "from": "rolledback", "to": "poolfenced", "variant": "security", "label": "restore fails", "route": "straight", "fromSide": "right", "toSide": "left", "labelDy": 40 },
    { "from": "rolledback", "to": "requested", "variant": "dashed", "label": "fix journal, rerun 00:13:50Z", "route": "bottom-channel", "fromSide": "bottom", "toSide": "bottom", "channelY": 372 },
    { "from": "enablement", "to": "reboot", "variant": "dashed", "route": "straight", "fromSide": "right", "toSide": "left" },
    { "from": "reboot", "to": "fixed", "variant": "dashed", "route": "straight", "fromSide": "right", "toSide": "left" }
  ],
  "cards": [
    { "dot": "cyan", "title": "Order of operations", "items": ["Static validation, then the work and GPU fences, then the snapshot", "Seats are applied and health-waited (900 s, served model verified) before the router moves", "The router is published last, only after both seats verify; any exception runs restore_snapshot()"] },
    { "dot": "rose", "title": "Two attempts 10-29", "items": ["23:59:33Z rollback: journal active_sha256 f4c35105... matched no config on disk", "Live haproxy.cfg was byte-identical to haproxy.cfg.two-dense.staged (4abec1a6...)", "00:13:50Z success after Derek approved repointing the journal"] },
    { "dot": "amber", "title": "Persistence gap", "items": ["Committed changes runtime state only; the tool never calls systemctl enable/disable", "A reboot starts whatever units are enabled, regardless of the profile file", "Fixed by hand at 00:14:50Z; nothing in the tool prevents recurrence"] }
  ]
}
