{
  "fixtureId": "fixture-early-exit-search",
  "contractName": "findFirstMatchPassCount",
  "lessonIds": [
    "stop-loop-early-on-match"
  ],
  "invalidInputPolicy": "Reject non-array items or empty string target with ERR_INVALID_SEARCH_INPUT; an empty items array [] is valid and returns found=false, matchIndex=-1, passesUsed=0.",
  "cases": [
    {
      "caseId": "typical-early-stop-with-duplicate",
      "kind": "typical",
      "input": {
        "items": [
          "S10",
          "S24",
          "S31",
          "S24"
        ],
        "target": "S24"
      },
      "expected": {
        "found": true,
        "matchIndex": 1,
        "passesUsed": 2
      },
      "reason": "Stops at first match index 1 after 2 passes instead of scanning all 4 items.",
      "catchesBug": "Missing early exit that scans all 4 items and overwrites matchIndex with 3"
    },
    {
      "caseId": "boundary-first-element-match",
      "kind": "boundary",
      "input": {
        "items": [
          "S24",
          "S10",
          "S31"
        ],
        "target": "S24"
      },
      "expected": {
        "found": true,
        "matchIndex": 0,
        "passesUsed": 1
      },
      "reason": "Best-case boundary where index 0 matches immediately in 1 pass.",
      "catchesBug": "Off-by-one 1-based index returning matchIndex=1 instead of 0"
    },
    {
      "caseId": "boundary-empty-list-zero-passes",
      "kind": "boundary",
      "input": {
        "items": [],
        "target": "S24"
      },
      "expected": {
        "found": false,
        "matchIndex": -1,
        "passesUsed": 0
      },
      "reason": "Empty roster executes 0 passes and reports not found.",
      "catchesBug": "Accessing items[0] before checking list length"
    },
    {
      "caseId": "contrast-not-found-full-scan",
      "kind": "typical",
      "input": {
        "items": [
          "S10",
          "S31"
        ],
        "target": "S99"
      },
      "expected": {
        "found": false,
        "matchIndex": -1,
        "passesUsed": 2
      },
      "reason": "Verifies full scan count when target is absent.",
      "catchesBug": "Returning matchIndex=0 as default when not found"
    },
    {
      "caseId": "invalid-empty-target",
      "kind": "invalid",
      "input": {
        "items": [
          "S10",
          "S24"
        ],
        "target": ""
      },
      "expectedError": "ERR_INVALID_SEARCH_INPUT",
      "reason": "Empty target ID is rejected by input validation.",
      "catchesBug": "Searching for an empty string instead of rejecting invalid query"
    }
  ]
}
