{
  "asset": "Back-in-stock notification batch simulator",
  "inputs_are_worked_examples": true,
  "source_checked": "2026-11-07",
  "model_module": "../engine.mjs",
  "model_sha256": "f79e5c6f8ba3bd046eaa99db10de26da8c33dec1cb04838f22bcdbb8986b9602",
  "publisher": "Next Order",
  "asset_url": "https://nextorderhq.com/resources/back-in-stock-batch-cases/",
  "source_references": [
    {
      "title": "Klaviyo, back-in-stock flow settings",
      "url": "https://help.klaviyo.com/hc/en-us/articles/115003872251",
      "captured": "2026-11-07",
      "scope": "Account thresholds, subscriber-per-unit batching, inventory recheck after waits, not reserved stock."
    }
  ],
  "scope": "A notification does not consume or reserve inventory. Sales beyond available stock are rejected rather than silently floored to zero. This is an explicit replay, not a Klaviyo account emulator. All-at-once mode, consent, other filters and live purchases are outside it.",
  "cases": [
    {
      "brand_id": "nextorderhq",
      "case_id": "worked-initial-case",
      "inputs": {
        "waiting": 12,
        "stock": 5,
        "minimum": 2,
        "ratio": 1,
        "interval": 1,
        "batches": 3,
        "sold": 2,
        "restocked": 0
      },
      "expected_error": null,
      "expected_result": {
        "title": "Read the queue at each batch check",
        "summary": "8 notifications in the declared replay; 4 subscribers remain. Notifications do not subtract stock or reserve units.",
        "records": [
          {
            "batch": 1,
            "hour": 0,
            "stock_at_check": 5,
            "notified": 5,
            "subscribers_remaining": 7
          },
          {
            "batch": 2,
            "hour": 1,
            "stock_at_check": 3,
            "notified": 3,
            "subscribers_remaining": 4
          },
          {
            "batch": 3,
            "hour": 2,
            "stock_at_check": 1,
            "notified": 0,
            "subscribers_remaining": 4
          }
        ],
        "note": "This is an explicit stock-and-queue model, not a Klaviyo account emulator. All-at-once mode, consent, other filters, timing precision and live purchases are outside it. Stock changes occur only between the modeled batches."
      },
      "scope": "Worked model inputs and expected declared-model behavior, not provider or merchant outcomes."
    },
    {
      "brand_id": "nextorderhq",
      "case_id": "stock-rechecked-each-batch",
      "inputs": {
        "waiting": 12,
        "stock": 5,
        "minimum": 2,
        "ratio": 1,
        "interval": 1,
        "batches": 3,
        "sold": 2,
        "restocked": 0
      },
      "expected_error": null,
      "expected_result": {
        "title": "Read the queue at each batch check",
        "summary": "8 notifications in the declared replay; 4 subscribers remain. Notifications do not subtract stock or reserve units.",
        "records": [
          {
            "batch": 1,
            "hour": 0,
            "stock_at_check": 5,
            "notified": 5,
            "subscribers_remaining": 7
          },
          {
            "batch": 2,
            "hour": 1,
            "stock_at_check": 3,
            "notified": 3,
            "subscribers_remaining": 4
          },
          {
            "batch": 3,
            "hour": 2,
            "stock_at_check": 1,
            "notified": 0,
            "subscribers_remaining": 4
          }
        ],
        "note": "This is an explicit stock-and-queue model, not a Klaviyo account emulator. All-at-once mode, consent, other filters, timing precision and live purchases are outside it. Stock changes occur only between the modeled batches."
      },
      "scope": "Worked model inputs and expected declared-model behavior, not provider or merchant outcomes."
    },
    {
      "brand_id": "nextorderhq",
      "case_id": "notifications-dont-consume-stock",
      "inputs": {
        "waiting": 12,
        "stock": 5,
        "minimum": 2,
        "ratio": 1,
        "interval": 1,
        "batches": 3,
        "sold": 0,
        "restocked": 0
      },
      "expected_error": null,
      "expected_result": {
        "title": "Read the queue at each batch check",
        "summary": "12 notifications in the declared replay; 0 subscribers remain. Notifications do not subtract stock or reserve units.",
        "records": [
          {
            "batch": 1,
            "hour": 0,
            "stock_at_check": 5,
            "notified": 5,
            "subscribers_remaining": 7
          },
          {
            "batch": 2,
            "hour": 1,
            "stock_at_check": 5,
            "notified": 5,
            "subscribers_remaining": 2
          },
          {
            "batch": 3,
            "hour": 2,
            "stock_at_check": 5,
            "notified": 2,
            "subscribers_remaining": 0
          }
        ],
        "note": "This is an explicit stock-and-queue model, not a Klaviyo account emulator. All-at-once mode, consent, other filters, timing precision and live purchases are outside it. Stock changes occur only between the modeled batches."
      },
      "scope": "Worked model inputs and expected declared-model behavior, not provider or merchant outcomes."
    },
    {
      "brand_id": "nextorderhq",
      "case_id": "missing-stock-not-zero",
      "inputs": {
        "waiting": 12,
        "stock": "",
        "minimum": 2,
        "ratio": 1,
        "interval": 1,
        "batches": 3,
        "sold": 2,
        "restocked": 0
      },
      "expected_error": "Starting stock needs a numeric value; blank or non-number inputs are not zero.",
      "expected_result": null,
      "scope": "Worked model inputs and expected declared-model behavior, not provider or merchant outcomes."
    },
    {
      "brand_id": "nextorderhq",
      "case_id": "too-many-batches",
      "inputs": {
        "waiting": 12,
        "stock": 5,
        "minimum": 2,
        "ratio": 1,
        "interval": 1,
        "batches": 21,
        "sold": 2,
        "restocked": 0
      },
      "expected_error": "Keep the replay within 20 batches and the stated input bounds.",
      "expected_result": null,
      "scope": "Worked model inputs and expected declared-model behavior, not provider or merchant outcomes."
    },
    {
      "brand_id": "nextorderhq",
      "case_id": "whitespace-stock-is-not-zero",
      "inputs": {
        "waiting": 12,
        "stock": " ",
        "minimum": 2,
        "ratio": 1,
        "interval": 1,
        "batches": 3,
        "sold": 2,
        "restocked": 0
      },
      "expected_error": "Starting stock needs a numeric value; blank or non-number inputs are not zero.",
      "expected_result": null,
      "scope": "Worked model inputs and expected declared-model behavior, not provider or merchant outcomes."
    },
    {
      "brand_id": "nextorderhq",
      "case_id": "oversold-interval-rejected",
      "inputs": {
        "waiting": 12,
        "stock": 5,
        "minimum": 2,
        "ratio": 1,
        "interval": 1,
        "batches": 3,
        "sold": 20,
        "restocked": 0
      },
      "expected_error": "Batch 2: declared sales exceed stock plus declared restock. Change the inputs; this replay does not model overselling.",
      "expected_result": null,
      "scope": "Worked model inputs and expected declared-model behavior, not provider or merchant outcomes."
    }
  ]
}
