{
  "ursId": "URS-014",
  "title": "Display Available Inventory for Rep Trunk Stock",
  "timestamp": "2026-04-23T03:36:30.720Z",
  "durationMs": 51489,
  "config": {
    "inboxUrl": "http://localhost:62705",
    "dbHost": "localhost",
    "dbPort": 62706,
    "dbName": "cc_repinbox_dev"
  },
  "setup": {
    "status": "pass"
  },
  "scenarios": [
    {
      "name": "Step 1: Login and navigate",
      "status": "pass",
      "description": "Step 1: Login and navigate",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/screenshots/step-01-logged-in.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/screenshots/step-01-inventory-locations.png"
      ],
      "explanation": "The test logs in as a sales rep (Bob Kauffman) and navigates to the inventory locations list, verifying that TRUNK-36 appears and is accessible. This proves that authorized users can reach their trunk stock location from the main inventory view.",
      "expectedAuditActions": [
        "user_log:user:login"
      ],
      "startedAt": "2026-04-23T03:36:35.669Z",
      "finishedAt": "2026-04-23T03:36:38.897Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/videos/step-01-login-navigate.webm"
    },
    {
      "name": "Step 2: Trunk inventory overview",
      "status": "pass",
      "description": "Step 2: Trunk inventory overview",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/screenshots/step-02-trunk-inventory-overview.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/screenshots/step-02-all-products-visible.png"
      ],
      "explanation": "Navigates directly to TRUNK-36 and confirms all three test products — Diagnostic Kit, Sterile Gloves, and Antiseptic Solution — are listed together. This proves the system displays available trunk stock inventory in a single unified view.",
      "startedAt": "2026-04-23T03:36:45.924Z",
      "finishedAt": "2026-04-23T03:36:49.350Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/videos/step-02-trunk-inventory.webm"
    },
    {
      "name": "Step 3: Diagnostic Kit details",
      "status": "pass",
      "description": "Step 3: Diagnostic Kit details",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/screenshots/step-03-diagnostic-kit-details.png"
      ],
      "explanation": "Verifies the Diagnostic Kit row shows the correct product name, lot number, on-hand quantity, and expiration date. This proves per-item details are accurately surfaced for the first product in the trunk stock display.",
      "startedAt": "2026-04-23T03:36:54.076Z",
      "finishedAt": "2026-04-23T03:36:54.076Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/videos/step-03-diagnostic-kit.webm"
    },
    {
      "name": "Step 4: Sterile Gloves details",
      "status": "pass",
      "description": "Step 4: Sterile Gloves details",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/screenshots/step-04-sterile-gloves-details.png"
      ],
      "explanation": "Verifies the Sterile Gloves row shows the correct product name, lot number, on-hand quantity, and expiration date. This proves per-item details are accurate for a second, distinct product in the same trunk location.",
      "startedAt": "2026-04-23T03:37:01.015Z",
      "finishedAt": "2026-04-23T03:37:01.015Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/videos/step-04-sterile-gloves.webm"
    },
    {
      "name": "Step 5: Antiseptic Solution details",
      "status": "pass",
      "description": "Step 5: Antiseptic Solution details",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/screenshots/step-05-antiseptic-solution-details.png"
      ],
      "explanation": "Verifies the Antiseptic Solution row shows the correct product name, lot number, on-hand quantity, and expiration date, completing the per-product detail verification across all three trunk stock items.",
      "startedAt": "2026-04-23T03:37:08.202Z",
      "finishedAt": "2026-04-23T03:37:08.202Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/videos/step-05-antiseptic-solution.webm"
    },
    {
      "name": "Step 6: Filter functionality",
      "status": "pass",
      "description": "Step 6: Filter functionality",
      "screenshots": [
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/screenshots/step-06-before-filter.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/screenshots/step-06-filtered-results.png",
        "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/screenshots/step-06-filter-cleared.png"
      ],
      "explanation": "Applies a lot/serial filter string to the inventory table and confirms only the matching product row remains visible. Clearing the filter restores all rows. This proves the filter functionality narrows results correctly and does not suppress data when cleared.",
      "startedAt": "2026-04-23T03:37:15.168Z",
      "finishedAt": "2026-04-23T03:37:19.645Z",
      "videoPath": "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z/videos/step-06-filter-functionality.webm"
    }
  ],
  "dbValidations": [
    {
      "name": "Inventory items exist at TRUNK-36",
      "query": "\n    SELECT count(*)::int as item_count\n    FROM inventory_items ii\n    JOIN org_products op ON ii.product_id = op.id\n    WHERE ii.real_world_location_id = $1\n      AND op.sku IN ($2, $3, $4)\n      AND ii.organization_id = $5",
      "status": "pass",
      "rows": [
        {
          "item_count": 3
        }
      ],
      "assertion": "Exactly 3 inventory items should exist at TRUNK-36"
    },
    {
      "name": "Product details match expected values",
      "query": "\n    SELECT op.title, op.sku, ii.lot, ii.expiration::text, ii.quantity_ready\n    FROM inventory_items ii\n    JOIN org_products op ON ii.product_id = op.id\n    WHERE ii.real_world_location_id = $1\n      AND op.sku IN ($2, $3, $4)\n      AND ii.organization_id = $5\n    ORDER BY op.title",
      "status": "pass",
      "rows": [
        {
          "title": "Antiseptic Solution (500ml)",
          "sku": "URS014-AS-001",
          "lot": "AS-2024-112",
          "expiration": "2026-09-15",
          "quantity_ready": 8
        },
        {
          "title": "Diagnostic Kit",
          "sku": "URS014-DK-001",
          "lot": "DK-2024-001",
          "expiration": "2026-12-31",
          "quantity_ready": 15
        },
        {
          "title": "Sterile Gloves (Box of 100)",
          "sku": "URS014-SG-001",
          "lot": "SG-2024-045",
          "expiration": "2027-06-30",
          "quantity_ready": 50
        }
      ],
      "assertion": "Each product should have the correct title, lot, quantity, and expiration"
    },
    {
      "name": "Total inventory quantity is correct",
      "query": "\n    SELECT sum(ii.quantity_ready)::int as total_quantity\n    FROM inventory_items ii\n    JOIN org_products op ON ii.product_id = op.id\n    WHERE ii.real_world_location_id = $1\n      AND op.sku IN ($2, $3, $4)\n      AND ii.organization_id = $5",
      "status": "pass",
      "rows": [
        {
          "total_quantity": 73
        }
      ],
      "assertion": "Total quantity should be 73 (15 + 50 + 8)"
    },
    {
      "name": "All items belong to StellarTech org",
      "query": "\n    SELECT ii.organization_id, count(*)::int as item_count\n    FROM inventory_items ii\n    JOIN org_products op ON ii.product_id = op.id\n    WHERE ii.real_world_location_id = $1\n      AND op.sku IN ($2, $3, $4)\n      AND ii.organization_id = $5\n    GROUP BY ii.organization_id",
      "status": "pass",
      "rows": [
        {
          "organization_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
          "item_count": 3
        }
      ],
      "assertion": "All inventory items should belong to the StellarTech organization"
    }
  ],
  "overallStatus": "pass",
  "outputDir": "/Users/jason/projects/casecohort/code/validation_test_results/urs-014-trunk-stock-display/2026-04-23T03-36-30-715Z",
  "auditStartTime": "2026-04-23T03:36:28.791Z",
  "auditEventEvidence": [
    {
      "createdAt": "2026-04-23T03:36:33.115Z",
      "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:36:42.447Z",
      "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:36:50.563Z",
      "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:36:57.666Z",
      "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:37:04.707Z",
      "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:37:11.752Z",
      "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"
    }
  ],
  "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: Login and navigate",
      "expectedAction": "user_log:user:login",
      "found": true
    }
  ],
  "emailAssertions": []
}