{
  "kind": "original-bounded-choice-workflow",
  "version": 1,
  "scope": "Identify a database lookup pattern performed separately for each item in a supplied collection.",
  "question": "Classify the shown lookup path: Peritem if each collection item triggers a separate database call; Batched if one query fetches the required items together; Sequential if separate ordered calls are explicitly required by a dependency or protocol; Unclear if helpers or database behavior are missing. Promise.all changes scheduling, not whether calls remain per item. Do not infer measured performance.",
  "choices": [
    "Peritem",
    "Batched",
    "Sequential",
    "Unclear"
  ],
  "actions": {
    "Peritem": {
      "action": "preview_jev_per_item_database_query",
      "payload": {
        "decision": "Peritem"
      },
      "pending": true
    },
    "Batched": {
      "action": "preview_jev_per_item_database_query",
      "payload": {
        "decision": "Batched"
      },
      "pending": true
    },
    "Sequential": {
      "action": "preview_jev_per_item_database_query",
      "payload": {
        "decision": "Sequential"
      },
      "pending": true
    },
    "Unclear": {
      "action": "preview_jev_per_item_database_query",
      "payload": {
        "decision": "Unclear"
      },
      "pending": true
    }
  },
  "samples": [
    {
      "id": "case-1",
      "label": "Looped lookups",
      "expected": "Peritem",
      "request": {
        "context": "{\n  \"task\": \"Identify a database lookup pattern performed separately for each item in a supplied collection.\",\n  \"evidence\": {\n    \"code\": \"for (const id of ids) { users.push(await db.user.findUnique({ where: { id } })); }\",\n    \"context\": \"Each helper call sends one database query; no dependency exists\"\n  }\n}",
        "question": "Classify the shown lookup path: Peritem if each collection item triggers a separate database call; Batched if one query fetches the required items together; Sequential if separate ordered calls are explicitly required by a dependency or protocol; Unclear if helpers or database behavior are missing. Promise.all changes scheduling, not whether calls remain per item. Do not infer measured performance.",
        "choices": [
          "Peritem",
          "Batched",
          "Sequential",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-2",
      "label": "Concurrent lookups",
      "expected": "Peritem",
      "request": {
        "context": "{\n  \"task\": \"Identify a database lookup pattern performed separately for each item in a supplied collection.\",\n  \"evidence\": {\n    \"code\": \"await Promise.all(ids.map(id => db.user.findUnique({ where: { id } })));\",\n    \"context\": \"Each findUnique sends one database query\"\n  }\n}",
        "question": "Classify the shown lookup path: Peritem if each collection item triggers a separate database call; Batched if one query fetches the required items together; Sequential if separate ordered calls are explicitly required by a dependency or protocol; Unclear if helpers or database behavior are missing. Promise.all changes scheduling, not whether calls remain per item. Do not infer measured performance.",
        "choices": [
          "Peritem",
          "Batched",
          "Sequential",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-3",
      "label": "One membership query",
      "expected": "Batched",
      "request": {
        "context": "{\n  \"task\": \"Identify a database lookup pattern performed separately for each item in a supplied collection.\",\n  \"evidence\": {\n    \"code\": \"await db.user.findMany({ where: { id: { in: ids } } });\",\n    \"context\": \"findMany emits one database query\"\n  }\n}",
        "question": "Classify the shown lookup path: Peritem if each collection item triggers a separate database call; Batched if one query fetches the required items together; Sequential if separate ordered calls are explicitly required by a dependency or protocol; Unclear if helpers or database behavior are missing. Promise.all changes scheduling, not whether calls remain per item. Do not infer measured performance.",
        "choices": [
          "Peritem",
          "Batched",
          "Sequential",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-4",
      "label": "Dependent traversal",
      "expected": "Sequential",
      "request": {
        "context": "{\n  \"task\": \"Identify a database lookup pattern performed separately for each item in a supplied collection.\",\n  \"evidence\": {\n    \"code\": \"while (nextId) { const node = await db.read(nextId); nextId = node.nextId; }\",\n    \"context\": \"The linked traversal cannot precompute all keys\"\n  }\n}",
        "question": "Classify the shown lookup path: Peritem if each collection item triggers a separate database call; Batched if one query fetches the required items together; Sequential if separate ordered calls are explicitly required by a dependency or protocol; Unclear if helpers or database behavior are missing. Promise.all changes scheduling, not whether calls remain per item. Do not infer measured performance.",
        "choices": [
          "Peritem",
          "Batched",
          "Sequential",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-5",
      "label": "Unknown batch helper",
      "expected": "Unclear",
      "request": {
        "context": "{\n  \"task\": \"Identify a database lookup pattern performed separately for each item in a supplied collection.\",\n  \"evidence\": {\n    \"code\": \"const users = await loadUsers(ids);\",\n    \"helper\": \"loadUsers implementation unavailable\"\n  }\n}",
        "question": "Classify the shown lookup path: Peritem if each collection item triggers a separate database call; Batched if one query fetches the required items together; Sequential if separate ordered calls are explicitly required by a dependency or protocol; Unclear if helpers or database behavior are missing. Promise.all changes scheduling, not whether calls remain per item. Do not infer measured performance.",
        "choices": [
          "Peritem",
          "Batched",
          "Sequential",
          "Unclear"
        ]
      }
    },
    {
      "id": "case-6",
      "label": "Lookup from loaded map",
      "expected": "Batched",
      "request": {
        "context": "{\n  \"task\": \"Identify a database lookup pattern performed separately for each item in a supplied collection.\",\n  \"evidence\": {\n    \"code\": \"const all = await db.readUsers(ids); const users = ids.map(id => all.get(id));\",\n    \"helper\": \"readUsers emits one collective query and returns an in-memory Map\"\n  }\n}",
        "question": "Classify the shown lookup path: Peritem if each collection item triggers a separate database call; Batched if one query fetches the required items together; Sequential if separate ordered calls are explicitly required by a dependency or protocol; Unclear if helpers or database behavior are missing. Promise.all changes scheduling, not whether calls remain per item. Do not infer measured performance.",
        "choices": [
          "Peritem",
          "Batched",
          "Sequential",
          "Unclear"
        ]
      }
    }
  ],
  "consumer": "preview_choice_workflow.py"
}
