{
  "run_id": "banking-docs-c9aef3140970",
  "frozen_at": "2026-10-08T11:17:17.619160+00:00",
  "question_count": 40,
  "expected_responses": 80,
  "questions_sha256": "044b9209a7b36866a74fa22aee75010bacd682193a38f4a5b47f96439da2242f",
  "config": {
    "model": "gpt-4.1-mini-2025-04-14",
    "settings": {
      "temperature": 0,
      "seed": 7,
      "max_tokens": 800,
      "response_format": {
        "type": "json_object"
      }
    },
    "prices_usd_per_million": {
      "input": 0.4,
      "output": 1.6,
      "cached_input": 0.1
    },
    "price_source": "https://developers.openai.com/api/docs/models/gpt-4.1-mini",
    "price_checked_at": "2026-10-08T10:08:50.120047+00:00",
    "price_capture_sha256": "f3176cb5cdbf65c93bd61f43f9a29872f2a30752a806275520e8dca443d0f621",
    "budget_usd": 10,
    "retry_policy": "No automatic retries. Failed or interrupted requests retain their full cost reservation and outcome."
  },
  "records": [
    {
      "question_id": "B01",
      "arm": "bare",
      "cache_key": "13baba04ffc514e0d8a84fbc7bbe7924e9ebebf2074ca48a4b8be960ff205c65",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was gross card spend in CAD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B01",
      "arm": "documented",
      "cache_key": "dc9650a08325f872e3bd677382ca8e2292f611a44eddcafae653fc531cdd98ed",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was gross card spend in CAD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B02",
      "arm": "documented",
      "cache_key": "da2517be4b1cab9b2f5688f270bde7c3e55d1da2bad0cf3579750b46dd8644d7",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was gross card spend in USD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B02",
      "arm": "bare",
      "cache_key": "72a10ff7593252fddcbf9bc604faf83cf844d6c62f7de508e9c014ea5ccf4636",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was gross card spend in USD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B03",
      "arm": "bare",
      "cache_key": "dd287a9306f9a8b0c7fa3a0de1423c09d34cdec5480892d77d70e67e4336cbb9",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was the refunded card amount in CAD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B03",
      "arm": "documented",
      "cache_key": "936166474cc0bab476b750c06ccb7b692980dae3a43b492dc0cddfb9dd5ac907",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was the refunded card amount in CAD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B04",
      "arm": "documented",
      "cache_key": "d7ed3e3340d3e39cdd6c75024705a48f767a5b065c31a936836defdac565cf04",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was net card spend in CAD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B04",
      "arm": "bare",
      "cache_key": "1d80dc18ed491441e04a73a6100325a72779c8361a6ab02899206f47bab900d8",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was net card spend in CAD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B05",
      "arm": "bare",
      "cache_key": "e4083f365769419826710e90926fa46a8e0ebf20153958432def987a334c9126",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was net card spend in USD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B05",
      "arm": "documented",
      "cache_key": "18123f641062fd4044d1c0712ca756468e363b9d366dd3f5a2dfb2920083eacd",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was net card spend in USD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B06",
      "arm": "documented",
      "cache_key": "1be8a452623766bac0751dd775d5eb21e90f0f6a2e5d4356bb22def96bb195a0",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "How many CAD purchase events contributed to July 2026 card spend? Return one count."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B06",
      "arm": "bare",
      "cache_key": "d2824a5bf2cef6b3c23a1d24bbc91396d105678d8b8c46cc6f2e56f45ee1f5ad",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "How many CAD purchase events contributed to July 2026 card spend? Return one count."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B07",
      "arm": "bare",
      "cache_key": "b746ada727ac030d1df5feb60bdcd1fecad2b111fac95c518a2b14040f0ca52e",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "Break down July 2026 net card spend in CAD by category label, including the uncategorized bucket. Return category label and net minor units for categories with activity."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B07",
      "arm": "documented",
      "cache_key": "5d5fc257759bb9e1576d0d5d9faee7855e65c8cc93499a0846eb9af6f6b4d59b",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "Break down July 2026 net card spend in CAD by category label, including the uncategorized bucket. Return category label and net minor units for categories with activity."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B08",
      "arm": "documented",
      "cache_key": "f2191d1b73ac3e2dc58514dffa01c16aa0dd4d1be99314c06c756b58a2ac2282",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "Break down July 2026 net card spend in USD by category label, including the uncategorized bucket. Return category label and net minor units for categories with activity."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B08",
      "arm": "bare",
      "cache_key": "98690c2c2e4179987da90f11bb0e26563f10bf88f663e6655139cb477cba8ab4",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "Break down July 2026 net card spend in USD by category label, including the uncategorized bucket. Return category label and net minor units for categories with activity."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B09",
      "arm": "bare",
      "cache_key": "a90a40b6c4ed05fff47fcece24dbb5c8a8ad71b34bcb3a99a147e3a260312da7",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "Break down July 2026 net card spend in CAD by organization. Return organization_id and net minor units for organizations with card activity."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B09",
      "arm": "documented",
      "cache_key": "d567cca1e89607a5504c7c0a3fb624e4095423c504f6cd4f8167d3cb9f935f48",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "Break down July 2026 net card spend in CAD by organization. Return organization_id and net minor units for organizations with card activity."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B10",
      "arm": "documented",
      "cache_key": "abc2590a021cf6b4ed73c4fecda08e7a6c7d2b7e506dbb80862d03235342af16",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "Break down July 2026 net card spend in USD by organization. Return organization_id and net minor units for organizations with card activity."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B10",
      "arm": "bare",
      "cache_key": "7ce3fd6a1bafd2718394c3b2b84d9e213b48dd3fab0d6725d35274e135a01a59",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "Break down July 2026 net card spend in USD by organization. Return organization_id and net minor units for organizations with card activity."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B11",
      "arm": "bare",
      "cache_key": "aeb721dab7bae3bf40ecbe08182a82a15837f14314963ecc9689a151441a6b24",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "For every CAD account, including zero-spend accounts, show July 2026 net card spend. Return account_id and net minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B11",
      "arm": "documented",
      "cache_key": "5373dae4449ebfdf61a4ce52d677a6a1bfe27f88c1cf68f3795c660de6f1deb1",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "For every CAD account, including zero-spend accounts, show July 2026 net card spend. Return account_id and net minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B12",
      "arm": "documented",
      "cache_key": "16680bf92417fe79c7264fe37d47c75c6f4bbc74e68cf5ed7699b5be800a2599",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "For every USD account, including zero-spend accounts, show July 2026 net card spend. Return account_id and net minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B12",
      "arm": "bare",
      "cache_key": "e2e85eebfbee7613b04219b443cf4d531711890354bbabda15f946de1a67ae1b",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "For every USD account, including zero-spend accounts, show July 2026 net card spend. Return account_id and net minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B13",
      "arm": "bare",
      "cache_key": "294982c303ead6937b8f8189db2bfc104e52ee9f21111f8afc7bbdc7f2afce99",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "Show daily CAD net card spend during July 2026, only dates with card activity, in chronological order. Return UTC date as YYYY-MM-DD and net minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B13",
      "arm": "documented",
      "cache_key": "3ed03be7f52b42ace8ad898a3503ea6623715f2aeae220b90daebc6a62751277",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "Show daily CAD net card spend during July 2026, only dates with card activity, in chronological order. Return UTC date as YYYY-MM-DD and net minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B14",
      "arm": "documented",
      "cache_key": "b754dd12ff2cf132595db2d3796a2680911623a7fc868b8e8498f4efac75d118",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "Which three CAD accounts had the highest July 2026 net card spend? Include all accounts as candidates. Return account_id and net minor units, descending by spend and then ascending by account_id to break ties."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B14",
      "arm": "bare",
      "cache_key": "9f330cc92d0c837785d5a4b2f8fd64648767422844c41caf05220dc9eca39bdc",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "Which three CAD accounts had the highest July 2026 net card spend? Include all accounts as candidates. Return account_id and net minor units, descending by spend and then ascending by account_id to break ties."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B15",
      "arm": "bare",
      "cache_key": "3617fc09a026e31a9ed1506707ad4ab7f080233e66b00b458db8e296985265a0",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "Which three category labels had the highest July 2026 net card spend in CAD? Include the uncategorized bucket. Return category label and net minor units, descending by spend and then ascending by label to break ties."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B15",
      "arm": "documented",
      "cache_key": "0765e0eba8ee8cb5f76d6cbc7d9f207f457b559da258908f85c5018e11efb47c",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "Which three category labels had the highest July 2026 net card spend in CAD? Include the uncategorized bucket. Return category label and net minor units, descending by spend and then ascending by label to break ties."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B16",
      "arm": "documented",
      "cache_key": "6ac320395202c03792c9e62b0e79a7dd911af0c483dd8c62161376183629056d",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "At the snapshot, how many active cards does every CAD account have? Include accounts with none. Return account_id and active-card count."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B16",
      "arm": "bare",
      "cache_key": "745271473a0f889f9f122fb97ce927549314cb63e6c65c85a2f6402ee1c68c40",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "At the snapshot, how many active cards does every CAD account have? Include accounts with none. Return account_id and active-card count."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B17",
      "arm": "bare",
      "cache_key": "f9c8883f852d33904c92dc8c73915d8b8259a567f32f4b6a2d2c70c7265dc273",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "At the snapshot, how many active cards are there in each account currency? Return currency and active-card count, retaining currencies with no active cards."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B17",
      "arm": "documented",
      "cache_key": "4ff6f1465d3d65f76705461b959584e079c779f976c4147adb951b4267d43d70",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "At the snapshot, how many active cards are there in each account currency? Return currency and active-card count, retaining currencies with no active cards."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B18",
      "arm": "documented",
      "cache_key": "9521ceb9f027075c325a4352748abec4818fee3019419ca9b98bbcb9ebf65883",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "For each CAD purchase that received a refund in July 2026, show original transaction_id, original purchase amount and the total refunded during July, all amounts in minor units. The original purchase may be in another reporting period."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B18",
      "arm": "bare",
      "cache_key": "4af6f965799415267017e76d3e618c720edc679fbbdbda92b2b2b2630662b3ec",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "For each CAD purchase that received a refund in July 2026, show original transaction_id, original purchase amount and the total refunded during July, all amounts in minor units. The original purchase may be in another reporting period."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B19",
      "arm": "bare",
      "cache_key": "da788be9338fffd09c89f9db500868a5465cbae67d011ce6b2a1c40711d39047",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "How many distinct CAD purchases received at least one refund during July 2026? Return one count, including purchases from earlier periods."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B19",
      "arm": "documented",
      "cache_key": "6fe45708a6161fc0eba72063a2ad17349925858e7f9dea48a0498a8c101e61e3",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "How many distinct CAD purchases received at least one refund during July 2026? Return one count, including purchases from earlier periods."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B20",
      "arm": "documented",
      "cache_key": "bf1a14b30d12c16afd3fbb39ea8922f49e4e3b63bd3574f1a2ede7f1e31004a4",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was the deposit amount in CAD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B20",
      "arm": "bare",
      "cache_key": "dc586420b26a429643f8d726dbc17fbcb3eb117c0bd5bc689ff87c10859ea0fa",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was the deposit amount in CAD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B21",
      "arm": "bare",
      "cache_key": "f9c24b5c8ceb78202d51e45c42a5e607dcfa3b06d3186b207fa74cd9fe3093fa",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was the deposit amount in USD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B21",
      "arm": "documented",
      "cache_key": "7c3e583a6b444b27d174fe0fa2fd4e23a560ece6ce71b888a90d5729ef30ce13",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was the deposit amount in USD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B22",
      "arm": "documented",
      "cache_key": "15e5ff61102bf469504e22e2e10d65b998f80a69c2f0203b74f523a4449aea65",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was the withdrawal amount in CAD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B22",
      "arm": "bare",
      "cache_key": "506a8be4f1a12862ff053fc6716ace33051af6c11d54c93fe7ce8692e5226195",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was the withdrawal amount in CAD during July 2026? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B23",
      "arm": "bare",
      "cache_key": "19cbd64b738a6a2aa3f1849537212308f39f5a10aca76c0a81190e6ff92406e7",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was net external cash flow in CAD during July 2026? Return one signed amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B23",
      "arm": "documented",
      "cache_key": "2388eebeea2fae2fd4b3ce23633063867d4c544bdf8d5fd8cb0cc0fc4e0a1875",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was net external cash flow in CAD during July 2026? Return one signed amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B24",
      "arm": "documented",
      "cache_key": "837990edc42e94f08e4d8480b1ad2e550ff612720ebad20693463a67b3056854",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was net external cash flow in USD during July 2026? Return one signed amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B24",
      "arm": "bare",
      "cache_key": "026f13faf4c995bf8d38247b44b245ee4d2842b55f4939e673c13f9f8a1deb4d",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was net external cash flow in USD during July 2026? Return one signed amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B25",
      "arm": "bare",
      "cache_key": "9393df46bad8ba35b2339a7ec525231c41250f6694a6573b92f6e50f76816f5c",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was internal transfer volume in CAD during July 2026? Count each transfer once. Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B25",
      "arm": "documented",
      "cache_key": "7f1b5d234c6550e997e07fc23b32ee431531f33aa53c55dcf3e953e9c280e6e3",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was internal transfer volume in CAD during July 2026? Count each transfer once. Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B26",
      "arm": "documented",
      "cache_key": "1dd03368f5d3d8b68ab66c2c2becaf534c477cdba51f4b79d8f25741f183aff2",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "How many internal transfers completed during July 2026, by currency? Count each transfer once. Return currency and transfer count."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B26",
      "arm": "bare",
      "cache_key": "ca14e4fbae6f87d0e33e81c316d2d22a52ab06d979bda722cdcd5bf27e41a017",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "How many internal transfers completed during July 2026, by currency? Count each transfer once. Return currency and transfer count."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B27",
      "arm": "bare",
      "cache_key": "8473c18a5f17c0d95ed5bba4dee75759d2d69a75baafd52ec0b8a4637d8a2008",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was the combined closing ledger balance of all CAD accounts on 2026-07-31? Return one signed amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B27",
      "arm": "documented",
      "cache_key": "acef0519b8e04acf010ca3c9d8fb82f8a518a75cde5d36156e02336a02f6b642",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was the combined closing ledger balance of all CAD accounts on 2026-07-31? Return one signed amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B28",
      "arm": "documented",
      "cache_key": "50c38052204ac290cdd607fe2ad327209554c52cabd5192569f4832aa3288a95",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was the combined closing ledger balance of all USD accounts on 2026-07-31? Return one signed amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B28",
      "arm": "bare",
      "cache_key": "90b1ffa16f3656ef69ae0dd2c2d549c2735f00a4c68d7df1a2ebb702a288d0c1",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was the combined closing ledger balance of all USD accounts on 2026-07-31? Return one signed amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B29",
      "arm": "bare",
      "cache_key": "e1a1c63426fb4df7235ce8c2c0d2de06c0168a44d19ed115a2f27cafef17f4ed",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was the combined opening ledger balance of all CAD accounts on 2026-07-01? Return one signed amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B29",
      "arm": "documented",
      "cache_key": "2020ea3416471195b4364e9686606ebf451137e2ed0ebed328ed19a2217aa25a",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was the combined opening ledger balance of all CAD accounts on 2026-07-01? Return one signed amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B30",
      "arm": "documented",
      "cache_key": "4b4c19550d2655b3a875838db6f45cabf926c643fb6f65ebb87090488d235ed6",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was the combined closing ledger balance of all CAD accounts on 2026-07-15? Return one signed amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B30",
      "arm": "bare",
      "cache_key": "25f499dfc1813a79cec998d5f9e29fb5bfdc8b0aa3e55f53f254a80404a16f62",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was the combined closing ledger balance of all CAD accounts on 2026-07-15? Return one signed amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B31",
      "arm": "bare",
      "cache_key": "b416b51a4c606c83a3b8dc75e9e8545ffe5aba9a0b31f9616c1cae9f78272ae7",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was gross CAD card spend on 2026-07-01? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B31",
      "arm": "documented",
      "cache_key": "941c3462ad38f3763e858a47d606404a2c35d8c37c4ba15ae4988822abcd39c6",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was gross CAD card spend on 2026-07-01? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B32",
      "arm": "documented",
      "cache_key": "276554ed201f7cb30d6df2ba3f322c324909439a4019245ac3ae3f87f0bb2a74",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was gross CAD card spend on 2026-07-31? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B32",
      "arm": "bare",
      "cache_key": "bcdade6e56879d98bfededa69c40432ffdaa1b3b1c017861d8d408e542e1b86c",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was gross CAD card spend on 2026-07-31? Return one amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B33",
      "arm": "bare",
      "cache_key": "56ae2fb2e7293863abc2b4668a5a11e73f312216d1256dccd3d40b642f04283f",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "For CAD purchase events marked pending at the snapshot and initiated during July 2026, return the event count and total amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B33",
      "arm": "documented",
      "cache_key": "ab44d1204d30fab67bfef8e654283cfae527bbbde30bf612f6f5dc14df72fc10",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "For CAD purchase events marked pending at the snapshot and initiated during July 2026, return the event count and total amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B34",
      "arm": "documented",
      "cache_key": "576caad1c384efc3becfb41f5a9ee48b5ca851990ba0d175a3c0a93c46ef380d",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "For CAD purchase events marked void at the snapshot and initiated during July 2026, return the event count and total amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B34",
      "arm": "bare",
      "cache_key": "1022358e2929e6ec8aeca8d9a2819809fe3c63a195fe1abbc16de931cfbac081",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "For CAD purchase events marked void at the snapshot and initiated during July 2026, return the event count and total amount in minor units."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B35",
      "arm": "bare",
      "cache_key": "80d086f94f05d99b61f40a9fc9a891028c1680d200f87e9b395d2d84cb789e99",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "Which CAD accounts had no purchases contributing to July 2026 card spend? Return account_id, including accounts with other ledger activity."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B35",
      "arm": "documented",
      "cache_key": "2b486d28ac0f62b6bfd99744e053c6af7a47ad06e98d4f598fbc14c7f0532e4a",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "Which CAD accounts had no purchases contributing to July 2026 card spend? Return account_id, including accounts with other ledger activity."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B36",
      "arm": "documented",
      "cache_key": "c78c3592ef0d0adbe83de1f7b3ec0e36f4f1b21e13079a730c85f79aa0d0d5b9",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "Reconcile July 2026 ledger balances by currency. Return currency, opening balance at July 1, total signed posted movement during July, and closing balance at July 31. Use minor units and include all accounts."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B36",
      "arm": "bare",
      "cache_key": "746c2f69523df4de8112cb1e64887c6390a0774ca0d4ae6ef012d200f2d02ceb",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "Reconcile July 2026 ledger balances by currency. Return currency, opening balance at July 1, total signed posted movement during July, and closing balance at July 31. Use minor units and include all accounts."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B37",
      "arm": "bare",
      "cache_key": "756ed0d0c15ceadc875d719a822cdc926b40a757c5a2338f931feb9b006b68e7",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was total net card spend during July 2026? Return one monetary total."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B37",
      "arm": "documented",
      "cache_key": "e1cac0c1bba5fe591eba0ba30e3833d1b95d5121bda7874ff9178fd1f1cc51df",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was total net card spend during July 2026? Return one monetary total."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B38",
      "arm": "documented",
      "cache_key": "258213d3bcb3f204787f30d772ab1ff45924b8de69a2ac68fedc6299cdf6267d",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was net card spend in CAD? Return one monetary total."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B38",
      "arm": "bare",
      "cache_key": "dac0271f5901e2b2dfb14aadd7ff285cc9c516f4cc6f6e73debcdbb5788e86d7",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was net card spend in CAD? Return one monetary total."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B39",
      "arm": "bare",
      "cache_key": "f7f663232d1084203c995465d0cf59b3274ebc2f0015252e46ec61a626dfb0b3",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "What was the combined balance of all CAD accounts on 2026-07-31? Return one monetary total."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B39",
      "arm": "documented",
      "cache_key": "b5939356bc1a86cf29e821a045e790651601da519a04ab1db7e7bed0979bed08",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "What was the combined balance of all CAD accounts on 2026-07-31? Return one monetary total."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B40",
      "arm": "documented",
      "cache_key": "23e9fa474be54d5e59f183a92f5f83c678fe75634e0cfc839a564a9cdb84e71e",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "system",
          "content": "# Banking data definitions\n\nThis is a fictional event ledger. All timestamps and dates use UTC. The snapshot is 2026-08-03\n00:00. Monetary values are integer minor units. CAD and USD are separate; no FX rate is supplied.\nNever sum currencies into one monetary figure. No default currency or reporting period is defined.\n\n## Sources and relationships\n\naccounts has one row per account_id, its primary key. organization_id groups accounts. currency\nis the account's fixed currency. account_status is the status at the snapshot, either open or\nclosed. opening_balance_minor is its ledger balance at 2026-07-01 00:00. Include closed and\nzero-activity accounts unless the question explicitly filters them.\n\ncards has one row per card_id, its primary key. cards.account_id references accounts.account_id;\nan account can have multiple cards or none. card_status is active, frozen or cancelled at the\nsnapshot. Current card status never removes past posted spending.\n\ncategories has one row per category_id, its primary key. category_name is a display label;\nreporting_group is a broader grouping. NULL category_id means uncategorized, not a missing row to\ndrop. When a label is requested, use Uncategorized for that NULL bucket.\n\ntransactions has one row per transaction_id, its primary key. account_id references accounts;\ncard_id, when present, references cards for that same account. category_id is nullable and\nreferences categories. Transactions inherit their account's currency. amount_minor is positive;\ndirection supplies the sign: credit adds to balance, debit subtracts. event_kind is purchase,\nrefund, deposit, withdrawal or transfer. status is posted, pending or void. Only posted events\nchange ledger balances or standard spend/cash-flow metrics. pending and void have no posted_at.\n\noccurred_at records the initiating event. posted_at records ledger recognition. Standard financial\nperiods use posted_at, even when occurred_at is in another month. Use half-open intervals: the\nrequested start at 00:00 inclusive, the next day/month at 00:00 exclusive. Explicit questions about\npending or void activity use occurred_at. The date of a posted refund is its own recognition date,\nnot the original purchase's date.\n\nPurchases are debits; refunds and deposits are credits; withdrawals are debits. A refund's\nrelated_transaction_id references its original posted purchase, with matching account, currency,\ncard and category. Several partial refunds can reference one purchase; their cumulative amount\ncannot exceed it. No other event kind uses related_transaction_id.\n\nA transfer_group_id identifies exactly two transfer events between distinct accounts in the\nsame currency: one debit and one equal credit with the same status and posting time. A transfer\nis internal movement and excluded from external cash flow and spend. Transfer volume counts only\nthe debit leg; transfer count counts groups once. No FX transfer is present.\n\n## Metric definitions\n\nGross card spend is the sum of posted purchase amounts in the reporting period. Refunded amount\nis the sum of posted refund amounts in the reporting period, regardless of original purchase date.\nNet card spend is gross card spend minus refunded amount. Purchase count counts purchase events,\nnot distinct cards or netted purchase/refund pairs. Refund count counts refund events.\n\nDeposits and withdrawals are their respective posted event amounts. Net external cash flow is\nall posted nontransfer credits minus all posted nontransfer debits, including purchases and\nrefunds as well as deposits and withdrawals. It is not the deposits-minus-withdrawals subtotal.\n\nOpening ledger balance on a date includes the initial opening balance plus all posted signed\nmovements before that UTC date. Closing ledger balance includes all posted signed movements\nthrough the end of that UTC date. It is a stock: sum across accounts on a single date, never across\ndates. Pending/void activity does not change it. Negative ledger balances are allowed in this\nfixture. Available balance, spendable cash, holds and credit limits are not modeled.\n\nActive-card count uses current card_status, counts cards, and retains accounts with zero active\ncards when reporting per account. An account with no posted purchases can still have deposits,\nwithdrawals, transfers or refunds. \"No purchases\" does not mean \"no ledger activity\".\n\n## Materialized marts and safe joins\n\naccount_daily has exactly one row per (account_id, balance_date), including zero-activity accounts.\nIt spans 2026-07-01 through 2026-08-02. currency is fixed by account. opening_minor and closing_minor\nare ledger stocks; posted_credit_minor and posted_debit_minor are that date's posted flows.\nopening_minor + posted_credit_minor - posted_debit_minor equals closing_minor. Join accounts on\naccount_id, many daily rows to one account. Aggregate/filter the requested date first. Do not join\nunaggregated cards or transactions to balance rows; that multiplies the stock.\n\ncard_spend_daily has one row per (spend_date, card_id, category_id), where spend_date is the posted\nUTC date and NULL category_id is a real bucket. account_id and currency are determined by card.\nIt includes only posted purchases/refunds and no zero-filled calendar. purchased_minor,\nrefunded_minor, net_spend_minor, purchase_count and refund_count are additive within a currency.\nnet_spend_minor equals purchased_minor minus refunded_minor. A refund-only day can be negative.\n\nAllowed dimension joins: either mart to accounts on account_id; card_spend_daily to cards on\ncard_id; card_spend_daily to categories on category_id with a LEFT JOIN to retain NULL categories;\ntransactions to accounts on account_id, to cards on card_id and to categories with a LEFT JOIN.\nEach is many-to-one at the dimension key. Refund events can join original transactions on\nrelated_transaction_id = transaction_id, many refunds to one purchase. Preaggregate the refund\nside when summing original amounts, otherwise a partial-refund series repeats the original.\n\nNo high-risk, suspicious-account or other risk threshold is defined. Ask for the missing business\nrule when requested. A question asking for \"balance\" without specifying ledger versus available\nbalance requires clarification. Do not silently substitute ledger balance for available funds.\n"
        },
        {
          "role": "user",
          "content": "Which CAD accounts were high risk during July 2026? Return account_id."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    },
    {
      "question_id": "B40",
      "arm": "bare",
      "cache_key": "130eaa981b9043a20ff40188bcae714054c235e58a1a9f36b76261fe5168e3b1",
      "prompt": [
        {
          "role": "system",
          "content": "You are answering a question using a fictional banking DuckDB database.\nReturn exactly one JSON object and no markdown. For an answerable question use\n{\"kind\":\"sql\",\"sql\":\"SELECT ...\"}. Return the requested columns in their requested order.\nColumn aliases do not matter. Monetary answers must use integer minor units, not rounded units.\nFor an ambiguous question use {\"kind\":\"clarification\",\"missing\":[...]} with only the relevant\nlabels from currency, time_window, balance_definition, metric_definition. Do not choose an\nunstated currency, reporting period or unsupported business definition. Never guess a risk threshold.\nNo database tools or data samples are available during generation. Write one SELECT statement;\nnonrecursive CTEs and ordinary subqueries are permitted. Only the supplied tables and listed scalar\nor aggregate functions are allowed. No external files, network, extensions, mutation, multiple\nstatements, recursive queries, window functions, UNION or table-generating functions. Date and\nnumeric literals, JOIN, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT and Boolean operators are allowed.\n\nAllowed functions: ABS, AVG, CASE, CAST, COALESCE, COUNT, DATE, DATE_TRUNC, DAY, DAY_OF_WEEK, EXTRACT, IF, MAX, MIN, MONTH, NULLIF, ROUND, STRFTIME, SUM, TIMESTAMP_TRUNC, TIME_TO_STR, TRY_CAST, YEAR\nPhysical schema (names and types):\n{\"account_daily\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"balance_date\", \"type\": \"DATE\"}, {\"name\": \"opening_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_credit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"posted_debit_minor\", \"type\": \"BIGINT\"}, {\"name\": \"closing_minor\", \"type\": \"BIGINT\"}], \"accounts\": [{\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"organization_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"account_status\", \"type\": \"VARCHAR\"}, {\"name\": \"opening_balance_minor\", \"type\": \"BIGINT\"}], \"card_spend_daily\": [{\"name\": \"spend_date\", \"type\": \"DATE\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"purchased_minor\", \"type\": \"BIGINT\"}, {\"name\": \"refunded_minor\", \"type\": \"BIGINT\"}, {\"name\": \"net_spend_minor\", \"type\": \"BIGINT\"}, {\"name\": \"purchase_count\", \"type\": \"BIGINT\"}, {\"name\": \"refund_count\", \"type\": \"BIGINT\"}], \"cards\": [{\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_status\", \"type\": \"VARCHAR\"}], \"categories\": [{\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_name\", \"type\": \"VARCHAR\"}, {\"name\": \"reporting_group\", \"type\": \"VARCHAR\"}], \"transactions\": [{\"name\": \"transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"account_id\", \"type\": \"VARCHAR\"}, {\"name\": \"card_id\", \"type\": \"VARCHAR\"}, {\"name\": \"category_id\", \"type\": \"VARCHAR\"}, {\"name\": \"event_kind\", \"type\": \"VARCHAR\"}, {\"name\": \"status\", \"type\": \"VARCHAR\"}, {\"name\": \"direction\", \"type\": \"VARCHAR\"}, {\"name\": \"amount_minor\", \"type\": \"BIGINT\"}, {\"name\": \"currency\", \"type\": \"VARCHAR\"}, {\"name\": \"occurred_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"posted_at\", \"type\": \"TIMESTAMP\"}, {\"name\": \"related_transaction_id\", \"type\": \"VARCHAR\"}, {\"name\": \"transfer_group_id\", \"type\": \"VARCHAR\"}]}"
        },
        {
          "role": "user",
          "content": "Which CAD accounts were high risk during July 2026? Return account_id."
        }
      ],
      "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
      "metadata_hash": "2d21813bd70c514388ada4abed56fd9b1d9707e87e90eb62020f04f2498bfb16"
    }
  ],
  "data_hash": "f937f3c0db0b2037d97e2fe000b6522daba5e9f597c30e70e8d8d7c8a9f2da67",
  "core_sha256": {
    "bootstrap.py": "cf3c1d4c5347555903e26aa624a71c600888f8875d0eefa4ba38b1cf1a795d59",
    "dependency.json": "7e878accb8f16c57d7320f37927264f662d49e496683cfd456653b396e465507",
    "vendor/contract-manifest.json": "21fdb39b407d598a477931bacf8229ff3eb7767818729ac1374193dee7ddbe57",
    "requirements.lock": "a54b4752dc7b66a30a1ae3c15387eabd74e515d08ceb14c62508ba339c2e9788",
    "collect.py": "d0dfc50c4d3aefbcfb678628488c4c9d3f1f72468462b1549441975ce8795148",
    "replay.py": "ba14357758d919cdf46a4e5492dae2ed43c8e12134ad15946e64bc771298924f",
    "banking/inputs.py": "e16ee63c01568145d31d64212dc3c19bcb681d11c265f1c98973eac788a1b130",
    "banking/scoring.py": "8dd14aa09820df04d0277b6c3e0055add001424be5733857192c1d47bc2c1f45",
    "banking/run_contract.py": "8e2388af311e2fa7ef857b767cbfec16e22566ad5a42420eb01249d8810885a2",
    "banking/build.py": "55107beffbbffaca533b770022c7baf1e4623d492bc4c528952a2c2a3bd70a9a",
    "banking/data.py": "fbd41ea420adcf87fe0ac102af2bb51c4e07742b43c211976345b1a307c96167",
    "banking/validate.py": "86c8618a2800ea3f9c2616e3fff0f796e6e0bbb6756457fe7591453ff9f8c9d2",
    "banking/gold.py": "671d08d9f7b2a4a0873df1ccb3625781d35c4b2b4d5326d8ed2817909afe9cb6",
    "DESIGN.md": "b1eef21b46c0525632cbbf23e99f7ee9188777c0775c62f6c3a46ff26ad0bd77"
  },
  "development_result_sha256": "bd26e4217df9368078564e34eb35ee5a352c448688725de81092722909a2c2c0",
  "verification_sha256": "311739b26c24775fdd6481430ce98c2e218eb2316e896d8e6109fddeef21eda6",
  "comparison": "Same raw-SQL answerer; only the documentation bundle differs."
}
