{
  "ursId": "URS-027",
  "title": "Auto-notify distributors on applicable order types",
  "timestamp": "2026-08-03T23:02:07.344Z",
  "durationMs": 65373,
  "config": {
    "inboxUrl": "http://localhost:38095",
    "dbHost": "localhost",
    "dbPort": 36851,
    "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-08-03T23-02-07-343Z/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-08-03T23:02:18.883Z",
      "finishedAt": "2026-08-03T23:02:18.883Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-08-03T23-02-07-343Z/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-08-03T23-02-07-343Z/screenshots/step-02-dropship-form.png",
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-08-03T23-02-07-343Z/screenshots/step-02-dropship-products.png",
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-08-03T23-02-07-343Z/screenshots/step-02-dropship-review.png",
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-08-03T23-02-07-343Z/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-08-03T23:02:31.972Z",
      "finishedAt": "2026-08-03T23:02:40.850Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-08-03T23-02-07-343Z/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-08-03T23-02-07-343Z/screenshots/step-03-consignment-form.png",
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-08-03T23-02-07-343Z/screenshots/step-03-consignment-products.png",
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-08-03T23-02-07-343Z/screenshots/step-03-consignment-review.png",
        "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-08-03T23-02-07-343Z/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-08-03T23:02:53.004Z",
      "finishedAt": "2026-08-03T23:02:58.938Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-08-03T23-02-07-343Z/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-08-03T23-02-07-343Z/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-08-03T23:03:08.607Z",
      "finishedAt": "2026-08-03T23:03:08.607Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-027-auto-notify-distributors/2026-08-03T23-02-07-343Z/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": "019fc9dd-b7dc-7f0b-a1a1-df1b1ee55398",
          "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": "019fc9dd-712e-78bc-860c-08af8a7f6bb6",
          "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": "019fc9dd-712e-78bc-860c-08af8a7f6bb6",
          "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": "019fc9dd-b7dc-7f0b-a1a1-df1b1ee55398",
          "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": "019fc9dd-712e-78bc-860c-08af8a7f6bb6",
          "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": "019fc9dd-712e-78bc-860c-08af8a7f6bb6",
          "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": "019fc9dd-b7dc-7f0b-a1a1-df1b1ee55398",
          "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": "019fc9dd-b7dc-7f0b-a1a1-df1b1ee55398",
          "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": "019fc9dd-712e-78bc-860c-08af8a7f6bb6",
          "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": "019fc9dd-712e-78bc-860c-08af8a7f6bb6",
          "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": "019fc9dd-b7dc-7f0b-a1a1-df1b1ee55398",
          "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": "019fc9dd-b7dc-7f0b-a1a1-df1b1ee55398",
          "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": "019fc9dd-712e-78bc-860c-08af8a7f6bb6",
          "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": "019fc9dd-712e-78bc-860c-08af8a7f6bb6",
          "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": "019fc9dd-b7dc-7f0b-a1a1-df1b1ee55398",
          "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": "019fc9dd-b7dc-7f0b-a1a1-df1b1ee55398",
          "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-08-03T23-02-07-343Z",
  "auditStartTime": "2026-08-03T23:02:05.702Z",
  "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-08-03T23-02-07-343Z/screenshots/emails/2026-08-03T23-02-41-268Z-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-08-03T23-02-07-343Z/screenshots/emails/2026-08-03T23-02-59-849Z-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-08-03T23-02-07-343Z/screenshots/emails/OR-1-inv_1bAC7c8kvD3a3RQPp3rAJqJ2deyTv1Xn8N.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-08-03T23-02-07-343Z/screenshots/emails/OR-2-inv_16TKeGOP2lQ60fQPcOpYRDa71DAj8mCOG3.png"
    }
  ],
  "auditEventEvidence": [
    {
      "createdAt": "2026-08-03T23:02:12.905Z",
      "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-08-03T23:02:22.883Z",
      "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:02:40.645Z",
      "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": "019fc9dd-7141-7819-b1ea-95a021bb84b8",
      "secondaryObjectId": null,
      "payload": {
        "title": "Order OR-1",
        "source": {
          "type": "order_request",
          "orderRequestId": "019fc9dd-712e-78bc-860c-08af8a7f6bb6"
        }
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:02:40.645Z",
      "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": "019fc9dd-712e-78bc-860c-08af8a7f6bb6",
      "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-08-03T23:02:41.310Z",
      "eventType": "transactional_email",
      "action": "order_request_submitted",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9dd-712e-78bc-860c-08af8a7f6bb6",
      "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/019fc9dd-7381-748d-9684-f1a7be674adf/",
        "subject": "New Order Request Submitted - OR-1 from Corveta Surgical Group",
        "messageId": "dev-console-log",
        "relatedEntityType": "order_request"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:02:44.398Z",
      "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:02:58.757Z",
      "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": "019fc9dd-b7dc-7f0b-a1a1-df1b1ee55398",
      "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-08-03T23:02:58.757Z",
      "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": "019fc9dd-b7e8-7d38-aff7-3af6f895d39c",
      "secondaryObjectId": null,
      "payload": {
        "title": "Order OR-2",
        "source": {
          "type": "order_request",
          "orderRequestId": "019fc9dd-b7dc-7f0b-a1a1-df1b1ee55398"
        }
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:02:59.914Z",
      "eventType": "transactional_email",
      "action": "order_request_submitted",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019fc9dd-b7dc-7f0b-a1a1-df1b1ee55398",
      "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/019fc9dd-bc25-7589-9fbc-a3964fcae652/",
        "subject": "New Order Request Submitted - OR-2 from Corveta Surgical Group",
        "messageId": "dev-console-log",
        "relatedEntityType": "order_request"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-08-03T23:03:02.147Z",
      "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
    }
  ]
}