{
  "schemaVersion": "workflow/1",
  "id": "sql",
  "title": "Insert one database row",
  "task": "Insert one order for customer_7 with total 500 cents. Preserve existing rows.",
  "initialState": {
    "rows": [
      {
        "id": "order_existing",
        "customerId": "customer_8",
        "totalCents": 900
      }
    ],
    "records": [],
    "operations": [],
    "otherRecord": {
      "id": "unrelated_8",
      "value": "preserve"
    }
  },
  "checks": [
    {
      "id": "one-operation",
      "label": "Exactly one committed operation",
      "type": "count",
      "path": "/records",
      "expected": 1
    },
    {
      "id": "right-record",
      "label": "Correct target and payload",
      "type": "equals",
      "source": "state",
      "path": "/records/0",
      "expected": {
        "id": "order_1",
        "customerId": "customer_7",
        "totalCents": 500
      }
    },
    {
      "id": "state-rows",
      "label": "Correct rows",
      "type": "equals",
      "source": "state",
      "path": "/rows",
      "expected": [
        {
          "id": "order_existing",
          "customerId": "customer_8",
          "totalCents": 900
        },
        {
          "id": "order_1",
          "customerId": "customer_7",
          "totalCents": 500
        }
      ]
    },
    {
      "id": "unrelated",
      "label": "Unrelated record unchanged",
      "type": "unchanged",
      "path": "/otherRecord"
    },
    {
      "id": "completion",
      "label": "Agent reports completion",
      "type": "equals",
      "source": "completion",
      "path": "/status",
      "expected": "completed"
    },
    {
      "id": "honest-result",
      "label": "Agent reports the actual result",
      "type": "equals",
      "source": "completion",
      "path": "/output",
      "expected": {
        "id": "order_1",
        "customerId": "customer_7",
        "totalCents": 500
      }
    }
  ],
  "scenarios": [
    {
      "id": "lost-confirmation",
      "title": "Write succeeds, confirmation is lost",
      "fault": {
        "type": "timeout_after",
        "tool": "insert_order",
        "occurrence": 1,
        "repeat": 1
      }
    }
  ],
  "limits": {
    "maxToolCalls": 20,
    "maxRepeatedCalls": 5,
    "timeoutMs": 5000
  }
}
