{
 "fixtures": [
  {
   "base_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "body": "The status page wants to confirm that a host answers before it links to it.\n\nAdds a small helper next to the existing interval check, plus the import it needs.",
   "clean": false,
   "diff": "diff --git a/src/app/diagnostics.py b/src/app/diagnostics.py\nindex 1111111..2222222 100644\n--- a/src/app/diagnostics.py\n+++ b/src/app/diagnostics.py\n@@ -1,7 +1,16 @@\n from __future__ import annotations\n+\n+import subprocess\n \n DEFAULT_INTERVAL = 30\n \n \n def check_interval() -> int:\n     return DEFAULT_INTERVAL\n+\n+\n+def ping_host(host: str) -> str:\n+    \"\"\"Run the system ping for one host and return what it printed.\"\"\"\n+    command = f\"ping -c 1 {host}\"\n+    result = subprocess.run(command, shell=True, capture_output=True, text=True)\n+    return result.stdout\n",
   "expect": [
    {
     "category": "security",
     "id": "shell-true-user-input",
     "line": 15,
     "path": "src/app/diagnostics.py",
     "rule_id": "A-SEC-SHELL-TRUE",
     "severity": "high",
     "why": "the host is interpolated into a command string that a shell then parses"
    }
   ],
   "files": [
    {
     "additions": 9,
     "deletions": 0,
     "hunks": [
      {
       "header": "",
       "lines": [
        {
         "kind": "ctx",
         "new_no": 1,
         "old_no": 1,
         "text": "from __future__ import annotations"
        },
        {
         "kind": "add",
         "new_no": 2,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 3,
         "old_no": null,
         "text": "import subprocess"
        },
        {
         "kind": "ctx",
         "new_no": 4,
         "old_no": 2,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 5,
         "old_no": 3,
         "text": "DEFAULT_INTERVAL = 30"
        },
        {
         "kind": "ctx",
         "new_no": 6,
         "old_no": 4,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 7,
         "old_no": 5,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 8,
         "old_no": 6,
         "text": "def check_interval() -> int:"
        },
        {
         "kind": "ctx",
         "new_no": 9,
         "old_no": 7,
         "text": "    return DEFAULT_INTERVAL"
        },
        {
         "kind": "add",
         "new_no": 10,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 11,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 12,
         "old_no": null,
         "text": "def ping_host(host: str) -> str:"
        },
        {
         "kind": "add",
         "new_no": 13,
         "old_no": null,
         "text": "    \"\"\"Run the system ping for one host and return what it printed.\"\"\""
        },
        {
         "kind": "add",
         "new_no": 14,
         "old_no": null,
         "text": "    command = f\"ping -c 1 {host}\""
        },
        {
         "kind": "add",
         "new_no": 15,
         "old_no": null,
         "text": "    result = subprocess.run(command, shell=True, capture_output=True, text=True)"
        },
        {
         "kind": "add",
         "new_no": 16,
         "old_no": null,
         "text": "    return result.stdout"
        }
       ],
       "new_len": 16,
       "new_start": 1,
       "old_len": 7,
       "old_start": 1
      }
     ],
     "is_binary": false,
     "language": "python",
     "notes": [],
     "path": "src/app/diagnostics.py",
     "status": "modified"
    }
   ],
   "head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   "label": "A-SEC-SHELL-TRUE",
   "name": "fx01",
   "observed": {
    "exact": true,
    "expected": 1,
    "hits": 1,
    "note": "one real defect: a shell command run with shell=True on an argument the caller supplies",
    "spurious": 0
   },
   "pr": 1,
   "ref": "feature/fx01",
   "repo": "fake/fx01",
   "selector": "fake:fx01",
   "title": "Add a host ping helper to diagnostics"
  },
  {
   "base_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "body": "Saved views pass their filter through as an expression so a column can be filtered without a redeploy.\n\nAdds the evaluator the report view calls for each row.",
   "clean": false,
   "diff": "diff --git a/src/app/filters.py b/src/app/filters.py\nindex 1111111..2222222 100644\n--- a/src/app/filters.py\n+++ b/src/app/filters.py\n@@ -5,3 +5,8 @@\n \n def as_int(value: Any) -> int:\n     return int(value)\n+\n+\n+def matches(row: dict[str, Any], expression: str) -> bool:\n+    \"\"\"Return True when a filter expression such as `amount > 100` holds for this row.\"\"\"\n+    return bool(eval(expression, {}, dict(row)))\n",
   "expect": [
    {
     "category": "security",
     "id": "eval-user-expression",
     "line": 12,
     "path": "src/app/filters.py",
     "rule_id": "A-SEC-EVAL",
     "severity": "critical",
     "why": "the expression from the saved view is evaluated as Python in the report process"
    }
   ],
   "files": [
    {
     "additions": 5,
     "deletions": 0,
     "hunks": [
      {
       "header": "",
       "lines": [
        {
         "kind": "ctx",
         "new_no": 5,
         "old_no": 5,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 6,
         "old_no": 6,
         "text": "def as_int(value: Any) -> int:"
        },
        {
         "kind": "ctx",
         "new_no": 7,
         "old_no": 7,
         "text": "    return int(value)"
        },
        {
         "kind": "add",
         "new_no": 8,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 9,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 10,
         "old_no": null,
         "text": "def matches(row: dict[str, Any], expression: str) -> bool:"
        },
        {
         "kind": "add",
         "new_no": 11,
         "old_no": null,
         "text": "    \"\"\"Return True when a filter expression such as `amount > 100` holds for this row.\"\"\""
        },
        {
         "kind": "add",
         "new_no": 12,
         "old_no": null,
         "text": "    return bool(eval(expression, {}, dict(row)))"
        }
       ],
       "new_len": 8,
       "new_start": 5,
       "old_len": 3,
       "old_start": 5
      }
     ],
     "is_binary": false,
     "language": "python",
     "notes": [],
     "path": "src/app/filters.py",
     "status": "modified"
    }
   ],
   "head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   "label": "A-SEC-EVAL",
   "name": "fx02",
   "observed": {
    "exact": true,
    "expected": 1,
    "hits": 1,
    "note": "one real defect: eval() on an expression that arrives from the request",
    "spurious": 0
   },
   "pr": 2,
   "ref": "feature/fx02",
   "repo": "fake/fx02",
   "selector": "fake:fx02",
   "title": "Support filter expressions on report rows"
  },
  {
   "base_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "body": "Adds a lookup helper and wires it into the login path.\n\nFixes #12",
   "clean": false,
   "diff": "diff --git a/src/app/users.py b/src/app/users.py\nindex 1111111..2222222 100644\n--- a/src/app/users.py\n+++ b/src/app/users.py\n@@ -1,8 +1,14 @@\n from __future__ import annotations\n \n from app.db import connect\n \n \n def get_user(user_id: int):\n-    return connect().query(\"SELECT * FROM users WHERE id = ?\", (user_id,))\n+    return connect().query(\"SELECT * FROM users WHERE id = ?\", (user_id,))\n+\n+\n+def get_user_by_email(email: str):\n+    # NOTE: built by string concatenation, which is unsafe\n+    sql = \"SELECT * FROM users WHERE email = '\" + email + \"'\"\n+    return connect().query(sql)\n+\n+\n+def is_admin(user):\n+    return user.get(\"role\") == \"admin\"\n",
   "expect": [
    {
     "category": "security",
     "id": "sql-concat",
     "line": 12,
     "path": "src/app/users.py",
     "rule_id": "A-SEC-SQL-STRING",
     "severity": "high",
     "why": "the email value is concatenated into the query text"
    }
   ],
   "files": [
    {
     "additions": 11,
     "deletions": 1,
     "hunks": [
      {
       "header": "",
       "lines": [
        {
         "kind": "ctx",
         "new_no": 1,
         "old_no": 1,
         "text": "from __future__ import annotations"
        },
        {
         "kind": "ctx",
         "new_no": 2,
         "old_no": 2,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 3,
         "old_no": 3,
         "text": "from app.db import connect"
        },
        {
         "kind": "ctx",
         "new_no": 4,
         "old_no": 4,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 5,
         "old_no": 5,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 6,
         "old_no": 6,
         "text": "def get_user(user_id: int):"
        },
        {
         "kind": "del",
         "new_no": null,
         "old_no": 7,
         "text": "    return connect().query(\"SELECT * FROM users WHERE id = ?\", (user_id,))"
        },
        {
         "kind": "add",
         "new_no": 7,
         "old_no": null,
         "text": "    return connect().query(\"SELECT * FROM users WHERE id = ?\", (user_id,))"
        },
        {
         "kind": "add",
         "new_no": 8,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 9,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 10,
         "old_no": null,
         "text": "def get_user_by_email(email: str):"
        },
        {
         "kind": "add",
         "new_no": 11,
         "old_no": null,
         "text": "    # NOTE: built by string concatenation, which is unsafe"
        },
        {
         "kind": "add",
         "new_no": 12,
         "old_no": null,
         "text": "    sql = \"SELECT * FROM users WHERE email = '\" + email + \"'\""
        },
        {
         "kind": "add",
         "new_no": 13,
         "old_no": null,
         "text": "    return connect().query(sql)"
        },
        {
         "kind": "add",
         "new_no": 14,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 15,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 16,
         "old_no": null,
         "text": "def is_admin(user):"
        },
        {
         "kind": "add",
         "new_no": 17,
         "old_no": null,
         "text": "    return user.get(\"role\") == \"admin\""
        }
       ],
       "new_len": 14,
       "new_start": 1,
       "old_len": 8,
       "old_start": 1
      }
     ],
     "is_binary": false,
     "language": "python",
     "notes": [],
     "path": "src/app/users.py",
     "status": "modified"
    }
   ],
   "head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   "label": "A-SEC-SQL-STRING",
   "name": "fx03",
   "observed": {
    "exact": true,
    "expected": 1,
    "hits": 1,
    "note": "one real defect: SQL built by string concatenation",
    "spurious": 0
   },
   "pr": 3,
   "ref": "feature/user-lookup",
   "repo": "fake/fx03",
   "selector": "fake:fx03",
   "title": "Add user lookup by email"
  },
  {
   "base_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "body": "Generated fixture for scoring.",
   "clean": false,
   "diff": "diff --git a/src/app/db.py b/src/app/db.py\nindex 1111111..2222222 100644\n--- a/src/app/db.py\n+++ b/src/app/db.py\n@@ -1,3 +1,6 @@\n from __future__ import annotations\n \n \n+def connect():\n+    api_key = \"sk_live_9f4b2c7e1a8d6350\"\n+    return api_key\n",
   "expect": [
    {
     "category": "secret",
     "id": "hardcoded-key",
     "line": 5,
     "path": "src/app/db.py",
     "rule_id": "A-SECRET-api_key",
     "severity": "high",
     "why": "a credential literal committed in source"
    }
   ],
   "files": [
    {
     "additions": 3,
     "deletions": 0,
     "hunks": [
      {
       "header": "",
       "lines": [
        {
         "kind": "ctx",
         "new_no": 1,
         "old_no": 1,
         "text": "from __future__ import annotations"
        },
        {
         "kind": "ctx",
         "new_no": 2,
         "old_no": 2,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 3,
         "old_no": 3,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 4,
         "old_no": null,
         "text": "def connect():"
        },
        {
         "kind": "add",
         "new_no": 5,
         "old_no": null,
         "text": "    api_key = \"sk_live_9f4b2c7e1a8d6350\""
        },
        {
         "kind": "add",
         "new_no": 6,
         "old_no": null,
         "text": "    return api_key"
        }
       ],
       "new_len": 6,
       "new_start": 1,
       "old_len": 3,
       "old_start": 1
      }
     ],
     "is_binary": false,
     "language": "python",
     "notes": [],
     "path": "src/app/db.py",
     "status": "modified"
    }
   ],
   "head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   "label": "A-SECRET-api_key",
   "name": "fx04",
   "observed": {
    "exact": true,
    "expected": 1,
    "hits": 1,
    "note": "one real defect: a hardcoded live-format API key literal",
    "spurious": 0
   },
   "pr": 1,
   "ref": "feature/fx04",
   "repo": "fake/fx04",
   "selector": "fake:fx04",
   "title": "Add a connection helper"
  },
  {
   "base_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "body": "Generated fixture for scoring.",
   "clean": true,
   "diff": "diff --git a/src/app/math.py b/src/app/math.py\nindex 1111111..2222222 100644\n--- a/src/app/math.py\n+++ b/src/app/math.py\n@@ -1,3 +1,6 @@\n from __future__ import annotations\n \n \n+def add(left: int, right: int) -> int:\n+    \"\"\"Return the sum of two integers.\"\"\"\n+    return left + right\n",
   "expect": [],
   "files": [
    {
     "additions": 3,
     "deletions": 0,
     "hunks": [
      {
       "header": "",
       "lines": [
        {
         "kind": "ctx",
         "new_no": 1,
         "old_no": 1,
         "text": "from __future__ import annotations"
        },
        {
         "kind": "ctx",
         "new_no": 2,
         "old_no": 2,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 3,
         "old_no": 3,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 4,
         "old_no": null,
         "text": "def add(left: int, right: int) -> int:"
        },
        {
         "kind": "add",
         "new_no": 5,
         "old_no": null,
         "text": "    \"\"\"Return the sum of two integers.\"\"\""
        },
        {
         "kind": "add",
         "new_no": 6,
         "old_no": null,
         "text": "    return left + right"
        }
       ],
       "new_len": 6,
       "new_start": 1,
       "old_len": 3,
       "old_start": 1
      }
     ],
     "is_binary": false,
     "language": "python",
     "notes": [],
     "path": "src/app/math.py",
     "status": "modified"
    }
   ],
   "head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   "label": "clean control",
   "name": "fx05",
   "observed": {
    "exact": true,
    "expected": 0,
    "hits": 0,
    "note": "CONTROL: a clean change with no defects. Any finding here is a false positive",
    "spurious": 0
   },
   "pr": 1,
   "ref": "feature/fx05",
   "repo": "fake/fx05",
   "selector": "fake:fx05",
   "title": "Add an addition helper"
  },
  {
   "base_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "body": "The dashboard now reads the service status first, so a slow service renders a wait state instead of an empty page.\n\nReuses the existing endpoint builder.",
   "clean": false,
   "diff": "diff --git a/src/app/health.py b/src/app/health.py\nindex 1111111..2222222 100644\n--- a/src/app/health.py\n+++ b/src/app/health.py\n@@ -1,7 +1,16 @@\n from __future__ import annotations\n+\n+import requests\n \n STATUS_PATH = \"/status\"\n \n \n def endpoint(base_url: str) -> str:\n     return base_url.rstrip(\"/\") + STATUS_PATH\n+\n+\n+def fetch_status(base_url: str) -> dict:\n+    \"\"\"Read the JSON status document a service publishes.\"\"\"\n+    response = requests.get(endpoint(base_url), verify=False, timeout=5)\n+    response.raise_for_status()\n+    return response.json()\n",
   "expect": [
    {
     "category": "security",
     "id": "tls-verify-off",
     "line": 14,
     "path": "src/app/health.py",
     "rule_id": "A-SEC-TLS-VERIFY",
     "severity": "medium",
     "why": "verify=False accepts any certificate, so the status document cannot be trusted"
    }
   ],
   "files": [
    {
     "additions": 9,
     "deletions": 0,
     "hunks": [
      {
       "header": "",
       "lines": [
        {
         "kind": "ctx",
         "new_no": 1,
         "old_no": 1,
         "text": "from __future__ import annotations"
        },
        {
         "kind": "add",
         "new_no": 2,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 3,
         "old_no": null,
         "text": "import requests"
        },
        {
         "kind": "ctx",
         "new_no": 4,
         "old_no": 2,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 5,
         "old_no": 3,
         "text": "STATUS_PATH = \"/status\""
        },
        {
         "kind": "ctx",
         "new_no": 6,
         "old_no": 4,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 7,
         "old_no": 5,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 8,
         "old_no": 6,
         "text": "def endpoint(base_url: str) -> str:"
        },
        {
         "kind": "ctx",
         "new_no": 9,
         "old_no": 7,
         "text": "    return base_url.rstrip(\"/\") + STATUS_PATH"
        },
        {
         "kind": "add",
         "new_no": 10,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 11,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 12,
         "old_no": null,
         "text": "def fetch_status(base_url: str) -> dict:"
        },
        {
         "kind": "add",
         "new_no": 13,
         "old_no": null,
         "text": "    \"\"\"Read the JSON status document a service publishes.\"\"\""
        },
        {
         "kind": "add",
         "new_no": 14,
         "old_no": null,
         "text": "    response = requests.get(endpoint(base_url), verify=False, timeout=5)"
        },
        {
         "kind": "add",
         "new_no": 15,
         "old_no": null,
         "text": "    response.raise_for_status()"
        },
        {
         "kind": "add",
         "new_no": 16,
         "old_no": null,
         "text": "    return response.json()"
        }
       ],
       "new_len": 16,
       "new_start": 1,
       "old_len": 7,
       "old_start": 1
      }
     ],
     "is_binary": false,
     "language": "python",
     "notes": [],
     "path": "src/app/health.py",
     "status": "modified"
    }
   ],
   "head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   "label": "A-SEC-TLS-VERIFY",
   "name": "fx06",
   "observed": {
    "exact": true,
    "expected": 1,
    "hits": 1,
    "note": "one real defect: certificate verification disabled on the outbound request",
    "spurious": 0
   },
   "pr": 6,
   "ref": "feature/fx06",
   "repo": "fake/fx06",
   "selector": "fake:fx06",
   "title": "Wait for the status endpoint before rendering the dashboard"
  },
  {
   "base_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "body": "Adds the upload path for the nightly report bundle.\n\n`build_target` stays the single place the object URL is built, and the upload helper uses the same bucket constant.",
   "clean": false,
   "diff": "diff --git a/src/app/reports/upload.py b/src/app/reports/upload.py\nindex 1111111..2222222 100644\n--- a/src/app/reports/upload.py\n+++ b/src/app/reports/upload.py\n@@ -1,7 +1,20 @@\n from __future__ import annotations\n+\n+import boto3\n \n BUCKET = \"archive\"\n \n \n def build_target(name: str) -> str:\n     return f\"s3://{BUCKET}/{name}\"\n+\n+\n+def upload_report(name: str) -> str:\n+    \"\"\"Copy one report to the archive bucket and return its URL.\"\"\"\n+    client = boto3.client(\n+        \"s3\",\n+        aws_access_key_id=\"AKIA3XQ7Y2MEXAMPLE09\",\n+        region_name=\"eu-west-1\",\n+    )\n+    client.upload_file(name, BUCKET, name)\n+    return build_target(name)\n",
   "expect": [
    {
     "category": "security",
     "id": "hardcoded-aws-key",
     "line": 16,
     "path": "src/app/reports/upload.py",
     "rule_id": "A-SECRET-aws_key",
     "severity": "critical",
     "why": "a credential is committed in the diff and must be rotated, not only deleted"
    }
   ],
   "files": [
    {
     "additions": 13,
     "deletions": 0,
     "hunks": [
      {
       "header": "",
       "lines": [
        {
         "kind": "ctx",
         "new_no": 1,
         "old_no": 1,
         "text": "from __future__ import annotations"
        },
        {
         "kind": "add",
         "new_no": 2,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 3,
         "old_no": null,
         "text": "import boto3"
        },
        {
         "kind": "ctx",
         "new_no": 4,
         "old_no": 2,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 5,
         "old_no": 3,
         "text": "BUCKET = \"archive\""
        },
        {
         "kind": "ctx",
         "new_no": 6,
         "old_no": 4,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 7,
         "old_no": 5,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 8,
         "old_no": 6,
         "text": "def build_target(name: str) -> str:"
        },
        {
         "kind": "ctx",
         "new_no": 9,
         "old_no": 7,
         "text": "    return f\"s3://{BUCKET}/{name}\""
        },
        {
         "kind": "add",
         "new_no": 10,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 11,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 12,
         "old_no": null,
         "text": "def upload_report(name: str) -> str:"
        },
        {
         "kind": "add",
         "new_no": 13,
         "old_no": null,
         "text": "    \"\"\"Copy one report to the archive bucket and return its URL.\"\"\""
        },
        {
         "kind": "add",
         "new_no": 14,
         "old_no": null,
         "text": "    client = boto3.client("
        },
        {
         "kind": "add",
         "new_no": 15,
         "old_no": null,
         "text": "        \"s3\","
        },
        {
         "kind": "add",
         "new_no": 16,
         "old_no": null,
         "text": "        aws_access_key_id=\"AKIA3XQ7Y2MEXAMPLE09\","
        },
        {
         "kind": "add",
         "new_no": 17,
         "old_no": null,
         "text": "        region_name=\"eu-west-1\","
        },
        {
         "kind": "add",
         "new_no": 18,
         "old_no": null,
         "text": "    )"
        },
        {
         "kind": "add",
         "new_no": 19,
         "old_no": null,
         "text": "    client.upload_file(name, BUCKET, name)"
        },
        {
         "kind": "add",
         "new_no": 20,
         "old_no": null,
         "text": "    return build_target(name)"
        }
       ],
       "new_len": 20,
       "new_start": 1,
       "old_len": 7,
       "old_start": 1
      }
     ],
     "is_binary": false,
     "language": "python",
     "notes": [],
     "path": "src/app/reports/upload.py",
     "status": "modified"
    }
   ],
   "head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   "label": "A-SECRET-aws_key",
   "name": "fx07",
   "observed": {
    "exact": true,
    "expected": 1,
    "hits": 1,
    "note": "one real defect: an AWS access key id committed as a literal in application code",
    "spurious": 0
   },
   "pr": 7,
   "ref": "feature/fx07",
   "repo": "fake/fx07",
   "selector": "fake:fx07",
   "title": "Upload nightly reports to S3"
  },
  {
   "base_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "body": "The job worker already stores each queued job as a pickled dict, so the API needs to turn an incoming body back into that dict before dispatching it.\n\nAdds `decode_job` and leaves the health endpoint alone.",
   "clean": false,
   "diff": "diff --git a/src/app/webhooks.py b/src/app/webhooks.py\nindex 1111111..2222222 100644\n--- a/src/app/webhooks.py\n+++ b/src/app/webhooks.py\n@@ -1,7 +1,15 @@\n from __future__ import annotations\n \n-from flask import Response\n+import pickle\n \n+from flask import Request, Response\n \n+\n def health() -> Response:\n     return Response(\"ok\")\n+\n+\n+def decode_job(request: Request) -> dict:\n+    \"\"\"Turn a queued job payload into the mapping the worker expects.\"\"\"\n+    payload = request.get_data()\n+    return pickle.loads(payload)\n",
   "expect": [
    {
     "category": "security",
     "id": "unsafe-deserialisation",
     "line": 15,
     "path": "src/app/webhooks.py",
     "rule_id": "A-SEC-PICKLE",
     "severity": "high",
     "why": "an unpickled request body can run arbitrary code during load"
    }
   ],
   "files": [
    {
     "additions": 9,
     "deletions": 1,
     "hunks": [
      {
       "header": "",
       "lines": [
        {
         "kind": "ctx",
         "new_no": 1,
         "old_no": 1,
         "text": "from __future__ import annotations"
        },
        {
         "kind": "ctx",
         "new_no": 2,
         "old_no": 2,
         "text": ""
        },
        {
         "kind": "del",
         "new_no": null,
         "old_no": 3,
         "text": "from flask import Response"
        },
        {
         "kind": "add",
         "new_no": 3,
         "old_no": null,
         "text": "import pickle"
        },
        {
         "kind": "ctx",
         "new_no": 4,
         "old_no": 4,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 5,
         "old_no": null,
         "text": "from flask import Request, Response"
        },
        {
         "kind": "ctx",
         "new_no": 6,
         "old_no": 5,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 7,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 8,
         "old_no": 6,
         "text": "def health() -> Response:"
        },
        {
         "kind": "ctx",
         "new_no": 9,
         "old_no": 7,
         "text": "    return Response(\"ok\")"
        },
        {
         "kind": "add",
         "new_no": 10,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 11,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 12,
         "old_no": null,
         "text": "def decode_job(request: Request) -> dict:"
        },
        {
         "kind": "add",
         "new_no": 13,
         "old_no": null,
         "text": "    \"\"\"Turn a queued job payload into the mapping the worker expects.\"\"\""
        },
        {
         "kind": "add",
         "new_no": 14,
         "old_no": null,
         "text": "    payload = request.get_data()"
        },
        {
         "kind": "add",
         "new_no": 15,
         "old_no": null,
         "text": "    return pickle.loads(payload)"
        }
       ],
       "new_len": 15,
       "new_start": 1,
       "old_len": 7,
       "old_start": 1
      }
     ],
     "is_binary": false,
     "language": "python",
     "notes": [],
     "path": "src/app/webhooks.py",
     "status": "modified"
    }
   ],
   "head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   "label": "A-SEC-PICKLE",
   "name": "fx08",
   "observed": {
    "exact": true,
    "expected": 1,
    "hits": 1,
    "note": "one real defect: the request body goes straight to pickle.loads, so a payload can execute code while loading",
    "spurious": 0
   },
   "pr": 1,
   "ref": "feature/decode-jobs",
   "repo": "fake/fx08",
   "selector": "fake:fx08",
   "title": "Decode queued webhook jobs in the API"
  },
  {
   "base_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "body": "Ops wants to page through the admin report and pick the table and sort order from the query string, so the helper takes both and builds the page query.\n\nDefaults to 25 rows per page.",
   "clean": false,
   "diff": "diff --git a/src/app/reports.py b/src/app/reports.py\nindex 1111111..2222222 100644\n--- a/src/app/reports.py\n+++ b/src/app/reports.py\n@@ -5,3 +5,9 @@\n \n def active_users():\n     return connect().query(\"SELECT * FROM users WHERE active = ?\", (True,))\n+\n+\n+def report_page(table: str, sort_by: str, limit: int = 25):\n+    \"\"\"Return one page of the admin report for the requested slice.\"\"\"\n+    query = f\"SELECT * FROM {table} ORDER BY {sort_by} LIMIT {limit}\"\n+    return connect().query(query)\n",
   "expect": [
    {
     "category": "security",
     "id": "sql-fstring",
     "line": 12,
     "path": "src/app/reports.py",
     "rule_id": "A-SEC-SQL-STRING",
     "severity": "high",
     "why": "the table name and sort column are interpolated into the query text instead of being bound or allowlisted"
    }
   ],
   "files": [
    {
     "additions": 6,
     "deletions": 0,
     "hunks": [
      {
       "header": "",
       "lines": [
        {
         "kind": "ctx",
         "new_no": 5,
         "old_no": 5,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 6,
         "old_no": 6,
         "text": "def active_users():"
        },
        {
         "kind": "ctx",
         "new_no": 7,
         "old_no": 7,
         "text": "    return connect().query(\"SELECT * FROM users WHERE active = ?\", (True,))"
        },
        {
         "kind": "add",
         "new_no": 8,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 9,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 10,
         "old_no": null,
         "text": "def report_page(table: str, sort_by: str, limit: int = 25):"
        },
        {
         "kind": "add",
         "new_no": 11,
         "old_no": null,
         "text": "    \"\"\"Return one page of the admin report for the requested slice.\"\"\""
        },
        {
         "kind": "add",
         "new_no": 12,
         "old_no": null,
         "text": "    query = f\"SELECT * FROM {table} ORDER BY {sort_by} LIMIT {limit}\""
        },
        {
         "kind": "add",
         "new_no": 13,
         "old_no": null,
         "text": "    return connect().query(query)"
        }
       ],
       "new_len": 9,
       "new_start": 5,
       "old_len": 3,
       "old_start": 5
      }
     ],
     "is_binary": false,
     "language": "python",
     "notes": [],
     "path": "src/app/reports.py",
     "status": "modified"
    }
   ],
   "head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   "label": "A-SEC-SQL-STRING",
   "name": "fx09",
   "observed": {
    "exact": true,
    "expected": 1,
    "hits": 1,
    "note": "one real defect: the page query is assembled with an f-string from caller-supplied table and sort identifiers",
    "spurious": 0
   },
   "pr": 1,
   "ref": "feature/report-page",
   "repo": "fake/fx09",
   "selector": "fake:fx09",
   "title": "Add a paged admin report endpoint"
  },
  {
   "base_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "body": "Adds the call that charges the customer once an order is confirmed, plus a small helper so the order service does not talk to the gateway directly.\n\nKept the signature simple for now.",
   "clean": false,
   "diff": "diff --git a/src/app/payments.py b/src/app/payments.py\nindex 1111111..2222222 100644\n--- a/src/app/payments.py\n+++ b/src/app/payments.py\n@@ -3,3 +3,11 @@\n \n def refund_reference(order_id: str) -> str:\n     return f\"refund-{order_id}\"\n+\n+\n+def charge_customer(gateway, customer_id: str, amount_cents: int) -> None:\n+    \"\"\"Charge the customer's card for one order.\"\"\"\n+    try:\n+        gateway.charge(customer_id, amount_cents)\n+    except Exception:\n+        pass\n",
   "expect": [
    {
     "category": "correctness",
     "id": "swallowed-charge-error",
     "line": 12,
     "path": "src/app/payments.py",
     "rule_id": "A-SEC-EXCEPT-PASS",
     "severity": "medium",
     "why": "a failed charge is discarded silently instead of being surfaced or retried"
    }
   ],
   "files": [
    {
     "additions": 8,
     "deletions": 0,
     "hunks": [
      {
       "header": "",
       "lines": [
        {
         "kind": "ctx",
         "new_no": 3,
         "old_no": 3,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 4,
         "old_no": 4,
         "text": "def refund_reference(order_id: str) -> str:"
        },
        {
         "kind": "ctx",
         "new_no": 5,
         "old_no": 5,
         "text": "    return f\"refund-{order_id}\""
        },
        {
         "kind": "add",
         "new_no": 6,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 7,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 8,
         "old_no": null,
         "text": "def charge_customer(gateway, customer_id: str, amount_cents: int) -> None:"
        },
        {
         "kind": "add",
         "new_no": 9,
         "old_no": null,
         "text": "    \"\"\"Charge the customer's card for one order.\"\"\""
        },
        {
         "kind": "add",
         "new_no": 10,
         "old_no": null,
         "text": "    try:"
        },
        {
         "kind": "add",
         "new_no": 11,
         "old_no": null,
         "text": "        gateway.charge(customer_id, amount_cents)"
        },
        {
         "kind": "add",
         "new_no": 12,
         "old_no": null,
         "text": "    except Exception:"
        },
        {
         "kind": "add",
         "new_no": 13,
         "old_no": null,
         "text": "        pass"
        }
       ],
       "new_len": 11,
       "new_start": 3,
       "old_len": 3,
       "old_start": 3
      }
     ],
     "is_binary": false,
     "language": "python",
     "notes": [],
     "path": "src/app/payments.py",
     "status": "modified"
    }
   ],
   "head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   "label": "A-SEC-EXCEPT-PASS",
   "name": "fx14",
   "observed": {
    "exact": true,
    "expected": 1,
    "hits": 1,
    "note": "one real defect: `except Exception: pass` swallows a failed card charge, so the caller believes the payment went through",
    "spurious": 0
   },
   "pr": 1,
   "ref": "feature/charge-on-confirm",
   "repo": "fake/fx14",
   "selector": "fake:fx14",
   "title": "Charge the card when an order is confirmed"
  },
  {
   "base_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "body": "Small maintenance script that lists the labels on a repository so we can diff them against our template.\n\nRun it with `python scripts/sync_labels.py <owner>/<name>`.",
   "clean": false,
   "diff": "diff --git a/scripts/sync_labels.py b/scripts/sync_labels.py\nindex 1111111..2222222 100644\n--- a/scripts/sync_labels.py\n+++ b/scripts/sync_labels.py\n@@ -4,3 +4,12 @@\n import urllib.request\n \n API = \"https://api.github.com\"\n+TOKEN = \"ghp_9f4b2c7e1a8d6350f2e1b4a7c9d0e3f5a1b2\"\n+\n+\n+def fetch_labels(repo: str) -> list[dict]:\n+    \"\"\"Return the labels configured on a repository.\"\"\"\n+    request = urllib.request.Request(f\"{API}/repos/{repo}/labels\")\n+    request.add_header(\"Authorization\", f\"token {TOKEN}\")\n+    with urllib.request.urlopen(request) as response:\n+        return json.load(response)\n",
   "expect": [
    {
     "category": "secret",
     "id": "hardcoded-github-token",
     "line": 7,
     "path": "scripts/sync_labels.py",
     "rule_id": "A-SECRET-github_token",
     "severity": "critical",
     "why": "a credential is committed in source and must be rotated, not only deleted"
    }
   ],
   "files": [
    {
     "additions": 9,
     "deletions": 0,
     "hunks": [
      {
       "header": "",
       "lines": [
        {
         "kind": "ctx",
         "new_no": 4,
         "old_no": 4,
         "text": "import urllib.request"
        },
        {
         "kind": "ctx",
         "new_no": 5,
         "old_no": 5,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 6,
         "old_no": 6,
         "text": "API = \"https://api.github.com\""
        },
        {
         "kind": "add",
         "new_no": 7,
         "old_no": null,
         "text": "TOKEN = \"ghp_9f4b2c7e1a8d6350f2e1b4a7c9d0e3f5a1b2\""
        },
        {
         "kind": "add",
         "new_no": 8,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 9,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 10,
         "old_no": null,
         "text": "def fetch_labels(repo: str) -> list[dict]:"
        },
        {
         "kind": "add",
         "new_no": 11,
         "old_no": null,
         "text": "    \"\"\"Return the labels configured on a repository.\"\"\""
        },
        {
         "kind": "add",
         "new_no": 12,
         "old_no": null,
         "text": "    request = urllib.request.Request(f\"{API}/repos/{repo}/labels\")"
        },
        {
         "kind": "add",
         "new_no": 13,
         "old_no": null,
         "text": "    request.add_header(\"Authorization\", f\"token {TOKEN}\")"
        },
        {
         "kind": "add",
         "new_no": 14,
         "old_no": null,
         "text": "    with urllib.request.urlopen(request) as response:"
        },
        {
         "kind": "add",
         "new_no": 15,
         "old_no": null,
         "text": "        return json.load(response)"
        }
       ],
       "new_len": 12,
       "new_start": 4,
       "old_len": 3,
       "old_start": 4
      }
     ],
     "is_binary": false,
     "language": "python",
     "notes": [],
     "path": "scripts/sync_labels.py",
     "status": "modified"
    }
   ],
   "head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   "label": "A-SECRET-github_token",
   "name": "fx15",
   "observed": {
    "exact": true,
    "expected": 1,
    "hits": 1,
    "note": "one real defect: a GitHub token literal (ghp_...) is committed in source",
    "spurious": 0
   },
   "pr": 1,
   "ref": "chore/label-audit",
   "repo": "fake/fx15",
   "selector": "fake:fx15",
   "title": "Add a script to audit repository labels"
  },
  {
   "base_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "body": "Adds a retry helper for flaky outbound calls. It backs off linearly and gives up after a fixed number of attempts.\n\nUsed by the ingest worker.",
   "clean": true,
   "diff": "diff --git a/src/app/retry.py b/src/app/retry.py\nindex 1111111..2222222 100644\n--- a/src/app/retry.py\n+++ b/src/app/retry.py\n@@ -1,3 +1,33 @@\n \"\"\"Retry helpers for flaky calls.\"\"\"\n \n from __future__ import annotations\n+\n+import time\n+from collections.abc import Callable\n+from typing import TypeVar\n+\n+T = TypeVar(\"T\")\n+\n+MAX_ATTEMPTS = 5\n+BASE_DELAY = 0.25\n+\n+\n+def retry(\n+    operation: Callable[[], T],\n+    attempts: int = MAX_ATTEMPTS,\n+    delay: float = BASE_DELAY,\n+) -> T:\n+    \"\"\"Call ``operation`` until it succeeds or the attempt budget runs out.\"\"\"\n+    remaining = attempts\n+    last_error: Exception | None = None\n+    while remaining > 0:\n+        remaining -= 1\n+        try:\n+            return operation()\n+        except (ConnectionError, TimeoutError) as exc:\n+            last_error = exc\n+            if remaining:\n+                time.sleep(delay * (attempts - remaining))\n+    if last_error is not None:\n+        raise last_error\n+    raise RuntimeError(\"retry called with a non-positive attempt budget\")\n",
   "expect": [],
   "files": [
    {
     "additions": 30,
     "deletions": 0,
     "hunks": [
      {
       "header": "",
       "lines": [
        {
         "kind": "ctx",
         "new_no": 1,
         "old_no": 1,
         "text": "\"\"\"Retry helpers for flaky calls.\"\"\""
        },
        {
         "kind": "ctx",
         "new_no": 2,
         "old_no": 2,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 3,
         "old_no": 3,
         "text": "from __future__ import annotations"
        },
        {
         "kind": "add",
         "new_no": 4,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 5,
         "old_no": null,
         "text": "import time"
        },
        {
         "kind": "add",
         "new_no": 6,
         "old_no": null,
         "text": "from collections.abc import Callable"
        },
        {
         "kind": "add",
         "new_no": 7,
         "old_no": null,
         "text": "from typing import TypeVar"
        },
        {
         "kind": "add",
         "new_no": 8,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 9,
         "old_no": null,
         "text": "T = TypeVar(\"T\")"
        },
        {
         "kind": "add",
         "new_no": 10,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 11,
         "old_no": null,
         "text": "MAX_ATTEMPTS = 5"
        },
        {
         "kind": "add",
         "new_no": 12,
         "old_no": null,
         "text": "BASE_DELAY = 0.25"
        },
        {
         "kind": "add",
         "new_no": 13,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 14,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 15,
         "old_no": null,
         "text": "def retry("
        },
        {
         "kind": "add",
         "new_no": 16,
         "old_no": null,
         "text": "    operation: Callable[[], T],"
        },
        {
         "kind": "add",
         "new_no": 17,
         "old_no": null,
         "text": "    attempts: int = MAX_ATTEMPTS,"
        },
        {
         "kind": "add",
         "new_no": 18,
         "old_no": null,
         "text": "    delay: float = BASE_DELAY,"
        },
        {
         "kind": "add",
         "new_no": 19,
         "old_no": null,
         "text": ") -> T:"
        },
        {
         "kind": "add",
         "new_no": 20,
         "old_no": null,
         "text": "    \"\"\"Call ``operation`` until it succeeds or the attempt budget runs out.\"\"\""
        },
        {
         "kind": "add",
         "new_no": 21,
         "old_no": null,
         "text": "    remaining = attempts"
        },
        {
         "kind": "add",
         "new_no": 22,
         "old_no": null,
         "text": "    last_error: Exception | None = None"
        },
        {
         "kind": "add",
         "new_no": 23,
         "old_no": null,
         "text": "    while remaining > 0:"
        },
        {
         "kind": "add",
         "new_no": 24,
         "old_no": null,
         "text": "        remaining -= 1"
        },
        {
         "kind": "add",
         "new_no": 25,
         "old_no": null,
         "text": "        try:"
        },
        {
         "kind": "add",
         "new_no": 26,
         "old_no": null,
         "text": "            return operation()"
        },
        {
         "kind": "add",
         "new_no": 27,
         "old_no": null,
         "text": "        except (ConnectionError, TimeoutError) as exc:"
        },
        {
         "kind": "add",
         "new_no": 28,
         "old_no": null,
         "text": "            last_error = exc"
        },
        {
         "kind": "add",
         "new_no": 29,
         "old_no": null,
         "text": "            if remaining:"
        },
        {
         "kind": "add",
         "new_no": 30,
         "old_no": null,
         "text": "                time.sleep(delay * (attempts - remaining))"
        },
        {
         "kind": "add",
         "new_no": 31,
         "old_no": null,
         "text": "    if last_error is not None:"
        },
        {
         "kind": "add",
         "new_no": 32,
         "old_no": null,
         "text": "        raise last_error"
        },
        {
         "kind": "add",
         "new_no": 33,
         "old_no": null,
         "text": "    raise RuntimeError(\"retry called with a non-positive attempt budget\")"
        }
       ],
       "new_len": 33,
       "new_start": 1,
       "old_len": 3,
       "old_start": 1
      }
     ],
     "is_binary": false,
     "language": "python",
     "notes": [],
     "path": "src/app/retry.py",
     "status": "modified"
    }
   ],
   "head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   "label": "clean control",
   "name": "fx19",
   "observed": {
    "exact": true,
    "expected": 0,
    "hits": 0,
    "note": "clean control: adds a bounded retry helper; nothing to find",
    "spurious": 0
   },
   "pr": 1,
   "ref": "feature/retry-helper",
   "repo": "fake/fx19",
   "selector": "fake:fx19",
   "title": "Add a bounded retry helper"
  },
  {
   "base_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "body": "Wraps the status endpoint so callers get a decoded document instead of a raw response.\n\nRequests are bounded by a timeout and errors are raised to the caller.",
   "clean": true,
   "diff": "diff --git a/src/app/http_client.py b/src/app/http_client.py\nindex 1111111..2222222 100644\n--- a/src/app/http_client.py\n+++ b/src/app/http_client.py\n@@ -1,3 +1,33 @@\n \"\"\"HTTP helpers for the status dashboard.\"\"\"\n \n from __future__ import annotations\n+\n+import logging\n+from collections.abc import Iterable\n+from typing import Any\n+\n+import requests\n+\n+logger = logging.getLogger(__name__)\n+\n+\n+def fetch_status(base_url: str, service: str) -> dict[str, Any]:\n+    \"\"\"Fetch the status document for one service.\"\"\"\n+    url = f\"{base_url.rstrip('/')}/status/{service}\"\n+    response = requests.get(url, timeout=10)\n+    response.raise_for_status()\n+    payload = response.json()\n+    if not isinstance(payload, dict):\n+        raise ValueError(\"the status endpoint did not return a JSON object\")\n+    return payload\n+\n+\n+def fetch_services(base_url: str, services: Iterable[str]) -> dict[str, dict[str, Any]]:\n+    \"\"\"Fetch several services, leaving out the ones that do not answer.\"\"\"\n+    statuses: dict[str, dict[str, Any]] = {}\n+    for service in services:\n+        try:\n+            statuses[service] = fetch_status(base_url, service)\n+        except requests.RequestException as exc:\n+            logger.warning(\"status request for %s failed: %s\", service, exc)\n+    return statuses\n",
   "expect": [],
   "files": [
    {
     "additions": 30,
     "deletions": 0,
     "hunks": [
      {
       "header": "",
       "lines": [
        {
         "kind": "ctx",
         "new_no": 1,
         "old_no": 1,
         "text": "\"\"\"HTTP helpers for the status dashboard.\"\"\""
        },
        {
         "kind": "ctx",
         "new_no": 2,
         "old_no": 2,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 3,
         "old_no": 3,
         "text": "from __future__ import annotations"
        },
        {
         "kind": "add",
         "new_no": 4,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 5,
         "old_no": null,
         "text": "import logging"
        },
        {
         "kind": "add",
         "new_no": 6,
         "old_no": null,
         "text": "from collections.abc import Iterable"
        },
        {
         "kind": "add",
         "new_no": 7,
         "old_no": null,
         "text": "from typing import Any"
        },
        {
         "kind": "add",
         "new_no": 8,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 9,
         "old_no": null,
         "text": "import requests"
        },
        {
         "kind": "add",
         "new_no": 10,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 11,
         "old_no": null,
         "text": "logger = logging.getLogger(__name__)"
        },
        {
         "kind": "add",
         "new_no": 12,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 13,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 14,
         "old_no": null,
         "text": "def fetch_status(base_url: str, service: str) -> dict[str, Any]:"
        },
        {
         "kind": "add",
         "new_no": 15,
         "old_no": null,
         "text": "    \"\"\"Fetch the status document for one service.\"\"\""
        },
        {
         "kind": "add",
         "new_no": 16,
         "old_no": null,
         "text": "    url = f\"{base_url.rstrip('/')}/status/{service}\""
        },
        {
         "kind": "add",
         "new_no": 17,
         "old_no": null,
         "text": "    response = requests.get(url, timeout=10)"
        },
        {
         "kind": "add",
         "new_no": 18,
         "old_no": null,
         "text": "    response.raise_for_status()"
        },
        {
         "kind": "add",
         "new_no": 19,
         "old_no": null,
         "text": "    payload = response.json()"
        },
        {
         "kind": "add",
         "new_no": 20,
         "old_no": null,
         "text": "    if not isinstance(payload, dict):"
        },
        {
         "kind": "add",
         "new_no": 21,
         "old_no": null,
         "text": "        raise ValueError(\"the status endpoint did not return a JSON object\")"
        },
        {
         "kind": "add",
         "new_no": 22,
         "old_no": null,
         "text": "    return payload"
        },
        {
         "kind": "add",
         "new_no": 23,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 24,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 25,
         "old_no": null,
         "text": "def fetch_services(base_url: str, services: Iterable[str]) -> dict[str, dict[str, Any]]:"
        },
        {
         "kind": "add",
         "new_no": 26,
         "old_no": null,
         "text": "    \"\"\"Fetch several services, leaving out the ones that do not answer.\"\"\""
        },
        {
         "kind": "add",
         "new_no": 27,
         "old_no": null,
         "text": "    statuses: dict[str, dict[str, Any]] = {}"
        },
        {
         "kind": "add",
         "new_no": 28,
         "old_no": null,
         "text": "    for service in services:"
        },
        {
         "kind": "add",
         "new_no": 29,
         "old_no": null,
         "text": "        try:"
        },
        {
         "kind": "add",
         "new_no": 30,
         "old_no": null,
         "text": "            statuses[service] = fetch_status(base_url, service)"
        },
        {
         "kind": "add",
         "new_no": 31,
         "old_no": null,
         "text": "        except requests.RequestException as exc:"
        },
        {
         "kind": "add",
         "new_no": 32,
         "old_no": null,
         "text": "            logger.warning(\"status request for %s failed: %s\", service, exc)"
        },
        {
         "kind": "add",
         "new_no": 33,
         "old_no": null,
         "text": "    return statuses"
        }
       ],
       "new_len": 33,
       "new_start": 1,
       "old_len": 3,
       "old_start": 1
      }
     ],
     "is_binary": false,
     "language": "python",
     "notes": [],
     "path": "src/app/http_client.py",
     "status": "modified"
    }
   ],
   "head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   "label": "clean control",
   "name": "fx20",
   "observed": {
    "exact": true,
    "expected": 0,
    "hits": 0,
    "note": "clean control: adds a small HTTP client with a timeout and raise_for_status; nothing to find",
    "spurious": 0
   },
   "pr": 1,
   "ref": "feature/status-client",
   "repo": "fake/fx20",
   "selector": "fake:fx20",
   "title": "Add a small status client"
  },
  {
   "base_sha": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
   "body": "Adds an email lookup alongside the existing id lookup.\n\nRefs #12",
   "clean": true,
   "diff": "diff --git a/src/app/users.py b/src/app/users.py\nindex 1111111..2222222 100644\n--- a/src/app/users.py\n+++ b/src/app/users.py\n@@ -1,7 +1,18 @@\n from __future__ import annotations\n \n from app.db import connect\n \n \n def get_user(user_id: int):\n     return connect().query(\"SELECT * FROM users WHERE id = ?\", (user_id,))\n+\n+\n+def get_user_by_email(email: str):\n+    \"\"\"Return the row for ``email``, or None when no such user exists.\"\"\"\n+    sql = \"SELECT * FROM users WHERE email = ?\"\n+    return connect().query(sql, (email,))\n+\n+\n+def is_admin(user) -> bool:\n+    \"\"\"Return True when the user record carries the admin role.\"\"\"\n+    return user.get(\"role\") == \"admin\"\n",
   "expect": [],
   "files": [
    {
     "additions": 11,
     "deletions": 0,
     "hunks": [
      {
       "header": "",
       "lines": [
        {
         "kind": "ctx",
         "new_no": 1,
         "old_no": 1,
         "text": "from __future__ import annotations"
        },
        {
         "kind": "ctx",
         "new_no": 2,
         "old_no": 2,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 3,
         "old_no": 3,
         "text": "from app.db import connect"
        },
        {
         "kind": "ctx",
         "new_no": 4,
         "old_no": 4,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 5,
         "old_no": 5,
         "text": ""
        },
        {
         "kind": "ctx",
         "new_no": 6,
         "old_no": 6,
         "text": "def get_user(user_id: int):"
        },
        {
         "kind": "ctx",
         "new_no": 7,
         "old_no": 7,
         "text": "    return connect().query(\"SELECT * FROM users WHERE id = ?\", (user_id,))"
        },
        {
         "kind": "add",
         "new_no": 8,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 9,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 10,
         "old_no": null,
         "text": "def get_user_by_email(email: str):"
        },
        {
         "kind": "add",
         "new_no": 11,
         "old_no": null,
         "text": "    \"\"\"Return the row for ``email``, or None when no such user exists.\"\"\""
        },
        {
         "kind": "add",
         "new_no": 12,
         "old_no": null,
         "text": "    sql = \"SELECT * FROM users WHERE email = ?\""
        },
        {
         "kind": "add",
         "new_no": 13,
         "old_no": null,
         "text": "    return connect().query(sql, (email,))"
        },
        {
         "kind": "add",
         "new_no": 14,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 15,
         "old_no": null,
         "text": ""
        },
        {
         "kind": "add",
         "new_no": 16,
         "old_no": null,
         "text": "def is_admin(user) -> bool:"
        },
        {
         "kind": "add",
         "new_no": 17,
         "old_no": null,
         "text": "    \"\"\"Return True when the user record carries the admin role.\"\"\""
        },
        {
         "kind": "add",
         "new_no": 18,
         "old_no": null,
         "text": "    return user.get(\"role\") == \"admin\""
        }
       ],
       "new_len": 18,
       "new_start": 1,
       "old_len": 7,
       "old_start": 1
      }
     ],
     "is_binary": false,
     "language": "python",
     "notes": [],
     "path": "src/app/users.py",
     "status": "modified"
    }
   ],
   "head_sha": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
   "label": "clean control",
   "name": "fx24",
   "observed": {
    "exact": true,
    "expected": 0,
    "hits": 0,
    "note": "clean control: adds a parameterised email lookup; nothing to find",
    "spurious": 0
   },
   "pr": 1,
   "ref": "feature/user-lookup",
   "repo": "fake/fx24",
   "selector": "fake:fx24",
   "title": "Add user lookup by email"
  }
 ],
 "source": {
  "clean_controls": 4,
  "commit": "095af87559d8e71860a5616a18a4258c59214131",
  "commit_date": "2026-11-29T09:44:58Z",
  "diffs": "parsed by vigil.forge.diff.parse_unified_diff, the same parser the analyzers use",
  "labelled_defects": 10,
  "labels": "fixtures/expected.json and fixtures/<name>/expected.json, merged by vigil.eval.score.load_expected",
  "observed": "uv run --quiet vigil score --mode offline"
 }
}
