{
  "ursId": "URS-050",
  "title": "Select Another Rep's Trunk Stock for Bill-Only Orders",
  "timestamp": "2026-09-29T02:30:51.318Z",
  "durationMs": 77181,
  "config": {
    "inboxUrl": "http://localhost:40699",
    "dbHost": "localhost",
    "dbPort": 33481,
    "dbName": "cc_repinbox_dev"
  },
  "setup": {
    "status": "pass"
  },
  "scenarios": [
    {
      "name": "Step 1: Login and own trunk",
      "status": "pass",
      "description": "Step 1: Login and own trunk",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/screenshots/step-01-logged-in.png",
        "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/screenshots/step-01-own-trunk-inventory.png"
      ],
      "explanation": "A sales rep logs in and navigates to their trunk stock. This establishes the baseline inventory context and confirms that a rep can view their own trunk before attempting to use another rep's trunk.",
      "startedAt": "2026-09-29T02:30:59.697Z",
      "finishedAt": "2026-09-29T02:31:03.438Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/videos/step-01-own-trunk.webm"
    },
    {
      "name": "Step 2: Bill-only form start",
      "status": "pass",
      "description": "Step 2: Bill-only form start",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/screenshots/step-02-bill-only-form.png",
        "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/screenshots/step-02-account-selected.png",
        "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/screenshots/step-02-devices-step.png"
      ],
      "explanation": "The sales rep begins a new bill-only order by selecting the manufacturer and a sales account. This step navigates through the first two stages of the bill-only form to reach the inventory source selection screen.",
      "startedAt": "2026-09-29T02:31:20.665Z",
      "finishedAt": "2026-09-29T02:31:22.169Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/videos/step-02-bill-only-start.webm"
    },
    {
      "name": "Step 3: Other rep trunk selection",
      "status": "pass",
      "description": "Step 3: Other rep trunk selection",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/screenshots/step-03-other-button-clicked.png",
        "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/screenshots/step-03-rep-trunk-dropdown.png",
        "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/screenshots/step-03-ryan-trunk-selected.png",
        "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/screenshots/step-03-product-from-ryan.png",
        "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/screenshots/step-03-review-other-rep-source.png",
        "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/screenshots/step-03-order-submitted.png"
      ],
      "explanation": "The rep selects \"Other Rep Trunk\" as the inventory source and chooses a specific colleague's trunk from the dropdown. The order is completed and submitted, demonstrating that the system correctly allows a rep to draw from another rep's trunk stock when creating a bill-only order.",
      "expectedEmailTemplates": [
        "New Bill-Only Order"
      ],
      "expectedAuditActions": [
        "decision:bill_only_order.inventory_items_decrement"
      ],
      "startedAt": "2026-09-29T02:31:38.587Z",
      "finishedAt": "2026-09-29T02:31:59.511Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/videos/step-03-other-rep-trunk.webm"
    },
    {
      "name": "Step 4: Database verification",
      "status": "pass",
      "description": "Step 4: Database verification",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/screenshots/step-04-billing-list.png"
      ],
      "explanation": "The billing list is opened to confirm the submitted order appears. This step provides screenshot evidence that the bill-only order is visible in the system after submission using another rep's trunk.",
      "startedAt": "2026-09-29T02:32:06.232Z",
      "finishedAt": "2026-09-29T02:32:06.232Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/videos/step-04-db-verification.webm"
    }
  ],
  "dbValidations": [
    {
      "name": "Bill-only order created by Blair",
      "query": "SELECT bo.id, bo.order_number, bo.status, bo.sales_account_id,\n        bo.created_at, bo.created_by_user_id\n      FROM billing_orders bo\n      WHERE bo.created_by_user_id = $1\n        AND bo.created_at > NOW() - INTERVAL '30 minutes'\n      ORDER BY bo.created_at DESC\n      LIMIT 5",
      "status": "pass",
      "rows": [
        {
          "id": "01a0eb01-2486-7837-a53c-7a99966ec949",
          "order_number": "BO-1",
          "status": "submitted",
          "sales_account_id": "fea7b8c9-d0e1-2345-0123-456789012345",
          "created_at": "2026-09-29T02:31:55.711Z",
          "created_by_user_id": "17b8c9d0-e1f2-3456-1234-567890123456"
        }
      ],
      "assertion": "At least one billing order should have been created by Blair Bennett in the last 30 minutes"
    },
    {
      "name": "Order items reference other rep's trunk",
      "query": "SELECT boi.id, boi.billing_order_id, boi.location_id,\n        boi.lot_number, boi.product_id, op.title as product_name,\n        rwl.name as location_name, rwl.type as location_type\n      FROM billing_order_items boi\n      JOIN billing_orders bo ON boi.billing_order_id = bo.id\n      LEFT JOIN org_products op ON boi.product_id = op.id\n      LEFT JOIN real_world_locations rwl ON boi.location_id = rwl.id\n      WHERE bo.created_by_user_id = $1\n        AND bo.created_at > NOW() - INTERVAL '30 minutes'\n      ORDER BY bo.created_at DESC\n      LIMIT 10",
      "status": "pass",
      "rows": [
        {
          "id": "01a0eb01-2474-7ec8-a813-aebffe7d35e3",
          "billing_order_id": "01a0eb01-2486-7837-a53c-7a99966ec949",
          "location_id": "b7f8a9b0-c1d2-3456-1234-567890123456",
          "lot_number": "URS050-SP-001",
          "product_id": "01989ca2-6a54-7834-8376-06a0251bacd8",
          "product_name": "NovaPatch® PET",
          "location_name": "TRUNK-26",
          "location_type": "trunk_stock"
        }
      ],
      "assertion": "At least one billing order item should have location_id = b7f8a9b0-c1d2-3456-1234-567890123456 (Rana's TRUNK-26)"
    },
    {
      "name": "Lot number matches test data",
      "query": "SELECT boi.lot_number, boi.location_id, rwl.name as location_name\n      FROM billing_order_items boi\n      JOIN billing_orders bo ON boi.billing_order_id = bo.id\n      LEFT JOIN real_world_locations rwl ON boi.location_id = rwl.id\n      WHERE bo.created_by_user_id = $1\n        AND bo.created_at > NOW() - INTERVAL '30 minutes'\n        AND boi.lot_number = $2\n      LIMIT 5",
      "status": "pass",
      "rows": [
        {
          "lot_number": "URS050-SP-001",
          "location_id": "b7f8a9b0-c1d2-3456-1234-567890123456",
          "location_name": "TRUNK-26"
        }
      ],
      "assertion": "Billing order item should have lot_number = URS050-SP-001"
    },
    {
      "name": "Order linked to correct sales account",
      "query": "SELECT bo.id, bo.sales_account_id, sa.name as account_name\n      FROM billing_orders bo\n      JOIN sales_accounts sa ON bo.sales_account_id = sa.id\n      WHERE bo.created_by_user_id = $1\n        AND bo.created_at > NOW() - INTERVAL '30 minutes'\n        AND bo.sales_account_id = $2\n      ORDER BY bo.created_at DESC\n      LIMIT 5",
      "status": "pass",
      "rows": [
        {
          "id": "01a0eb01-2486-7837-a53c-7a99966ec949",
          "sales_account_id": "fea7b8c9-d0e1-2345-0123-456789012345",
          "account_name": "ROSS Surgical Account Request"
        }
      ],
      "assertion": "The billing order should be linked to ROSS Surgical Account"
    },
    {
      "name": "Inventory history records removal from other rep's trunk",
      "query": "SELECT ih.id, ih.item_id, ih.quantity, ih.status, ih.info,\n        ih.created_at, ii.lot, ii.real_world_location_id, rwl.name as location_name\n      FROM inventory_history ih\n      JOIN inventory_items ii ON ih.item_id = ii.id\n      LEFT JOIN real_world_locations rwl ON ii.real_world_location_id = rwl.id\n      WHERE ii.lot = $1\n        AND ii.organization_id = $2\n        AND ih.created_at > NOW() - INTERVAL '30 minutes'\n        AND ih.info->>'action' = 'removed'\n        AND ih.info->>'reason' = 'bill_only_order'\n      ORDER BY ih.created_at DESC\n      LIMIT 10",
      "status": "pass",
      "rows": [
        {
          "id": "01a0eb01-2496-7ea3-8533-d75f4c9db9ce",
          "item_id": "7f941039-7a62-4e68-b603-a3b7811caa34",
          "quantity": 1,
          "status": "ready",
          "info": {
            "action": "removed",
            "reason": "bill_only_order",
            "bestEffort": true,
            "billingOrderId": "01a0eb01-2486-7837-a53c-7a99966ec949",
            "shortageQuantity": 0,
            "requestedQuantity": 1
          },
          "created_at": "2026-09-29T02:31:55.711Z",
          "lot": "URS050-SP-001",
          "real_world_location_id": "b7f8a9b0-c1d2-3456-1234-567890123456",
          "location_name": "TRUNK-26"
        }
      ],
      "assertion": "Inventory history should show a removal with reason=bill_only_order from TRUNK-26 (Rana)"
    },
    {
      "name": "Blair's own trunk was NOT decremented",
      "query": "SELECT ih.id, ih.item_id, ih.info, ih.created_at, ii.lot\n      FROM inventory_history ih\n      JOIN inventory_items ii ON ih.item_id = ii.id\n      WHERE ii.lot = $1\n        AND ii.organization_id = $2\n        AND ih.created_at > NOW() - INTERVAL '30 minutes'\n        AND ih.info->>'action' = 'removed'\n        AND ih.info->>'reason' = 'bill_only_order'\n      LIMIT 5",
      "status": "pass",
      "rows": [],
      "assertion": "Blair's trunk (TRUNK-36) should not have any bill_only_order removals for the test lot"
    }
  ],
  "overallStatus": "pass",
  "outputDir": "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z",
  "auditStartTime": "2026-09-29T02:30:49.572Z",
  "emailEvidence": [
    {
      "subject": "New Bill-Only Order - 9/29/2026 - Vantis BO-1",
      "template": "New_Bill-Only_Order_-_9_29_2026_-_Vantis_BO-1",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-050-other-rep-trunk-stock/2026-09-29T02-30-51-317Z/screenshots/emails/2026-09-29T02-31-58-008Z-New_Bill-Only_Order_-_9_29_2026_-_Vantis_BO-1.png"
    }
  ],
  "auditEventEvidence": [
    {
      "createdAt": "2026-09-29T02:30:57.588Z",
      "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-09-29T02:31:07.584Z",
      "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-09-29T02:31:19.118Z",
      "eventType": "decision",
      "action": "representatives.gate_rep_action",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "secondaryObjectId": null,
      "payload": {
        "reason": "no_blocking_relationship",
        "orderType": null,
        "performed": false,
        "entityType": "organization",
        "gatedAction": "bill_only",
        "isOwnTrunkDestination": null,
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:19.118Z",
      "eventType": "decision",
      "action": "bill_only_order.duplicate_submission_block",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "fea7b8c9-d0e1-2345-0123-456789012345",
      "secondaryObjectId": null,
      "payload": {
        "step": "surgery",
        "reason": "no_same_day_candidates",
        "performed": false,
        "entityType": "sales_account",
        "vetoedCount": 0,
        "flaggedCount": 0,
        "candidateCount": 0,
        "matchedSignals": {
          "patientId": false,
          "surgeonName": false,
          "patientLastName": false
        },
        "unmatchedCount": 0
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:25.178Z",
      "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-09-29T02:31:35.842Z",
      "eventType": "decision",
      "action": "bill_only_order.duplicate_submission_block",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "fea7b8c9-d0e1-2345-0123-456789012345",
      "secondaryObjectId": null,
      "payload": {
        "step": "surgery",
        "reason": "no_same_day_candidates",
        "performed": false,
        "entityType": "sales_account",
        "vetoedCount": 0,
        "flaggedCount": 0,
        "candidateCount": 0,
        "matchedSignals": {
          "patientId": false,
          "surgeonName": false,
          "patientLastName": false
        },
        "unmatchedCount": 0
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:35.842Z",
      "eventType": "decision",
      "action": "representatives.gate_rep_action",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "secondaryObjectId": null,
      "payload": {
        "reason": "no_blocking_relationship",
        "orderType": null,
        "performed": false,
        "entityType": "organization",
        "gatedAction": "bill_only",
        "isOwnTrunkDestination": null,
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:55.711Z",
      "eventType": "decision",
      "action": "representatives.gate_rep_action",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "secondaryObjectId": null,
      "payload": {
        "reason": "no_blocking_relationship",
        "orderType": null,
        "performed": false,
        "entityType": "organization",
        "gatedAction": "bill_only",
        "isOwnTrunkDestination": null,
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:55.711Z",
      "eventType": "decision",
      "action": "bill_only_order.duplicate_submission_block",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "fea7b8c9-d0e1-2345-0123-456789012345",
      "secondaryObjectId": null,
      "payload": {
        "step": "review",
        "reason": "no_same_day_candidates",
        "performed": false,
        "entityType": "sales_account",
        "vetoedCount": 0,
        "flaggedCount": 0,
        "candidateCount": 0,
        "matchedSignals": {
          "patientId": false,
          "surgeonName": false,
          "patientLastName": false
        },
        "unmatchedCount": 0
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:55.711Z",
      "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": "01a0eb01-2486-7837-a53c-7a99966ec949",
      "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-09-29T02:31:55.711Z",
      "eventType": "scheduled_task",
      "action": "scheduled_task.scheduled",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb01-24a8-760e-a494-267bcf6a0f5e",
      "secondaryObjectId": null,
      "payload": {
        "entityId": "01a0eb01-2486-7837-a53c-7a99966ec949",
        "revision": 0,
        "taskKind": "bill_only_po_missing_followup",
        "entityType": "billing_order",
        "scheduledAt": "2026-10-06T02:31:55.814Z"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:55.711Z",
      "eventType": "scheduled_task",
      "action": "scheduled_task.scheduled",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb01-24ac-71fb-88f8-e1b032c1111b",
      "secondaryObjectId": null,
      "payload": {
        "entityId": "01a0eb01-2486-7837-a53c-7a99966ec949",
        "revision": 0,
        "taskKind": "bill_only_po_missing_followup",
        "entityType": "billing_order",
        "scheduledAt": "2026-10-13T02:31:55.814Z"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:55.711Z",
      "eventType": "scheduled_task",
      "action": "scheduled_task.scheduled",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb01-24b0-7a18-8265-570b3de34fdb",
      "secondaryObjectId": null,
      "payload": {
        "entityId": "01a0eb01-2486-7837-a53c-7a99966ec949",
        "revision": 0,
        "taskKind": "bill_only_po_missing_followup",
        "entityType": "billing_order",
        "scheduledAt": "2026-10-20T02:31:55.814Z"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:55.711Z",
      "eventType": "decision",
      "action": "representatives.gate_rep_action",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "secondaryObjectId": null,
      "payload": {
        "reason": "no_blocking_relationship",
        "orderType": null,
        "performed": false,
        "entityType": "organization",
        "gatedAction": "bill_only",
        "isOwnTrunkDestination": null,
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:55.711Z",
      "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": "01a0eb01-2486-7837-a53c-7a99966ec949",
      "secondaryObjectId": null,
      "payload": {
        "reason": "inventory_items_decremented",
        "itemCount": 1,
        "performed": true,
        "entityType": "billing_order",
        "hasCaseToteItems": false
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:55.711Z",
      "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": "01a0eb01-2486-7837-a53c-7a99966ec949",
      "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-09-29T02:31:55.711Z",
      "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": "01a0eb01-2486-7837-a53c-7a99966ec949",
      "secondaryObjectId": null,
      "payload": {
        "reason": null,
        "toStatus": "submitted",
        "fromStatus": null,
        "automatedAction": false
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:55.711Z",
      "eventType": "decision",
      "action": "basicErp.deriveSalesOrder",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb01-2486-7837-a53c-7a99966ec949",
      "secondaryObjectId": null,
      "payload": {
        "reason": "flag_disabled",
        "performed": false,
        "entityType": "billing_order"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:57.530Z",
      "eventType": "decision",
      "action": "bill_only.notifications.cc_incident_recipients",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb01-2486-7837-a53c-7a99966ec949",
      "secondaryObjectId": null,
      "payload": {
        "reason": "order has no no-charge item with an incident reason",
        "performed": false,
        "entityType": "billing_order"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:58.039Z",
      "eventType": "transactional_email",
      "action": "new_bill_only",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb01-2486-7837-a53c-7a99966ec949",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "blair.bennett@corvetasurgical.com"
        ],
        "s3Path": "email-audit/b2c3d4e5-f6a7-8901-bcde-f12345678901/01a0eb01-2d41-7f61-9493-8fd351ce86ec/",
        "subject": "New Bill-Only Order - 9/29/2026 - Vantis BO-1",
        "messageId": "dev-console-log",
        "relatedEntityType": "billing_order"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:01.280Z",
      "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"
    }
  ],
  "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": [
    {
      "stepName": "Step 3: Other rep trunk selection",
      "expectedAction": "decision:bill_only_order.inventory_items_decrement",
      "found": true
    }
  ],
  "emailAssertions": [
    {
      "stepName": "Step 3: Other rep trunk selection",
      "expectedTemplate": "New Bill-Only Order",
      "found": true
    }
  ]
}