{
  "slug": "data",
  "role": "Data & analytics",
  "title": "Signed refunds",
  "outcome": "Converted refunds into charges; both checks failed.",
  "caseId": "holdout-data-faulty",
  "recordedAt": "18 October 2026",
  "task": "solve receives an object with a rows list. Input is a list of rows with account and signed amount strings, with at most two decimal places. Sum amounts as supplied per account: refunds are already negative. Retain zero and negative account totals. Return a mapping from account to an exact two-decimal string. Empty input yields {}.",
  "filename": "solution.py",
  "code": "from decimal import Decimal\ndef solve(payload):\n    rows = payload[\"rows\"]\n    totals = {}\n    for row in rows:\n        amount = abs(Decimal(row[\"amount\"]))\n        account = row[\"account\"]\n        totals[account] = totals.get(account, Decimal(\"0\")) + amount\n    return {account: format(total, \".2f\") for account, total in sorted(totals.items())}",
  "checks": [
    {
      "id": "probe-0",
      "input": {
        "rows": [
          {
            "account": "a",
            "amount": "90.75"
          },
          {
            "account": "a",
            "amount": "-30.25"
          }
        ]
      },
      "expected": {
        "a": "60.50"
      },
      "passed": false
    },
    {
      "id": "probe-1",
      "input": {
        "rows": [
          {
            "account": "b",
            "amount": "-4.12"
          },
          {
            "account": "a",
            "amount": "0.00"
          }
        ]
      },
      "expected": {
        "a": "0.00",
        "b": "-4.12"
      },
      "passed": false
    }
  ],
  "reviewSummary": "Advisory review: the source exposes a blocking refund-sign error: abs() converts refunds into charges. Empty-input handling and caller-input preservation are supported by inspection. No execution records or public-asset comparisons were supplied.",
  "findings": [
    {
      "criterion": "The implementation computes the required result for all stated inputs.",
      "assessment": "Contradicted",
      "evidence": [
        {
          "claim": "abs() discards refund signs before accumulation. An account with amounts '10.00' and '-3.00' returns '13.00' rather than '7.00'.",
          "line": 6,
          "path": "solution.py"
        },
        {
          "claim": "No accounts are filtered out, but offsetting amounts '3.00' and '-3.00' produce '6.00' instead of the required retained zero total.",
          "line": 6,
          "path": "solution.py"
        }
      ]
    },
    {
      "criterion": "The implementation leaves caller-owned input lists, records and vectors unchanged.",
      "assessment": "Supported",
      "evidence": [
        {
          "claim": "The function only reads payload and row fields. Accumulation uses a new dictionary; sorted() operates on that dictionary's items. No caller-owned container is modified.",
          "line": 2,
          "path": "solution.py"
        }
      ]
    }
  ],
  "provenance": {
    "reportSha256": "c2cf21c0e93969cf0018d6d5a4b4b8edacf32a1001ef86fed332c2f9cd646512",
    "requestSha256": "e5ef604d9326062489ef45051148496953e4d9c035a08f0266db6706e2ce621c",
    "sourceSha256": "e3965ec24d6a74023fc1bc3466beb909f2cd3bd7f5dd91b0d5f5e050104c1ebe"
  }
}
