{
  "ursId": "URS-027",
  "title": "Auto-notify distributors on applicable order types",
  "timestamp": "2026-04-23T03:38:59.036Z",
  "durationMs": 68805,
  "config": {
    "inboxUrl": "http://localhost:63525",
    "dbHost": "localhost",
    "dbPort": 63526,
    "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": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/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-04-23T03:39:07.429Z",
      "finishedAt": "2026-04-23T03:39:07.429Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/videos/step-01-recipients-config.webm"
    },
    {
      "name": "Step 2: Submit dropship order",
      "status": "pass",
      "description": "Step 2: Submit dropship order",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/screenshots/step-02-dropship-form.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/screenshots/step-02-dropship-products.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/screenshots/step-02-dropship-review.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/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-04-23T03:39:21.367Z",
      "finishedAt": "2026-04-23T03:39:32.146Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/videos/step-02-submit-dropship.webm"
    },
    {
      "name": "Step 3: Submit consignment order",
      "status": "pass",
      "description": "Step 3: Submit consignment order",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/screenshots/step-03-consignment-form.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/screenshots/step-03-consignment-products.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/screenshots/step-03-consignment-review.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/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-04-23T03:39:44.549Z",
      "finishedAt": "2026-04-23T03:39:50.353Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/videos/step-03-submit-consignment.webm"
    },
    {
      "name": "Step 4: Manufacturer sees orders",
      "status": "pass",
      "description": "Step 4: Manufacturer sees orders",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/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-04-23T03:40:01.805Z",
      "finishedAt": "2026-04-23T03:40:01.805Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/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": "019db86c-2b98-7b66-aef8-1a4710cf7244",
          "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": "019db86b-e554-77a2-93af-0193daf5393d",
          "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": "019db86b-e554-77a2-93af-0193daf5393d",
          "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": "019db86c-2b98-7b66-aef8-1a4710cf7244",
          "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@zurimed-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@stellartech-distributor.example.com",
          "name": "URS-027 distributor recipient",
          "recipient_purpose": "cc"
        }
      ],
      "assertion": "Both ZuriMED and StellarTech 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": "019db86b-e554-77a2-93af-0193daf5393d",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@zurimed-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@stellartech-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-1 from StellarTech Medical Solutions",
          "has_html": true
        },
        {
          "source": "audit_events",
          "related_entity_id": "019db86b-e554-77a2-93af-0193daf5393d",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@zurimed-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@stellartech-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-1 from StellarTech Medical Solutions",
          "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": "019db86c-2b98-7b66-aef8-1a4710cf7244",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@zurimed-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@stellartech-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-2 from StellarTech Medical Solutions",
          "has_html": true
        },
        {
          "source": "audit_events",
          "related_entity_id": "019db86c-2b98-7b66-aef8-1a4710cf7244",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@zurimed-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@stellartech-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-2 from StellarTech Medical Solutions",
          "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": "019db86b-e554-77a2-93af-0193daf5393d",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@zurimed-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@stellartech-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-1 from StellarTech Medical Solutions",
          "has_html": true
        },
        {
          "source": "audit_events",
          "related_entity_id": "019db86b-e554-77a2-93af-0193daf5393d",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@zurimed-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@stellartech-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-1 from StellarTech Medical Solutions",
          "has_html": false
        }
      ],
      "assertion": "The dropship order's notification(s) must address both the ZuriMED and the StellarTech 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": "019db86c-2b98-7b66-aef8-1a4710cf7244",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@zurimed-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@stellartech-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-2 from StellarTech Medical Solutions",
          "has_html": true
        },
        {
          "source": "audit_events",
          "related_entity_id": "019db86c-2b98-7b66-aef8-1a4710cf7244",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@zurimed-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@stellartech-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-2 from StellarTech Medical Solutions",
          "has_html": false
        }
      ],
      "assertion": "The consignment order's notification(s) must address both the ZuriMED and the StellarTech 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": "019db86b-e554-77a2-93af-0193daf5393d",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@zurimed-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@stellartech-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-1 from StellarTech Medical Solutions",
          "has_html": true
        },
        {
          "source": "audit_events",
          "related_entity_id": "019db86b-e554-77a2-93af-0193daf5393d",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@zurimed-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@stellartech-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-1 from StellarTech Medical Solutions",
          "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": "019db86c-2b98-7b66-aef8-1a4710cf7244",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@zurimed-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@stellartech-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-2 from StellarTech Medical Solutions",
          "has_html": true
        },
        {
          "source": "audit_events",
          "related_entity_id": "019db86c-2b98-7b66-aef8-1a4710cf7244",
          "to_addresses": [
            "URS-027 distributor recipient <urs027-distributor-test@zurimed-fulfillment.example.com>",
            "URS-027 distributor recipient <urs027-distributor-test@stellartech-distributor.example.com>"
          ],
          "cc_addresses": [],
          "subject": "New Order Request Submitted - OR-2 from StellarTech Medical Solutions",
          "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": "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z",
  "auditStartTime": "2026-04-23T03:38:57.156Z",
  "emailEvidence": [
    {
      "subject": "New Order Request Submitted - OR-1 from StellarTech Medical Solutions",
      "template": "New_Order_Request_Submitted_-_OR-1_from_StellarTech_Medical_Solutions",
      "screenshotPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/screenshots/emails/2026-04-23T03-39-32-113Z-New_Order_Request_Submitted_-_OR-1_from_StellarTech_Medical_Solutions.png"
    },
    {
      "subject": "New Order Request Submitted - OR-2 from StellarTech Medical Solutions",
      "template": "New_Order_Request_Submitted_-_OR-2_from_StellarTech_Medical_Solutions",
      "screenshotPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/screenshots/emails/2026-04-23T03-39-50-103Z-New_Order_Request_Submitted_-_OR-2_from_StellarTech_Medical_Solutions.png"
    },
    {
      "subject": "New Order Request Submitted - OR-1 from StellarTech Medical Solutions",
      "template": "order_request_submitted",
      "screenshotPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/screenshots/emails/OR-1-inv_1gbEpmqpGBKQ5DbIYIsRkjMrtmGwAh5nlD.png"
    },
    {
      "subject": "New Order Request Submitted - OR-2 from StellarTech Medical Solutions",
      "template": "order_request_submitted",
      "screenshotPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-027-auto-notify-distributors/2026-04-23T03-38-59-034Z/screenshots/emails/OR-2-inv_1iBkZa7JZk8q7b0iH4i0efnXCzKt15U39n.png"
    }
  ],
  "auditEventEvidence": [
    {
      "createdAt": "2026-04-23T03:39:01.319Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "mark.manufacturer@zurimed.com",
      "userId": "d4e5f6a7-b8c9-0123-def1-234567890123",
      "organizationName": "ZuriMED",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "mark.manufacturer@zurimed.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-04-23T03:39:12.121Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "bob.kauffman@stellartech.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "StellarTech Medical Solutions",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "bob.kauffman@stellartech.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-04-23T03:39:32.035Z",
      "eventType": "decision",
      "action": "order_request_created",
      "userEmail": "bob.kauffman@stellartech.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "ZuriMED",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019db86b-e554-77a2-93af-0193daf5393d",
      "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",
        "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-04-23T03:39:32.160Z",
      "eventType": "transactional_email",
      "action": "order_request_submitted",
      "userEmail": null,
      "userId": null,
      "organizationName": "ZuriMED",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019db86b-e554-77a2-93af-0193daf5393d",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "URS-027 distributor recipient <urs027-distributor-test@zurimed-fulfillment.example.com>",
          "URS-027 distributor recipient <urs027-distributor-test@stellartech-distributor.example.com>"
        ],
        "s3Path": "email-audit/a1b2c3d4-e5f6-7890-abcd-ef1234567890/019db86b-e597-7a5f-9c50-7c9d13323a2b/",
        "subject": "New Order Request Submitted - OR-1 from StellarTech Medical Solutions",
        "messageId": "dev-console-log",
        "relatedEntityType": "order_request"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-04-23T03:39:36.710Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "bob.kauffman@stellartech.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "StellarTech Medical Solutions",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "bob.kauffman@stellartech.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-04-23T03:39:50.011Z",
      "eventType": "decision",
      "action": "order_request_created",
      "userEmail": "bob.kauffman@stellartech.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "ZuriMED",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019db86c-2b98-7b66-aef8-1a4710cf7244",
      "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",
        "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-04-23T03:39:50.135Z",
      "eventType": "transactional_email",
      "action": "order_request_submitted",
      "userEmail": null,
      "userId": null,
      "organizationName": "ZuriMED",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "019db86c-2b98-7b66-aef8-1a4710cf7244",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "URS-027 distributor recipient <urs027-distributor-test@zurimed-fulfillment.example.com>",
          "URS-027 distributor recipient <urs027-distributor-test@stellartech-distributor.example.com>"
        ],
        "s3Path": "email-audit/a1b2c3d4-e5f6-7890-abcd-ef1234567890/019db86c-2bdf-70d7-9d31-ac0690ab91c6/",
        "subject": "New Order Request Submitted - OR-2 from StellarTech Medical Solutions",
        "messageId": "dev-console-log",
        "relatedEntityType": "order_request"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-04-23T03:39:54.950Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "mark.manufacturer@zurimed.com",
      "userId": "d4e5f6a7-b8c9-0123-def1-234567890123",
      "organizationName": "ZuriMED",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "mark.manufacturer@zurimed.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
    }
  ]
}