{
  "ursId": "URS-076",
  "title": "Cycle count lifecycle: request, perform, finish — inventory updated",
  "timestamp": "2026-09-29T02:30:59.033Z",
  "durationMs": 75572,
  "config": {
    "inboxUrl": "http://localhost:44379",
    "dbHost": "localhost",
    "dbPort": 40655,
    "dbName": "cc_repinbox_dev"
  },
  "setup": {
    "status": "pass"
  },
  "scenarios": [
    {
      "name": "Step 1: Admin requests a cycle count of distributor trunk and account locations",
      "status": "pass",
      "description": "Step 1: Admin requests a cycle count of distributor trunk and account locations",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/screenshots/step-01-wizard-scope.png",
        "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/screenshots/step-01-review.png",
        "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/screenshots/step-01-submitted.png"
      ],
      "explanation": "Alex Admin (Vantis manufacturer) opens the Cycle Counts request list and creates a new request through the two-step wizard: the Corveta distributorship is selected with the Both scope (trunks and sales accounts), then a due date and a URS-076 marker note are set on the review step. The review lists four resolved locations: the three trunk-like locations (both rep trunks and the team shared-inventory location) and the shipping location of ROSS Surgical, the only Corveta account that holds consignment stock. Corveta's two other accounts (Cedar Crest, Lakeside) do not hold consignment stock, so their locations are absent from the review even though the whole distributorship was selected. Submitting creates the request at status active, links the four locations, pre-opens a cycle count at each (origin admin_request), and assigns rep checklist tasks. The create path logs a create_cycle_count_request audit event and a create_cycle_count_request_item decision per opened count. This verifies an administrator controls which locations are counted and that only consignment accounts receive a cycle count request.",
      "expectedAuditActions": [
        "cycle_count_request:create_cycle_count_request",
        "decision:create_cycle_count_request_item"
      ],
      "startedAt": "2026-09-29T02:31:12.382Z",
      "finishedAt": "2026-09-29T02:31:17.000Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/videos/step-01-request.webm"
    },
    {
      "name": "Step 2: Admin narrows the request to a single trunk location",
      "status": "pass",
      "description": "Step 2: Admin narrows the request to a single trunk location",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/screenshots/step-02-detail-not-started.png",
        "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/screenshots/step-02-narrowed.png"
      ],
      "explanation": "Alex opens the request detail — every location shows Not started — and cancels Rana's TRUNK-26, the shared-inventory location, and the ROSS account location via Select locations → Cancel selected locations. Each cancellation removes the request-location link, closes that location's pre-opened count without applying it (cancelledReason request_location_cancelled), and logs a cancel_cycle_count_request_locations audit event plus per-location decisions. The request now tracks only Blair's TRUNK-36. This verifies the request's scope stays under admin control after creation.",
      "expectedAuditActions": [
        "cycle_count_request:cancel_cycle_count_request_locations",
        "decision:cancel_cycle_count_request_location"
      ],
      "startedAt": "2026-09-29T02:31:23.354Z",
      "finishedAt": "2026-09-29T02:31:28.235Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/videos/step-02-narrow.webm"
    },
    {
      "name": "Step 3: Rep opens the requested cycle count",
      "status": "pass",
      "description": "Step 3: Rep opens the requested cycle count",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/screenshots/step-03-location-page.png",
        "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/screenshots/step-03-scan-page.png"
      ],
      "explanation": "Blair Bennett (Corveta rep) opens his trunk's location page, which offers the request-created count as a continue link into its count screen (\"Add items\"). No separate count needs to be started — the request pre-opened it, and the partial unique index guarantees at most one open count per location and inventory. This verifies the requested count reaches the rep who performs it.",
      "startedAt": "2026-09-29T02:31:34.399Z",
      "finishedAt": "2026-09-29T02:31:36.120Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/videos/step-03-open.webm"
    },
    {
      "name": "Step 4: Rep records the counted items with manual entries",
      "status": "pass",
      "description": "Step 4: Rep records the counted items with manual entries",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/screenshots/step-04-counted-items.png"
      ],
      "explanation": "Blair records what is physically on the shelf through the Add items card's Form mode: 3 NovaPatch PET (of 5 expected — an under-count), 3 LiraLock SN (matching the expected quantity), and 2 Kestrel Footswitches that inventory did not list (a found item). Each entry is a product + lot + quantity row in the count's scan batch. Choosing these three cases exercises every reconciliation direction — removal, no-op, and addition — when the count is finished.",
      "startedAt": "2026-09-29T02:32:00.015Z",
      "finishedAt": "2026-09-29T02:32:00.015Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/videos/step-04-count.webm"
    },
    {
      "name": "Step 5: Rep finishes the cycle count",
      "status": "pass",
      "description": "Step 5: Rep finishes the cycle count",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/screenshots/step-05-finish-summary.png",
        "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/screenshots/step-05-finished.png"
      ],
      "explanation": "Blair presses Finish cycle count on the count screen and confirms in the finish dialog, which shows the counted total and pins the request-locked inventory. finishCycleCount closes the scan batches, reconciles inventory to the counted quantities (one cycle_count_reconcile inventory transaction with add/remove inventory_history rows), closes the count as applied, and auto-completes the request since its only remaining location is now counted, which also emails the requester. The close is recorded as a cycle_count:close user event and the auto-completion as an auto_complete_cycle_count_request audit event and decision. This is the primary URS-076 evidence that finishing a cycle count updates inventory.",
      "expectedEmailTemplates": [
        "Cycle Count Request 100% Complete"
      ],
      "expectedAuditActions": [
        "user_log:cycle_count:close",
        "cycle_count_request:auto_complete_cycle_count_request",
        "decision:auto_complete_cycle_count_request"
      ],
      "startedAt": "2026-09-29T02:32:05.187Z",
      "finishedAt": "2026-09-29T02:32:06.246Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/videos/step-05-finish.webm"
    },
    {
      "name": "Step 6: Completion is reflected for the rep and the admin",
      "status": "pass",
      "description": "Step 6: Completion is reflected for the rep and the admin",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/screenshots/step-06-location-completed.png",
        "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/screenshots/step-06-request-completed.png"
      ],
      "explanation": "Both sides observe the completed lifecycle: the trunk's cycle count list shows the count as Completed for Blair, and Alex's request detail shows 1 / 1 locations counted with the location row Completed. This verifies the monitoring rollup reflects the finished count to the requesting administrator.",
      "startedAt": "2026-09-29T02:32:10.678Z",
      "finishedAt": "2026-09-29T02:32:13.673Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/videos/step-06-completed.webm"
    }
  ],
  "dbValidations": [
    {
      "name": "Cycle count request completed",
      "query": "SELECT id, status, name, total_location_count, completed_at, created_by_user_id\n      FROM cycle_count_requests\n      WHERE organization_id = $1\n        AND note LIKE '%' || $2 || '%'\n        AND created_at >= $3\n      ORDER BY created_at DESC",
      "status": "pass",
      "rows": [
        {
          "id": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
          "status": "completed",
          "name": "Cycle count request - Sep 29, 2026, 2:31 AM",
          "total_location_count": 1,
          "completed_at": "2026-09-29T02:32:06.028Z",
          "created_by_user_id": "f6a7b8c9-d0e1-2345-f123-456789012345"
        }
      ],
      "assertion": "Exactly one URS-076 request exists for this run, created by Alex Admin, with status 'completed' and a non-null completed_at"
    },
    {
      "name": "Non-consignment accounts excluded from request",
      "query": "SELECT 'request_location' AS kind, location_id\n      FROM cycle_count_request_locations\n      WHERE request_id = $1 AND location_id = ANY($2)\n      UNION ALL\n      SELECT 'cycle_count' AS kind, location_id\n      FROM cycle_counts\n      WHERE organization_id = $3\n        AND metadata->>'requestId' = $1::text\n        AND location_id = ANY($2)",
      "status": "pass",
      "rows": [],
      "assertion": "No request-location row and no request-opened cycle count exists for the shipping locations of the non-consignment accounts (Cedar Crest Hospital - Shipping, Lakeside Ortho - Shipping)"
    },
    {
      "name": "Cancelled location removed from request",
      "query": "SELECT location_id, inventory_id FROM cycle_count_request_locations\n      WHERE request_id = $1",
      "status": "pass",
      "rows": [
        {
          "location_id": "a6e7f8a9-b0c1-2345-0123-456789012345",
          "inventory_id": "fa000001-0000-4000-8000-000000000001"
        }
      ],
      "assertion": "Exactly one request-location row remains and it is Blair's trunk (the rest were cancelled)"
    },
    {
      "name": "Cycle count closed and applied",
      "query": "SELECT id, closed_at, closed_by_user_id, applied,\n        metadata->>'origin' AS origin, metadata->>'requestId' AS request_id\n      FROM cycle_counts\n      WHERE organization_id = $1\n        AND location_id = $2\n        AND metadata->>'requestId' = $3::text",
      "status": "pass",
      "rows": [
        {
          "id": "01a0eb00-8ba0-70c8-ba3d-9f948b086b2f",
          "closed_at": "2026-09-29T02:32:05.989Z",
          "closed_by_user_id": "17b8c9d0-e1f2-3456-1234-567890123456",
          "applied": true,
          "origin": "admin_request",
          "request_id": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a"
        }
      ],
      "assertion": "The request-opened count at Blair's trunk is closed by Blair Bennett with applied = true"
    },
    {
      "name": "Cancelled locations' counts closed without applying",
      "query": "SELECT id, location_id, closed_at, applied,\n        metadata->>'cancelledReason' AS cancelled_reason\n      FROM cycle_counts\n      WHERE organization_id = $1\n        AND location_id <> $2\n        AND metadata->>'requestId' = $3::text",
      "status": "pass",
      "rows": [
        {
          "id": "01a0eb00-8ba5-73f4-95b8-9897230d339e",
          "location_id": "01a0eb00-2756-7326-9f28-1f36ddd62ab3",
          "closed_at": "2026-09-29T02:31:27.433Z",
          "applied": false,
          "cancelled_reason": "request_location_cancelled"
        },
        {
          "id": "01a0eb00-8bab-77cf-af35-f769c506becf",
          "location_id": "6ea3b4c5-d6e7-8901-6789-012345678901",
          "closed_at": "2026-09-29T02:31:27.437Z",
          "applied": false,
          "cancelled_reason": "request_location_cancelled"
        },
        {
          "id": "01a0eb00-8b97-7d4d-b2fa-854ef67e6f59",
          "location_id": "b7f8a9b0-c1d2-3456-1234-567890123456",
          "closed_at": "2026-09-29T02:31:27.442Z",
          "applied": false,
          "cancelled_reason": "request_location_cancelled"
        }
      ],
      "assertion": "All three cancelled locations' pre-opened counts are closed with applied = false and cancelledReason = 'request_location_cancelled'"
    },
    {
      "name": "Inventory updated to counted quantities",
      "query": "SELECT ii.lot, SUM(ii.quantity_ready)::int AS quantity_ready\n      FROM inventory_items ii\n      WHERE ii.real_world_location_id = $1\n        AND ii.lot IN ($2, $3, $4)\n      GROUP BY ii.lot\n      ORDER BY ii.lot",
      "status": "pass",
      "rows": [
        {
          "lot": "URS076-KF-001",
          "quantity_ready": 2
        },
        {
          "lot": "URS076-LL-001",
          "quantity_ready": 3
        },
        {
          "lot": "URS076-NP-001",
          "quantity_ready": 3
        }
      ],
      "assertion": "On-hand quantity per lot matches the count: URS076-NP-001 = 3 (was 5), URS076-LL-001 = 3 (was 3), URS076-KF-001 = 2 (was absent)"
    },
    {
      "name": "Reconciliation transaction recorded",
      "query": "SELECT id, source_type, source_id, created_by\n      FROM inventory_transactions\n      WHERE source_type = 'cycle_count_reconcile'\n        AND source_id = $1",
      "status": "pass",
      "rows": [
        {
          "id": "01a0eb01-4c51-7ab5-a279-aa3c5ef62742",
          "source_type": "cycle_count_reconcile",
          "source_id": "01a0eb00-8ba0-70c8-ba3d-9f948b086b2f",
          "created_by": "17b8c9d0-e1f2-3456-1234-567890123456"
        }
      ],
      "assertion": "Exactly one inventory transaction with source_type 'cycle_count_reconcile' references the finished count, created by Blair Bennett"
    },
    {
      "name": "Inventory history traces the reconciliation",
      "query": "SELECT ih.info->>'action' AS action, ih.quantity, ii.lot\n      FROM inventory_history ih\n      JOIN inventory_items ii ON ii.id = ih.item_id\n      WHERE ih.info->>'cycleCountId' = $1::text\n        AND ih.info->>'reason' = 'cycle_count'\n      ORDER BY ii.lot, action",
      "status": "pass",
      "rows": [
        {
          "action": "added",
          "quantity": 2,
          "lot": "URS076-KF-001"
        },
        {
          "action": "added",
          "quantity": 3,
          "lot": "URS076-LL-001"
        },
        {
          "action": "removed",
          "quantity": 3,
          "lot": "URS076-LL-001"
        },
        {
          "action": "added",
          "quantity": 3,
          "lot": "URS076-NP-001"
        },
        {
          "action": "removed",
          "quantity": 5,
          "lot": "URS076-NP-001"
        },
        {
          "action": "removed",
          "quantity": 5,
          "lot": "VM-PMX-2402"
        },
        {
          "action": "removed",
          "quantity": 10,
          "lot": "VM-PMX-2440"
        },
        {
          "action": "removed",
          "quantity": 4,
          "lot": "VM-SHV-2401"
        },
        {
          "action": "removed",
          "quantity": 6,
          "lot": "VM-SHV-2415"
        },
        {
          "action": "removed",
          "quantity": 3,
          "lot": "VM-SHV-FT01"
        },
        {
          "action": "removed",
          "quantity": 2,
          "lot": "VM-SHV-FT02"
        },
        {
          "action": "removed",
          "quantity": 4,
          "lot": "VM-SHV-FT03"
        }
      ],
      "assertion": "History records the reconcile per lot: URS076-NP-001 removed 5 / added 3, URS076-LL-001 removed 3 / added 3, URS076-KF-001 added 2 — all with reason 'cycle_count'"
    },
    {
      "name": "Scan batches closed",
      "query": "SELECT id, closed_at FROM scan_batches WHERE cycle_count_id = $1",
      "status": "pass",
      "rows": [
        {
          "id": "01a0eb01-02a9-7f8f-97a5-00e5198b2ede",
          "closed_at": "2026-09-29T02:32:05.952Z"
        }
      ],
      "assertion": "At least one scan batch exists for the count and all have closed_at set"
    },
    {
      "name": "No negative inventory quantities",
      "query": "SELECT id, lot, quantity_ready FROM inventory_items\n      WHERE real_world_location_id = $1 AND quantity_ready < 0",
      "status": "pass",
      "rows": [],
      "assertion": "Reconciliation never drives quantity_ready below zero"
    },
    {
      "name": "Audit log covers the lifecycle",
      "query": "SELECT DISTINCT action FROM audit_events\n      WHERE created_at >= $1\n        AND action = ANY($2)\n        AND organization_id IN ($3, $4)",
      "status": "pass",
      "rows": [
        {
          "action": "auto_complete_cycle_count_request"
        },
        {
          "action": "cancel_cycle_count_request_locations"
        },
        {
          "action": "create_cycle_count_request"
        },
        {
          "action": "cycle_count:close"
        }
      ],
      "assertion": "Audit events since the run started include: create_cycle_count_request, cancel_cycle_count_request_locations, cycle_count:close, auto_complete_cycle_count_request"
    }
  ],
  "overallStatus": "pass",
  "outputDir": "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z",
  "auditStartTime": "2026-09-29T02:30:57.308Z",
  "emailEvidence": [
    {
      "subject": "Cycle Count Request 100% Complete - Cycle count request - Sep 29, 2026, 2:31 AM",
      "template": "Cycle_Count_Request_100%_Complete_-_Cycle_count_request_-_Sep_29,_2026,_2_31_AM",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-076-cycle-count/2026-09-29T02-30-59-032Z/screenshots/emails/2026-09-29T02-32-06-133Z-Cycle_Count_Request_100%_Complete_-_Cycle_count_request_-_Sep_29,_2026,_2_31_AM.png"
    }
  ],
  "auditEventEvidence": [
    {
      "createdAt": "2026-09-29T02:31:04.438Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-09-29T02:31:16.576Z",
      "eventType": "decision",
      "action": "create_cycle_count_request_item",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8bd0-7c9d-a52c-b1ec529af620",
      "secondaryObjectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "payload": {
        "reason": "assigned_trunk_owner",
        "performed": true,
        "entityType": "checklist_item",
        "locationId": "a6e7f8a9-b0c1-2345-0123-456789012345",
        "checklistId": "01a0eb00-8bc3-7d0b-8eb6-e381e8a4828c",
        "inventoryId": "fa000001-0000-4000-8000-000000000001",
        "cycleCountId": "01a0eb00-8ba0-70c8-ba3d-9f948b086b2f",
        "locationType": "trunk_stock",
        "assigneeCount": 1,
        "assigneeResolutionReason": null
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:16.576Z",
      "eventType": "decision",
      "action": "create_cycle_count_request_item",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8bd2-7b84-ae6f-01c592865e0d",
      "secondaryObjectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "payload": {
        "reason": "assigned_shared_inventory_team",
        "performed": true,
        "entityType": "checklist_item",
        "locationId": "01a0eb00-2756-7326-9f28-1f36ddd62ab3",
        "checklistId": "01a0eb00-8bc3-7d0b-8eb6-e381e8a4828c",
        "inventoryId": "fa000001-0000-4000-8000-000000000001",
        "cycleCountId": "01a0eb00-8ba5-73f4-95b8-9897230d339e",
        "locationType": "shared_inventory",
        "assigneeCount": 1,
        "assigneeResolutionReason": null
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:16.576Z",
      "eventType": "decision",
      "action": "create_cycle_count_request_item",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8bd4-7182-86c3-a1b58354cfc8",
      "secondaryObjectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "payload": {
        "reason": "created_unassigned",
        "performed": true,
        "entityType": "checklist_item",
        "locationId": "6ea3b4c5-d6e7-8901-6789-012345678901",
        "checklistId": "01a0eb00-8bc3-7d0b-8eb6-e381e8a4828c",
        "inventoryId": "fa000001-0000-4000-8000-000000000001",
        "cycleCountId": "01a0eb00-8bab-77cf-af35-f769c506becf",
        "locationType": "hospital",
        "assigneeCount": 0,
        "assigneeResolutionReason": "no_active_reps"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:16.576Z",
      "eventType": "decision",
      "action": "assign_unassigned_cycle_counts_review_recipients",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "secondaryObjectId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "payload": {
        "reason": "distributor_admin_roles_assigned",
        "performed": true,
        "entityType": "organization",
        "assignmentCount": 8,
        "usedRequestingUserFloor": false
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:16.576Z",
      "eventType": "checklist",
      "action": "checklists.create",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8c6c-7808-ac93-6e099659a994",
      "secondaryObjectId": null,
      "payload": {
        "title": "Cycle count assignment review",
        "source": {
          "type": "cycle_count_assignment_review",
          "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
        }
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:16.576Z",
      "eventType": "decision",
      "action": "refresh_unassigned_cycle_counts_review_item",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "secondaryObjectId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "payload": {
        "reason": "created",
        "performed": true,
        "entityType": "organization",
        "unassignedCount": 1
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:16.576Z",
      "eventType": "checklist",
      "action": "checklists.create",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8bc3-7d0b-8eb6-e381e8a4828c",
      "secondaryObjectId": null,
      "payload": {
        "title": "Cycle Count Request — Oct 6, 2026",
        "source": {
          "scope": "admin_request",
          "feature": "cycle_counts"
        }
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:16.576Z",
      "eventType": "decision",
      "action": "create_cycle_count_request_item",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8bcd-798c-849a-7f8fdc060dec",
      "secondaryObjectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "payload": {
        "reason": "assigned_trunk_owner",
        "performed": true,
        "entityType": "checklist_item",
        "locationId": "b7f8a9b0-c1d2-3456-1234-567890123456",
        "checklistId": "01a0eb00-8bc3-7d0b-8eb6-e381e8a4828c",
        "inventoryId": "fa000001-0000-4000-8000-000000000001",
        "cycleCountId": "01a0eb00-8b97-7d4d-b2fa-854ef67e6f59",
        "locationType": "trunk_stock",
        "assigneeCount": 1,
        "assigneeResolutionReason": null
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:16.576Z",
      "eventType": "decision",
      "action": "auto_complete_cycle_count_request",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "secondaryObjectId": "01a0eb00-8b97-7d4d-b2fa-854ef67e6f59",
      "payload": {
        "reason": "request_has_incomplete_cycle_counts",
        "performed": false,
        "entityType": "cycle_count_request"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:16.576Z",
      "eventType": "cycle_count_request",
      "action": "create_cycle_count_request",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "secondaryObjectId": null,
      "payload": {
        "name": "Cycle count request - Sep 29, 2026, 2:31 AM",
        "dueDate": "2026-10-06",
        "noteLength": 62,
        "checklistIds": [
          "01a0eb00-8bc3-7d0b-8eb6-e381e8a4828c"
        ],
        "totalLocationCount": 4,
        "reusedCycleCountIds": [],
        "skipSharedInventory": false,
        "supersededRequestIds": [],
        "locationInventoryPairs": [
          {
            "locationId": "b7f8a9b0-c1d2-3456-1234-567890123456",
            "inventoryId": "fa000001-0000-4000-8000-000000000001",
            "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
          },
          {
            "locationId": "a6e7f8a9-b0c1-2345-0123-456789012345",
            "inventoryId": "fa000001-0000-4000-8000-000000000001",
            "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
          },
          {
            "locationId": "01a0eb00-2756-7326-9f28-1f36ddd62ab3",
            "inventoryId": "fa000001-0000-4000-8000-000000000001",
            "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
          },
          {
            "locationId": "6ea3b4c5-d6e7-8901-6789-012345678901",
            "inventoryId": "fa000001-0000-4000-8000-000000000001",
            "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
          }
        ]
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:19.771Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-09-29T02:31:27.311Z",
      "eventType": "decision",
      "action": "tickets.checklist_item_resolve.auto_resolve_ticket",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8bd2-7b84-ae6f-01c592865e0d",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Checklist item is not linked to any ticket.",
        "newState": "skipped",
        "oldState": "ready",
        "performed": false,
        "entityType": "checklist_item"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:27.311Z",
      "eventType": "decision",
      "action": "refresh_unassigned_cycle_counts_review_item",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "secondaryObjectId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "payload": {
        "reason": "no_unassigned_locations",
        "performed": false,
        "entityType": "organization",
        "unassignedCount": 0
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:27.311Z",
      "eventType": "decision",
      "action": "cancel_cycle_count_request_location",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb00-2756-7326-9f28-1f36ddd62ab3",
      "secondaryObjectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "payload": {
        "reason": "request_location_cancelled",
        "performed": true,
        "entityType": "real_world_location",
        "inventoryId": "fa000001-0000-4000-8000-000000000001"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:27.311Z",
      "eventType": "decision",
      "action": "cancel_cycle_count_request_location",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "6ea3b4c5-d6e7-8901-6789-012345678901",
      "secondaryObjectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "payload": {
        "reason": "request_location_cancelled",
        "performed": true,
        "entityType": "real_world_location",
        "inventoryId": "fa000001-0000-4000-8000-000000000001"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:27.311Z",
      "eventType": "decision",
      "action": "cancel_cycle_count_request_location",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "b7f8a9b0-c1d2-3456-1234-567890123456",
      "secondaryObjectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "payload": {
        "reason": "request_location_cancelled",
        "performed": true,
        "entityType": "real_world_location",
        "inventoryId": "fa000001-0000-4000-8000-000000000001"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:27.311Z",
      "eventType": "decision",
      "action": "auto_complete_cycle_count_request",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "secondaryObjectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "payload": {
        "reason": "request_has_incomplete_cycle_counts",
        "performed": false,
        "entityType": "cycle_count_request"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:27.311Z",
      "eventType": "cycle_count_request",
      "action": "cancel_cycle_count_request_locations",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "secondaryObjectId": null,
      "payload": {
        "skippedLocations": [],
        "cancellationReason": null,
        "cancelledLocations": [
          {
            "locationId": "01a0eb00-2756-7326-9f28-1f36ddd62ab3",
            "inventoryId": "fa000001-0000-4000-8000-000000000001"
          },
          {
            "locationId": "6ea3b4c5-d6e7-8901-6789-012345678901",
            "inventoryId": "fa000001-0000-4000-8000-000000000001"
          },
          {
            "locationId": "b7f8a9b0-c1d2-3456-1234-567890123456",
            "inventoryId": "fa000001-0000-4000-8000-000000000001"
          }
        ],
        "skippedChecklistItemIds": [
          "01a0eb00-8bcd-798c-849a-7f8fdc060dec",
          "01a0eb00-8bd2-7b84-ae6f-01c592865e0d",
          "01a0eb00-8bd4-7182-86c3-a1b58354cfc8"
        ],
        "softCancelledCycleCountIds": [
          "01a0eb00-8ba5-73f4-95b8-9897230d339e",
          "01a0eb00-8bab-77cf-af35-f769c506becf",
          "01a0eb00-8b97-7d4d-b2fa-854ef67e6f59"
        ]
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:27.311Z",
      "eventType": "decision",
      "action": "tickets.checklist_item_resolve.auto_resolve_ticket",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8c74-7d65-b0d4-81dbb5013c17",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Checklist item is not linked to any ticket.",
        "newState": "completed",
        "oldState": "ready",
        "performed": false,
        "entityType": "checklist_item"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:27.311Z",
      "eventType": "decision",
      "action": "tickets.checklist_item_resolve.auto_resolve_ticket",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8bcd-798c-849a-7f8fdc060dec",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Checklist item is not linked to any ticket.",
        "newState": "skipped",
        "oldState": "ready",
        "performed": false,
        "entityType": "checklist_item"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:27.311Z",
      "eventType": "decision",
      "action": "tickets.checklist_item_resolve.auto_resolve_ticket",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8bd4-7182-86c3-a1b58354cfc8",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Checklist item is not linked to any ticket.",
        "newState": "skipped",
        "oldState": "ready",
        "performed": false,
        "entityType": "checklist_item"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:30.620Z",
      "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:38.874Z",
      "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:32:01.765Z",
      "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:32:05.874Z",
      "eventType": "decision",
      "action": "finish_cycle_count",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8ba0-70c8-ba3d-9f948b086b2f",
      "secondaryObjectId": "a6e7f8a9-b0c1-2345-0123-456789012345",
      "payload": {
        "reason": "count_open",
        "performed": true,
        "entityType": "cycle_count",
        "inventoryId": "fa000001-0000-4000-8000-000000000001",
        "includeDeliveredPackages": true
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:05.874Z",
      "eventType": "decision",
      "action": "refresh_unassigned_cycle_counts_review_item",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "secondaryObjectId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "payload": {
        "reason": "no_unassigned_locations",
        "performed": false,
        "entityType": "organization",
        "unassignedCount": 0
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:05.874Z",
      "eventType": "decision",
      "action": "ensure_lot_expiration_cycle_counter_assignment",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "b7f8a9b0-c1d2-3456-1234-567890123456",
      "secondaryObjectId": null,
      "payload": {
        "reason": "no_latest_cycle_counter",
        "performed": false,
        "entityType": "real_world_location",
        "checklistItemId": "01a0eb00-1e6f-7657-b873-f99ea3dc2b1f"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:05.874Z",
      "eventType": "decision",
      "action": "upgrade_lot_expiration_checklist_priority",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "secondaryObjectId": null,
      "payload": {
        "reason": "no_open_checklists_below_high",
        "performed": false,
        "entityType": "organization"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:05.874Z",
      "eventType": "decision",
      "action": "ensure_lot_expiration_checklist",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "secondaryObjectId": null,
      "payload": {
        "reason": "all_locations_already_open",
        "performed": false,
        "entityType": "organization"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:05.874Z",
      "eventType": "decision",
      "action": "send_cycle_count_request_completed_notification",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "secondaryObjectId": null,
      "payload": {
        "reason": "creator_available",
        "performed": true,
        "entityType": "cycle_count_request"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:05.874Z",
      "eventType": "cycle_count_request",
      "action": "auto_complete_cycle_count_request",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "secondaryObjectId": null,
      "payload": {
        "cycleCountId": "01a0eb00-8ba0-70c8-ba3d-9f948b086b2f"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:05.874Z",
      "eventType": "decision",
      "action": "auto_complete_cycle_count_request",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "secondaryObjectId": "01a0eb00-8ba0-70c8-ba3d-9f948b086b2f",
      "payload": {
        "reason": "request_auto_completed",
        "performed": true,
        "entityType": "cycle_count_request"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:05.874Z",
      "eventType": "decision",
      "action": "cycleCount.excludeSequesteredReturnUnits",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8ba0-70c8-ba3d-9f948b086b2f",
      "secondaryObjectId": null,
      "payload": {
        "reason": "No open return movement holds units at the location",
        "performed": false,
        "entityType": "cycleCount",
        "exclusions": [],
        "locationId": "a6e7f8a9-b0c1-2345-0123-456789012345",
        "inventoryId": "fa000001-0000-4000-8000-000000000001",
        "sequesteredLineCount": 0
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:05.874Z",
      "eventType": "decision",
      "action": "inventory.gate_cycle_count_evidence_photos",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8ba0-70c8-ba3d-9f948b086b2f",
      "secondaryObjectId": null,
      "payload": {
        "reason": "requirement_not_active",
        "performed": false,
        "entityType": "cycle_count",
        "locationId": "a6e7f8a9-b0c1-2345-0123-456789012345",
        "inventoryId": "fa000001-0000-4000-8000-000000000001"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:05.874Z",
      "eventType": "decision",
      "action": "tickets.checklist_item_resolve.auto_resolve_ticket",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "fa000009-0000-4000-8000-000000000009",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Checklist item is not linked to any ticket.",
        "newState": "completed",
        "oldState": "ready",
        "performed": false,
        "entityType": "checklist_item"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:05.874Z",
      "eventType": "decision",
      "action": "tickets.checklist_item_resolve.auto_resolve_ticket",
      "userEmail": null,
      "userId": null,
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8bd0-7c9d-a52c-b1ec529af620",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Checklist item is not linked to any ticket.",
        "newState": "completed",
        "oldState": "ready",
        "performed": false,
        "entityType": "checklist_item"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:06.087Z",
      "eventType": "user_log",
      "action": "cycle_count:close",
      "userEmail": "blair.bennett@corvetasurgical.com",
      "userId": "17b8c9d0-e1f2-3456-1234-567890123456",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb00-8ba0-70c8-ba3d-9f948b086b2f",
      "secondaryObjectId": "a6e7f8a9-b0c1-2345-0123-456789012345",
      "payload": {
        "inventoryId": "fa000001-0000-4000-8000-000000000001"
      },
      "route": "/inventory/locations/[locationId]/cycle_count/[cycleCountId]/scan",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-09-29T02:32:06.166Z",
      "eventType": "transactional_email",
      "action": "cycle_count_request_completed",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb00-8b7a-7d9c-9e6d-f17f5a9b576a",
      "secondaryObjectId": null,
      "payload": {
        "to": [
          "alex.admin@vantismedical.com"
        ],
        "s3Path": "email-audit/a1b2c3d4-e5f6-7890-abcd-ef1234567890/01a0eb01-4cff-7925-9d15-37ced0b95d91/",
        "subject": "Cycle Count Request 100% Complete - Cycle count request - Sep 29, 2026, 2:31 AM",
        "messageId": "dev-console-log",
        "relatedEntityType": "cycle_count_request"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:07.948Z",
      "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:32:12.315Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "alex.admin@vantismedical.com",
      "userId": "f6a7b8c9-d0e1-2345-f123-456789012345",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "alex.admin@vantismedical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    }
  ],
  "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: Admin requests a cycle count of distributor trunk and account locations",
      "expectedAction": "cycle_count_request:create_cycle_count_request",
      "found": true
    },
    {
      "stepName": "Step 1: Admin requests a cycle count of distributor trunk and account locations",
      "expectedAction": "decision:create_cycle_count_request_item",
      "found": true
    },
    {
      "stepName": "Step 2: Admin narrows the request to a single trunk location",
      "expectedAction": "cycle_count_request:cancel_cycle_count_request_locations",
      "found": true
    },
    {
      "stepName": "Step 2: Admin narrows the request to a single trunk location",
      "expectedAction": "decision:cancel_cycle_count_request_location",
      "found": true
    },
    {
      "stepName": "Step 5: Rep finishes the cycle count",
      "expectedAction": "user_log:cycle_count:close",
      "found": true
    },
    {
      "stepName": "Step 5: Rep finishes the cycle count",
      "expectedAction": "cycle_count_request:auto_complete_cycle_count_request",
      "found": true
    },
    {
      "stepName": "Step 5: Rep finishes the cycle count",
      "expectedAction": "decision:auto_complete_cycle_count_request",
      "found": true
    }
  ],
  "emailAssertions": [
    {
      "stepName": "Step 5: Rep finishes the cycle count",
      "expectedTemplate": "Cycle Count Request 100% Complete",
      "found": true
    }
  ]
}