{
  "ursId": "URS-027",
  "title": "Auto-notify distributors on applicable order types",
  "timestamp": "2026-09-29T02:24:52.888Z",
  "durationMs": 130456,
  "config": {
    "inboxUrl": "http://localhost:34715",
    "dbHost": "localhost",
    "dbPort": 43517,
    "dbName": "cc_repinbox_dev"
  },
  "setup": {
    "status": "pass"
  },
  "scenarios": [
    {
      "name": "Step 1: Distributor notification recipients configured",
      "status": "pass",
      "description": "Step 1: Distributor notification recipients configured",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/screenshots/step-01-notifications-settings.png"
      ],
      "explanation": "Confirms the notification routing configuration has distributor recipients wired to the `order_request_submitted` event type. This pre-condition check ensures the auto-notify mechanism is enabled before any orders are submitted.",
      "expectedAuditActions": [
        "user_log:user:login"
      ],
      "startedAt": "2026-09-29T02:25:26.421Z",
      "finishedAt": "2026-09-29T02:25:26.421Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/videos/step-01-recipients-config.webm"
    },
    {
      "name": "Step 2: Submit dropship order",
      "status": "pass",
      "description": "Step 2: Submit dropship order",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/screenshots/step-02-dropship-form.png",
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/screenshots/step-02-dropship-products.png",
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/screenshots/step-02-dropship-review.png",
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/screenshots/step-02-dropship-submitted.png"
      ],
      "explanation": "A sales rep submits a dropship order, which is a notification-eligible order type. This triggers the `order_request_submitted` event and causes the system to automatically enqueue distributor notification emails, directly exercising the auto-notify requirement.",
      "expectedEmailTemplates": [
        "order_request_submitted"
      ],
      "startedAt": "2026-09-29T02:25:41.533Z",
      "finishedAt": "2026-09-29T02:25:51.153Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/videos/step-02-submit-dropship.webm"
    },
    {
      "name": "Step 3: Submit consignment order",
      "status": "pass",
      "description": "Step 3: Submit consignment order",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/screenshots/step-03-consignment-form.png",
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/screenshots/step-03-consignment-products.png",
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/screenshots/step-03-consignment-review.png",
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/screenshots/step-03-consignment-submitted.png"
      ],
      "explanation": "A sales rep submits a consignment order to provide a contrast case. This verifies that the auto-notify behavior applies to multiple applicable order types and that the system processes each submission without error.",
      "expectedEmailTemplates": [
        "order_request_submitted"
      ],
      "startedAt": "2026-09-29T02:26:44.044Z",
      "finishedAt": "2026-09-29T02:26:49.898Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/videos/step-03-submit-consignment.webm"
    },
    {
      "name": "Step 4: Manufacturer sees orders",
      "status": "pass",
      "description": "Step 4: Manufacturer sees orders",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/screenshots/step-04-orders-list.png"
      ],
      "explanation": "A manufacturer admin reviews both submitted orders in the system. This confirms that both order types are visible in the manufacturer view and that each submission completed successfully end-to-end.",
      "startedAt": "2026-09-29T02:26:59.238Z",
      "finishedAt": "2026-09-29T02:26:59.238Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/videos/step-04-orders-list.webm"
    }
  ],
  "dbValidations": [
    {
      "name": "Both URS-027 order_requests exist",
      "query": "SELECT id, request_number, order_type, status, notes,\n      receiving_rep_user_id, fulfilling_organization_id, requesting_organization_id\n    FROM order_requests\n    WHERE requested_by_user_id = $1\n      AND notes LIKE $2\n    ORDER BY created_at DESC",
      "status": "pass",
      "rows": [
        {
          "id": "01a0eafc-7918-7b5e-9e67-31ea02ae937b",
          "request_number": "OR-2",
          "order_type": "consignment",
          "status": "submitted",
          "notes": "URS-027 consignment contrast order",
          "receiving_rep_user_id": null,
          "fulfilling_organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
          "requesting_organization_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
        },
        {
          "id": "01a0eafb-933f-7e36-9e6a-b440bdc53afb",
          "request_number": "OR-1",
          "order_type": "dropship",
          "status": "submitted",
          "notes": "URS-027 dropship distributor-applicable order",
          "receiving_rep_user_id": null,
          "fulfilling_organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
          "requesting_organization_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
        }
      ],
      "assertion": "Both the dropship and consignment URS-027 test orders should exist"
    },
    {
      "name": "Both order types (dropship + consignment) successfully submitted",
      "query": "SELECT id, request_number, order_type, status, notes,\n      receiving_rep_user_id, fulfilling_organization_id, requesting_organization_id\n    FROM order_requests\n    WHERE requested_by_user_id = $1\n      AND notes LIKE $2\n    ORDER BY created_at DESC",
      "status": "pass",
      "rows": [
        {
          "id": "01a0eafb-933f-7e36-9e6a-b440bdc53afb",
          "request_number": "OR-1",
          "order_type": "dropship",
          "status": "submitted",
          "notes": "URS-027 dropship distributor-applicable order",
          "receiving_rep_user_id": null,
          "fulfilling_organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
          "requesting_organization_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
        },
        {
          "id": "01a0eafc-7918-7b5e-9e67-31ea02ae937b",
          "request_number": "OR-2",
          "order_type": "consignment",
          "status": "submitted",
          "notes": "URS-027 consignment contrast order",
          "receiving_rep_user_id": null,
          "fulfilling_organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
          "requesting_organization_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
        }
      ],
      "assertion": "Both a dropship and a consignment URS-027 order should exist (each must trigger distributor notifications independent of order_type)."
    },
    {
      "name": "Distributor + manufacturer notification recipients are configured",
      "query": "SELECT organization_id, notification_type, email_address, name,\n      recipient_purpose\n    FROM organization_notification_recipients\n    WHERE notification_type = 'order_request_submitted'\n      AND organization_id = ANY($1)\n      AND recipient_purpose = 'cc'\n      AND email_address IS NOT NULL\n    ORDER BY organization_id, email_address",
      "status": "pass",
      "rows": [
        {
          "organization_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
          "notification_type": "order_request_submitted",
          "email_address": "urs027-distributor-test@vantis-fulfillment.example.com",
          "name": "URS-027 distributor recipient",
          "recipient_purpose": "cc"
        },
        {
          "organization_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
          "notification_type": "order_request_submitted",
          "email_address": "urs027-distributor-test@corveta-distributor.example.com",
          "name": "URS-027 distributor recipient",
          "recipient_purpose": "cc"
        }
      ],
      "assertion": "Both Vantis and Corveta must have at least one CC recipient for order_request_submitted notifications"
    },
    {
      "name": "order_request_submitted notification was enqueued/sent for the dropship order",
      "query": "restate_outbox + restate_outbox_dlq + audit_events + spec snapshots",
      "status": "pass",
      "rows": [
        {
          "source": "snapshot",
          "related_entity_id": "01a0eafb-933f-7e36-9e6a-b440bdc53afb",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@vantis-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@corveta-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-1 from Corveta Surgical Group",
          "has_html": true
        },
        {
          "source": "audit_events",
          "related_entity_id": "01a0eafb-933f-7e36-9e6a-b440bdc53afb",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@vantis-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@corveta-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-1 from Corveta Surgical Group",
          "has_html": false
        }
      ],
      "assertion": "There should be an email row tied to the dropship order in restate_outbox, restate_outbox_dlq, audit_events, or the spec-captured snapshot dir"
    },
    {
      "name": "order_request_submitted notification was enqueued/sent for the consignment order",
      "query": "restate_outbox + restate_outbox_dlq + audit_events + spec snapshots",
      "status": "pass",
      "rows": [
        {
          "source": "snapshot",
          "related_entity_id": "01a0eafc-7918-7b5e-9e67-31ea02ae937b",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@vantis-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@corveta-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-2 from Corveta Surgical Group",
          "has_html": true
        },
        {
          "source": "audit_events",
          "related_entity_id": "01a0eafc-7918-7b5e-9e67-31ea02ae937b",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@vantis-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@corveta-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-2 from Corveta Surgical Group",
          "has_html": false
        }
      ],
      "assertion": "There should be an email row tied to the consignment order in restate_outbox, restate_outbox_dlq, audit_events, or the spec-captured snapshot dir"
    },
    {
      "name": "Dropship email recipients include BOTH the URS-027 distributor + manufacturer marker emails",
      "query": "evidence rows aggregated",
      "status": "pass",
      "rows": [
        {
          "source": "snapshot",
          "related_entity_id": "01a0eafb-933f-7e36-9e6a-b440bdc53afb",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@vantis-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@corveta-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-1 from Corveta Surgical Group",
          "has_html": true
        },
        {
          "source": "audit_events",
          "related_entity_id": "01a0eafb-933f-7e36-9e6a-b440bdc53afb",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@vantis-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@corveta-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-1 from Corveta Surgical Group",
          "has_html": false
        }
      ],
      "assertion": "The dropship order's notification(s) must address both the Vantis and the Corveta URS-027 marker recipients (on `to` or `cc`) — proves distributor wiring fired."
    },
    {
      "name": "Consignment email recipients include BOTH the URS-027 distributor + manufacturer marker emails",
      "query": "evidence rows aggregated",
      "status": "pass",
      "rows": [
        {
          "source": "snapshot",
          "related_entity_id": "01a0eafc-7918-7b5e-9e67-31ea02ae937b",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@vantis-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@corveta-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-2 from Corveta Surgical Group",
          "has_html": true
        },
        {
          "source": "audit_events",
          "related_entity_id": "01a0eafc-7918-7b5e-9e67-31ea02ae937b",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@vantis-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@corveta-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-2 from Corveta Surgical Group",
          "has_html": false
        }
      ],
      "assertion": "The consignment order's notification(s) must address both the Vantis and the Corveta URS-027 marker recipients (on `to` or `cc`)."
    },
    {
      "name": "At least one dropship-email subject references the dropship request_number",
      "query": "evidence rows aggregated",
      "status": "pass",
      "rows": [
        {
          "source": "snapshot",
          "related_entity_id": "01a0eafb-933f-7e36-9e6a-b440bdc53afb",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@vantis-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@corveta-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-1 from Corveta Surgical Group",
          "has_html": true
        },
        {
          "source": "audit_events",
          "related_entity_id": "01a0eafb-933f-7e36-9e6a-b440bdc53afb",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@vantis-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@corveta-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-1 from Corveta Surgical Group",
          "has_html": false
        }
      ],
      "assertion": "At least one notification email for the dropship order must have a subject that references the dropship order's request_number"
    },
    {
      "name": "At least one consignment-email subject references the consignment request_number",
      "query": "evidence rows aggregated",
      "status": "pass",
      "rows": [
        {
          "source": "snapshot",
          "related_entity_id": "01a0eafc-7918-7b5e-9e67-31ea02ae937b",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@vantis-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@corveta-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-2 from Corveta Surgical Group",
          "has_html": true
        },
        {
          "source": "audit_events",
          "related_entity_id": "01a0eafc-7918-7b5e-9e67-31ea02ae937b",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@vantis-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@corveta-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-2 from Corveta Surgical Group",
          "has_html": false
        }
      ],
      "assertion": "At least one notification email for the consignment order must have a subject that references the consignment order's request_number"
    }
  ],
  "overallStatus": "pass",
  "outputDir": "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z",
  "auditStartTime": "2026-09-29T02:24:52.023Z",
  "emailEvidence": [
    {
      "subject": "New Order Request Submitted - OR-1 from Corveta Surgical Group",
      "template": "New_Order_Request_Submitted_-_OR-1_from_Corveta_Surgical_Group",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/screenshots/emails/2026-09-29T02-25-51-771Z-New_Order_Request_Submitted_-_OR-1_from_Corveta_Surgical_Group.png"
    },
    {
      "subject": "New Order Request Submitted - OR-2 from Corveta Surgical Group",
      "template": "New_Order_Request_Submitted_-_OR-2_from_Corveta_Surgical_Group",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/screenshots/emails/2026-09-29T02-26-51-272Z-New_Order_Request_Submitted_-_OR-2_from_Corveta_Surgical_Group.png"
    },
    {
      "subject": "New Order Request Submitted - OR-1 from Corveta Surgical Group",
      "template": "order_request_submitted",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/screenshots/emails/OR-1-inv_1iycFee7Jr6C39SgTIb0YAHsWV8BrZ94he.png"
    },
    {
      "subject": "New Order Request Submitted - OR-2 from Corveta Surgical Group",
      "template": "order_request_submitted",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-09-29T02-24-52-888Z/screenshots/emails/OR-2-inv_19duYXgnUfGZ0wqYltWRQzEXl1NEjTCSDE.png"
    }
  ],
  "auditEventEvidence": [
    {
      "createdAt": "2026-09-29T02:25:19.996Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "mark.manufacturer@vantismedical.com",
      "userId": "d4e5f6a7-b8c9-0123-def1-234567890123",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "mark.manufacturer@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-09-29T02:25:31.622Z",
      "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:25:50.814Z",
      "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": "01a0eafb-935d-7b29-a581-866568df9780",
      "secondaryObjectId": null,
      "payload": {
        "title": "Order OR-1",
        "source": {
          "type": "order_request",
          "orderRequestId": "01a0eafb-933f-7e36-9e6a-b440bdc53afb"
        }
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:25:50.814Z",
      "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": "dropship",
        "performed": false,
        "entityType": "organization",
        "gatedAction": "order_request",
        "isOwnTrunkDestination": false,
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:25:50.814Z",
      "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": "01a0eafb-933f-7e36-9e6a-b440bdc53afb",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Order request OR-1 created (importSource=manual)",
        "priority": "normal",
        "itemCount": 1,
        "orderType": "dropship",
        "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-09-29T02:25:51.885Z",
      "eventType": "transactional_email",
      "action": "order_request_submitted",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eafb-933f-7e36-9e6a-b440bdc53afb",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "URS-027 distributor recipient <urs027-distributor-test@vantis-fulfillment.example.com>",
          "URS-027 distributor recipient <urs027-distributor-test@corveta-distributor.example.com>"
        ],
        "s3Path": "email-audit/a1b2c3d4-e5f6-7890-abcd-ef1234567890/01a0eafb-96b3-7502-9c03-cdbd820313ee/",
        "subject": "New Order Request Submitted - OR-1 from Corveta Surgical Group",
        "messageId": "dev-console-log",
        "relatedEntityType": "order_request"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:25:55.869Z",
      "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:26:49.723Z",
      "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": "01a0eafc-7925-7971-b6e6-0cc57e4fa0ab",
      "secondaryObjectId": null,
      "payload": {
        "title": "Order OR-2",
        "source": {
          "type": "order_request",
          "orderRequestId": "01a0eafc-7918-7b5e-9e67-31ea02ae937b"
        }
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:26:49.723Z",
      "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": "01a0eafc-7918-7b5e-9e67-31ea02ae937b",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Order request OR-2 created (importSource=manual)",
        "priority": "normal",
        "itemCount": 1,
        "orderType": "consignment",
        "performed": true,
        "entityType": "order_request",
        "importSource": "manual",
        "requestNumber": "OR-2",
        "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-09-29T02:26:49.723Z",
      "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": "consignment",
        "performed": false,
        "entityType": "organization",
        "gatedAction": "order_request",
        "isOwnTrunkDestination": false,
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:26:51.298Z",
      "eventType": "transactional_email",
      "action": "order_request_submitted",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eafc-7918-7b5e-9e67-31ea02ae937b",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "URS-027 distributor recipient <urs027-distributor-test@vantis-fulfillment.example.com>",
          "URS-027 distributor recipient <urs027-distributor-test@corveta-distributor.example.com>"
        ],
        "s3Path": "email-audit/a1b2c3d4-e5f6-7890-abcd-ef1234567890/01a0eafc-7f11-7d38-af10-47d17d54d041/",
        "subject": "New Order Request Submitted - OR-2 from Corveta Surgical Group",
        "messageId": "dev-console-log",
        "relatedEntityType": "order_request"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:26:53.194Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "mark.manufacturer@vantismedical.com",
      "userId": "d4e5f6a7-b8c9-0123-def1-234567890123",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "mark.manufacturer@vantismedical.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 1: Distributor notification recipients configured",
      "expectedAction": "user_log:user:login",
      "found": true
    }
  ],
  "emailAssertions": [
    {
      "stepName": "Step 2: Submit dropship order",
      "expectedTemplate": "order_request_submitted",
      "found": true
    },
    {
      "stepName": "Step 3: Submit consignment order",
      "expectedTemplate": "order_request_submitted",
      "found": true
    }
  ]
}