{
  "id": "coding",
  "category": "Coding",
  "number": "01",
  "title": "Audit a legacy data pipeline",
  "eyebrow": "Repository reasoning",
  "description": "Recover dependencies, trace table lineage, and find the job that never runs.",
  "brief": "A small analytics pipeline has lost its owner. Inspect the four-file workspace and produce a machine-readable audit without running the scheduled jobs.",
  "skills": [
    "Code understanding",
    "Dependency mapping",
    "Structured output"
  ],
  "requirements": [
    "Inventory every provided file using an absolute /workspace path.",
    "List existing file-to-file dependencies and raw-to-derived table lineage.",
    "Report the missing scheduled job with a file-and-line evidence reference.",
    "Submit audit.json with exactly inventory, dependency_edges, table_lineage, and findings. Array order does not matter."
  ],
  "files": [
    {
      "path": "workspace/crontab",
      "language": "cron",
      "content": "0 2 * * * python3 /workspace/jobs/load_orders.py\n30 2 * * * python3 /workspace/jobs/send_digest.py\n"
    },
    {
      "path": "workspace/jobs/load_orders.py",
      "language": "python",
      "content": "from pathlib import Path\nimport json\n\nCONFIG = Path(__file__).parent.parent / \"config\" / \"warehouse.json\"\nQUERY = \"INSERT INTO daily_orders SELECT order_id, total FROM raw_orders\"\n\n\ndef build_job():\n    config = json.loads(CONFIG.read_text())\n    return {\"database\": config[\"database\"], \"query\": QUERY}\n\n\nif __name__ == \"__main__\":\n    print(json.dumps(build_job()))\n"
    },
    {
      "path": "workspace/config/warehouse.json",
      "language": "json",
      "content": "{\n  \"database\": \"analytics\",\n  \"mode\": \"append\",\n  \"owner\": \"data-platform\"\n}\n"
    },
    {
      "path": "workspace/schema.json",
      "language": "json",
      "content": "{\n  \"raw_orders\": [\"order_id\", \"total\"],\n  \"daily_orders\": [\"order_id\", \"total\"]\n}\n"
    }
  ],
  "outputs": [
    {
      "path": "reference/audit.json",
      "language": "json",
      "content": "{\n  \"inventory\": [\n    \"/workspace/config/warehouse.json\",\n    \"/workspace/crontab\",\n    \"/workspace/jobs/load_orders.py\",\n    \"/workspace/schema.json\"\n  ],\n  \"dependency_edges\": [\n    {\n      \"from\": \"/workspace/crontab\",\n      \"to\": \"/workspace/jobs/load_orders.py\"\n    },\n    {\n      \"from\": \"/workspace/jobs/load_orders.py\",\n      \"to\": \"/workspace/config/warehouse.json\"\n    }\n  ],\n  \"table_lineage\": [\n    {\n      \"source\": \"raw_orders\",\n      \"target\": \"daily_orders\",\n      \"operation\": \"INSERT\"\n    }\n  ],\n  \"findings\": [\n    {\n      \"type\": \"missing_scheduled_job\",\n      \"path\": \"/workspace/jobs/send_digest.py\",\n      \"evidence\": \"/workspace/crontab:2\"\n    }\n  ]\n}\n"
    }
  ],
  "rubric": [
    {
      "label": "Complete inventory",
      "points": 20,
      "detail": "All four files appear once, using the required absolute paths."
    },
    {
      "label": "Dependency graph",
      "points": 25,
      "detail": "Both existing-file edges are present; the missing job is not treated as an existing node."
    },
    {
      "label": "Table lineage",
      "points": 20,
      "detail": "raw_orders \u2192 daily_orders is correctly identified as an INSERT operation."
    },
    {
      "label": "Evidence-backed finding",
      "points": 25,
      "detail": "The missing send_digest.py job is tied to line 2 of the crontab."
    },
    {
      "label": "Output contract",
      "points": 10,
      "detail": "The JSON contains exactly the four specified top-level keys."
    }
  ],
  "evaluationNote": "Deterministic validator included. Run it locally against a submitted audit; this preview shows the reference artifact, not a model run.",
  "command": "python3 grader.py reference/audit.json",
  "packageHref": "/samples/coding-audit.zip",
  "jsonHref": "/samples/coding-audit.json",
  "notice": "Illustrative sample \u00b7 Original fictional inputs and reference output.",
  "instruction": "# Audit a legacy data pipeline\n\nIllustrative sample \u00b7 Original fictional inputs and reference output.\n\nA small analytics pipeline has lost its owner. Inspect the four-file workspace and produce a machine-readable audit without running the scheduled jobs.\n\n## Task\n\n1. Inventory every provided file using an absolute /workspace path.\n2. List existing file-to-file dependencies and raw-to-derived table lineage.\n3. Report the missing scheduled job with a file-and-line evidence reference.\n4. Submit audit.json with exactly inventory, dependency_edges, table_lineage, and findings. Array order does not matter.\n\n## Evaluation\n\nDeterministic validator included. Run it locally against a submitted audit; this preview shows the reference artifact, not a model run.\n\n```sh\npython3 grader.py reference/audit.json\n```\n\nReference artifacts are an answer key. Exclude reference/ and rubric.json from model inputs when measuring independent task performance.\n",
  "extraFiles": [
    {
      "path": "grader.py",
      "language": "python",
      "content": "\"\"\"Check this fixture's output contract. Python 3, standard library only.\"\"\"\nimport json\nimport sys\nfrom pathlib import Path\n\nreference = json.loads((Path(__file__).parent / \"reference\" / \"audit.json\").read_text())\ncandidate = json.loads(Path(sys.argv[1]).read_text())\n\ndef normalized(items):\n    return sorted(json.dumps(item, sort_keys=True) for item in items)\n\nchecks = [\n    (\"Exact output schema\", 10, isinstance(candidate, dict) and set(candidate) == set(reference)),\n    (\"Complete artifact inventory\", 20, normalized(candidate.get(\"inventory\", [])) == normalized(reference[\"inventory\"])),\n    (\"Existing-file dependencies\", 25, normalized(candidate.get(\"dependency_edges\", [])) == normalized(reference[\"dependency_edges\"])),\n    (\"Source-to-target lineage\", 20, normalized(candidate.get(\"table_lineage\", [])) == normalized(reference[\"table_lineage\"])),\n    (\"Missing-job evidence\", 25, normalized(candidate.get(\"findings\", [])) == normalized(reference[\"findings\"])),\n]\nscore = sum(points for _, points, passed in checks if passed)\nprint(json.dumps({\"score\": score, \"possible\": 100, \"checks\": [\n    {\"name\": name, \"points\": points, \"passed\": passed} for name, points, passed in checks\n]}, indent=2))\nsys.exit(0 if score == 100 else 1)\n"
    }
  ],
  "provenance": "# Sample provenance\n\nThis package contains a synthetic demonstration for the Commorai website. Its task inputs, names, values, code, and reference outputs are illustrative examples, not customer work or measured model results.\n\nReference outputs are answer keys for the supplied fictional inputs. They demonstrate the expected deliverable format and do not report an independently evaluated model response.\n"
}
