{
  "kind": "original-bounded-choice-workflow",
  "version": 1,
  "scope": "Check whether a supplied SQL SELECT expresses the user’s defined analytics request.",
  "question": "Compare the SELECT with the question, schema and metric definitions: Match if its metric, filters, grouping, entities and detail level express the requested result; Mismatch for a material difference; Unclear if required meaning, schema or query behavior is missing. Read the query without executing it. Match is neither syntax validation nor permission to run SQL, and unknown business definitions must not be invented.",
  "choices": [
    "Match",
    "Mismatch",
    "Unclear"
  ],
  "actions": {
    "Match": {
      "action": "preview_jev_sql_question_match",
      "payload": {
        "decision": "Match"
      },
      "pending": true
    },
    "Mismatch": {
      "action": "preview_jev_sql_question_match",
      "payload": {
        "decision": "Mismatch"
      },
      "pending": true
    },
    "Unclear": {
      "action": "preview_jev_sql_question_match",
      "payload": {
        "decision": "Unclear"
      },
      "pending": true
    }
  },
  "samples": [
    {
      "id": "case-1",
      "label": "Correct grouped count",
      "expected": "Match",
      "request": {
        "context": "{\n  \"task\": \"Check whether a supplied SQL SELECT expresses the user’s defined analytics request.\",\n  \"evidence\": {\n    \"question\": \"Count orders per customer.\",\n    \"schema\": \"orders(id,customer_id,total); one row per order\",\n    \"sql\": \"SELECT customer_id, COUNT(*) FROM orders GROUP BY customer_id;\"\n  }\n}",
        "question": "Compare the SELECT with the question, schema and metric definitions: Match if its metric, filters, grouping, entities and detail level express the requested result; Mismatch for a material difference; Unclear if required meaning, schema or query behavior is missing. Read the query without executing it. Match is neither syntax validation nor permission to run SQL, and unknown business definitions must not be invented.",
        "choices": [
          "Match",
          "Mismatch",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-2",
      "label": "Wrong metric",
      "expected": "Mismatch",
      "request": {
        "context": "{\n  \"task\": \"Check whether a supplied SQL SELECT expresses the user’s defined analytics request.\",\n  \"evidence\": {\n    \"question\": \"Count orders per customer.\",\n    \"schema\": \"orders(id,customer_id,total); one row per order\",\n    \"sql\": \"SELECT customer_id, SUM(total) FROM orders GROUP BY customer_id;\"\n  }\n}",
        "question": "Compare the SELECT with the question, schema and metric definitions: Match if its metric, filters, grouping, entities and detail level express the requested result; Mismatch for a material difference; Unclear if required meaning, schema or query behavior is missing. Read the query without executing it. Match is neither syntax validation nor permission to run SQL, and unknown business definitions must not be invented.",
        "choices": [
          "Match",
          "Mismatch",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-3",
      "label": "Wrong population",
      "expected": "Mismatch",
      "request": {
        "context": "{\n  \"task\": \"Check whether a supplied SQL SELECT expresses the user’s defined analytics request.\",\n  \"evidence\": {\n    \"question\": \"Count all open tickets.\",\n    \"schema\": \"tickets(id,status); status open or closed\",\n    \"sql\": \"SELECT COUNT(*) FROM tickets WHERE status = 'closed';\"\n  }\n}",
        "question": "Compare the SELECT with the question, schema and metric definitions: Match if its metric, filters, grouping, entities and detail level express the requested result; Mismatch for a material difference; Unclear if required meaning, schema or query behavior is missing. Read the query without executing it. Match is neither syntax validation nor permission to run SQL, and unknown business definitions must not be invented.",
        "choices": [
          "Match",
          "Mismatch",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-4",
      "label": "Grouping lost",
      "expected": "Mismatch",
      "request": {
        "context": "{\n  \"task\": \"Check whether a supplied SQL SELECT expresses the user’s defined analytics request.\",\n  \"evidence\": {\n    \"question\": \"Count tickets separately for each team.\",\n    \"schema\": \"tickets(id,team_id)\",\n    \"sql\": \"SELECT COUNT(*) FROM tickets;\"\n  }\n}",
        "question": "Compare the SELECT with the question, schema and metric definitions: Match if its metric, filters, grouping, entities and detail level express the requested result; Mismatch for a material difference; Unclear if required meaning, schema or query behavior is missing. Read the query without executing it. Match is neither syntax validation nor permission to run SQL, and unknown business definitions must not be invented.",
        "choices": [
          "Match",
          "Mismatch",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-5",
      "label": "Explicit all-time scope",
      "expected": "Match",
      "request": {
        "context": "{\n  \"task\": \"Check whether a supplied SQL SELECT expresses the user’s defined analytics request.\",\n  \"evidence\": {\n    \"question\": \"How many orders have ever been recorded?\",\n    \"schema\": \"orders(id,created_at); one retained row per order\",\n    \"sql\": \"SELECT COUNT(*) FROM orders;\"\n  }\n}",
        "question": "Compare the SELECT with the question, schema and metric definitions: Match if its metric, filters, grouping, entities and detail level express the requested result; Mismatch for a material difference; Unclear if required meaning, schema or query behavior is missing. Read the query without executing it. Match is neither syntax validation nor permission to run SQL, and unknown business definitions must not be invented.",
        "choices": [
          "Match",
          "Mismatch",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-6",
      "label": "Undefined active metric",
      "expected": "Unclear",
      "request": {
        "context": "{\n  \"task\": \"Check whether a supplied SQL SELECT expresses the user’s defined analytics request.\",\n  \"evidence\": {\n    \"question\": \"Count active accounts.\",\n    \"schema\": \"accounts(id,last_seen_at)\",\n    \"sql\": \"SELECT COUNT(*) FROM accounts WHERE last_seen_at >= '2026-10-01';\",\n    \"definitions\": \"No definition of active or reporting period.\"\n  }\n}",
        "question": "Compare the SELECT with the question, schema and metric definitions: Match if its metric, filters, grouping, entities and detail level express the requested result; Mismatch for a material difference; Unclear if required meaning, schema or query behavior is missing. Read the query without executing it. Match is neither syntax validation nor permission to run SQL, and unknown business definitions must not be invented.",
        "choices": [
          "Match",
          "Mismatch",
          "Unclear"
        ]
      }
    }
  ],
  "consumer": "preview_choice_workflow.py"
}
