{
  "version": 1,
  "kind": "synthetic_acceptance_specification",
  "status": "not_run",
  "scope": "One new enquiry creates one deal and one next activity; distinct enquiries may share a person.",
  "notes": [
    "Reset each case to its declared baseline.",
    "Symbolic keys are not real account IDs.",
    "No account connection or Make blueprint is included.",
    "A review state is unresolved and must not be reported as a completed handoff."
  ],
  "cases": [
    {
      "id": "D01",
      "name": "One new enquiry",
      "seed": {
        "people": 0,
        "deals": 0,
        "activities": 0
      },
      "procedure": "Deliver one complete event with a stable submission key and a contact identity your matching rule accepts.",
      "events": [
        {
          "submission_key": "ENQ-101",
          "contact_key": "PERSON-101",
          "service": "consultation"
        }
      ],
      "expected": {
        "people": 1,
        "deals": 1,
        "activities": 1,
        "state": "complete"
      },
      "acceptance": "The assigned owner can see one enquiry and one next action. The event record points to the resulting IDs."
    },
    {
      "id": "D02",
      "name": "Ten deliveries of the same event",
      "seed": {
        "people": 0,
        "deals": 0,
        "activities": 0
      },
      "procedure": "Deliver the D01 event ten times, one after another, using the same submission key and payload.",
      "events": [
        {
          "submission_key": "ENQ-101",
          "contact_key": "PERSON-101",
          "service": "consultation",
          "repeat_delivery": 10
        }
      ],
      "expected": {
        "people": 1,
        "deals": 1,
        "activities": 1,
        "state": "complete"
      },
      "acceptance": "The tenth delivery leaves the same final record IDs and counts as the first. It does not create another activity."
    },
    {
      "id": "D03",
      "name": "Two simultaneous deliveries",
      "seed": {
        "people": 0,
        "deals": 0,
        "activities": 0
      },
      "procedure": "Deliver two identical D01 events at the same time, then inspect both execution histories.",
      "events": [
        {
          "submission_key": "ENQ-101",
          "contact_key": "PERSON-101",
          "service": "consultation",
          "parallel_deliveries": 2
        }
      ],
      "expected": {
        "people": 1,
        "deals": 1,
        "activities": 1,
        "state": "complete"
      },
      "acceptance": "Both deliveries are accounted for, but only one final set of records exists. A search-before-create diagram alone does not pass this case."
    },
    {
      "id": "D04",
      "name": "A new enquiry from an existing person",
      "seed": {
        "people": 1,
        "deals": 1,
        "activities": 1,
        "contact_key": "PERSON-101",
        "completed_submission": "ENQ-101"
      },
      "procedure": "Deliver a new submission key from the existing test person. This test suite deliberately treats a new enquiry as a separate deal and activity.",
      "events": [
        {
          "submission_key": "ENQ-102",
          "contact_key": "PERSON-101",
          "service": "new-project"
        }
      ],
      "expected": {
        "people": 1,
        "deals": 2,
        "activities": 2,
        "state": "complete"
      },
      "acceptance": "The person is reused, while the legitimate second enquiry and next action are preserved. Count totals include the seeded records."
    },
    {
      "id": "D05",
      "name": "The same key with different content",
      "seed": {
        "people": 1,
        "deals": 1,
        "activities": 1,
        "completed_submission": "ENQ-101",
        "contact_key": "PERSON-101",
        "service": "consultation"
      },
      "procedure": "Seed the completed ENQ-101 enquiry for PERSON-101 with service consultation. Redeliver the same submission key with different-service. Compare the explicit payload fields before any update.",
      "events": [
        {
          "submission_key": "ENQ-101",
          "contact_key": "PERSON-101",
          "service": "different-service"
        }
      ],
      "expected": {
        "people": 1,
        "deals": 1,
        "activities": 1,
        "state": "review"
      },
      "acceptance": "The conflict is visible for review. It neither silently overwrites the first enquiry nor creates a second deal."
    },
    {
      "id": "D06",
      "name": "Failure after saving the person",
      "seed": {
        "people": 0,
        "deals": 0,
        "activities": 0
      },
      "procedure": "After the person write, trigger a controlled validation failure in a separate test step before the deal write. Keep automatic completion off, retain the error, and reconcile the saved person before an explicit recovery attempt. This is not the lost-acknowledgement case.",
      "events": [
        {
          "submission_key": "ENQ-106",
          "contact_key": "PERSON-106",
          "service": "consultation"
        }
      ],
      "expected": {
        "people": 1,
        "deals": 1,
        "activities": 1,
        "state": "complete"
      },
      "acceptance": "Recovery reuses the saved person and creates exactly one deal and activity. Keep the original failure and recovery evidence."
    },
    {
      "id": "D07",
      "name": "A write succeeded but its acknowledgement was lost",
      "seed": {
        "people": 0,
        "deals": 0,
        "activities": 0
      },
      "procedure": "Simulate a successful deal write followed by an interrupted acknowledgement before its ID is stored. Reconcile the destination before another create.",
      "events": [
        {
          "submission_key": "ENQ-107",
          "contact_key": "PERSON-107",
          "service": "consultation"
        }
      ],
      "expected": {
        "people": 1,
        "deals": 1,
        "activities": [
          0,
          1
        ],
        "state": [
          "review",
          "complete"
        ]
      },
      "acceptance": "No second deal is created. A complete outcome requires one person, one deal and one verified next activity. A visible review outcome can contain zero or one activity and remains unresolved.",
      "allowed_outcomes": [
        {
          "people": 1,
          "deals": 1,
          "activities": 0,
          "state": "review"
        },
        {
          "people": 1,
          "deals": 1,
          "activities": 1,
          "state": "review"
        },
        {
          "people": 1,
          "deals": 1,
          "activities": 1,
          "state": "complete"
        }
      ]
    },
    {
      "id": "D08",
      "name": "Missing contact identity",
      "seed": {
        "people": 0,
        "deals": 0,
        "activities": 0
      },
      "procedure": "Submit an event without a contact identity. Preserve the unresolved event without creating CRM records.",
      "events": [
        {
          "submission_key": "ENQ-108",
          "contact_key": null,
          "service": "consultation"
        }
      ],
      "expected": {
        "people": 0,
        "deals": 0,
        "activities": 0,
        "state": "review"
      },
      "acceptance": "The unresolved request is retained for review without silently joining it to a person or creating an incomplete deal."
    },
    {
      "id": "D09",
      "name": "More than one contact matches",
      "seed": {
        "people": 2,
        "deals": 0,
        "activities": 0,
        "contact_key": "PERSON-SHARED",
        "matching_candidates": 2
      },
      "procedure": "Seed two test people that both match the selected contact rule for PERSON-SHARED. Submit a new enquiry. The scenario must retain it for review without choosing a person arbitrarily.",
      "events": [
        {
          "submission_key": "ENQ-109",
          "contact_key": "PERSON-SHARED",
          "service": "consultation"
        }
      ],
      "expected": {
        "people": 2,
        "deals": 0,
        "activities": 0,
        "state": "review"
      },
      "acceptance": "Both seeded people remain. No deal or activity is created. The ambiguous request and its two candidate references remain visible for review."
    }
  ]
}
