{
  "kind": "original-bounded-choice-workflow",
  "version": 1,
  "scope": "Inspect whether two writes sharing a database invariant have explicit all-or-nothing execution on their shown failure path.",
  "question": "For the shown writes: Atomic if a supplied transaction contract commits or rolls back all related writes together; Partial if related same-database writes can leave one committed after the next fails; Independent if no shared invariant requires the writes together. Use Unclear for missing wrapper or failure semantics, or cross-system operations. A lock name alone does not prove atomicity. Classify the shown contract, not actual database behavior.",
  "choices": [
    "Atomic",
    "Partial",
    "Independent",
    "Unclear"
  ],
  "actions": {
    "Atomic": {
      "action": "preview_jev_related_write_atomicity",
      "payload": {
        "decision": "Atomic"
      },
      "pending": true
    },
    "Partial": {
      "action": "preview_jev_related_write_atomicity",
      "payload": {
        "decision": "Partial"
      },
      "pending": true
    },
    "Independent": {
      "action": "preview_jev_related_write_atomicity",
      "payload": {
        "decision": "Independent"
      },
      "pending": true
    },
    "Unclear": {
      "action": "preview_jev_related_write_atomicity",
      "payload": {
        "decision": "Unclear"
      },
      "pending": true
    }
  },
  "samples": [
    {
      "id": "case-1",
      "label": "Project and owner membership",
      "expected": "Partial",
      "request": {
        "context": "{\n  \"task\": \"Inspect whether two writes sharing a database invariant have explicit all-or-nothing execution on their shown failure path.\",\n  \"evidence\": {\n    \"code\": \"await db.projects.create(project); await db.memberships.create(owner);\",\n    \"invariant\": \"A project must have its owner membership.\",\n    \"failure\": \"First write autocommits; second may fail with no cleanup; same database.\"\n  }\n}",
        "question": "For the shown writes: Atomic if a supplied transaction contract commits or rolls back all related writes together; Partial if related same-database writes can leave one committed after the next fails; Independent if no shared invariant requires the writes together. Use Unclear for missing wrapper or failure semantics, or cross-system operations. A lock name alone does not prove atomicity. Classify the shown contract, not actual database behavior.",
        "choices": [
          "Atomic",
          "Partial",
          "Independent",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-2",
      "label": "Verified transaction",
      "expected": "Atomic",
      "request": {
        "context": "{\n  \"task\": \"Inspect whether two writes sharing a database invariant have explicit all-or-nothing execution on their shown failure path.\",\n  \"evidence\": {\n    \"code\": \"await db.transaction(async tx => { await tx.projects.create(project); await tx.memberships.create(owner); });\",\n    \"invariant\": \"A project must have its owner membership.\",\n    \"wrapper\": \"Same-database transaction commits both writes together and rolls back both if either fails.\"\n  }\n}",
        "question": "For the shown writes: Atomic if a supplied transaction contract commits or rolls back all related writes together; Partial if related same-database writes can leave one committed after the next fails; Independent if no shared invariant requires the writes together. Use Unclear for missing wrapper or failure semantics, or cross-system operations. A lock name alone does not prove atomicity. Classify the shown contract, not actual database behavior.",
        "choices": [
          "Atomic",
          "Partial",
          "Independent",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-3",
      "label": "Unrelated records",
      "expected": "Independent",
      "request": {
        "context": "{\n  \"task\": \"Inspect whether two writes sharing a database invariant have explicit all-or-nothing execution on their shown failure path.\",\n  \"evidence\": {\n    \"code\": \"await db.activity.create(event); await db.preferences.update(theme);\",\n    \"invariant\": \"These concern unrelated users and are valid independently.\",\n    \"failure\": \"Each may succeed or fail separately.\"\n  }\n}",
        "question": "For the shown writes: Atomic if a supplied transaction contract commits or rolls back all related writes together; Partial if related same-database writes can leave one committed after the next fails; Independent if no shared invariant requires the writes together. Use Unclear for missing wrapper or failure semantics, or cross-system operations. A lock name alone does not prove atomicity. Classify the shown contract, not actual database behavior.",
        "choices": [
          "Atomic",
          "Partial",
          "Independent",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-4",
      "label": "Opaque lock wrapper",
      "expected": "Unclear",
      "request": {
        "context": "{\n  \"task\": \"Inspect whether two writes sharing a database invariant have explicit all-or-nothing execution on their shown failure path.\",\n  \"evidence\": {\n    \"code\": \"await withProjectLock(async lockedDb => { await lockedDb.projects.create(project); await lockedDb.memberships.create(owner); });\",\n    \"invariant\": \"A project must have an owner membership.\",\n    \"wrapper\": \"Implementation and rollback behavior are not provided.\"\n  }\n}",
        "question": "For the shown writes: Atomic if a supplied transaction contract commits or rolls back all related writes together; Partial if related same-database writes can leave one committed after the next fails; Independent if no shared invariant requires the writes together. Use Unclear for missing wrapper or failure semantics, or cross-system operations. A lock name alone does not prove atomicity. Classify the shown contract, not actual database behavior.",
        "choices": [
          "Atomic",
          "Partial",
          "Independent",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-5",
      "label": "Lock without rollback",
      "expected": "Partial",
      "request": {
        "context": "{\n  \"task\": \"Inspect whether two writes sharing a database invariant have explicit all-or-nothing execution on their shown failure path.\",\n  \"evidence\": {\n    \"code\": \"await withLock(async db => { await db.projects.create(project); await db.memberships.create(owner); });\",\n    \"invariant\": \"A project must have an owner membership.\",\n    \"wrapper\": \"Only prevents concurrent execution; each write autocommits, with no rollback on later failure.\"\n  }\n}",
        "question": "For the shown writes: Atomic if a supplied transaction contract commits or rolls back all related writes together; Partial if related same-database writes can leave one committed after the next fails; Independent if no shared invariant requires the writes together. Use Unclear for missing wrapper or failure semantics, or cross-system operations. A lock name alone does not prove atomicity. Classify the shown contract, not actual database behavior.",
        "choices": [
          "Atomic",
          "Partial",
          "Independent",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-6",
      "label": "Two services",
      "expected": "Unclear",
      "request": {
        "context": "{\n  \"task\": \"Inspect whether two writes sharing a database invariant have explicit all-or-nothing execution on their shown failure path.\",\n  \"evidence\": {\n    \"code\": \"await database.createProject(project); await externalDirectory.addOwner(owner);\",\n    \"invariant\": \"The two records should agree.\",\n    \"failure\": \"Services and compensation policy are separate and unspecified.\"\n  }\n}",
        "question": "For the shown writes: Atomic if a supplied transaction contract commits or rolls back all related writes together; Partial if related same-database writes can leave one committed after the next fails; Independent if no shared invariant requires the writes together. Use Unclear for missing wrapper or failure semantics, or cross-system operations. A lock name alone does not prove atomicity. Classify the shown contract, not actual database behavior.",
        "choices": [
          "Atomic",
          "Partial",
          "Independent",
          "Unclear"
        ]
      }
    }
  ],
  "consumer": "preview_choice_workflow.py"
}
