{
  "kind": "original-bounded-choice-workflow",
  "version": 1,
  "scope": "Classify the timing of an external side effect relative to a database commit using supplied transaction and helper semantics.",
  "question": "Review the external effect relative to database commit. Before commit means an email, HTTP call or external enqueue happens before commit succeeds. Deferred means actual dispatch occurs only after successful commit, including an outbox written in the transaction and dispatched afterward. No external effect means only database/local work is shown. Review takes precedence when commit order or helper behavior is missing/conflicting. Registering a callback is not dispatch. Do not guarantee delivery.",
  "choices": [
    "Before commit",
    "Deferred",
    "No external effect",
    "Review"
  ],
  "actions": {
    "Before commit": {
      "action": "preview_jev_external_effect_commit_order",
      "payload": {
        "decision": "Before commit"
      },
      "pending": true
    },
    "Deferred": {
      "action": "preview_jev_external_effect_commit_order",
      "payload": {
        "decision": "Deferred"
      },
      "pending": true
    },
    "No external effect": {
      "action": "preview_jev_external_effect_commit_order",
      "payload": {
        "decision": "No external effect"
      },
      "pending": true
    },
    "Review": {
      "action": "preview_jev_external_effect_commit_order",
      "payload": {
        "decision": "Review"
      },
      "pending": true
    }
  },
  "samples": [
    {
      "id": "case-1",
      "label": "Email inside the transaction",
      "expected": "Before commit",
      "request": {
        "context": "{\n  \"task\": \"Classify the timing of an external side effect relative to a database commit using supplied transaction and helper semantics.\",\n  \"evidence\": {\n    \"sequence\": [\n      \"begin\",\n      \"save order\",\n      \"send receipt email now\",\n      \"commit\"\n    ],\n    \"contract\": \"send receipt immediately contacts the external mail service.\"\n  }\n}",
        "question": "Review the external effect relative to database commit. Before commit means an email, HTTP call or external enqueue happens before commit succeeds. Deferred means actual dispatch occurs only after successful commit, including an outbox written in the transaction and dispatched afterward. No external effect means only database/local work is shown. Review takes precedence when commit order or helper behavior is missing/conflicting. Registering a callback is not dispatch. Do not guarantee delivery.",
        "choices": [
          "Before commit",
          "Deferred",
          "No external effect",
          "Review"
        ]
      }
    },
    {
      "id": "case-2",
      "label": "After-commit callback",
      "expected": "Deferred",
      "request": {
        "context": "{\n  \"task\": \"Classify the timing of an external side effect relative to a database commit using supplied transaction and helper semantics.\",\n  \"evidence\": {\n    \"sequence\": [\n      \"begin\",\n      \"save order\",\n      \"register callback\",\n      \"commit\",\n      \"callback dispatches receipt\"\n    ],\n    \"contract\": \"Callback runs only after a successful commit and is discarded on rollback.\"\n  }\n}",
        "question": "Review the external effect relative to database commit. Before commit means an email, HTTP call or external enqueue happens before commit succeeds. Deferred means actual dispatch occurs only after successful commit, including an outbox written in the transaction and dispatched afterward. No external effect means only database/local work is shown. Review takes precedence when commit order or helper behavior is missing/conflicting. Registering a callback is not dispatch. Do not guarantee delivery.",
        "choices": [
          "Before commit",
          "Deferred",
          "No external effect",
          "Review"
        ]
      }
    },
    {
      "id": "case-3",
      "label": "Transactional outbox",
      "expected": "Deferred",
      "request": {
        "context": "{\n  \"task\": \"Classify the timing of an external side effect relative to a database commit using supplied transaction and helper semantics.\",\n  \"evidence\": {\n    \"sequence\": [\n      \"begin\",\n      \"save order\",\n      \"write outbox row in same database\",\n      \"commit\",\n      \"dispatcher sends committed outbox row\"\n    ],\n    \"contract\": \"Dispatcher cannot read or send uncommitted rows.\"\n  }\n}",
        "question": "Review the external effect relative to database commit. Before commit means an email, HTTP call or external enqueue happens before commit succeeds. Deferred means actual dispatch occurs only after successful commit, including an outbox written in the transaction and dispatched afterward. No external effect means only database/local work is shown. Review takes precedence when commit order or helper behavior is missing/conflicting. Registering a callback is not dispatch. Do not guarantee delivery.",
        "choices": [
          "Before commit",
          "Deferred",
          "No external effect",
          "Review"
        ]
      }
    },
    {
      "id": "case-4",
      "label": "Database-only work",
      "expected": "No external effect",
      "request": {
        "context": "{\n  \"task\": \"Classify the timing of an external side effect relative to a database commit using supplied transaction and helper semantics.\",\n  \"evidence\": {\n    \"sequence\": [\n      \"begin\",\n      \"update two rows\",\n      \"commit\"\n    ],\n    \"contract\": \"No triggers, hooks or helpers contact an external system.\"\n  }\n}",
        "question": "Review the external effect relative to database commit. Before commit means an email, HTTP call or external enqueue happens before commit succeeds. Deferred means actual dispatch occurs only after successful commit, including an outbox written in the transaction and dispatched afterward. No external effect means only database/local work is shown. Review takes precedence when commit order or helper behavior is missing/conflicting. Registering a callback is not dispatch. Do not guarantee delivery.",
        "choices": [
          "Before commit",
          "Deferred",
          "No external effect",
          "Review"
        ]
      }
    },
    {
      "id": "case-5",
      "label": "Unknown enqueue helper",
      "expected": "Review",
      "request": {
        "context": "{\n  \"task\": \"Classify the timing of an external side effect relative to a database commit using supplied transaction and helper semantics.\",\n  \"evidence\": {\n    \"sequence\": [\n      \"begin\",\n      \"save order\",\n      \"enqueueReceipt()\",\n      \"commit\"\n    ],\n    \"contract\": \"It is unknown whether enqueue writes a database row or immediately calls an external broker.\"\n  }\n}",
        "question": "Review the external effect relative to database commit. Before commit means an email, HTTP call or external enqueue happens before commit succeeds. Deferred means actual dispatch occurs only after successful commit, including an outbox written in the transaction and dispatched afterward. No external effect means only database/local work is shown. Review takes precedence when commit order or helper behavior is missing/conflicting. Registering a callback is not dispatch. Do not guarantee delivery.",
        "choices": [
          "Before commit",
          "Deferred",
          "No external effect",
          "Review"
        ]
      }
    },
    {
      "id": "case-6",
      "label": "Broker enqueue before commit",
      "expected": "Before commit",
      "request": {
        "context": "{\n  \"task\": \"Classify the timing of an external side effect relative to a database commit using supplied transaction and helper semantics.\",\n  \"evidence\": {\n    \"sequence\": [\n      \"begin\",\n      \"save order\",\n      \"publish to external queue now\",\n      \"commit\"\n    ],\n    \"contract\": \"The external queue can deliver the message immediately.\"\n  }\n}",
        "question": "Review the external effect relative to database commit. Before commit means an email, HTTP call or external enqueue happens before commit succeeds. Deferred means actual dispatch occurs only after successful commit, including an outbox written in the transaction and dispatched afterward. No external effect means only database/local work is shown. Review takes precedence when commit order or helper behavior is missing/conflicting. Registering a callback is not dispatch. Do not guarantee delivery.",
        "choices": [
          "Before commit",
          "Deferred",
          "No external effect",
          "Review"
        ]
      }
    }
  ],
  "consumer": "preview_choice_workflow.py"
}
