{
  "ursId": "URS-073",
  "title": "Lot traceability for virtual kits (direct orders and bill-only)",
  "timestamp": "2026-08-03T23:05:35.930Z",
  "durationMs": 217694,
  "config": {
    "inboxUrl": "http://localhost:43713",
    "dbHost": "localhost",
    "dbPort": 33223,
    "dbName": "cc_repinbox_dev"
  },
  "setup": {
    "status": "pass"
  },
  "scenarios": [
    {
      "name": "Step 1: Kit setup",
      "status": "pass",
      "description": "Step 1: Kit setup",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-01-kit-product.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-01-kit-bom.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-01-liralock-allowed-lots.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-01-novapatch-allowed-lots.png"
      ],
      "explanation": "Documents the virtual-kit definition: IK2025LL (LiraLock® Implant Kit) is a virtual kit with lot policy \"none\" — kits are never lot-stamped — composed of two components that each carry lot policy \"approved\" with a distinct allowed-lot list (LL516SNA: LN2509/LN2510, NP019N1A: LN2511/LN2512). The distinct lists prove there is no ambiguity about which lots are valid for which component.",
      "startedAt": "2026-08-03T23:05:42.481Z",
      "finishedAt": "2026-08-03T23:05:46.438Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/videos/step-01-kit-setup.webm"
    },
    {
      "name": "Step 2: Catalog & account",
      "status": "pass",
      "description": "Step 2: Catalog & account",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-02-catalog-entry.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-02-sales-account.png"
      ],
      "explanation": "Shows the kit product-catalog entry with billing and ordering enabled, and the ROSS sales account carrying effective approved pricing for the kit plus the \"holds stocked inventory\" billing setting that makes it eligible for direct orders.",
      "startedAt": "2026-08-03T23:05:52.466Z",
      "finishedAt": "2026-08-03T23:05:56.625Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/videos/step-02-catalog-account.webm"
    },
    {
      "name": "Step 3: Baseline inventory",
      "status": "pass",
      "description": "Step 3: Baseline inventory",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-03-baseline-inventory.png"
      ],
      "explanation": "Records the component inventory on hand at the ROSS shipping location before any order activity. This baseline is what makes the later inventory increase (delivery) and decrease (bill-only) conclusively attributable to the two order flows.",
      "startedAt": "2026-08-03T23:06:01.377Z",
      "finishedAt": "2026-08-03T23:06:01.377Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/videos/step-03-baseline-inventory.webm"
    },
    {
      "name": "Step 4: Create direct order",
      "status": "pass",
      "description": "Step 4: Create direct order",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-04-destination.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-04-kit-quantity.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-04-review.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-04-submitted.png"
      ],
      "explanation": "A Corveta sales rep orders 1x of the virtual kit for the ROSS account. Because the account holds owned stock, the order is created as a DIRECT order.",
      "startedAt": "2026-08-03T23:06:43.039Z",
      "finishedAt": "2026-08-03T23:06:49.795Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/videos/step-04-create-direct-order.webm"
    },
    {
      "name": "Step 5: Approve order",
      "status": "pass",
      "description": "Step 5: Approve order",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-05-approval-dialog.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-05-approved-no-lots.png"
      ],
      "explanation": "The manufacturer approves the order, creating the fulfillment order. The order detail lists the kit's components but shows no lot numbers yet — lots are stamped by the warehouse at shipment time, not at order time. The \"Direct Order Created\" notification email (captured in the Email Evidence section) breaks the kit line out into its component SKUs so recipients see what the warehouse will fulfill.",
      "expectedEmailTemplates": [
        "Direct Order Created"
      ],
      "startedAt": "2026-08-03T23:06:58.523Z",
      "finishedAt": "2026-08-03T23:07:05.506Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/videos/step-05-approve-order.webm"
    },
    {
      "name": "Step 6: Import shipping notice",
      "status": "pass",
      "description": "Step 6: Import shipping notice",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-06-upload-form.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-06-import-complete.png"
      ],
      "explanation": "The warehouse ASN is imported through the real /packages/upload pipeline. The warehouse has no concept of virtual kits, so the notice lists the component SKUs with their lots (LL516SNA/LN2509, NP019N1A/LN2511) against the fulfillment order number, with carrier \"demo\" and a magic DFX tracking number that simulates the carrier feed.",
      "startedAt": "2026-08-03T23:07:17.728Z",
      "finishedAt": "2026-08-03T23:07:22.577Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/videos/step-06-import-shipping-notice.webm"
    },
    {
      "name": "Step 7: Lot pages",
      "status": "pass",
      "description": "Step 7: Lot pages",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-07-package-lots.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-07-fulfillment-lots.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-07-order-shipped-lots.png"
      ],
      "explanation": "The imported component lots are now traceable on every page in the chain: the shipping package detail (each item shows its SKU, resolved product description, lot, and the virtual kit it belongs to), the fulfillment order detail (lots per component SKU), and the order request detail (\"Shipped lots:\" per component under the kit line).",
      "startedAt": "2026-08-03T23:07:26.839Z",
      "finishedAt": "2026-08-03T23:07:29.528Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/videos/step-07-lot-pages.webm"
    },
    {
      "name": "Step 8: Delivery & inventory increase",
      "status": "pass",
      "description": "Step 8: Delivery & inventory increase",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-08-package-delivered.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-08-inventory-increased.png"
      ],
      "explanation": "The demo tracking sequence delivers the package through the same handler a real carrier webhook uses, firing the auto-add-inventory hook: each component lot rises by exactly the shipped quantity at the ROSS location, proving received direct-order stock increases inventory with the correct lots.",
      "startedAt": "2026-08-03T23:07:45.105Z",
      "finishedAt": "2026-08-03T23:07:46.338Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/videos/step-08-delivery-inventory-increase.webm"
    },
    {
      "name": "Step 9: Bill-only lot entry",
      "status": "pass",
      "description": "Step 9: Bill-only lot entry",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-09-kit-selected.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-09-missing-lot-error.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-09-ll516sna-lot-options.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-09-np019n1a-lot-options.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-09-lots-selected.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-09-review.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-09-submitted.png"
      ],
      "explanation": "The bill-only form asks for a lot for every tracked kit component and validates them: continuing without lots is rejected, and each component's dropdown offers only that component's approved lots (never the other component's). The order is submitted with LN2509 + LN2511 sourced from the ROSS location stock.",
      "startedAt": "2026-08-03T23:08:04.133Z",
      "finishedAt": "2026-08-03T23:08:16.996Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/videos/step-09-bill-only-lots.webm"
    },
    {
      "name": "Step 10: Bill-only lots & decrement",
      "status": "pass",
      "description": "Step 10: Bill-only lots & decrement",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-10-billing-order-lots.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-10-inventory-decremented.png"
      ],
      "explanation": "The submitted bill-only order shows the kit line with its component lots, and the same lots decrement at the same location — consuming the exact units the direct order delivered, which closes the traceability loop. The \"New Bill-Only Order\" notification (captured in the Email Evidence section) nests each component and its lot number under the kit line. Hospital-stock-only orders intentionally send no billing-contact emails (the stock is already owned by the facility), so the DOF evidence comes from the billable trunk order in the next steps.",
      "expectedEmailTemplates": [
        "New Bill-Only Order"
      ],
      "startedAt": "2026-08-03T23:08:21.486Z",
      "finishedAt": "2026-08-03T23:08:22.905Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/videos/step-10-bill-only-decrement.webm"
    },
    {
      "name": "Step 11: Trunk bill-only",
      "status": "pass",
      "description": "Step 11: Trunk bill-only",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-11-trunk-lots-selected.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-11-trunk-review.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-11-trunk-submitted.png"
      ],
      "explanation": "A second bill-only order sources the kit from Blair's trunk using each component's OTHER approved lot (LL516SNA: LN2510, NP019N1A: LN2512). Unlike hospital stock, trunk-sourced orders bill the facility, so this order produces the notification emails that evidence the lots.",
      "startedAt": "2026-08-03T23:08:45.615Z",
      "finishedAt": "2026-08-03T23:08:49.997Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/videos/step-11-trunk-bill-only.webm"
    },
    {
      "name": "Step 12: DOF notification email",
      "status": "pass",
      "description": "Step 12: DOF notification email",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-12-send-notifications.png",
        "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/step-12-notifications-sent.png"
      ],
      "explanation": "The manufacturer sends the Delivered Order Form notification from the bill-only detail page. The DOF email (captured in the Email Evidence section) renders the kit line with its component lot numbers, proving the lots flow into outbound notifications.",
      "expectedEmailTemplates": [
        "Delivered Order"
      ],
      "startedAt": "2026-08-03T23:08:57.971Z",
      "finishedAt": "2026-08-03T23:09:09.508Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/videos/step-12-dof-notification.webm"
    }
  ],
  "dbValidations": [
    {
      "name": "Virtual kit is defined with lot policy none and a two-component BOM",
      "query": "SELECT p.sku, p.product_kind, p.lot_policy, cp.sku AS component_sku, pc.quantity\n     FROM org_products p\n     JOIN product_components pc ON pc.composite_product_id = p.id\n     JOIN org_products cp ON cp.id = pc.component_product_id\n     WHERE p.id = $1 ORDER BY pc.sort_order",
      "status": "pass",
      "rows": [
        {
          "sku": "IK2025LL",
          "product_kind": "virtual_kit",
          "lot_policy": "none",
          "component_sku": "LL516SNA",
          "quantity": 1
        },
        {
          "sku": "IK2025LL",
          "product_kind": "virtual_kit",
          "lot_policy": "none",
          "component_sku": "NP019N1A",
          "quantity": 1
        }
      ],
      "assertion": "Kit IK2025LL is a virtual_kit with lot_policy none and components LL516SNA + NP019N1A"
    },
    {
      "name": "Components use approved lot policies with distinct allowed-lot lists",
      "query": "SELECT p.sku, p.lot_policy, array_agg(al.lot_value ORDER BY al.lot_value) AS lots\n     FROM org_products p\n     JOIN org_product_allowed_lots al ON al.org_product_id = p.id\n     WHERE p.id = ANY($1) GROUP BY p.id, p.sku, p.lot_policy ORDER BY p.sku",
      "status": "pass",
      "rows": [
        {
          "sku": "LL516SNA",
          "lot_policy": "approved",
          "lots": [
            "LN2509",
            "LN2510"
          ]
        },
        {
          "sku": "NP019N1A",
          "lot_policy": "approved",
          "lots": [
            "LN2511",
            "LN2512"
          ]
        }
      ],
      "assertion": "LL516SNA allows LN2509/LN2510; NP019N1A allows LN2511/LN2512"
    },
    {
      "name": "Kit catalog entry allows billing and ordering; account has effective, enabled pricing and holds owned stock",
      "query": "SELECT ci.allow_billing, ci.allow_ordering, ci.active,\n            ap.price, ap.status AS pricing_status, ap.enabled AS pricing_enabled,\n            p.pricing_mode, sa.holds_owned_stock\n     FROM product_catalog_items ci\n     JOIN org_products p ON p.id = $3\n     JOIN sales_account_approved_pricing ap ON ap.id = $2\n     JOIN sales_accounts sa ON sa.id = ap.sales_account_id\n     WHERE ci.id = $1",
      "status": "pass",
      "rows": [
        {
          "allow_billing": true,
          "allow_ordering": true,
          "active": true,
          "price": "5000.00",
          "pricing_status": "effective",
          "pricing_enabled": true,
          "pricing_mode": "fixed",
          "holds_owned_stock": true
        }
      ],
      "assertion": "allow_billing, allow_ordering, active, effective+enabled pricing, pricing_mode=fixed, holds_owned_stock all true"
    },
    {
      "name": "Direct order for the kit exists, is approved, and produced a fulfillment order",
      "query": "SELECT orq.request_number, orq.order_type, orq.status, fo.order_number, fo.status AS fo_status\n     FROM order_requests orq\n     JOIN order_request_items ori ON ori.order_request_id = orq.id AND ori.product_id = $1\n     LEFT JOIN fulfillment_orders fo ON fo.order_request_id = orq.id\n     WHERE orq.notes LIKE $2",
      "status": "pass",
      "rows": [
        {
          "request_number": "OR-1",
          "order_type": "direct",
          "status": "approved",
          "order_number": "OR-1-FO-1",
          "fo_status": "delivered"
        }
      ],
      "assertion": "A direct-type order request for the kit is approved with a fulfillment order"
    },
    {
      "name": "Shipping package carries the component SKUs with their lots and reached delivered",
      "query": "SELECT sp.status, spi.info->>'sku' AS sku, spi.info->>'lot' AS lot, spi.quantity\n     FROM shipping_packages sp\n     JOIN shipping_package_items spi ON spi.package_id = sp.id\n     JOIN shipping_package_fulfillment_orders spfo ON spfo.shipping_package_id = sp.id\n     JOIN fulfillment_orders fo ON fo.id = spfo.fulfillment_order_id\n     JOIN order_requests orq ON orq.id = fo.order_request_id\n     WHERE orq.notes LIKE $1\n     ORDER BY spi.info->>'sku'",
      "status": "pass",
      "rows": [
        {
          "status": "delivered",
          "sku": "LL516SNA",
          "lot": "LN2509",
          "quantity": 1
        },
        {
          "status": "delivered",
          "sku": "NP019N1A",
          "lot": "LN2511",
          "quantity": 1
        }
      ],
      "assertion": "Package items = LL516SNA/LN2509 + NP019N1A/LN2511, package status delivered"
    },
    {
      "name": "Billing orders carry kit parent lines with component child rows for both lot sets",
      "query": "SELECT parent.billing_order_id, child.lot_number, cp.sku AS component_sku\n     FROM billing_order_items parent\n     JOIN billing_order_items child ON child.parent_billing_order_item_id = parent.id\n     JOIN org_products cp ON cp.id = child.product_id\n     WHERE parent.product_id = $1\n     ORDER BY child.lot_number",
      "status": "pass",
      "rows": [
        {
          "billing_order_id": "019fc9e2-89c7-71e6-8af4-094cc878b53e",
          "lot_number": "LN2509",
          "component_sku": "LL516SNA"
        },
        {
          "billing_order_id": "019fc9e3-0aaa-7016-b943-ce38eb69f074",
          "lot_number": "LN2510",
          "component_sku": "LL516SNA"
        },
        {
          "billing_order_id": "019fc9e2-89c7-71e6-8af4-094cc878b53e",
          "lot_number": "LN2511",
          "component_sku": "NP019N1A"
        },
        {
          "billing_order_id": "019fc9e3-0aaa-7016-b943-ce38eb69f074",
          "lot_number": "LN2512",
          "component_sku": "NP019N1A"
        }
      ],
      "assertion": "Hospital-stock order children = LL516SNA/LN2509 + NP019N1A/LN2511; trunk order children = LL516SNA/LN2510 + NP019N1A/LN2512"
    },
    {
      "name": "Inventory returned to baseline after +1 (ASN delivery) and −1 (bill-only decrement)",
      "query": "SELECT lot, SUM(quantity_ready)::int AS quantity\n     FROM inventory_items\n     WHERE real_world_location_id = $1 AND lot = ANY($2)\n     GROUP BY lot ORDER BY lot",
      "status": "pass",
      "rows": [
        {
          "lot": "LN2509",
          "quantity": 5
        },
        {
          "lot": "LN2511",
          "quantity": 5
        }
      ],
      "assertion": "Each active lot ends at 5 (baseline 5 +1 delivered −1 billed)"
    },
    {
      "name": "Trunk stock decremented for the billable order (other approved lots)",
      "query": "SELECT lot, SUM(quantity_ready)::int AS quantity\n     FROM inventory_items\n     WHERE real_world_location_id = $1 AND lot = ANY($2)\n     GROUP BY lot ORDER BY lot",
      "status": "pass",
      "rows": [
        {
          "lot": "LN2510",
          "quantity": 4
        },
        {
          "lot": "LN2512",
          "quantity": 4
        }
      ],
      "assertion": "Each trunk lot ends at 4 (baseline 5 −1 billed)"
    },
    {
      "name": "Bill-only decrements recorded inventory transactions for the kit orders",
      "query": "SELECT it.source_type, it.source_id\n     FROM inventory_transactions it\n     WHERE it.source_type = 'bill_only_order' AND it.source_id IN (\n       SELECT DISTINCT boi.billing_order_id FROM billing_order_items boi\n       WHERE boi.product_id = $1)",
      "status": "pass",
      "rows": [
        {
          "source_type": "bill_only_order",
          "source_id": "019fc9e2-89c7-71e6-8af4-094cc878b53e"
        },
        {
          "source_type": "bill_only_order",
          "source_id": "019fc9e3-0aaa-7016-b943-ce38eb69f074"
        }
      ],
      "assertion": "Each kit billing order has a bill_only_order inventory transaction"
    },
    {
      "name": "Direct Order Created email lists the kit components",
      "query": "Email HTML inspection: a /Direct_Order_Created/ capture must contain IK2025LL, LL516SNA, NP019N1A",
      "status": "pass",
      "rows": [
        {
          "file": "2026-08-03T23-07-00-447Z-Direct_Order_Created_-_OR-1-FO-1.html",
          "matched": true
        }
      ],
      "assertion": "Captured email contains: IK2025LL, LL516SNA, NP019N1A"
    },
    {
      "name": "New Bill-Only email carries the hospital-stock component lots",
      "query": "Email HTML inspection: a /New_Bill-Only_Order/ capture must contain LL516SNA, LN2509, NP019N1A, LN2511",
      "status": "pass",
      "rows": [
        {
          "file": "2026-08-03T23-08-16-127Z-New_Bill-Only_Order_-_8_3_2026_-_Vantis_BO-2.html",
          "matched": true
        },
        {
          "file": "2026-08-03T23-08-49-205Z-New_Bill-Only_Order_-_8_3_2026_-_Vantis_BO-3.html",
          "matched": false
        }
      ],
      "assertion": "Captured email contains: LL516SNA, LN2509, NP019N1A, LN2511"
    },
    {
      "name": "New Bill-Only email carries the trunk component lots",
      "query": "Email HTML inspection: a /New_Bill-Only_Order/ capture must contain LL516SNA, LN2510, NP019N1A, LN2512",
      "status": "pass",
      "rows": [
        {
          "file": "2026-08-03T23-08-16-127Z-New_Bill-Only_Order_-_8_3_2026_-_Vantis_BO-2.html",
          "matched": false
        },
        {
          "file": "2026-08-03T23-08-49-205Z-New_Bill-Only_Order_-_8_3_2026_-_Vantis_BO-3.html",
          "matched": true
        }
      ],
      "assertion": "Captured email contains: LL516SNA, LN2510, NP019N1A, LN2512"
    },
    {
      "name": "Delivered Order (DOF) email carries the component lots",
      "query": "Email HTML inspection: a /Delivered_Order/ capture must contain LL516SNA, LN2510, NP019N1A, LN2512",
      "status": "pass",
      "rows": [
        {
          "file": "2026-08-03T23-08-59-743Z-Delivered_Order_-_8_3_2026_-_Vantis_BO-3.html",
          "matched": true
        }
      ],
      "assertion": "Captured email contains: LL516SNA, LN2510, NP019N1A, LN2512"
    }
  ],
  "overallStatus": "pass",
  "outputDir": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z",
  "auditStartTime": "2026-08-03T23:05:34.040Z",
  "emailEvidence": [
    {
      "subject": "Direct Order Created - OR-1-FO-1",
      "template": "Direct_Order_Created_-_OR-1-FO-1",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/emails/2026-08-03T23-07-00-447Z-Direct_Order_Created_-_OR-1-FO-1.png"
    },
    {
      "subject": "New Bill-Only Order - 8/3/2026 - Vantis BO-2",
      "template": "New_Bill-Only_Order_-_8_3_2026_-_Vantis_BO-2",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/emails/2026-08-03T23-08-16-127Z-New_Bill-Only_Order_-_8_3_2026_-_Vantis_BO-2.png"
    },
    {
      "subject": "New Bill-Only Order - 8/3/2026 - Vantis BO-3",
      "template": "New_Bill-Only_Order_-_8_3_2026_-_Vantis_BO-3",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/emails/2026-08-03T23-08-49-205Z-New_Bill-Only_Order_-_8_3_2026_-_Vantis_BO-3.png"
    },
    {
      "subject": "Delivered Order - 8/3/2026 - Vantis BO-3",
      "template": "Delivered_Order_-_8_3_2026_-_Vantis_BO-3",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-073-virtual-kit-lot-traceability/2026-08-03T23-05-35-930Z/screenshots/emails/2026-08-03T23-08-59-743Z-Delivered_Order_-_8_3_2026_-_Vantis_BO-3.png"
    }
  ],
  "auditEventEvidence": [
    {
      "createdAt": "2026-08-03T23:05:39.372Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:05:49.441Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:05:58.273Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:06:33.854Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "blair.bennett@corvetasurgical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:06:49.611Z",
      "eventType": "checklist",
      "action": "checklists.create",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e1-3db3-7b8b-9f78-50e7717d1408",
      "secondaryObjectId": null,
      "payload": {
        "title": "Order OR-1",
        "source": {
          "type": "order_request",
          "orderRequestId": "019fc9e1-3da1-7376-a3d1-0e87765dec03"
        }
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:49.611Z",
      "eventType": "decision",
      "action": "order_request_created",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e1-3da1-7376-a3d1-0e87765dec03",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Order request OR-1 created (importSource=manual)",
        "priority": "normal",
        "itemCount": 1,
        "orderType": "direct",
        "performed": true,
        "entityType": "order_request",
        "importSource": "manual",
        "requestNumber": "OR-1",
        "selfFulfilled": false,
        "resolvedLocationId": "6ea3b4c5-d6e7-8901-6789-012345678901",
        "resolvedSalesAccountId": "fea7b8c9-d0e1-2345-0123-456789012345",
        "fulfillingOrganizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:51.385Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:06:59.099Z",
      "eventType": "fulfillment_order",
      "action": "status_change",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e1-62e3-7fcd-8e52-0847f4e895f7",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Order automatically submitted for fulfillment",
        "toStatus": "submitted",
        "fromStatus": "created",
        "automatedAction": true,
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:59.099Z",
      "eventType": "decision",
      "action": "extensiv_order_push.skipped",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e1-62e3-7fcd-8e52-0847f4e895f7",
      "secondaryObjectId": "019fc9e1-3da1-7376-a3d1-0e87765dec03",
      "payload": {
        "flags": {
          "wms_integrations": false,
          "extensiv_wms_integration": false
        },
        "reason": "wms_feature_flag_disabled",
        "orderType": "direct",
        "performed": false,
        "entityType": "FulfillmentOrder",
        "triggerReason": "fulfillment_order_submitted"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:59.099Z",
      "eventType": "decision",
      "action": "tickets.checklist_item_resolve.auto_resolve_ticket",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e1-3db6-7765-ad64-5a361a0166bc",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Checklist item is not linked to any ticket.",
        "newState": "approved",
        "oldState": "ready",
        "performed": false,
        "entityType": "checklist_item"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:06:59.099Z",
      "eventType": "fulfillment_order",
      "action": "status_change",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e1-62e3-7fcd-8e52-0847f4e895f7",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Fulfillment order created from approved items",
        "toStatus": "created",
        "fromStatus": null,
        "automatedAction": true,
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:07:00.471Z",
      "eventType": "transactional_email",
      "action": "direct_order_created",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9e1-62e3-7fcd-8e52-0847f4e895f7",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "blair.bennett@corvetasurgical.com"
        ],
        "s3Path": "email-audit/b2c3d4e5-f6a7-8901-bcde-f12345678901/019fc9e1-67e6-7f63-a67e-84b844788d98/",
        "subject": "Direct Order Created - OR-1-FO-1",
        "messageId": "dev-console-log",
        "relatedEntityType": "fulfillment_order"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:07:08.380Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:07:19.033Z",
      "eventType": "fulfillment_order",
      "action": "status_change",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e1-62e3-7fcd-8e52-0847f4e895f7",
      "secondaryObjectId": null,
      "payload": {
        "reason": "All items shipped",
        "toStatus": "shipped",
        "fromStatus": "submitted",
        "automatedAction": true,
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:07:19.033Z",
      "eventType": "decision",
      "action": "recalculate_order_status",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e1-3da1-7376-a3d1-0e87765dec03",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Shipping status updated from null to shipped",
        "performed": true,
        "entityType": "order_request",
        "quantities": {
          "totalShipped": 2,
          "totalApproved": 1,
          "totalDelivered": 0,
          "hasProcessingOrders": false
        },
        "approvalStatus": "approved",
        "toShippingStatus": "shipped",
        "fromShippingStatus": null,
        "fulfillingOrganizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:07:24.113Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:07:32.380Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:07:39.068Z",
      "eventType": "decision",
      "action": "enable_team_tracked_inventory_routing",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9e1-b075-7bf3-8911-3b03c6c4c74c",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Package linked to direct order",
        "performed": false,
        "entityType": "shipping_package"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:07:39.099Z",
      "eventType": "decision",
      "action": "recalculate_order_status",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e1-3da1-7376-a3d1-0e87765dec03",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Shipping status updated from shipped to delivered",
        "performed": true,
        "entityType": "order_request",
        "quantities": {
          "totalShipped": 2,
          "totalApproved": 1,
          "totalDelivered": 2,
          "hasProcessingOrders": false
        },
        "approvalStatus": "approved",
        "toShippingStatus": "delivered",
        "fromShippingStatus": "shipped",
        "fulfillingOrganizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:07:39.099Z",
      "eventType": "fulfillment_order",
      "action": "status_change",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e1-62e3-7fcd-8e52-0847f4e895f7",
      "secondaryObjectId": null,
      "payload": {
        "reason": "All items delivered",
        "toStatus": "delivered",
        "fromStatus": "shipped",
        "automatedAction": true,
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:07:49.194Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "blair.bennett@corvetasurgical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:08:14.624Z",
      "eventType": "decision",
      "action": "bill_only_order.inventory_items_decrement",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e2-89c7-71e6-8af4-094cc878b53e",
      "secondaryObjectId": null,
      "payload": {
        "reason": "inventory_items_decremented",
        "itemCount": 2,
        "performed": true,
        "entityType": "billing_order",
        "inventorySource": "inventory_items"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:08:14.624Z",
      "eventType": "decision",
      "action": "bill_only_order.direct_po_import_on_create",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e2-89c7-71e6-8af4-094cc878b53e",
      "secondaryObjectId": null,
      "payload": {
        "reason": "No uploaded PO documents",
        "performed": false,
        "entityType": "billing_order",
        "fileSourceOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "hasSelectedPurchaseOrderId": false,
        "purchaseOrderDocumentCount": 0
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:08:14.624Z",
      "eventType": "decision",
      "action": "bill_only.link_purchase_order",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9e2-89c7-71e6-8af4-094cc878b53e",
      "secondaryObjectId": null,
      "payload": {
        "reason": "no_purchase_order_selected",
        "performed": false,
        "entityType": "billing_order",
        "salesOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "manufacturerOrganizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:08:14.624Z",
      "eventType": "billing_order",
      "action": "status_change",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e2-89c7-71e6-8af4-094cc878b53e",
      "secondaryObjectId": null,
      "payload": {
        "reason": null,
        "toStatus": "completed",
        "fromStatus": null,
        "automatedAction": false
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:08:16.143Z",
      "eventType": "transactional_email",
      "action": "new_bill_only",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9e2-89c7-71e6-8af4-094cc878b53e",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "blair.bennett@corvetasurgical.com"
        ],
        "s3Path": "email-audit/b2c3d4e5-f6a7-8901-bcde-f12345678901/019fc9e2-8f84-7d2a-a68d-38b9c1aa28b5/",
        "subject": "New Bill-Only Order - 8/3/2026 - Vantis BO-2",
        "messageId": "dev-console-log",
        "relatedEntityType": "billing_order"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:08:18.541Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "blair.bennett@corvetasurgical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:08:25.728Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "blair.bennett@corvetasurgical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:08:47.624Z",
      "eventType": "decision",
      "action": "bill_only_order.inventory_items_decrement",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e3-0aaa-7016-b943-ce38eb69f074",
      "secondaryObjectId": null,
      "payload": {
        "reason": "inventory_items_decremented",
        "itemCount": 2,
        "performed": true,
        "entityType": "billing_order",
        "inventorySource": "inventory_items"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:08:47.624Z",
      "eventType": "decision",
      "action": "bill_only_order.direct_po_import_on_create",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e3-0aaa-7016-b943-ce38eb69f074",
      "secondaryObjectId": null,
      "payload": {
        "reason": "No uploaded PO documents",
        "performed": false,
        "entityType": "billing_order",
        "fileSourceOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "hasSelectedPurchaseOrderId": false,
        "purchaseOrderDocumentCount": 0
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:08:47.624Z",
      "eventType": "billing_order",
      "action": "status_change",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9e3-0aaa-7016-b943-ce38eb69f074",
      "secondaryObjectId": null,
      "payload": {
        "reason": null,
        "toStatus": "submitted",
        "fromStatus": null,
        "automatedAction": false
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:08:47.624Z",
      "eventType": "decision",
      "action": "bill_only.link_purchase_order",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9e3-0aaa-7016-b943-ce38eb69f074",
      "secondaryObjectId": null,
      "payload": {
        "reason": "no_purchase_order_selected",
        "performed": false,
        "entityType": "billing_order",
        "salesOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "manufacturerOrganizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:08:49.223Z",
      "eventType": "transactional_email",
      "action": "new_bill_only",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9e3-0aaa-7016-b943-ce38eb69f074",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "blair.bennett@corvetasurgical.com"
        ],
        "s3Path": "email-audit/b2c3d4e5-f6a7-8901-bcde-f12345678901/019fc9e3-10bd-7051-a940-3b3ffab2f9f4/",
        "subject": "New Bill-Only Order - 8/3/2026 - Vantis BO-3",
        "messageId": "dev-console-log",
        "relatedEntityType": "billing_order"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:08:51.560Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-08-03T23:08:59.765Z",
      "eventType": "transactional_email",
      "action": "bill_only_dof_generated",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "019fc9e3-0aaa-7016-b943-ce38eb69f074",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "blair.bennett@corvetasurgical.com"
        ],
        "s3Path": "email-audit/b2c3d4e5-f6a7-8901-bcde-f12345678901/019fc9e3-39e9-7690-892f-93e44b785469/",
        "subject": "Delivered Order - 8/3/2026 - Vantis BO-3",
        "messageId": "dev-console-log",
        "attachmentFiles": [
          {
            "s3Key": "email-audit/b2c3d4e5-f6a7-8901-bcde-f12345678901/019fc9e3-39e9-7690-892f-93e44b785469/attachments/1-BO-3-delivered-order-form-2026-08-03.pdf",
            "filename": "BO-3-delivered-order-form-2026-08-03.pdf"
          }
        ],
        "relatedEntityType": "billing_order"
      },
      "route": null,
      "traceId": null
    }
  ],
  "auditQuery": "SELECT\n    ae.created_at,\n    ae.event_type,\n    ae.action,\n    ae.user_id,\n    u.email AS user_email,\n    ae.organization_id,\n    o.name AS organization_name,\n    ae.object_id,\n    ae.secondary_object_id,\n    ae.payload,\n    ae.route,\n    ae.trace_id\n  FROM audit_events ae\n  LEFT JOIN users u ON u.id = ae.user_id\n  LEFT JOIN organizations o ON o.id = ae.organization_id\n  WHERE ae.created_at >= $1\n    AND ae.organization_id = ANY($2::uuid[])\n  ORDER BY ae.created_at ASC",
  "auditAssertions": [],
  "emailAssertions": [
    {
      "stepName": "Step 5: Approve order",
      "expectedTemplate": "Direct Order Created",
      "found": true
    },
    {
      "stepName": "Step 10: Bill-only lots & decrement",
      "expectedTemplate": "New Bill-Only Order",
      "found": true
    },
    {
      "stepName": "Step 12: DOF notification email",
      "expectedTemplate": "Delivered Order",
      "found": true
    }
  ]
}