{
  "ursId": "URS-078",
  "title": "Recertification required for a new certification version",
  "timestamp": "2026-09-29T02:30:59.671Z",
  "durationMs": 69671,
  "config": {
    "inboxUrl": "http://localhost:38449",
    "dbHost": "localhost",
    "dbPort": 41169,
    "dbName": "cc_repinbox_dev"
  },
  "setup": {
    "status": "pass"
  },
  "scenarios": [
    {
      "name": "Step 1: Gate re-engaged for superseded version",
      "status": "pass",
      "description": "Step 1: Gate re-engaged for superseded version",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-01-billing-blocked.png",
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-01-billing-picker.png",
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-01-training-offered-again.png"
      ],
      "explanation": "A representative who completed version 1 of the manufacturer's required certification opens bill-only and order-request creation after version 2 was published. The manufacturer is absent from both manufacturer pickers with a 'Certification required' notice, and the certification checklist offers the updated training form again — not an already-certified state — despite the completed version-1 record.",
      "startedAt": "2026-09-29T02:31:11.644Z",
      "finishedAt": "2026-09-29T02:31:22.993Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/videos/step-01-gate-reengaged.webm"
    },
    {
      "name": "Step 1: Trunk order requests allowed while pending",
      "status": "pass",
      "description": "Step 1: Trunk order requests allowed while pending",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-01-orders-trunk-allowed.png"
      ],
      "startedAt": "2026-09-29T02:31:19.643Z",
      "finishedAt": "2026-09-29T02:31:19.643Z"
    },
    {
      "name": "Step 2: Recompletion creates a new record",
      "status": "pass",
      "description": "Step 2: Recompletion creates a new record",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-02-signing-code-sent.png",
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-02-magic-link-verified.png",
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-02-doc-acknowledged.png",
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-02-quiz-passed.png",
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-02-signature.png",
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-02-completed.png",
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-02-certificate-ready.png",
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-02-gate-lifted.png"
      ],
      "explanation": "The representative completes version 2 behind the Part 11 signing re-authentication gate, using the MAGIC LINK path: a one-time signing code is requested, read out of the email the system sent, and carried into the page through the emailed link, which verifies it and strips the code from the URL. The representative then acknowledges the updated training document (timestamped server-side), passes the knowledge check at 100%, signs, and receives a fresh certificate. The recompletion writes a NEW certification record that supersedes the version-1 record; the historical record is never modified. The manufacturer immediately reappears in the pickers.",
      "expectedEmailTemplates": [
        "Your signing code"
      ],
      "expectedAuditActions": [
        "certification:signing_code_issued",
        "certification:signing_code_verified",
        "certification:signing_code_consumed",
        "certification:completed",
        "certification:superseded"
      ],
      "startedAt": "2026-09-29T02:31:31.492Z",
      "finishedAt": "2026-09-29T02:31:52.426Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/videos/step-02-recompletion.webm"
    },
    {
      "name": "Step 3: New requirement re-gates per manufacturer",
      "status": "pass",
      "description": "Step 3: New requirement re-gates per manufacturer",
      "screenshots": [
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-03-create-dialog.png",
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-03-cert-created.png",
        "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/step-03-rep-regated.png"
      ],
      "explanation": "A second manufacturer's admin creates a certification required of all representatives. The previously active representative is demoted to pending certification for that manufacturer only: its name leaves the picker while the freshly recertified manufacturer remains selectable — the inverse of the run's starting state, proving per-manufacturer isolation of the requirement.",
      "startedAt": "2026-09-29T02:31:59.242Z",
      "finishedAt": "2026-09-29T02:32:08.273Z",
      "videoPath": "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/videos/step-03-new-requirement.webm"
    }
  ],
  "dbValidations": [
    {
      "name": "Historical version-1 record untouched by the recompletion",
      "query": "SELECT row_to_json(r)::text AS row FROM certification_records r WHERE r.id = $1",
      "status": "pass",
      "rows": [
        {
          "row": "{\"id\":\"ce000700-0000-4000-8000-000000000004\",\"organization_id\":\"a1b2c3d4-e5f6-7890-abcd-ef1234567890\",\"certification_id\":\"ce000100-0000-4000-8000-000000000001\",\"certification_version_id\":\"ce000200-0000-4000-8000-000000000001\",\"rep_user_id\":\"ce000001-0000-4000-8000-000000000004\",\"requesting_organization_id\":\"b2c3d4e5-f6a7-8901-bcde-f12345678901\",\"completed_at\":\"2025-12-03T02:23:22.269+00:00\",\"signature_ref\":\"demo-signature/ce000700-0000-4000-8000-000000000004\",\"form_submission_id\":\"ce000600-0000-4000-8000-000000000004\",\"supersedes_record_id\":null,\"created_at\":\"2025-12-03T02:23:22.269+00:00\",\"expires_at\":\"2027-12-03\"}"
        }
      ],
      "assertion": "Every column of the version-1 record is byte-identical to the setup snapshot"
    },
    {
      "name": "Recompletion created a new record superseding the version-1 record",
      "query": "SELECT id, certification_version_id, supersedes_record_id,\n            completed_at, signature_ref, form_submission_id\n     FROM certification_records\n     WHERE rep_user_id = $1 AND certification_id = $2\n     ORDER BY created_at",
      "status": "pass",
      "rows": [
        {
          "id": "ce000700-0000-4000-8000-000000000004",
          "certification_version_id": "ce000200-0000-4000-8000-000000000001",
          "supersedes_record_id": null,
          "completed_at": "2025-12-03T02:23:22.269Z",
          "signature_ref": "demo-signature/ce000700-0000-4000-8000-000000000004",
          "form_submission_id": "ce000600-0000-4000-8000-000000000004"
        },
        {
          "id": "01a0eb01-017f-7c10-8dd3-1e49694588fe",
          "certification_version_id": "ce000200-0000-4000-8000-000000000002",
          "supersedes_record_id": "ce000700-0000-4000-8000-000000000004",
          "completed_at": "2026-09-29T02:31:46.815Z",
          "signature_ref": "01a0eb01-017f-7c10-8dd3-1e4a40d10df4",
          "form_submission_id": "01a0eb00-f08d-7fb9-b480-a4606690798d"
        }
      ],
      "assertion": "Exactly two records exist: the fixture version-1 record and a new version-2 record that supersedes it, with completion timestamp, signature reference, and form submission"
    },
    {
      "name": "Part 11 signing challenge (magic-link path) verified, consumed, and linked to the new signature",
      "query": "SELECT ch.code_hash, ch.email_sent_at, ch.verified_at, ch.signing_window_expires_at,\n            ch.consumed_at, ch.consumed_signature_id, r.signature_ref\n     FROM certification_signing_challenges ch\n     JOIN certification_records r\n       ON r.rep_user_id = ch.user_id AND r.certification_id = ch.certification_id\n      AND r.id != $3\n     WHERE ch.user_id = $1 AND ch.certification_id = $2\n       AND ch.consumed_at IS NOT NULL",
      "status": "pass",
      "rows": [
        {
          "code_hash": "16852c4e9dd03e855a14f158cc931cbe9113103563fe37864402d68a10f46e43",
          "email_sent_at": "2026-09-29T02:31:31.235Z",
          "verified_at": "2026-09-29T02:31:33.638Z",
          "signing_window_expires_at": "2026-09-29T06:31:33.638Z",
          "consumed_at": "2026-09-29T02:31:46.823Z",
          "consumed_signature_id": "01a0eb01-017f-7c10-8dd3-1e4a40d10df4",
          "signature_ref": "01a0eb01-017f-7c10-8dd3-1e4a40d10df4"
        }
      ],
      "assertion": "Exactly one consumed signing challenge exists for the recompletion: emailed, verified (magic link opened the signing window), consumed by the completion, linked to the NEW record's signature, and storing only a sha256 hash — never the raw code"
    },
    {
      "name": "Status change recorded: relationship re-activated on recompletion",
      "query": "SELECT from_status, to_status, reason_code\n     FROM organization_representation_request_status_changes\n     WHERE relationship_id = $1\n       AND to_status = 'active' AND reason_code = 'certification_completed'\n       AND created_at > NOW() - INTERVAL '2 hours'",
      "status": "pass",
      "rows": [
        {
          "from_status": "pending_certification",
          "to_status": "active",
          "reason_code": "certification_completed"
        }
      ],
      "assertion": "A status-change row with reason_code certification_completed moved the relationship to active"
    },
    {
      "name": "Completed and superseded audit events recorded for the recompletion",
      "query": "SELECT action, COUNT(*)::int AS count\n     FROM audit_events\n     WHERE event_type = 'certification' AND action IN ('completed', 'superseded')\n       AND organization_id = $1 AND user_id = $2\n       AND created_at > NOW() - INTERVAL '2 hours'\n     GROUP BY action",
      "status": "pass",
      "rows": [
        {
          "action": "completed",
          "count": 1
        },
        {
          "action": "superseded",
          "count": 1
        }
      ],
      "assertion": "Both a certification 'completed' and a certification 'superseded' audit event exist"
    },
    {
      "name": "Second manufacturer's certification created with version 1 and an all-reps requirement",
      "query": "SELECT c.name, v.version_number, a.target_type, a.mandatory, a.active\n     FROM certifications c\n     JOIN certification_versions v ON v.certification_id = c.id\n     JOIN certification_assignments a ON a.certification_id = c.id\n     WHERE c.organization_id = $1",
      "status": "pass",
      "rows": [
        {
          "name": "Halcyon Field Safety Certification",
          "version_number": 1,
          "target_type": "all_reps",
          "mandatory": true,
          "active": true
        }
      ],
      "assertion": "One certification exists for the second manufacturer with version_number 1 and an active mandatory all_reps assignment"
    },
    {
      "name": "Second manufacturer's created and assigned audit events recorded",
      "query": "SELECT action FROM audit_events\n     WHERE event_type = 'certification' AND action IN ('created', 'assigned')\n       AND organization_id = $1\n       AND created_at > NOW() - INTERVAL '2 hours'",
      "status": "pass",
      "rows": [
        {
          "action": "assigned"
        },
        {
          "action": "created"
        }
      ],
      "assertion": "Both a certification 'created' and a certification 'assigned' audit event exist"
    },
    {
      "name": "New requirement demoted the representative to pending_certification",
      "query": "SELECT r.status, r.active,\n       (SELECT COUNT(*)::int FROM organization_representation_request_status_changes sc\n        WHERE sc.relationship_id = r.id\n          AND sc.to_status = 'pending_certification' AND sc.reason_code = $2\n          AND sc.created_at > NOW() - INTERVAL '2 hours') AS demotion_changes\n     FROM organization_representation_relationships r WHERE r.id = $1",
      "status": "pass",
      "rows": [
        {
          "status": "pending_certification",
          "active": false,
          "demotion_changes": 1
        }
      ],
      "assertion": "The second-manufacturer relationship is pending_certification with a demotion status-change row (reason_code recertification_assignment)"
    },
    {
      "name": "No completion record exists for the second manufacturer's certification",
      "query": "SELECT COUNT(*)::int AS count\n     FROM certification_records\n     WHERE rep_user_id = $1 AND organization_id = $2",
      "status": "pass",
      "rows": [
        {
          "count": 0
        }
      ],
      "assertion": "The representative has no completion record for the new requirement"
    }
  ],
  "overallStatus": "pass",
  "outputDir": "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z",
  "auditStartTime": "2026-09-29T02:30:57.812Z",
  "emailEvidence": [
    {
      "subject": "Your signing code for LiraLock Implant System Certification",
      "template": "Your_signing_code_for_LiraLock_Implant_System_Certification",
      "screenshotPath": "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/screenshots/emails/2026-09-29T02-31-32-431Z-Your_signing_code_for_LiraLock_Implant_System_Certification.png"
    }
  ],
  "auditEventEvidence": [
    {
      "createdAt": "2026-09-29T02:31:05.146Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "theo.larsen@corvetasurgical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-09-29T02:31:25.976Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "theo.larsen@corvetasurgical.com"
      },
      "route": "/login",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-09-29T02:31:31.091Z",
      "eventType": "decision",
      "action": "certifications.signing_challenge.send_sms",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb00-c46f-708c-8ed7-eebc71e00c0e",
      "secondaryObjectId": null,
      "payload": {
        "reason": "no_phone_channel",
        "performed": false,
        "entityType": "certification_signing_challenge"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:31.091Z",
      "eventType": "certification",
      "action": "signing_code_issued",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "ce000100-0000-4000-8000-000000000001",
      "secondaryObjectId": "01a0eb00-c46f-708c-8ed7-eebc71e00c0e",
      "payload": {
        "expiresAt": "2026-10-13T02:31:31.183Z"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:32.493Z",
      "eventType": "transactional_email",
      "action": "certification_signing_code",
      "userEmail": null,
      "userId": null,
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb00-c46f-708c-8ed7-eebc71e00c0e",
      "secondaryObjectId": null,
      "payload": {
        "to": "theo.larsen@corvetasurgical.com",
        "s3Path": "email-audit/a1b2c3d4-e5f6-7890-abcd-ef1234567890/01a0eb00-c95f-7cac-9100-c99c9ef045d4/",
        "subject": "Your signing code for LiraLock Implant System Certification",
        "messageId": "dev-console-log",
        "relatedEntityType": "certification_signing_challenge"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:33.609Z",
      "eventType": "certification",
      "action": "signing_code_verified",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "ce000100-0000-4000-8000-000000000001",
      "secondaryObjectId": "01a0eb00-c46f-708c-8ed7-eebc71e00c0e",
      "payload": {
        "signingWindowExpiresAt": "2026-09-29T06:31:33.638Z"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:42.468Z",
      "eventType": "decision",
      "action": "forms.grade_submission",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "ce000300-0000-4000-8000-000000000002",
      "secondaryObjectId": null,
      "payload": {
        "reason": "all_answers_correct",
        "stepId": "final",
        "performed": true,
        "entityType": "form_definition",
        "gradedCount": 3,
        "incorrectCount": 0
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:46.756Z",
      "eventType": "certification",
      "action": "signing_code_consumed",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "ce000100-0000-4000-8000-000000000001",
      "secondaryObjectId": "01a0eb00-c46f-708c-8ed7-eebc71e00c0e",
      "payload": {
        "signatureId": "01a0eb01-017f-7c10-8dd3-1e4a40d10df4"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:46.756Z",
      "eventType": "certification",
      "action": "completed",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb01-017f-7c10-8dd3-1e49694588fe",
      "secondaryObjectId": "ce000100-0000-4000-8000-000000000001",
      "payload": {
        "repUserId": "ce000001-0000-4000-8000-000000000004",
        "versionNumber": 2
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:46.756Z",
      "eventType": "certification",
      "action": "superseded",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "ce000700-0000-4000-8000-000000000004",
      "secondaryObjectId": "01a0eb01-017f-7c10-8dd3-1e49694588fe",
      "payload": null,
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:46.756Z",
      "eventType": "organization_representation",
      "action": "status_change",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "ce000002-0000-4000-8000-000000000004",
      "secondaryObjectId": null,
      "payload": {
        "reason": "Certification completed",
        "toStatus": "active",
        "fromStatus": "pending_certification",
        "reasonCode": "certification_completed",
        "requestingOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:46.756Z",
      "eventType": "decision",
      "action": "certifications.complete_certification.mark_relationship_certified",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "ce000002-0000-4000-8000-000000000004",
      "secondaryObjectId": "01a0eb01-017f-7c10-8dd3-1e49694588fe",
      "payload": {
        "reason": "relationship_pending_certification",
        "performed": true,
        "entityType": "organization_representation_relationship"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:46.756Z",
      "eventType": "decision",
      "action": "certifications.complete_certification.issue_certificate",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb01-017f-7c10-8dd3-1e49694588fe",
      "secondaryObjectId": "01a0eb01-01da-78a6-b524-f038348c0e19",
      "payload": {
        "reason": "quiz_backed_completion",
        "performed": true,
        "entityType": "certification_record"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:46.916Z",
      "eventType": "user_log",
      "action": "rep_relationship_certified",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "reason": "Certification completed",
        "userId": "ce000001-0000-4000-8000-000000000004",
        "userName": "Theo Larsen",
        "userEmail": "theo.larsen@corvetasurgical.com",
        "relationshipId": "ce000002-0000-4000-8000-000000000004",
        "distributorOrganizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
        "manufacturerOrganizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
      },
      "route": "/onboarding/[orgshortname]/certification",
      "traceId": "00000000000000000000000000000000"
    },
    {
      "createdAt": "2026-09-29T02:31:47.483Z",
      "eventType": "certification_certificate",
      "action": "issued",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb01-01da-78a6-b524-f038348c0e19",
      "secondaryObjectId": "ce000002-0000-4000-8000-000000000004",
      "payload": null,
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:47.493Z",
      "eventType": "certification_completion_record",
      "action": "issued",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Vantis",
      "organizationId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "objectId": "01a0eb01-01e3-7782-9baa-2d36e2a55b13",
      "secondaryObjectId": "01a0eb01-017f-7c10-8dd3-1e49694588fe",
      "payload": {
        "relationshipId": "ce000002-0000-4000-8000-000000000004"
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:31:59.802Z",
      "eventType": "checklist",
      "action": "checklists.create",
      "userEmail": "halcyon.admin@urs078.example",
      "userId": "01950078-0078-7078-8078-000000000003",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": "01a0eb01-349e-701c-b1ca-fa5a165ebaaa",
      "secondaryObjectId": null,
      "payload": {
        "title": "Complete certification for Halcyon Medical Systems (URS-078)",
        "source": {
          "scope": "certification",
          "feature": "representatives"
        }
      },
      "route": null,
      "traceId": null
    },
    {
      "createdAt": "2026-09-29T02:32:01.819Z",
      "eventType": "user_log",
      "action": "user:login",
      "userEmail": "theo.larsen@corvetasurgical.com",
      "userId": "ce000001-0000-4000-8000-000000000004",
      "organizationName": "Corveta Surgical Group",
      "organizationId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "objectId": null,
      "secondaryObjectId": null,
      "payload": {
        "email": "theo.larsen@corvetasurgical.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 2: Recompletion creates a new record",
      "expectedAction": "certification:signing_code_issued",
      "found": true
    },
    {
      "stepName": "Step 2: Recompletion creates a new record",
      "expectedAction": "certification:signing_code_verified",
      "found": true
    },
    {
      "stepName": "Step 2: Recompletion creates a new record",
      "expectedAction": "certification:signing_code_consumed",
      "found": true
    },
    {
      "stepName": "Step 2: Recompletion creates a new record",
      "expectedAction": "certification:completed",
      "found": true
    },
    {
      "stepName": "Step 2: Recompletion creates a new record",
      "expectedAction": "certification:superseded",
      "found": true
    }
  ],
  "emailAssertions": [
    {
      "stepName": "Step 2: Recompletion creates a new record",
      "expectedTemplate": "Your signing code",
      "found": true
    }
  ],
  "videoPaths": [
    "/home/runner/_work/code/code/validation_test_results/urs-078-recertification-required/2026-09-29T02-30-59-670Z/videos/step-03-rep-regated.webm"
  ]
}