{
  "fixtureId": "sequence-guard-contract",
  "contractName": "evaluateLoanSequence",
  "lessonIds": [
    "find-missing-step-in-sequence",
    "guard-against-blocked-step"
  ],
  "invalidInputPolicy": "Reject negative stock, non-integer stock, or non-boolean safetyBadge with INVALID_INPUT before running any precondition check or updating stock.",
  "cases": [
    {
      "caseId": "seq-typical-valid",
      "kind": "typical",
      "input": {
        "safetyBadge": true,
        "availableStock": 2,
        "nextRequest": false
      },
      "expected": {
        "approved": true,
        "remainingStock": 1,
        "slipPrinted": true
      },
      "reason": "Typical valid microscope loan with all read, precondition, and stock-update steps in safe order.",
      "catchesBug": "Detects missing stock decrement or inverted safetyBadge check."
    },
    {
      "caseId": "seq-boundary-last-item",
      "kind": "boundary",
      "input": {
        "safetyBadge": true,
        "availableStock": 1,
        "nextRequest": true
      },
      "expected": {
        "approved": true,
        "remainingStock": 0,
        "slipPrinted": true,
        "secondApproved": false
      },
      "reason": "Boundary at 1 item remaining followed by a second request: first succeeds leaving 0, second must be blocked.",
      "catchesBug": "Catches missing write/update step that would allow double-loaning the last microscope."
    },
    {
      "caseId": "seq-boundary-zero-stock",
      "kind": "boundary",
      "input": {
        "safetyBadge": true,
        "availableStock": 0,
        "nextRequest": false
      },
      "expected": {
        "approved": false,
        "remainingStock": 0,
        "slipPrinted": false
      },
      "reason": "Boundary at 0 stock: precondition check must stop before subtracting.",
      "catchesBug": "Catches unsafe order that decrements stock to -1 before checking availableStock > 0."
    },
    {
      "caseId": "seq-invalid-negative-stock",
      "kind": "invalid",
      "input": {
        "safetyBadge": true,
        "availableStock": -2,
        "nextRequest": false
      },
      "expectedError": "INVALID_INPUT",
      "reason": "Negative stock violates valid inventory domain and must fail validation before sequence steps.",
      "catchesBug": "Prevents silently treating negative stock as valid or allowing updates on corrupted state."
    }
  ]
}
