{
  "suite": "lifecycle",
  "description": "The complete transition table, stated exhaustively rather than by example, so an implementation cannot pass by getting the common edges right. Every ordered pair of distinct states appears exactly once.",
  "notes": [
    "NO STATE IS TERMINAL. A record withdrawn in error can be restored and an abandoned one revived, which CVE cannot do at all. Since nothing is ever destroyed, every state already holds its content, so refusing to let it come back would be policy with no data-integrity argument behind it.",
    "Nothing returns to RESERVED: it means an identifier exists and there is no content, and once content exists that statement is false.",
    "PUBLISHED does not reach DRAFT directly. PUBLISHED -> DISCARDED -> DRAFT reaches editing in two hops, so un-publishing is not impossible, only impossible to do SILENTLY.",
    "WITHDRAWN -> PUBLISHED skips the draft step, because restoring a record withdrawn in error is a correction of the withdrawal rather than of the record.",
    "WITHDRAWN -> DISCARDED was absent until 2026-08-25 and its absence was an omission, not a decision: every other state could be abandoned, and withdrawing a record and later concluding it should never have been published is the ordinary order those two judgements arrive in. The only route before it was WITHDRAWN -> PUBLISHED -> DISCARDED, which republishes a record in order to abandon it.",
    "wasWithdrawnOnce latches permanently and is never cleared by a restore, so a consumer reading only `state` is never misled about a record that was retracted and restored."
  ],
  "transitionCases": [
    {
      "from": "RESERVED",
      "to": "DRAFT",
      "expect": {
        "allowed": true
      }
    },
    {
      "from": "RESERVED",
      "to": "PUBLISHED",
      "expect": {
        "allowed": true
      }
    },
    {
      "from": "RESERVED",
      "to": "WITHDRAWN",
      "expect": {
        "allowed": false
      }
    },
    {
      "from": "RESERVED",
      "to": "DISCARDED",
      "expect": {
        "allowed": true
      }
    },
    {
      "from": "DRAFT",
      "to": "RESERVED",
      "expect": {
        "allowed": false
      }
    },
    {
      "from": "DRAFT",
      "to": "PUBLISHED",
      "expect": {
        "allowed": true
      }
    },
    {
      "from": "DRAFT",
      "to": "WITHDRAWN",
      "expect": {
        "allowed": false
      }
    },
    {
      "from": "DRAFT",
      "to": "DISCARDED",
      "expect": {
        "allowed": true
      }
    },
    {
      "from": "PUBLISHED",
      "to": "RESERVED",
      "expect": {
        "allowed": false
      }
    },
    {
      "from": "PUBLISHED",
      "to": "DRAFT",
      "expect": {
        "allowed": false
      }
    },
    {
      "from": "PUBLISHED",
      "to": "WITHDRAWN",
      "expect": {
        "allowed": true
      }
    },
    {
      "from": "PUBLISHED",
      "to": "DISCARDED",
      "expect": {
        "allowed": true
      }
    },
    {
      "from": "WITHDRAWN",
      "to": "RESERVED",
      "expect": {
        "allowed": false
      }
    },
    {
      "from": "WITHDRAWN",
      "to": "DRAFT",
      "expect": {
        "allowed": true
      }
    },
    {
      "from": "WITHDRAWN",
      "to": "PUBLISHED",
      "expect": {
        "allowed": true
      }
    },
    {
      "from": "WITHDRAWN",
      "to": "DISCARDED",
      "expect": {
        "allowed": true
      }
    },
    {
      "from": "DISCARDED",
      "to": "RESERVED",
      "expect": {
        "allowed": false
      }
    },
    {
      "from": "DISCARDED",
      "to": "DRAFT",
      "expect": {
        "allowed": true
      }
    },
    {
      "from": "DISCARDED",
      "to": "PUBLISHED",
      "expect": {
        "allowed": true
      }
    },
    {
      "from": "DISCARDED",
      "to": "WITHDRAWN",
      "expect": {
        "allowed": false
      }
    }
  ],
  "historyCases": [
    {
      "id": "withdraw-then-restore-keeps-the-latch",
      "history": ["RESERVED", "PUBLISHED", "WITHDRAWN", "PUBLISHED"],
      "expect": {
        "state": "PUBLISHED",
        "wasWithdrawnOnce": true
      }
    },
    {
      "id": "never-withdrawn-does-not-latch",
      "history": ["RESERVED", "DRAFT", "PUBLISHED"],
      "expect": {
        "state": "PUBLISHED",
        "wasWithdrawnOnce": false
      }
    }
  ]
}
