{
  "id": "k-camp-10",
  "title": "Workflow Set Campaign 2,000-contact 43-minute performance acceptance",
  "kind": "hubspot_sync",
  "linkedIssues": [
    4739,
    2862,
    2863
  ],
  "optional": true,
  "optionalReason": "Optional observation in the Set Campaign performance suite, whose required workloads are 20 and 100 contacts; excluded from functionality acceptance.",
  "executionMode": "serial",
  "executionModeReason": "The case owns one isolated 2,000-contact cohort and one fresh Campaign; no other case may share its local queue capacity or latency budget.",
  "requiresHubSpotSandboxPreflight": true,
  "caseTimeoutMs": 2580000,
  "caseGroups": [
    "hubspot-performance",
    "set-campaign-performance"
  ],
  "performanceContract": {
    "schemaVersion": "hubspot-set-campaign-performance/v1",
    "profile": "set_campaign_2000_contacts_43m",
    "acceptanceScope": "set_campaign_performance_claim",
    "expectation": "should_pass",
    "releaseBlocking": false,
    "correctnessRequired": true,
    "fullSuitePolicy": "dedicated_only",
    "nonPassPolicy": "reports_performance_failure_without_blocking_required_acceptance",
    "workload": {
      "providerContactCount": 2000,
      "hubspotBatchSize": 100,
      "hubspotBatchCount": 20,
      "workflowActionCount": 2000,
      "admissionConcurrency": 4
    },
    "budgets": {
      "leadMaterializationBudgetMs": 300000,
      "actionAdmissionMaxElapsedMs": 900000,
      "terminalLeadBudgetMs": 1200000,
      "cohortConsistencyBudgetMs": 300000,
      "stabilityRecheckDelayMs": 60000,
      "stabilityRequestTimeoutMs": 60000,
      "caseTimeoutMs": 2580000
    }
  },
  "provenance": {
    "businessScenario": "K-CAMP-10 is the reproducible #4739 terminal-latency acceptance without an intentional create/action race. Create 2,000 unique contacts in the admitted HubSpot sandbox through 20 provider-compliant batches, wait until at least one exact cohort Lead has materialized, and submit one real signed Set Campaign workflow action per contact at concurrency 4 within 15 minutes of case start. The terminal verdict batch-reads all 53 source properties and all 17 skip-if-set property histories for the complete live HubSpot cohort, evaluates the authoritative inbound mapping, compares all 102,000 persisted Lead cells, and validates all 4,000 projection-only routing cells. It also requires exactly 2,000 active Leads, finalized identity links, consumed evidence rows, Sent CampaignMembers, processed WorkItems, handoffs, and completed Runtime commands in the selected environment. The complete source, destination, mapping, and durability snapshot must remain unchanged for 60 seconds; an omitted source property or history, ambiguous history, mapping drift, failed admission, lost or duplicate identity, field mismatch, Contact projection, missing member, incomplete durable work, or late arrival fails the case.",
    "reportedBy": "#4739 Connector production consistency closure",
    "capturedAt": "2026-09-02",
    "calibrated": "This is a fixed performance deadline, not a calibration to the current implementation's throughput. The entire case must finish within 43 minutes so L2 can keep setup, execution, and report publication within its one-hour active-job envelope. Admission retains a 15-minute deadline measured from case start, including provider creation and readiness. Terminal attribution has 20 minutes, deep consistency has 5 minutes, and the unchanged stability proof retains a 60-second delay. The admission, polling, and stability-delay budgets total 41 minutes, reserving two minutes inside the case deadline for the final snapshot and overhead. Its 60-second timeout limits each SQL or provider request, not the complete multi-request snapshot; the entire snapshot and all retries must still finish within the case deadline. Readiness still covers the complete unique email-prefix cohort; all 2,000 contacts, exact source/destination/durability assertions, and the stable snapshot fingerprint remain mandatory. Missing this deadline is a failed performance observation, reported without blocking required acceptance. Do not enlarge the budget to make a slow implementation pass."
  },
  "steps": [
    {
      "id": "s0-create-campaign",
      "system": "nexuscrm",
      "authRole": "admin",
      "method": "POST",
      "path": "/services/data/v63.0/sobjects/Campaign",
      "body": {
        "Name": "IT K-CAMP-10 2K {{__runId}}",
        "IsActive": true
      },
      "expectStatusRange": [
        200,
        299
      ],
      "assertions": [
        {
          "path": "response.body.id",
          "exists": true
        }
      ]
    },
    {
      "id": "s1-create-contacts",
      "system": "hubspot",
      "method": "POST",
      "path": "/crm/v3/objects/contacts/batch/create",
      "generate": {
        "count": 2000,
        "batchSize": 100,
        "into": "inputs",
        "itemTemplate": {
          "properties": {
            "email": "kcamp10-{{__runId}}-{{i}}@example.com",
            "firstname": "KCamp10",
            "lastname": "Bulk-{{i}}",
            "lifecyclestage": "lead"
          }
        }
      },
      "expectStatusRange": [
        200,
        299
      ],
      "assertions": [
        {
          "path": "response.body.batchCount",
          "numericEquals": 20
        },
        {
          "path": "response.body.failedBatchCount",
          "numericEquals": 0
        },
        {
          "path": "response.body.resultCount",
          "numericEquals": 2000
        }
      ]
    },
    {
      "id": "s1a-first-lead-materialized",
      "system": "nexuscrm",
      "authRole": "admin",
      "method": "GET",
      "path": "/services/data/v63.0/query?q=SELECT Id,HubSpot_Id__c,Email FROM Lead WHERE Email LIKE 'kcamp10-{{__runId}}-%25' AND IsConverted=false LIMIT 1",
      "expectStatus": 200,
      "poll": {
        "budgetMs": 300000,
        "intervalMs": 10000
      },
      "onTimeout": "fail",
      "assertions": [
        {
          "path": "response.body.records",
          "lengthAtLeast": 1
        },
        {
          "path": "response.body.records[0].HubSpot_Id__c",
          "exists": true
        },
        {
          "path": "response.body.records[0].Email",
          "exists": true
        }
      ]
    },
    {
      "id": "s2-set-campaign",
      "system": "connector_action",
      "path": "/webhooks/hubspot-crm-connector/workflow-action",
      "forEach": "steps.s1-create-contacts.response.body.results",
      "contactIdField": "id",
      "emailField": "properties.email",
      "campaignId": "{{steps.s0-create-campaign.response.body.id}}",
      "status": "Sent",
      "callbackIdPrefix": "k-camp-10",
      "concurrency": 4,
      "maxCaseElapsedMs": 900000,
      "assertions": [
        {
          "path": "response.body.failedCount",
          "numericEquals": 0
        },
        {
          "path": "response.body.acceptedCount",
          "numericEquals": 2000
        }
      ]
    },
    {
      "id": "s3-lead-attribution-count",
      "system": "nexuscrm",
      "authRole": "admin",
      "method": "GET",
      "path": "/services/data/v63.0/query?q=SELECT COUNT() FROM Lead WHERE Id IN (SELECT LeadId FROM CampaignMember WHERE CampaignId='{{steps.s0-create-campaign.response.body.id}}' AND Status='Sent') AND First_Campaign__c='{{steps.s0-create-campaign.response.body.id}}' AND Last_Campaign__c='{{steps.s0-create-campaign.response.body.id}}'",
      "expectStatus": 200,
      "poll": {
        "budgetMs": 1200000,
        "intervalMs": 30000
      },
      "onTimeout": "fail",
      "assertions": [
        {
          "path": "response.body.totalSize",
          "atLeast": 2000
        }
      ]
    },
    {
      "id": "s4-exact-cohort",
      "system": "set_campaign_consistency",
      "actionStepId": "s2-set-campaign",
      "expectedCount": 2000,
      "timeoutMs": 60000,
      "expectStatus": 200,
      "poll": {
        "budgetMs": 300000,
        "intervalMs": 30000
      },
      "onTimeout": "fail",
      "assertions": [
        { "path": "response.body.consistent", "equals": true },
        { "path": "response.body.expectedCount", "numericEquals": 2000 },
        { "path": "response.body.providerCount", "numericEquals": 2000 },
        { "path": "response.body.providerBatchCount", "numericEquals": 40 },
        { "path": "response.body.mappingSourcePropertyCount", "numericEquals": 53 },
        { "path": "response.body.expectedSourcePropertyCount", "numericEquals": 106000 },
        { "path": "response.body.verifiedSourcePropertyCount", "numericEquals": 106000 },
        { "path": "response.body.sourcePropertyMissingCount", "numericEquals": 0 },
        { "path": "response.body.skipIfSetSourcePropertyCount", "numericEquals": 17 },
        { "path": "response.body.expectedSourceHistoryFieldCount", "numericEquals": 34000 },
        { "path": "response.body.verifiedSourceHistoryFieldCount", "numericEquals": 34000 },
        { "path": "response.body.sourceHistoryMismatchCount", "numericEquals": 0 },
        { "path": "response.body.mappingFieldCount", "numericEquals": 51 },
        { "path": "response.body.mappingProjectionOnlyCount", "numericEquals": 2 },
        { "path": "response.body.expectedProjectionOnlyCellCount", "numericEquals": 4000 },
        { "path": "response.body.verifiedProjectionOnlyCellCount", "numericEquals": 4000 },
        { "path": "response.body.projectionOnlyMismatchCount", "numericEquals": 0 },
        { "path": "response.body.deployedMappingCount", "numericEquals": 53 },
        { "path": "response.body.mappingContractMismatchCount", "numericEquals": 0 },
        { "path": "response.body.expectedMappedCellCount", "numericEquals": 102000 },
        { "path": "response.body.mappedCellCount", "numericEquals": 102000 },
        { "path": "response.body.matchedMappedCellCount", "numericEquals": 102000 },
        { "path": "response.body.deepMismatchCount", "numericEquals": 0 },
        { "path": "response.body.fullyEquivalentRecordCount", "numericEquals": 2000 },
        { "path": "response.body.leadCount", "numericEquals": 2000 },
        { "path": "response.body.contactCount", "numericEquals": 0 },
        { "path": "response.body.campaignMemberCount", "numericEquals": 2000 },
        { "path": "response.body.authorshipCount", "numericEquals": 2000 },
        { "path": "response.body.terminalEventCount", "numericEquals": 2000 },
        { "path": "response.body.mismatchCount", "numericEquals": 0 }
      ]
    },
    {
      "id": "s5-stable-exact-cohort",
      "system": "set_campaign_consistency",
      "actionStepId": "s2-set-campaign",
      "expectedCount": 2000,
      "delayMs": 60000,
      "timeoutMs": 60000,
      "expectStatus": 200,
      "assertions": [
        { "path": "response.body.consistent", "equals": true },
        { "path": "response.body.expectedCount", "numericEquals": 2000 },
        { "path": "response.body.providerCount", "numericEquals": 2000 },
        { "path": "response.body.providerBatchCount", "numericEquals": 40 },
        { "path": "response.body.mappingSourcePropertyCount", "numericEquals": 53 },
        { "path": "response.body.expectedSourcePropertyCount", "numericEquals": 106000 },
        { "path": "response.body.verifiedSourcePropertyCount", "numericEquals": 106000 },
        { "path": "response.body.sourcePropertyMissingCount", "numericEquals": 0 },
        { "path": "response.body.skipIfSetSourcePropertyCount", "numericEquals": 17 },
        { "path": "response.body.expectedSourceHistoryFieldCount", "numericEquals": 34000 },
        { "path": "response.body.verifiedSourceHistoryFieldCount", "numericEquals": 34000 },
        { "path": "response.body.sourceHistoryMismatchCount", "numericEquals": 0 },
        { "path": "response.body.mappingFieldCount", "numericEquals": 51 },
        { "path": "response.body.mappingProjectionOnlyCount", "numericEquals": 2 },
        { "path": "response.body.expectedProjectionOnlyCellCount", "numericEquals": 4000 },
        { "path": "response.body.verifiedProjectionOnlyCellCount", "numericEquals": 4000 },
        { "path": "response.body.projectionOnlyMismatchCount", "numericEquals": 0 },
        { "path": "response.body.deployedMappingCount", "numericEquals": 53 },
        { "path": "response.body.mappingContractMismatchCount", "numericEquals": 0 },
        { "path": "response.body.expectedMappedCellCount", "numericEquals": 102000 },
        { "path": "response.body.mappedCellCount", "numericEquals": 102000 },
        { "path": "response.body.matchedMappedCellCount", "numericEquals": 102000 },
        { "path": "response.body.deepMismatchCount", "numericEquals": 0 },
        { "path": "response.body.fullyEquivalentRecordCount", "numericEquals": 2000 },
        { "path": "response.body.leadCount", "numericEquals": 2000 },
        { "path": "response.body.contactCount", "numericEquals": 0 },
        { "path": "response.body.campaignMemberCount", "numericEquals": 2000 },
        { "path": "response.body.authorshipCount", "numericEquals": 2000 },
        { "path": "response.body.terminalEventCount", "numericEquals": 2000 },
        { "path": "response.body.mismatchCount", "numericEquals": 0 },
        { "path": "response.body.snapshotFingerprint", "equals": "{{steps.s4-exact-cohort.response.body.snapshotFingerprint}}" }
      ]
    }
  ]
}
