{
  "slug": "software",
  "role": "Software engineering",
  "title": "Strict event amounts",
  "outcome": "Accepted invalid amounts; one of two checks failed.",
  "caseId": "holdout-swe-faulty",
  "recordedAt": "18 October 2026",
  "task": "solve receives an object with a events list. Return the sum of amounts from records whose id is a nonempty string and amount is a Python integer but not a boolean. Ignore invalid records. Only the first valid occurrence of each ID counts globally. Empty input yields 0.",
  "filename": "solution.py",
  "code": "def solve(payload):\n    events = payload[\"events\"]\n    seen = set()\n    total = 0\n    for event in events:\n        if not isinstance(event, dict):\n            continue\n        key, amount = event.get(\"id\"), event.get(\"amount\")\n        if not isinstance(key, str) or not key or not isinstance(amount, int):\n            continue\n        if key in seen:\n            continue\n        seen.add(key)\n        total += amount\n    return total",
  "checks": [
    {
      "id": "probe-0",
      "input": {
        "events": [
          {
            "amount": true,
            "id": "a"
          },
          {
            "amount": 7,
            "id": "a"
          }
        ]
      },
      "expected": 7,
      "passed": false
    },
    {
      "id": "probe-1",
      "input": {
        "events": [
          {
            "amount": -3,
            "id": "x"
          },
          {
            "amount": 20,
            "id": "x"
          },
          {
            "amount": 8,
            "id": "y"
          }
        ]
      },
      "expected": 5,
      "passed": true
    }
  ],
  "reviewSummary": "Advisory review: the implementation accepts booleans as amounts, which can also suppress a later valid occurrence of the same ID. Input mutation is not evident in the source. No execution records were supplied.",
  "findings": [
    {
      "criterion": "The implementation computes the required result for all stated inputs.",
      "assessment": "Contradicted",
      "evidence": [
        {
          "claim": "The integer check accepts bool because bool subclasses int. An event with id 'x' and amount True returns 1 rather than the required 0.",
          "line": 8,
          "path": "solution.py"
        },
        {
          "claim": "A boolean amount incorrectly reserves its ID. Events ('x', True) then ('x', 5) produce 1 rather than 5 because the later valid record is skipped.",
          "line": 9,
          "path": "solution.py"
        }
      ]
    },
    {
      "criterion": "The implementation leaves caller-owned input lists, records and vectors unchanged.",
      "assessment": "Supported",
      "evidence": [
        {
          "claim": "The function only iterates events and reads record fields. Updates target a newly allocated seen set and integer total; no caller-owned list, record, or nested vector is written.",
          "line": 1,
          "path": "solution.py"
        }
      ]
    }
  ],
  "provenance": {
    "reportSha256": "d6a190d78fb3fdf06a62b1719018b0eafbe15a6b08ae5a35fda11282faf37b25",
    "requestSha256": "7e0431a78f3cf3c1315e7abd58a2cbded68c2e686db7bf568ef0cf0a264300d9",
    "sourceSha256": "e7fbd639ea049bc66045f24ecdada4b5200277c88b1bcdf961c3d262f11d25fa"
  }
}
