{
  "answers": {
    "c00": {
      "noul": 0.99,
      "type": "noul"
    },
    "c01": {
      "noul": 0.99,
      "type": "noul"
    },
    "c02": {
      "noul": 0.99,
      "type": "noul"
    },
    "c03": {
      "noul": 0.99,
      "type": "noul"
    },
    "c04": {
      "noul": 0.99,
      "type": "noul"
    },
    "c05": {
      "noul": 0.99,
      "type": "noul"
    },
    "c06": {
      "noul": 0.99,
      "type": "noul"
    },
    "c07": {
      "noul": 0.99,
      "type": "noul"
    },
    "c08": {
      "noul": 0.99,
      "type": "noul"
    },
    "c09": {
      "noul": 0.99,
      "type": "noul"
    },
    "c10": {
      "noul": 0.85,
      "type": "noul"
    },
    "w00": {
      "noul": 0.95,
      "type": "noul"
    },
    "w01": {
      "noul": 0.97,
      "type": "noul"
    },
    "w02": {
      "noul": 0.95,
      "type": "noul"
    },
    "w03": {
      "noul": 0.97,
      "type": "noul"
    },
    "w04": {
      "noul": 0.99,
      "type": "noul"
    },
    "w05": {
      "noul": 0.99,
      "type": "noul"
    },
    "w06": {
      "noul": 0.9,
      "type": "noul"
    },
    "w07": {
      "noul": 0.89,
      "type": "noul"
    },
    "w08": {
      "noul": 0.87,
      "type": "noul"
    }
  },
  "asked_at": "2026-11-23T03:05:03Z",
  "endpoint": "https://api.typesafe.ai/v1/systemone",
  "errors_helpful": [
    {
      "call": 0,
      "noul": 0.99,
      "question": "c00"
    },
    {
      "call": 1,
      "noul": 0.99,
      "question": "c01"
    },
    {
      "call": 2,
      "noul": 0.99,
      "question": "c02"
    },
    {
      "call": 3,
      "noul": 0.99,
      "question": "c03"
    },
    {
      "call": 4,
      "noul": 0.99,
      "question": "c04"
    },
    {
      "call": 5,
      "noul": 0.99,
      "question": "c05"
    },
    {
      "call": 6,
      "noul": 0.99,
      "question": "c06"
    },
    {
      "call": 7,
      "noul": 0.99,
      "question": "c07"
    },
    {
      "call": 8,
      "noul": 0.99,
      "question": "c08"
    },
    {
      "call": 9,
      "noul": 0.99,
      "question": "c09"
    },
    {
      "call": 10,
      "noul": 0.85,
      "question": "c10"
    }
  ],
  "format": "didrun.judgments.v1",
  "input_tokens": 18557,
  "method": "0.15.0",
  "model": "jev-1.14.0",
  "model_asked": "jev-1.14.0",
  "request": {
    "model": "jev-1.14.0",
    "questions": {
      "c00": {
        "criteria": {
          "false": "The reply names no argument of the tool: for example a generic failure, a stack trace with no argument named, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply names at least one argument of the tool that the call left out or got wrong, and so tells the caller what to change."
        },
        "instructions": {
          "arguments_sent": {},
          "question": "Does `reply` name an argument that the call must add or fix?",
          "reply": "Error executing tool explain_rule: 1 validation error for explain_ruleArguments\ncode\n  Field required [type=missing, input_value={}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.14/v/missing",
          "tool": "explain_rule"
        },
        "type": "noul"
      },
      "c01": {
        "criteria": {
          "false": "The reply does not point to `parameter`: for example a generic failure, an error about another argument, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply points to `parameter` or to its value and says the value has the wrong type or is not accepted."
        },
        "instructions": {
          "arguments_sent": {
            "code": {}
          },
          "parameter": "code",
          "question": "Does `reply` tell the caller that `parameter` has a value the tool does not accept?",
          "reply": "Error executing tool explain_rule: 1 validation error for explain_ruleArguments\ncode\n  Input should be a valid string [type=string_type, input_value={}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.14/v/string_type",
          "tool": "explain_rule"
        },
        "type": "noul"
      },
      "c02": {
        "criteria": {
          "false": "The reply names no argument of the tool: for example a generic failure, a stack trace with no argument named, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply names at least one argument of the tool that the call left out or got wrong, and so tells the caller what to change."
        },
        "instructions": {
          "arguments_sent": {},
          "question": "Does `reply` name an argument that the call must add or fix?",
          "reply": "Error executing tool contract_reference: 1 validation error for contract_referenceArguments\ntopic\n  Field required [type=missing, input_value={}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.14/v/missing",
          "tool": "contract_reference"
        },
        "type": "noul"
      },
      "c03": {
        "criteria": {
          "false": "The reply does not point to `parameter`: for example a generic failure, an error about another argument, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply points to `parameter` or to its value and says the value has the wrong type or is not accepted."
        },
        "instructions": {
          "arguments_sent": {
            "topic": {}
          },
          "parameter": "topic",
          "question": "Does `reply` tell the caller that `parameter` has a value the tool does not accept?",
          "reply": "Error executing tool contract_reference: 1 validation error for contract_referenceArguments\ntopic\n  Input should be a valid string [type=string_type, input_value={}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.14/v/string_type",
          "tool": "contract_reference"
        },
        "type": "noul"
      },
      "c04": {
        "criteria": {
          "false": "The reply names no argument of the tool: for example a generic failure, a stack trace with no argument named, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply names at least one argument of the tool that the call left out or got wrong, and so tells the caller what to change."
        },
        "instructions": {
          "arguments_sent": {},
          "question": "Does `reply` name an argument that the call must add or fix?",
          "reply": "Error executing tool export_odcs: 1 validation error for export_odcsArguments\npath\n  Field required [type=missing, input_value={}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.14/v/missing",
          "tool": "export_odcs"
        },
        "type": "noul"
      },
      "c05": {
        "criteria": {
          "false": "The reply does not point to `parameter`: for example a generic failure, an error about another argument, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply points to `parameter` or to its value and says the value has the wrong type or is not accepted."
        },
        "instructions": {
          "arguments_sent": {
            "path": {}
          },
          "parameter": "path",
          "question": "Does `reply` tell the caller that `parameter` has a value the tool does not accept?",
          "reply": "Error executing tool export_odcs: 1 validation error for export_odcsArguments\npath\n  Input should be a valid string [type=string_type, input_value={}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.14/v/string_type",
          "tool": "export_odcs"
        },
        "type": "noul"
      },
      "c06": {
        "criteria": {
          "false": "The reply names no argument of the tool: for example a generic failure, a stack trace with no argument named, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply names at least one argument of the tool that the call left out or got wrong, and so tells the caller what to change."
        },
        "instructions": {
          "arguments_sent": {},
          "question": "Does `reply` name an argument that the call must add or fix?",
          "reply": "Error executing tool generate_test_data: 1 validation error for generate_test_dataArguments\npath\n  Field required [type=missing, input_value={}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.14/v/missing",
          "tool": "generate_test_data"
        },
        "type": "noul"
      },
      "c07": {
        "criteria": {
          "false": "The reply does not point to `parameter`: for example a generic failure, an error about another argument, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply points to `parameter` or to its value and says the value has the wrong type or is not accepted."
        },
        "instructions": {
          "arguments_sent": {
            "path": {}
          },
          "parameter": "path",
          "question": "Does `reply` tell the caller that `parameter` has a value the tool does not accept?",
          "reply": "Error executing tool generate_test_data: 1 validation error for generate_test_dataArguments\npath\n  Input should be a valid string [type=string_type, input_value={}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.14/v/string_type",
          "tool": "generate_test_data"
        },
        "type": "noul"
      },
      "c08": {
        "criteria": {
          "false": "The reply names no argument of the tool: for example a generic failure, a stack trace with no argument named, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply names at least one argument of the tool that the call left out or got wrong, and so tells the caller what to change."
        },
        "instructions": {
          "arguments_sent": {},
          "question": "Does `reply` name an argument that the call must add or fix?",
          "reply": "Error executing tool run_contract: 2 validation errors for run_contractArguments\npath\n  Field required [type=missing, input_value={}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.14/v/missing\nsource\n  Field required [type=missing, input_value={}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.14/v/missing",
          "tool": "run_contract"
        },
        "type": "noul"
      },
      "c09": {
        "criteria": {
          "false": "The reply does not point to `parameter`: for example a generic failure, an error about another argument, an error from a service the tool tried to reach, or a normal answer.",
          "true": "The reply points to `parameter` or to its value and says the value has the wrong type or is not accepted."
        },
        "instructions": {
          "arguments_sent": {
            "path": {},
            "source": "didrun"
          },
          "parameter": "path",
          "question": "Does `reply` tell the caller that `parameter` has a value the tool does not accept?",
          "reply": "Error executing tool run_contract: 1 validation error for run_contractArguments\npath\n  Input should be a valid string [type=string_type, input_value={}, input_type=dict]\n    For further information visit https://errors.pydantic.dev/2.14/v/string_type",
          "tool": "run_contract"
        },
        "type": "noul"
      },
      "c10": {
        "criteria": {
          "false": "The reply does not say the tool is missing: for example a generic failure, a crash, or a normal answer.",
          "true": "The reply says the tool is unknown, not found, or does not exist."
        },
        "instructions": {
          "arguments_sent": {},
          "question": "Does `reply` tell the caller that there is no tool named `tool`?",
          "reply": "Unknown tool: didrun_unknown_tool",
          "tool": "didrun_unknown_tool"
        },
        "type": "noul"
      },
      "w00": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "The contract is **invalid**.\n\n- **Location:** `<root>`\n- **Error:** Unknown key `unknown_top_level_key` is not permitted in a canonical Open Lakehouse Contract.",
          "done_when": "The transcript shows a validate_contract reply for the supplied YAML with the validity result and any reported errors.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {
                "contract_yaml": "unknown_top_level_key: true"
              },
              "reply": "{\n  \"contract\": \"inline contract\",\n  \"valid\": false,\n  \"errors\": [\n    {\n      \"location\": \"<root>\",\n      \"problem\": \"Value error, unknown key(s) not permitted in canonical OLC contract: unknown_top_level_key\"\n    }\n  ]\n}",
              "tool": "validate_contract"
            }
          ],
          "task": "Validate this Open Lakehouse Contract YAML and report whether it is valid, including any errors and their locations:\n```yaml\nunknown_top_level_key: true\n```"
        },
        "type": "noul"
      },
      "w01": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "The contract is **invalid**. Validation reported one error:\n\n- **Location:** `<root>`\n- **Problem:** `unknown_top_level_key` is not permitted in a canonical Open Lakehouse Contract.",
          "done_when": "The transcript shows a validate_contract reply for the supplied YAML with the validity result and any reported errors.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {
                "contract_yaml": "unknown_top_level_key: true"
              },
              "reply": "{\n  \"contract\": \"inline contract\",\n  \"valid\": false,\n  \"errors\": [\n    {\n      \"location\": \"<root>\",\n      \"problem\": \"Value error, unknown key(s) not permitted in canonical OLC contract: unknown_top_level_key\"\n    }\n  ]\n}",
              "tool": "validate_contract"
            }
          ],
          "task": "Validate this Open Lakehouse Contract YAML and report whether it is valid, including any errors and their locations:\n```yaml\nunknown_top_level_key: true\n```"
        },
        "type": "noul"
      },
      "w02": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "The contract is **invalid**.\n\n- **Location:** `<root>`\n- **Error:** Unknown key `unknown_top_level_key` is not permitted in a canonical Open Lakehouse Contract.",
          "done_when": "The transcript shows a validate_contract reply for the supplied YAML with the validity result and any reported errors.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {
                "contract_yaml": "unknown_top_level_key: true"
              },
              "reply": "{\n  \"contract\": \"inline contract\",\n  \"valid\": false,\n  \"errors\": [\n    {\n      \"location\": \"<root>\",\n      \"problem\": \"Value error, unknown key(s) not permitted in canonical OLC contract: unknown_top_level_key\"\n    }\n  ]\n}",
              "tool": "validate_contract"
            }
          ],
          "task": "Validate this Open Lakehouse Contract YAML and report whether it is valid, including any errors and their locations:\n```yaml\nunknown_top_level_key: true\n```"
        },
        "type": "noul"
      },
      "w03": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "## KEY-002: Deduplicate sorted by its own key\n\n**Severity: critical.** This rule flags a `deduplicate` transformation when every column in `sort_by` is also part of the `on` key.\n\nRows in a duplicate group all have the same key, so sorting by that key does not distinguish them. The surviving row is therefore arbitrary, even though the contract appears to specify an ordering. Instead, sort by a column that can differ between duplicates—typically a version or update timestamp.\n\n### Failing contract\n\nHere, `sort_by: [trip_id]` cannot distinguish rows with the same `trip_id`:\n\n```yaml\nversion: 1.0.0\ninfo: { title: Trips, table_name: trips }\nmodel:\n  fields:\n    - { name: trip_id, type: string, required: true }\n    - { name: fare, type: float }\n    - { name: updated_at, type: timestamp }\nprimary_key: [trip_id]\ntransformations:\n  - deduplicate: { on: [trip_id], sort_by: [trip_id] }\n```\n\n### Fixed contract\n\nSorting by `updated_at` in descending order selects the most recently updated row, provided timestamps distinguish the duplicates:\n\n```yaml\nversion: 1.0.0\ninfo: { title: Trips, table_name: trips }\nmodel:\n  fields:\n    - { name: trip_id, type: string, required: true }\n    - { name: fare, type: float }\n    - { name: updated_at, type: timestamp }\nprimary_key: [trip_id]\ntransformations:\n  - deduplicate: { on: [trip_id], sort_by: [updated_at], order: desc }\n```\n\nIf duplicate rows can share the same `updated_at`, an additional tie-breaker may be needed for a deterministic choice.",
          "done_when": "The transcript shows the explain_rule reply for KEY-002, including the rule explanation and contract examples.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {
                "code": "KEY-002"
              },
              "reply": "{\n  \"rule\": \"KEY-002\",\n  \"title\": \"Deduplicate sorted by its own key\",\n  \"severity\": \"critical\",\n  \"checks\": \"A `deduplicate` whose `sort_by` columns are all inside its `on` key.\",\n  \"why\": \"Every row in a duplicate group has the same key, so sorting by the key orders nothing. The surviving row is as arbitrary as with no `sort_by` at all, but the contract now looks correct. Sort by a column that differs between duplicates, normally the record's version time.\",\n  \"failing_example\": \"version: 1.0.0\\ninfo: { title: Trips, table_name: trips }\\nmodel:\\n  fields:\\n    - { name: trip_id, type: string, required: true }\\n    - { name: fare, type: float }\\n    - { name: updated_at, type: timestamp }\\nprimary_key: [trip_id]\\ntransformations:\\n  - deduplicate: { on: [trip_id], sort_by: [trip_id] }\\n\",\n  \"fixed_example\": \"version: 1.0.0\\ninfo: { title: Trips, table_name: trips }\\nmodel:\\n  fields:\\n    - { name: trip_id, type: string, required: true }\\n    - { name: fare, type: float }\\n    - { name: updated_at, type: timestamp }\\nprimary_key: [trip_id]\\ntransformations:\\n  - deduplicate: { on: [trip_id], sort_by: [updated_at], order: desc }\\n\",\n  \"fixed_example_is_standard_olc\": true\n}",
              "tool": "explain_rule"
            }
          ],
          "task": "Explain the LakeLogic lint rule KEY-002, including what it checks, why it matters, and examples of a failing and fixed contract."
        },
        "type": "noul"
      },
      "w04": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "## KEY-002: Deduplicate sorted by its own key\n\n**Severity: critical**\n\nKEY-002 flags a `deduplicate` transformation when every column in `sort_by` is also in its `on` key.\n\nThis matters because all rows in a duplicate group have the same key values. Sorting by those values cannot distinguish the rows, so the surviving row may be arbitrary—even though the contract appears to specify an order. Instead, sort by a column that can differ between duplicates, typically a record version timestamp.\n\n### Failing contract\n\nHere, duplicate rows are grouped and sorted by `trip_id`, so the sort does not distinguish them:\n\n```yaml\nversion: 1.0.0\ninfo: { title: Trips, table_name: trips }\nmodel:\n  fields:\n    - { name: trip_id, type: string, required: true }\n    - { name: fare, type: float }\n    - { name: updated_at, type: timestamp }\nprimary_key: [trip_id]\ntransformations:\n  - deduplicate: { on: [trip_id], sort_by: [trip_id] }\n```\n\n### Fixed contract\n\nThis version sorts by `updated_at` in descending order, so the most recently updated row is selected:\n\n```yaml\nversion: 1.0.0\ninfo: { title: Trips, table_name: trips }\nmodel:\n  fields:\n    - { name: trip_id, type: string, required: true }\n    - { name: fare, type: float }\n    - { name: updated_at, type: timestamp }\nprimary_key: [trip_id]\ntransformations:\n  - deduplicate: { on: [trip_id], sort_by: [updated_at], order: desc }\n```\n\nIf duplicate rows can share the same `updated_at`, use an additional tie-breaker that distinguishes them to make the selection deterministic.",
          "done_when": "The transcript shows the explain_rule reply for KEY-002, including the rule explanation and contract examples.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {
                "code": "KEY-002"
              },
              "reply": "{\n  \"rule\": \"KEY-002\",\n  \"title\": \"Deduplicate sorted by its own key\",\n  \"severity\": \"critical\",\n  \"checks\": \"A `deduplicate` whose `sort_by` columns are all inside its `on` key.\",\n  \"why\": \"Every row in a duplicate group has the same key, so sorting by the key orders nothing. The surviving row is as arbitrary as with no `sort_by` at all, but the contract now looks correct. Sort by a column that differs between duplicates, normally the record's version time.\",\n  \"failing_example\": \"version: 1.0.0\\ninfo: { title: Trips, table_name: trips }\\nmodel:\\n  fields:\\n    - { name: trip_id, type: string, required: true }\\n    - { name: fare, type: float }\\n    - { name: updated_at, type: timestamp }\\nprimary_key: [trip_id]\\ntransformations:\\n  - deduplicate: { on: [trip_id], sort_by: [trip_id] }\\n\",\n  \"fixed_example\": \"version: 1.0.0\\ninfo: { title: Trips, table_name: trips }\\nmodel:\\n  fields:\\n    - { name: trip_id, type: string, required: true }\\n    - { name: fare, type: float }\\n    - { name: updated_at, type: timestamp }\\nprimary_key: [trip_id]\\ntransformations:\\n  - deduplicate: { on: [trip_id], sort_by: [updated_at], order: desc }\\n\",\n  \"fixed_example_is_standard_olc\": true\n}",
              "tool": "explain_rule"
            }
          ],
          "task": "Explain the LakeLogic lint rule KEY-002, including what it checks, why it matters, and examples of a failing and fixed contract."
        },
        "type": "noul"
      },
      "w05": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "## KEY-002: Deduplicate sorted by its own key\n\n**Severity: critical.** KEY-002 flags a `deduplicate` transformation when every column in `sort_by` is also in its `on` key.\n\nWithin a duplicate group, the key columns have the same values for every row. Sorting by those columns therefore does not determine which row survives. The result is as arbitrary as deduplicating without a sort order, even though the contract appears to specify one.\n\n### Failing example\n\nThis contract groups duplicates by `trip_id` and also sorts by `trip_id`:\n\n```yaml\nversion: 1.0.0\ninfo: { title: Trips, table_name: trips }\nmodel:\n  fields:\n    - { name: trip_id, type: string, required: true }\n    - { name: fare, type: float }\n    - { name: updated_at, type: timestamp }\nprimary_key: [trip_id]\ntransformations:\n  - deduplicate: { on: [trip_id], sort_by: [trip_id] }\n```\n\n### Fixed example\n\nSort by a column that can differ between duplicates, such as a record’s update time. Here, descending order selects the most recently updated row:\n\n```yaml\nversion: 1.0.0\ninfo: { title: Trips, table_name: trips }\nmodel:\n  fields:\n    - { name: trip_id, type: string, required: true }\n    - { name: fare, type: float }\n    - { name: updated_at, type: timestamp }\nprimary_key: [trip_id]\ntransformations:\n  - deduplicate: { on: [trip_id], sort_by: [updated_at], order: desc }\n```\n\nIf duplicate rows can share the same `updated_at`, consider an additional tie-breaker that distinguishes them.",
          "done_when": "The transcript shows the explain_rule reply for KEY-002, including the rule explanation and contract examples.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {
                "code": "KEY-002"
              },
              "reply": "{\n  \"rule\": \"KEY-002\",\n  \"title\": \"Deduplicate sorted by its own key\",\n  \"severity\": \"critical\",\n  \"checks\": \"A `deduplicate` whose `sort_by` columns are all inside its `on` key.\",\n  \"why\": \"Every row in a duplicate group has the same key, so sorting by the key orders nothing. The surviving row is as arbitrary as with no `sort_by` at all, but the contract now looks correct. Sort by a column that differs between duplicates, normally the record's version time.\",\n  \"failing_example\": \"version: 1.0.0\\ninfo: { title: Trips, table_name: trips }\\nmodel:\\n  fields:\\n    - { name: trip_id, type: string, required: true }\\n    - { name: fare, type: float }\\n    - { name: updated_at, type: timestamp }\\nprimary_key: [trip_id]\\ntransformations:\\n  - deduplicate: { on: [trip_id], sort_by: [trip_id] }\\n\",\n  \"fixed_example\": \"version: 1.0.0\\ninfo: { title: Trips, table_name: trips }\\nmodel:\\n  fields:\\n    - { name: trip_id, type: string, required: true }\\n    - { name: fare, type: float }\\n    - { name: updated_at, type: timestamp }\\nprimary_key: [trip_id]\\ntransformations:\\n  - deduplicate: { on: [trip_id], sort_by: [updated_at], order: desc }\\n\",\n  \"fixed_example_is_standard_olc\": true\n}",
              "tool": "explain_rule"
            }
          ],
          "task": "Explain the LakeLogic lint rule KEY-002, including what it checks, why it matters, and examples of a failing and fixed contract."
        },
        "type": "noul"
      },
      "w06": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "# Open Lakehouse Contract reference: Quality\n\nQuality rules are SQL-powered. A **row rule** is a predicate that each row must satisfy; a **dataset rule** is an aggregate assertion over the dataset. Shorthands such as `not_null`, `range`, and `accepted_values` compile to SQL.\n\nThe active engine executes the SQL: PySpark on Spark, DuckDB on DuckDB, and Polars SQL on Polars. The framework rewrites dialect functions where needed.\n\n## The shape\n\n```yaml\nquality:\n  enforce_required: true\n  fail_pipeline_on_dataset_error: false\n  row_rules: [ ... ]\n  dataset_rules: [ ... ]\n```\n\n| Field | Purpose |\n|---|---|\n| `enforce_required` | Generate `not_null` rules for fields marked `required: true`. |\n| `fail_pipeline_on_dataset_error` | Whether a dataset-rule failure aborts the pipeline. |\n| `row_rules` | Per-row rules; failing rows can be quarantined. |\n| `dataset_rules` | Rules evaluated over the whole good dataset. |\n\n## Row rules\n\nA row rule is a Boolean SQL predicate. A row passes when the predicate is true. The canonical form is `name` plus `sql`; the other forms are shorthand.\n\n### Custom SQL\n\n```yaml\n- name: email_domain_valid\n  sql: \"email NOT LIKE '%@temp-mail.%' AND email NOT LIKE '%@disposable.%'\"\n  category: validity\n  severity: error  # error: quarantine; warning: log and keep; info: log\n  phase: pre       # pre: source columns; post: derived columns\n```\n\n### `not_null`\n\n```yaml\n- not_null: email\n- not_null: { fields: [email, status, created_at] }\n- not_null: { field: customer_id, name: customer_id_required, severity: error }\n```\n\n### `accepted_values`\n\n```yaml\n- accepted_values: { field: status, values: [ACTIVE, INACTIVE, PENDING, SUSPENDED], category: consistency }\n```\n\n### `regex_match`\n\n```yaml\n- regex_match: { field: email, pattern: \"^[^@]+@[^@]+\\\\.[^@]+$\", category: correctness }\n```\n\n### `range`\n\n```yaml\n- range: { field: age, min: 18, max: 120, inclusive: true, category: correctness }\n```\n\nWith `inclusive: true`, the bounds are inclusive; with `false`, both a",
          "done_when": "The transcript shows the contract_reference reply for the quality topic.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {
                "topic": "quality"
              },
              "reply": "{\n  \"topic\": \"quality\",\n  \"markdown\": \"# Validation & Quality\\n\\nQuality is where an OLC earns \\\"executable\\\" — and, like transformations, it's **SQL-powered**. Every rule is a SQL predicate: a **row rule** is a `WHERE`-clause that a row must satisfy; a **dataset rule** is an aggregate query that must hold over the whole dataset. The shorthands (`not_null:`, `range:`, `accepted_values:`, …) are convenience wrappers that **compile to SQL**, so each is shown here **SQL variant first**.\\n\\n> If you can write a SQL `WHERE` clause, you can write a quality rule. No Python, no custom code — just SQL.\\n\\n!!! abstract \\\"Powered by\\\"\\n    Quality rules are **Pydantic** models; each rule's `sql` predicate is executed by the active engine — **PySpark** on Spark, **duckdb** on DuckDB, **polars** SQL on Polars — so a rule written once runs natively on every backend (the framework rewrites dialect functions like `regexp_matches`). Failing rows route to the [quarantine](#quarantine).\\n\\n## The shape\\n\\n```yaml\\nquality:\\n  enforce_required: true                  # auto not_null rules for required fields\\n  fail_pipeline_on_dataset_error: false   # a failed dataset rule aborts the run\\n  row_rules: [ ... ]                       # per-row SQL predicates\\n  dataset_rules: [ ... ]                   # whole-dataset SQL assertions\\n```\\n\\n| `Quality` field | Purpose |\\n|---|---|\\n| `enforce_required` | Auto-generate `not_null` rules for `required: true` fields. |\\n| `fail_pipeline_on_dataset_error` | Whether a dataset-rule failure aborts the pipeline. |\\n| `row_rules` | Rules evaluated per row; failing rows are quarantined. |\\n| `dataset_rules` | Rules evaluated over the whole (good) dataset. |\\n\\n---\\n\\n## Row rules\\n\\nA row rule is a boolean SQL predicate — the row **passes** when it's true. The canonical form is `name` + `sql`; everything else is shorthand for a common predicate.\\n\\n### Custom SQL (the canonical form)\\n\\n```sql\\nemail NOT LIKE '%@temp-mail.%' AND email NOT LIKE '%@disposable.%'\\n```\\n```yaml\\n- name: email_domain_valid\\n  sql: \\\"email NOT LIKE '%@temp-mail.%' AND email NOT LIKE '%@disposable.%'\\\"\\n  category: validity\\n  severity: error            # error (quarantine) | warning (log, keep) | info\\n  phase: pre                 # pre = source columns · post = derived columns\\n```\\n\\n### `not_null`\\n\\n```sql\\nemail IS NOT NULL\\n```\\n```yaml\\n- not_null: email                                    # simple\\n- not_null: { fields: [email, status, created_at] }  # many\\n- not_null: { field: customer_id, name: customer_id_required, severity: error }\\n```\\n\\n### `accepted_values`\\n\\n```sql\\nstatus IN ('ACTIVE', 'INACTIVE', 'PENDING', 'SUSPENDED')\\n```\\n```yaml\\n- accepted_values: { field: status, values: [ACTIVE, INACTIVE, PENDING, SUSPENDED], category: consistency }\\n```\\n\\n### `regex_match`\\n\\n```sql\\nregexp_matches(email, '^[^@]+@[^@]+\\\\.[^@]+$')\\n```\\n```yaml\\n- regex_match: { field: email, pattern: \\\"^[^@]+@[^@]+\\\\\\\\.[^@]+$\\\", category: correctness }\\n```\\n\\n### `range`\\n\\n```sql\\nage BETWEEN 18 AND 120        -- inclusive: true → BETWEEN; false → 18 < age < 120\\n```\\n```yaml\\n- range: { field: age, min: 18, max: 120, inclusive: true, category: correctness }\\n```\\n\\n### `referential_integrity`\\n\\n```sql\\ncountry_code IN (SELECT code FROM dim_countries)\\n```\\n```yaml\\n- referential_integrity: { field: country_code, reference: dim_countries, key: code, category: consistency }\\n```\\n\\n### `lifecycle_window`\\n\\n```sql\\nevent_time >= current_date - INTERVAL 30 DAY     -- reject rows outside the recency window\\n```\\n```yaml\\n- lifecycle_window: { field: event_time, window: 30d }\\n```\\n\\n### Numeric guardrails on a rule\\n\\nAny `QualityRule` can attach numeric bounds instead of writing the comparison in SQL:\\n\\n```yaml\\n- { name: amount_in_range,  sql: \\\"true\\\", must_be_between: [0, 100000] }\\n- { name: min_qty,          sql: \\\"true\\\", must_be_greater_than: 0 }\\n- { name: max_qty,          sql: \\\"true\\\", must_be_less_than: 1000 }\\n```\\n\\n| `QualityRule` field | Purpose |\\n|---|---|\\n| `name` **(req)** | Rule identifier (shown in quarantine + logs). |\\n| `sql` **(req)** | Boolean predicate; row passes when true. |\\n| `severity` | `error` (quarantine) · `warning` (log, keep row) · `info` (log only). |\\n| `category` | Free-form tag (validity, completeness, consistency…). |\\n| `description` | Human explanation, surfaced on failure. |\\n| `phase` | `pre` (source columns) or `post` (derived columns) — see [Execution Order](execution-order.md). |\\n| `must_be_between` / `must_be_less_than` / `must_be_greater_than` | Numeric bounds as an alternative to SQL. |\\n\\n---\\n\\n## Dataset rules\\n\\nA dataset rule is an **aggregate** SQL assertion over the whole good dataset — it returns a scalar (or boolean) that must hold. Where row rules quarantine bad *rows*, dataset rules judge the *whole batch*: they're your **in-pipeline quality gate** for the aggregate invariants that make up a data-quality SLO — volume, completeness, freshness, reconciliation.\\n\\n**Enforcement — what a failing dataset rule does:**\\n\\n- `severity: error | warning | info` — `error` fails the rule; `warning` / `info` log only.\\n- `fail_pipeline_on_dataset_error: true` (on the `quality` block) — a failed error-severity dataset rule **aborts the whole run**, so a bad aggregate never publishes.\\n- `must_be_between` / `must_be_greater_than` / `must_be_less_than` — bound the scalar the rule's SQL returns (else the SQL should return a boolean).\\n- **NULL result:** a rule whose `WHERE` matches no rows (`SELECT SUM(amount) FROM source WHERE amount < 0` on a clean batch) **passes** — nothing broke it. Rows that match but still give NULL **fail**: the value is unmeasured, not fine.\\n- `on_dataset_failure: quarantine` + `quarantine_scope: [symbol]` — set aside only the failing groups; the rest is written. A NULL (or NaN) scope value is a group of its own.\\n\\n### Custom SQL (the canonical form)\\n\\n```sql\\nSELECT SUM(CASE WHEN status = 'ACTIVE' THEN 1 ELSE 0 END) * 1.0 / COUNT(*) FROM source\\n```\\n```yaml\\n- name: active_customer_ratio\\n  sql: \\\"SELECT SUM(CASE WHEN status = 'ACTIVE' THEN 1 ELSE 0 END) * 1.0 / COUNT(*) FROM source\\\"\\n  must_be_greater_than: 0.60\\n  category: validity\\n```\\n\\n### `unique`\\n\\n```sql\\nSELECT COUNT(*) = COUNT(DISTINCT customer_id) FROM source\\n```\\n```yaml\\n- unique: customer_id                              # one column\\n- unique: [order_id, line_no]                      # composite key\\n- unique: { field: email, name: email_unique, severity: error }\\n- { name: sku_unique, unique: sku, severity: warning }\\n```\\n\\nA **dataset** rule: write it under `dataset_rules`, never `row_rules`. The mapping form takes\\nexactly one of `field` (one column) or `columns` (a list; `fields` is accepted too), plus\\noptional `name`, `severity`, `category` and `description`, which may also sit beside\\n`unique`. Any other key is rejected, so a typo such as `column:` fails validation instead of\\nquietly checking nothing.\\n\\n`primary_key` already implies this check: a conforming runtime verifies the key is unique\\nwithout a `unique` rule (LakeLogic adds `<keys>_unique`). A `unique` rule, or a\\n`COUNT(DISTINCT …)` SQL rule, over exactly the primary-key columns is treated as that same\\ncheck and is not run twice.\\n\\n### `null_ratio`\\n\\n```sql\\nSELECT COUNT(*) FILTER (WHERE phone IS NULL) * 1.0 / COUNT(*) <= 0.20 FROM source\\n```\\n```yaml\\n- null_ratio: { field: phone, max: 0.20, category: completeness }\\n```\\n\\n### `row_count_between`\\n\\n```sql\\nSELECT COUNT(*) BETWEEN 1000 AND 10000000 FROM source\\n```\\n```yaml\\n- row_count_between: { min: 1000, max: 10000000, category: completeness }\\n```\\n\\n---\\n\\n## Quality-SLO scenarios\\n\\nDataset rules are how you encode data-quality SLOs as **gates** — checked every run, enforced before publish. Each scenario shows the SQL, the rule, and what it protects against. Set `fail_pipeline_on_dataset_error: true` to make these hard gates.\\n\\n### Volume within band — catch truncated / runawa",
              "tool": "contract_reference"
            }
          ],
          "task": "Show me the Open Lakehouse Contract reference for the quality topic."
        },
        "type": "noul"
      },
      "w07": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "# Open Lakehouse Contract reference: Quality\n\nQuality rules are SQL-powered. A **row rule** is a `WHERE`-clause predicate that each row must satisfy; a **dataset rule** is an aggregate assertion over the whole dataset. Shorthands such as `not_null`, `range`, and `accepted_values` compile to SQL.\n\nRules execute through the active engine—PySpark, DuckDB, or Polars SQL—with dialect-function rewriting where needed. Failing rows can be routed to quarantine.\n\n## The shape\n\n```yaml\nquality:\n  enforce_required: true\n  fail_pipeline_on_dataset_error: false\n  row_rules: [...]\n  dataset_rules: [...]\n```\n\n| Field | Purpose |\n|---|---|\n| `enforce_required` | Auto-generate `not_null` rules for fields marked `required: true`. |\n| `fail_pipeline_on_dataset_error` | Whether a dataset-rule failure aborts the pipeline. |\n| `row_rules` | Per-row rules; failing rows are quarantined. |\n| `dataset_rules` | Rules evaluated over the whole good dataset. |\n\n## Row rules\n\nA row passes when its boolean SQL predicate is true. The canonical form uses `name` and `sql`; the other forms are shorthands.\n\n### Custom SQL\n\n```yaml\n- name: email_domain_valid\n  sql: \"email NOT LIKE '%@temp-mail.%' AND email NOT LIKE '%@disposable.%'\"\n  category: validity\n  severity: error  # error: quarantine; warning: log and keep; info: log\n  phase: pre       # pre: source columns; post: derived columns\n```\n\n### Shorthands\n\n```yaml\n# not_null\n- not_null: email\n- not_null: { fields: [email, status, created_at] }\n- not_null: { field: customer_id, name: customer_id_required, severity: error }\n\n# accepted_values\n- accepted_values: { field: status, values: [ACTIVE, INACTIVE, PENDING, SUSPENDED], category: consistency }\n\n# regex_match\n- regex_match: { field: email, pattern: \"^[^@]+@[^@]+\\\\.[^@]+$\", category: correctness }\n\n# range\n- range: { field: age, min: 18, max: 120, inclusive: true, category: correctness }\n\n# referential_integrity\n- referential_integrity: { field: country_code, reference: dim_countries, key: code, categ",
          "done_when": "The transcript shows the contract_reference reply for the quality topic.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {
                "topic": "quality"
              },
              "reply": "{\n  \"topic\": \"quality\",\n  \"markdown\": \"# Validation & Quality\\n\\nQuality is where an OLC earns \\\"executable\\\" — and, like transformations, it's **SQL-powered**. Every rule is a SQL predicate: a **row rule** is a `WHERE`-clause that a row must satisfy; a **dataset rule** is an aggregate query that must hold over the whole dataset. The shorthands (`not_null:`, `range:`, `accepted_values:`, …) are convenience wrappers that **compile to SQL**, so each is shown here **SQL variant first**.\\n\\n> If you can write a SQL `WHERE` clause, you can write a quality rule. No Python, no custom code — just SQL.\\n\\n!!! abstract \\\"Powered by\\\"\\n    Quality rules are **Pydantic** models; each rule's `sql` predicate is executed by the active engine — **PySpark** on Spark, **duckdb** on DuckDB, **polars** SQL on Polars — so a rule written once runs natively on every backend (the framework rewrites dialect functions like `regexp_matches`). Failing rows route to the [quarantine](#quarantine).\\n\\n## The shape\\n\\n```yaml\\nquality:\\n  enforce_required: true                  # auto not_null rules for required fields\\n  fail_pipeline_on_dataset_error: false   # a failed dataset rule aborts the run\\n  row_rules: [ ... ]                       # per-row SQL predicates\\n  dataset_rules: [ ... ]                   # whole-dataset SQL assertions\\n```\\n\\n| `Quality` field | Purpose |\\n|---|---|\\n| `enforce_required` | Auto-generate `not_null` rules for `required: true` fields. |\\n| `fail_pipeline_on_dataset_error` | Whether a dataset-rule failure aborts the pipeline. |\\n| `row_rules` | Rules evaluated per row; failing rows are quarantined. |\\n| `dataset_rules` | Rules evaluated over the whole (good) dataset. |\\n\\n---\\n\\n## Row rules\\n\\nA row rule is a boolean SQL predicate — the row **passes** when it's true. The canonical form is `name` + `sql`; everything else is shorthand for a common predicate.\\n\\n### Custom SQL (the canonical form)\\n\\n```sql\\nemail NOT LIKE '%@temp-mail.%' AND email NOT LIKE '%@disposable.%'\\n```\\n```yaml\\n- name: email_domain_valid\\n  sql: \\\"email NOT LIKE '%@temp-mail.%' AND email NOT LIKE '%@disposable.%'\\\"\\n  category: validity\\n  severity: error            # error (quarantine) | warning (log, keep) | info\\n  phase: pre                 # pre = source columns · post = derived columns\\n```\\n\\n### `not_null`\\n\\n```sql\\nemail IS NOT NULL\\n```\\n```yaml\\n- not_null: email                                    # simple\\n- not_null: { fields: [email, status, created_at] }  # many\\n- not_null: { field: customer_id, name: customer_id_required, severity: error }\\n```\\n\\n### `accepted_values`\\n\\n```sql\\nstatus IN ('ACTIVE', 'INACTIVE', 'PENDING', 'SUSPENDED')\\n```\\n```yaml\\n- accepted_values: { field: status, values: [ACTIVE, INACTIVE, PENDING, SUSPENDED], category: consistency }\\n```\\n\\n### `regex_match`\\n\\n```sql\\nregexp_matches(email, '^[^@]+@[^@]+\\\\.[^@]+$')\\n```\\n```yaml\\n- regex_match: { field: email, pattern: \\\"^[^@]+@[^@]+\\\\\\\\.[^@]+$\\\", category: correctness }\\n```\\n\\n### `range`\\n\\n```sql\\nage BETWEEN 18 AND 120        -- inclusive: true → BETWEEN; false → 18 < age < 120\\n```\\n```yaml\\n- range: { field: age, min: 18, max: 120, inclusive: true, category: correctness }\\n```\\n\\n### `referential_integrity`\\n\\n```sql\\ncountry_code IN (SELECT code FROM dim_countries)\\n```\\n```yaml\\n- referential_integrity: { field: country_code, reference: dim_countries, key: code, category: consistency }\\n```\\n\\n### `lifecycle_window`\\n\\n```sql\\nevent_time >= current_date - INTERVAL 30 DAY     -- reject rows outside the recency window\\n```\\n```yaml\\n- lifecycle_window: { field: event_time, window: 30d }\\n```\\n\\n### Numeric guardrails on a rule\\n\\nAny `QualityRule` can attach numeric bounds instead of writing the comparison in SQL:\\n\\n```yaml\\n- { name: amount_in_range,  sql: \\\"true\\\", must_be_between: [0, 100000] }\\n- { name: min_qty,          sql: \\\"true\\\", must_be_greater_than: 0 }\\n- { name: max_qty,          sql: \\\"true\\\", must_be_less_than: 1000 }\\n```\\n\\n| `QualityRule` field | Purpose |\\n|---|---|\\n| `name` **(req)** | Rule identifier (shown in quarantine + logs). |\\n| `sql` **(req)** | Boolean predicate; row passes when true. |\\n| `severity` | `error` (quarantine) · `warning` (log, keep row) · `info` (log only). |\\n| `category` | Free-form tag (validity, completeness, consistency…). |\\n| `description` | Human explanation, surfaced on failure. |\\n| `phase` | `pre` (source columns) or `post` (derived columns) — see [Execution Order](execution-order.md). |\\n| `must_be_between` / `must_be_less_than` / `must_be_greater_than` | Numeric bounds as an alternative to SQL. |\\n\\n---\\n\\n## Dataset rules\\n\\nA dataset rule is an **aggregate** SQL assertion over the whole good dataset — it returns a scalar (or boolean) that must hold. Where row rules quarantine bad *rows*, dataset rules judge the *whole batch*: they're your **in-pipeline quality gate** for the aggregate invariants that make up a data-quality SLO — volume, completeness, freshness, reconciliation.\\n\\n**Enforcement — what a failing dataset rule does:**\\n\\n- `severity: error | warning | info` — `error` fails the rule; `warning` / `info` log only.\\n- `fail_pipeline_on_dataset_error: true` (on the `quality` block) — a failed error-severity dataset rule **aborts the whole run**, so a bad aggregate never publishes.\\n- `must_be_between` / `must_be_greater_than` / `must_be_less_than` — bound the scalar the rule's SQL returns (else the SQL should return a boolean).\\n- **NULL result:** a rule whose `WHERE` matches no rows (`SELECT SUM(amount) FROM source WHERE amount < 0` on a clean batch) **passes** — nothing broke it. Rows that match but still give NULL **fail**: the value is unmeasured, not fine.\\n- `on_dataset_failure: quarantine` + `quarantine_scope: [symbol]` — set aside only the failing groups; the rest is written. A NULL (or NaN) scope value is a group of its own.\\n\\n### Custom SQL (the canonical form)\\n\\n```sql\\nSELECT SUM(CASE WHEN status = 'ACTIVE' THEN 1 ELSE 0 END) * 1.0 / COUNT(*) FROM source\\n```\\n```yaml\\n- name: active_customer_ratio\\n  sql: \\\"SELECT SUM(CASE WHEN status = 'ACTIVE' THEN 1 ELSE 0 END) * 1.0 / COUNT(*) FROM source\\\"\\n  must_be_greater_than: 0.60\\n  category: validity\\n```\\n\\n### `unique`\\n\\n```sql\\nSELECT COUNT(*) = COUNT(DISTINCT customer_id) FROM source\\n```\\n```yaml\\n- unique: customer_id                              # one column\\n- unique: [order_id, line_no]                      # composite key\\n- unique: { field: email, name: email_unique, severity: error }\\n- { name: sku_unique, unique: sku, severity: warning }\\n```\\n\\nA **dataset** rule: write it under `dataset_rules`, never `row_rules`. The mapping form takes\\nexactly one of `field` (one column) or `columns` (a list; `fields` is accepted too), plus\\noptional `name`, `severity`, `category` and `description`, which may also sit beside\\n`unique`. Any other key is rejected, so a typo such as `column:` fails validation instead of\\nquietly checking nothing.\\n\\n`primary_key` already implies this check: a conforming runtime verifies the key is unique\\nwithout a `unique` rule (LakeLogic adds `<keys>_unique`). A `unique` rule, or a\\n`COUNT(DISTINCT …)` SQL rule, over exactly the primary-key columns is treated as that same\\ncheck and is not run twice.\\n\\n### `null_ratio`\\n\\n```sql\\nSELECT COUNT(*) FILTER (WHERE phone IS NULL) * 1.0 / COUNT(*) <= 0.20 FROM source\\n```\\n```yaml\\n- null_ratio: { field: phone, max: 0.20, category: completeness }\\n```\\n\\n### `row_count_between`\\n\\n```sql\\nSELECT COUNT(*) BETWEEN 1000 AND 10000000 FROM source\\n```\\n```yaml\\n- row_count_between: { min: 1000, max: 10000000, category: completeness }\\n```\\n\\n---\\n\\n## Quality-SLO scenarios\\n\\nDataset rules are how you encode data-quality SLOs as **gates** — checked every run, enforced before publish. Each scenario shows the SQL, the rule, and what it protects against. Set `fail_pipeline_on_dataset_error: true` to make these hard gates.\\n\\n### Volume within band — catch truncated / runawa",
              "tool": "contract_reference"
            }
          ],
          "task": "Show me the Open Lakehouse Contract reference for the quality topic."
        },
        "type": "noul"
      },
      "w08": {
        "criteria": {
          "false": "The tool replies show an error, a missing or different result, or nothing about the task; or only the agent's final answer claims the task was done.",
          "true": "The tool replies in `steps` show the result that `done_when` describes. The result came from the server's tools, not only from the agent's own words."
        },
        "instructions": {
          "agent_final_answer": "# Open Lakehouse Contract reference: Quality\n\nQuality rules are SQL-powered. A **row rule** is a predicate each row must satisfy; a **dataset rule** is an aggregate assertion over the good dataset. Shorthands such as `not_null` and `range` compile to SQL. Rules execute in the active engine—PySpark, DuckDB, or Polars—with dialect functions rewritten by the framework.\n\n## Shape\n\n```yaml\nquality:\n  enforce_required: true\n  fail_pipeline_on_dataset_error: false\n  row_rules: [ ... ]\n  dataset_rules: [ ... ]\n```\n\n| Field | Purpose |\n|---|---|\n| `enforce_required` | Generate `not_null` rules for fields marked `required: true`. |\n| `fail_pipeline_on_dataset_error` | Abort the pipeline on an error-severity dataset-rule failure. |\n| `row_rules` | Per-row rules; failing rows can be quarantined. |\n| `dataset_rules` | Assertions over the whole good dataset. |\n\n## Row rules\n\nA row passes when its boolean SQL predicate is true. The canonical form uses `name` and `sql`:\n\n```yaml\n- name: email_domain_valid\n  sql: \"email NOT LIKE '%@temp-mail.%' AND email NOT LIKE '%@disposable.%'\"\n  category: validity\n  severity: error\n  phase: pre\n```\n\nCommon shorthands:\n\n```yaml\n- not_null: email\n- not_null: { fields: [email, status, created_at] }\n- not_null: { field: customer_id, name: customer_id_required, severity: error }\n\n- accepted_values:\n    field: status\n    values: [ACTIVE, INACTIVE, PENDING, SUSPENDED]\n    category: consistency\n\n- regex_match:\n    field: email\n    pattern: \"^[^@]+@[^@]+\\\\.[^@]+$\"\n    category: correctness\n\n- range: { field: age, min: 18, max: 120, inclusive: true, category: correctness }\n\n- referential_integrity:\n    field: country_code\n    reference: dim_countries\n    key: code\n    category: consistency\n\n- lifecycle_window: { field: event_time, window: 30d }\n```\n\n`range` is inclusive when `inclusive: true`; otherwise its bounds are exclusive.\n\nA `QualityRule` can also attach numeric guardrails:\n\n```yaml\n- { name: amount_in_range, sql: \"true\", must_be_between: [0, 10000",
          "done_when": "The transcript shows the contract_reference reply for the quality topic.",
          "how_it_ended": "answered",
          "question": "Did the agent finish `task`, as `done_when` describes, according to the tool replies in `steps`?",
          "steps": [
            {
              "arguments": {
                "topic": "quality"
              },
              "reply": "{\n  \"topic\": \"quality\",\n  \"markdown\": \"# Validation & Quality\\n\\nQuality is where an OLC earns \\\"executable\\\" — and, like transformations, it's **SQL-powered**. Every rule is a SQL predicate: a **row rule** is a `WHERE`-clause that a row must satisfy; a **dataset rule** is an aggregate query that must hold over the whole dataset. The shorthands (`not_null:`, `range:`, `accepted_values:`, …) are convenience wrappers that **compile to SQL**, so each is shown here **SQL variant first**.\\n\\n> If you can write a SQL `WHERE` clause, you can write a quality rule. No Python, no custom code — just SQL.\\n\\n!!! abstract \\\"Powered by\\\"\\n    Quality rules are **Pydantic** models; each rule's `sql` predicate is executed by the active engine — **PySpark** on Spark, **duckdb** on DuckDB, **polars** SQL on Polars — so a rule written once runs natively on every backend (the framework rewrites dialect functions like `regexp_matches`). Failing rows route to the [quarantine](#quarantine).\\n\\n## The shape\\n\\n```yaml\\nquality:\\n  enforce_required: true                  # auto not_null rules for required fields\\n  fail_pipeline_on_dataset_error: false   # a failed dataset rule aborts the run\\n  row_rules: [ ... ]                       # per-row SQL predicates\\n  dataset_rules: [ ... ]                   # whole-dataset SQL assertions\\n```\\n\\n| `Quality` field | Purpose |\\n|---|---|\\n| `enforce_required` | Auto-generate `not_null` rules for `required: true` fields. |\\n| `fail_pipeline_on_dataset_error` | Whether a dataset-rule failure aborts the pipeline. |\\n| `row_rules` | Rules evaluated per row; failing rows are quarantined. |\\n| `dataset_rules` | Rules evaluated over the whole (good) dataset. |\\n\\n---\\n\\n## Row rules\\n\\nA row rule is a boolean SQL predicate — the row **passes** when it's true. The canonical form is `name` + `sql`; everything else is shorthand for a common predicate.\\n\\n### Custom SQL (the canonical form)\\n\\n```sql\\nemail NOT LIKE '%@temp-mail.%' AND email NOT LIKE '%@disposable.%'\\n```\\n```yaml\\n- name: email_domain_valid\\n  sql: \\\"email NOT LIKE '%@temp-mail.%' AND email NOT LIKE '%@disposable.%'\\\"\\n  category: validity\\n  severity: error            # error (quarantine) | warning (log, keep) | info\\n  phase: pre                 # pre = source columns · post = derived columns\\n```\\n\\n### `not_null`\\n\\n```sql\\nemail IS NOT NULL\\n```\\n```yaml\\n- not_null: email                                    # simple\\n- not_null: { fields: [email, status, created_at] }  # many\\n- not_null: { field: customer_id, name: customer_id_required, severity: error }\\n```\\n\\n### `accepted_values`\\n\\n```sql\\nstatus IN ('ACTIVE', 'INACTIVE', 'PENDING', 'SUSPENDED')\\n```\\n```yaml\\n- accepted_values: { field: status, values: [ACTIVE, INACTIVE, PENDING, SUSPENDED], category: consistency }\\n```\\n\\n### `regex_match`\\n\\n```sql\\nregexp_matches(email, '^[^@]+@[^@]+\\\\.[^@]+$')\\n```\\n```yaml\\n- regex_match: { field: email, pattern: \\\"^[^@]+@[^@]+\\\\\\\\.[^@]+$\\\", category: correctness }\\n```\\n\\n### `range`\\n\\n```sql\\nage BETWEEN 18 AND 120        -- inclusive: true → BETWEEN; false → 18 < age < 120\\n```\\n```yaml\\n- range: { field: age, min: 18, max: 120, inclusive: true, category: correctness }\\n```\\n\\n### `referential_integrity`\\n\\n```sql\\ncountry_code IN (SELECT code FROM dim_countries)\\n```\\n```yaml\\n- referential_integrity: { field: country_code, reference: dim_countries, key: code, category: consistency }\\n```\\n\\n### `lifecycle_window`\\n\\n```sql\\nevent_time >= current_date - INTERVAL 30 DAY     -- reject rows outside the recency window\\n```\\n```yaml\\n- lifecycle_window: { field: event_time, window: 30d }\\n```\\n\\n### Numeric guardrails on a rule\\n\\nAny `QualityRule` can attach numeric bounds instead of writing the comparison in SQL:\\n\\n```yaml\\n- { name: amount_in_range,  sql: \\\"true\\\", must_be_between: [0, 100000] }\\n- { name: min_qty,          sql: \\\"true\\\", must_be_greater_than: 0 }\\n- { name: max_qty,          sql: \\\"true\\\", must_be_less_than: 1000 }\\n```\\n\\n| `QualityRule` field | Purpose |\\n|---|---|\\n| `name` **(req)** | Rule identifier (shown in quarantine + logs). |\\n| `sql` **(req)** | Boolean predicate; row passes when true. |\\n| `severity` | `error` (quarantine) · `warning` (log, keep row) · `info` (log only). |\\n| `category` | Free-form tag (validity, completeness, consistency…). |\\n| `description` | Human explanation, surfaced on failure. |\\n| `phase` | `pre` (source columns) or `post` (derived columns) — see [Execution Order](execution-order.md). |\\n| `must_be_between` / `must_be_less_than` / `must_be_greater_than` | Numeric bounds as an alternative to SQL. |\\n\\n---\\n\\n## Dataset rules\\n\\nA dataset rule is an **aggregate** SQL assertion over the whole good dataset — it returns a scalar (or boolean) that must hold. Where row rules quarantine bad *rows*, dataset rules judge the *whole batch*: they're your **in-pipeline quality gate** for the aggregate invariants that make up a data-quality SLO — volume, completeness, freshness, reconciliation.\\n\\n**Enforcement — what a failing dataset rule does:**\\n\\n- `severity: error | warning | info` — `error` fails the rule; `warning` / `info` log only.\\n- `fail_pipeline_on_dataset_error: true` (on the `quality` block) — a failed error-severity dataset rule **aborts the whole run**, so a bad aggregate never publishes.\\n- `must_be_between` / `must_be_greater_than` / `must_be_less_than` — bound the scalar the rule's SQL returns (else the SQL should return a boolean).\\n- **NULL result:** a rule whose `WHERE` matches no rows (`SELECT SUM(amount) FROM source WHERE amount < 0` on a clean batch) **passes** — nothing broke it. Rows that match but still give NULL **fail**: the value is unmeasured, not fine.\\n- `on_dataset_failure: quarantine` + `quarantine_scope: [symbol]` — set aside only the failing groups; the rest is written. A NULL (or NaN) scope value is a group of its own.\\n\\n### Custom SQL (the canonical form)\\n\\n```sql\\nSELECT SUM(CASE WHEN status = 'ACTIVE' THEN 1 ELSE 0 END) * 1.0 / COUNT(*) FROM source\\n```\\n```yaml\\n- name: active_customer_ratio\\n  sql: \\\"SELECT SUM(CASE WHEN status = 'ACTIVE' THEN 1 ELSE 0 END) * 1.0 / COUNT(*) FROM source\\\"\\n  must_be_greater_than: 0.60\\n  category: validity\\n```\\n\\n### `unique`\\n\\n```sql\\nSELECT COUNT(*) = COUNT(DISTINCT customer_id) FROM source\\n```\\n```yaml\\n- unique: customer_id                              # one column\\n- unique: [order_id, line_no]                      # composite key\\n- unique: { field: email, name: email_unique, severity: error }\\n- { name: sku_unique, unique: sku, severity: warning }\\n```\\n\\nA **dataset** rule: write it under `dataset_rules`, never `row_rules`. The mapping form takes\\nexactly one of `field` (one column) or `columns` (a list; `fields` is accepted too), plus\\noptional `name`, `severity`, `category` and `description`, which may also sit beside\\n`unique`. Any other key is rejected, so a typo such as `column:` fails validation instead of\\nquietly checking nothing.\\n\\n`primary_key` already implies this check: a conforming runtime verifies the key is unique\\nwithout a `unique` rule (LakeLogic adds `<keys>_unique`). A `unique` rule, or a\\n`COUNT(DISTINCT …)` SQL rule, over exactly the primary-key columns is treated as that same\\ncheck and is not run twice.\\n\\n### `null_ratio`\\n\\n```sql\\nSELECT COUNT(*) FILTER (WHERE phone IS NULL) * 1.0 / COUNT(*) <= 0.20 FROM source\\n```\\n```yaml\\n- null_ratio: { field: phone, max: 0.20, category: completeness }\\n```\\n\\n### `row_count_between`\\n\\n```sql\\nSELECT COUNT(*) BETWEEN 1000 AND 10000000 FROM source\\n```\\n```yaml\\n- row_count_between: { min: 1000, max: 10000000, category: completeness }\\n```\\n\\n---\\n\\n## Quality-SLO scenarios\\n\\nDataset rules are how you encode data-quality SLOs as **gates** — checked every run, enforced before publish. Each scenario shows the SQL, the rule, and what it protects against. Set `fail_pipeline_on_dataset_error: true` to make these hard gates.\\n\\n### Volume within band — catch truncated / runawa",
              "tool": "contract_reference"
            }
          ],
          "task": "Show me the Open Lakehouse Contract reference for the quality topic."
        },
        "type": "noul"
      }
    },
    "state": {
      "about": "Replies of an MCP server to tool calls that were sent with bad input on purpose, to see whether its error messages help a caller fix the call."
    }
  },
  "run_id": "01M8334C9AKV99F4SRD8N2K4FN",
  "works_done": [
    {
      "attempt": 0,
      "noul": 0.95,
      "question": "w00"
    },
    {
      "attempt": 1,
      "noul": 0.97,
      "question": "w01"
    },
    {
      "attempt": 2,
      "noul": 0.95,
      "question": "w02"
    },
    {
      "attempt": 3,
      "noul": 0.97,
      "question": "w03"
    },
    {
      "attempt": 4,
      "noul": 0.99,
      "question": "w04"
    },
    {
      "attempt": 5,
      "noul": 0.99,
      "question": "w05"
    },
    {
      "attempt": 6,
      "noul": 0.9,
      "question": "w06"
    },
    {
      "attempt": 7,
      "noul": 0.89,
      "question": "w07"
    },
    {
      "attempt": 8,
      "noul": 0.87,
      "question": "w08"
    }
  ]
}
