{
  "packageVersion": "1.0.0",
  "implementation": "standalone bundled routing.mjs",
  "capturedAt": "2026-10-08T12:41:56.277Z",
  "nodeVersion": "v22.23.2",
  "synthetic": true,
  "outboundMessaging": "absent",
  "caseCount": 5,
  "passed": 5,
  "failed": 0,
  "cases": [
    {
      "id": "complete",
      "input": {
        "customer": "Alex Morgan",
        "email": "alex@example.com",
        "area": "Bristol BS1",
        "message": "The kitchen tap has been dripping for a week. Could your plumber take a look? Please let me know the next step."
      },
      "expected": "One Plumbing enquiry owned by Service coordinator; review before approval, completed afterwards",
      "passed": true,
      "observed": {
        "before": {
          "id": "DEMO-001",
          "count": 1,
          "status": "review",
          "owner": "Service coordinator",
          "category": "Plumbing enquiry",
          "missing": [],
          "approvedDraft": null,
          "history": [
            {
              "label": "Enquiry received",
              "detail": "Added to this browser's demo queue."
            },
            {
              "label": "Request checked",
              "detail": "The example has contact, location and job details."
            },
            {
              "label": "Owner assigned",
              "detail": "Plumbing enquiry → Service coordinator."
            },
            {
              "label": "Reply prepared",
              "detail": "A template reply is waiting for your review and approval."
            }
          ],
          "notice": "DEMO-001 is ready for review. No email has been sent."
        },
        "after": {
          "id": "DEMO-001",
          "count": 1,
          "status": "completed",
          "owner": "Service coordinator",
          "category": "Plumbing enquiry",
          "missing": [],
          "approvedDraft": "Hi Alex Morgan,\n\nThanks for getting in touch. We have the details of your request. Our team will review it and confirm the next step. This is not yet a booking or a confirmed quote.\n\nNorthstar Plumbing\nSample business",
          "history": [
            {
              "label": "Enquiry received",
              "detail": "Added to this browser's demo queue."
            },
            {
              "label": "Request checked",
              "detail": "The example has contact, location and job details."
            },
            {
              "label": "Owner assigned",
              "detail": "Plumbing enquiry → Service coordinator."
            },
            {
              "label": "Reply prepared",
              "detail": "A template reply is waiting for your review and approval."
            },
            {
              "label": "Reply approved",
              "detail": "You reviewed and approved this draft."
            },
            {
              "label": "Reply simulated",
              "detail": "Recorded in the demo only. No email or external update was sent."
            }
          ],
          "notice": "Demo complete. Your approved reply was recorded; no email was sent."
        }
      }
    },
    {
      "id": "missing-details",
      "input": {
        "customer": "Sam Taylor",
        "email": "sam@example.com",
        "area": "",
        "message": "Can you help?"
      },
      "expected": "Review clarification; missing area and job detail remain unresolved after approval; awaiting-details",
      "passed": true,
      "observed": {
        "before": {
          "id": "DEMO-001",
          "count": 1,
          "status": "review",
          "owner": "Service coordinator",
          "category": "General enquiry",
          "missing": ["Area or postcode", "A little more detail about the job"],
          "approvedDraft": null,
          "history": [
            {
              "label": "Enquiry received",
              "detail": "Added to this browser's demo queue."
            },
            {
              "label": "Request checked",
              "detail": "More information needed: Area or postcode; A little more detail about the job."
            },
            {
              "label": "Owner assigned",
              "detail": "General enquiry → Service coordinator."
            },
            {
              "label": "Reply prepared",
              "detail": "A template reply is waiting for your review and approval."
            }
          ],
          "notice": "DEMO-001 is ready for review. No email has been sent."
        },
        "after": {
          "id": "DEMO-001",
          "count": 1,
          "status": "awaiting-details",
          "owner": "Service coordinator",
          "category": "General enquiry",
          "missing": ["Area or postcode", "A little more detail about the job"],
          "approvedDraft": "Hi Sam Taylor,\n\nThanks for getting in touch. Before we can review the job, could you share area or postcode and a little more detail about the job?\n\nNorthstar Plumbing\nSample business",
          "history": [
            {
              "label": "Enquiry received",
              "detail": "Added to this browser's demo queue."
            },
            {
              "label": "Request checked",
              "detail": "More information needed: Area or postcode; A little more detail about the job."
            },
            {
              "label": "Owner assigned",
              "detail": "General enquiry → Service coordinator."
            },
            {
              "label": "Reply prepared",
              "detail": "A template reply is waiting for your review and approval."
            },
            {
              "label": "Reply approved",
              "detail": "You reviewed and approved this draft."
            },
            {
              "label": "Clarification simulated",
              "detail": "Recorded in the demo only. No email or external update was sent."
            }
          ],
          "notice": "The demo is waiting for more details. No email was sent."
        }
      }
    },
    {
      "id": "normalized-duplicate",
      "input": {
        "customer": "Alex Morgan",
        "email": "alex@example.com",
        "area": "Bristol BS1",
        "message": "The kitchen tap has been dripping for a week. Could your plumber take a look? Please let me know the next step."
      },
      "expected": "Same ID; one record; unchanged state and history despite name/case/spacing differences",
      "passed": true,
      "observed": {
        "repeatedInput": {
          "customer": "Different display name",
          "email": "  ALEX@EXAMPLE.COM  ",
          "area": " BRISTOL   BS1 ",
          "message": "  THE  KITCHEN  TAP  HAS  BEEN  DRIPPING  FOR  A  WEEK.  COULD  YOUR  PLUMBER  TAKE  A  LOOK?  PLEASE  LET  ME  KNOW  THE  NEXT  STEP.  "
        },
        "before": {
          "id": "DEMO-001",
          "count": 1,
          "status": "review",
          "owner": "Service coordinator",
          "category": "Plumbing enquiry",
          "missing": [],
          "approvedDraft": null,
          "history": [
            {
              "label": "Enquiry received",
              "detail": "Added to this browser's demo queue."
            },
            {
              "label": "Request checked",
              "detail": "The example has contact, location and job details."
            },
            {
              "label": "Owner assigned",
              "detail": "Plumbing enquiry → Service coordinator."
            },
            {
              "label": "Reply prepared",
              "detail": "A template reply is waiting for your review and approval."
            }
          ],
          "notice": "DEMO-001 is ready for review. No email has been sent."
        },
        "after": {
          "id": "DEMO-001",
          "count": 1,
          "status": "review",
          "owner": "Service coordinator",
          "category": "Plumbing enquiry",
          "missing": [],
          "approvedDraft": null,
          "history": [
            {
              "label": "Enquiry received",
              "detail": "Added to this browser's demo queue."
            },
            {
              "label": "Request checked",
              "detail": "The example has contact, location and job details."
            },
            {
              "label": "Owner assigned",
              "detail": "Plumbing enquiry → Service coordinator."
            },
            {
              "label": "Reply prepared",
              "detail": "A template reply is waiting for your review and approval."
            }
          ],
          "notice": "Already received as DEMO-001. No duplicate task was created."
        }
      }
    },
    {
      "id": "repeated-approval",
      "input": {
        "customer": "Alex Morgan",
        "email": "alex@example.com",
        "area": "Bristol BS1",
        "message": "The kitchen tap has been dripping for a week. Could your plumber take a look? Please let me know the next step."
      },
      "expected": "Second approval leaves completed state, original approved text and history unchanged",
      "passed": true,
      "observed": {
        "before": {
          "id": "DEMO-001",
          "count": 1,
          "status": "completed",
          "owner": "Service coordinator",
          "category": "Plumbing enquiry",
          "missing": [],
          "approvedDraft": "Hi Alex Morgan,\n\nThanks for getting in touch. We have the details of your request. Our team will review it and confirm the next step. This is not yet a booking or a confirmed quote.\n\nNorthstar Plumbing\nSample business",
          "history": [
            {
              "label": "Enquiry received",
              "detail": "Added to this browser's demo queue."
            },
            {
              "label": "Request checked",
              "detail": "The example has contact, location and job details."
            },
            {
              "label": "Owner assigned",
              "detail": "Plumbing enquiry → Service coordinator."
            },
            {
              "label": "Reply prepared",
              "detail": "A template reply is waiting for your review and approval."
            },
            {
              "label": "Reply approved",
              "detail": "You reviewed and approved this draft."
            },
            {
              "label": "Reply simulated",
              "detail": "Recorded in the demo only. No email or external update was sent."
            }
          ],
          "notice": "Demo complete. Your approved reply was recorded; no email was sent."
        },
        "after": {
          "id": "DEMO-001",
          "count": 1,
          "status": "completed",
          "owner": "Service coordinator",
          "category": "Plumbing enquiry",
          "missing": [],
          "approvedDraft": "Hi Alex Morgan,\n\nThanks for getting in touch. We have the details of your request. Our team will review it and confirm the next step. This is not yet a booking or a confirmed quote.\n\nNorthstar Plumbing\nSample business",
          "history": [
            {
              "label": "Enquiry received",
              "detail": "Added to this browser's demo queue."
            },
            {
              "label": "Request checked",
              "detail": "The example has contact, location and job details."
            },
            {
              "label": "Owner assigned",
              "detail": "Plumbing enquiry → Service coordinator."
            },
            {
              "label": "Reply prepared",
              "detail": "A template reply is waiting for your review and approval."
            },
            {
              "label": "Reply approved",
              "detail": "You reviewed and approved this draft."
            },
            {
              "label": "Reply simulated",
              "detail": "Recorded in the demo only. No email or external update was sent."
            }
          ],
          "notice": "This enquiry is not waiting for approval."
        }
      }
    },
    {
      "id": "failure-recovery",
      "input": {
        "customer": "Alex Morgan",
        "email": "alex@example.com",
        "area": "Bristol BS1",
        "message": "The kitchen tap has been dripping for a week. Could your plumber take a look? Please let me know the next step."
      },
      "expected": "Blocked retains text; direct reapproval blocked; restore keeps one record and clears approval; fresh approval completes",
      "passed": true,
      "observed": {
        "blocked": {
          "id": "DEMO-001",
          "count": 1,
          "status": "blocked",
          "owner": "Service coordinator",
          "category": "Plumbing enquiry",
          "missing": [],
          "approvedDraft": "Thanks, Alex. We will check availability before confirming.",
          "history": [
            {
              "label": "Enquiry received",
              "detail": "Added to this browser's demo queue."
            },
            {
              "label": "Request checked",
              "detail": "The example has contact, location and job details."
            },
            {
              "label": "Owner assigned",
              "detail": "Plumbing enquiry → Service coordinator."
            },
            {
              "label": "Reply prepared",
              "detail": "A template reply is waiting for your review and approval."
            },
            {
              "label": "Reply approved",
              "detail": "You reviewed and approved this draft."
            },
            {
              "label": "Delivery paused",
              "detail": "The example connection is unavailable. Nothing was sent; the request is kept for recovery."
            }
          ],
          "notice": "Example connection failed. Restore it, then review the reply again."
        },
        "restored": {
          "id": "DEMO-001",
          "count": 1,
          "status": "review",
          "owner": "Service coordinator",
          "category": "Plumbing enquiry",
          "missing": [],
          "approvedDraft": null,
          "history": [
            {
              "label": "Enquiry received",
              "detail": "Added to this browser's demo queue."
            },
            {
              "label": "Request checked",
              "detail": "The example has contact, location and job details."
            },
            {
              "label": "Owner assigned",
              "detail": "Plumbing enquiry → Service coordinator."
            },
            {
              "label": "Reply prepared",
              "detail": "A template reply is waiting for your review and approval."
            },
            {
              "label": "Reply approved",
              "detail": "You reviewed and approved this draft."
            },
            {
              "label": "Delivery paused",
              "detail": "The example connection is unavailable. Nothing was sent; the request is kept for recovery."
            },
            {
              "label": "Example connection restored",
              "detail": "Review and approve the reply again before the demo continues."
            }
          ],
          "notice": "Example connection restored. Your reply needs a fresh approval."
        },
        "completed": {
          "id": "DEMO-001",
          "count": 1,
          "status": "completed",
          "owner": "Service coordinator",
          "category": "Plumbing enquiry",
          "missing": [],
          "approvedDraft": "Thanks, Alex. We will check availability before confirming.",
          "history": [
            {
              "label": "Enquiry received",
              "detail": "Added to this browser's demo queue."
            },
            {
              "label": "Request checked",
              "detail": "The example has contact, location and job details."
            },
            {
              "label": "Owner assigned",
              "detail": "Plumbing enquiry → Service coordinator."
            },
            {
              "label": "Reply prepared",
              "detail": "A template reply is waiting for your review and approval."
            },
            {
              "label": "Reply approved",
              "detail": "You reviewed and approved this draft."
            },
            {
              "label": "Delivery paused",
              "detail": "The example connection is unavailable. Nothing was sent; the request is kept for recovery."
            },
            {
              "label": "Example connection restored",
              "detail": "Review and approve the reply again before the demo continues."
            },
            {
              "label": "Reply approved",
              "detail": "You reviewed and approved this draft."
            },
            {
              "label": "Reply simulated",
              "detail": "Recorded in the demo only. No email or external update was sent."
            }
          ],
          "notice": "Demo complete. Your approved reply was recorded; no email was sent."
        }
      }
    }
  ]
}
