{
  "id": "set-campaign-canary-100-contacts",
  "title": "Workflow Set Campaign performance — 100 contacts",
  "kind": "hubspot_sync",
  "linkedIssues": [
    4739,
    5667
  ],
  "allowedTargetEnvironments": [
    "staging",
    "test1",
    "test2",
    "test3"
  ],
  "optional": true,
  "optionalReason": "Excluded from functionality acceptance; required in the Set Campaign performance suite.",
  "performanceContract": {
    "schemaVersion": "hubspot-set-campaign-performance/v1",
    "profile": "set_campaign_100_contacts",
    "acceptanceScope": "set_campaign_performance_claim",
    "expectation": "must_pass",
    "releaseBlocking": true,
    "correctnessRequired": true,
    "fullSuitePolicy": "dedicated_only",
    "nonPassPolicy": "fails_required_performance_acceptance"
  },
  "executionMode": "serial",
  "executionModeReason": "The case owns one isolated 100-contact cohort and one fresh Campaign; no other case may share its queue boundary.",
  "requiresHubSpotSandboxPreflight": true,
  "caseTimeoutMs": 2400000,
  "caseGroups": [
    "hubspot-performance",
    "set-campaign-performance",
    "set-campaign-canary-100-contacts"
  ],
  "provenance": {
    "businessScenario": "SET-CAMPAIGN-CANARY-100-CONTACTS exercises the corrected Set Campaign sequence with exactly 100 contacts. It creates one unique HubSpot cohort, waits for one cohort Lead to materialize, submits one signed workflow action per contact at concurrency 4, and reconciles all 53 source properties and all 17 skip-if-set property histories through the authoritative inbound mapping to all 51 persisted Lead fields for every returned provider identity. The two projection-only Salesforce routing hints must also select that Lead rather than a Contact. It requires exactly one active Lead, finalized authorship, one Sent CampaignMember, and one completed Runtime command per identity. The complete source, destination, mapping, and durability snapshot must remain unchanged for 60 seconds; an omitted source property or history, ambiguous history, mapping drift, active Contact projection, missing or duplicate row, field mismatch, failed/nonterminal work, or late arrival fails the case.",
    "reportedBy": "#5667 queue recovery and fixed canary",
    "capturedAt": "2026-09-01",
    "calibrated": "The workload is fixed in the checked-in case and is not runtime-tunable. Readiness checks the complete 100-ID provider cohort, so it neither assumes HubSpot batch-response order nor depends on wildcard predicate lowering; its 300-second budget matches the formal K-CAMP-10 readiness budget. The cheap aggregate gate retains its 10-minute ramp budget. A strict Test3 run then required more than the original 60-second consistency window but reached 100/100 deep equivalence within 442.247 seconds after the aggregate gate and retained the same fingerprint 60 seconds later. The consistency window is therefore set once to 10 minutes with 15-second observations, and the 40-minute case timeout covers the declared step budgets without weakening any exact assertion. This fixed 100-contact workload is required in the performance suite and excluded from functionality acceptance. The optional K-CAMP-10 2,000-contact performance observation remains a separate scale claim."
  },
  "steps": [
    {
      "id": "s0-create-campaign",
      "system": "nexuscrm",
      "authRole": "admin",
      "method": "POST",
      "path": "/services/data/v63.0/sobjects/Campaign",
      "body": {
        "Name": "IT Set Campaign 100 {{__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": 100,
        "batchSize": 100,
        "aggregateResponse": true,
        "into": "inputs",
        "itemTemplate": {
          "properties": {
            "email": "setcampaign100-{{__runId}}-{{i}}@example.com",
            "firstname": "KCamp10",
            "lastname": "Bulk-{{i}}",
            "lifecyclestage": "lead"
          }
        }
      },
      "expectStatusRange": [
        200,
        299
      ],
      "assertions": [
        {
          "path": "response.body.batchCount",
          "numericEquals": 1
        },
        {
          "path": "response.body.failedBatchCount",
          "numericEquals": 0
        },
        {
          "path": "response.body.resultCount",
          "numericEquals": 100
        }
      ]
    },
    {
      "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 HubSpot_Id__c IN ('{{steps.s1-create-contacts.response.body.results[0].id}}','{{steps.s1-create-contacts.response.body.results[1].id}}','{{steps.s1-create-contacts.response.body.results[2].id}}','{{steps.s1-create-contacts.response.body.results[3].id}}','{{steps.s1-create-contacts.response.body.results[4].id}}','{{steps.s1-create-contacts.response.body.results[5].id}}','{{steps.s1-create-contacts.response.body.results[6].id}}','{{steps.s1-create-contacts.response.body.results[7].id}}','{{steps.s1-create-contacts.response.body.results[8].id}}','{{steps.s1-create-contacts.response.body.results[9].id}}','{{steps.s1-create-contacts.response.body.results[10].id}}','{{steps.s1-create-contacts.response.body.results[11].id}}','{{steps.s1-create-contacts.response.body.results[12].id}}','{{steps.s1-create-contacts.response.body.results[13].id}}','{{steps.s1-create-contacts.response.body.results[14].id}}','{{steps.s1-create-contacts.response.body.results[15].id}}','{{steps.s1-create-contacts.response.body.results[16].id}}','{{steps.s1-create-contacts.response.body.results[17].id}}','{{steps.s1-create-contacts.response.body.results[18].id}}','{{steps.s1-create-contacts.response.body.results[19].id}}','{{steps.s1-create-contacts.response.body.results[20].id}}','{{steps.s1-create-contacts.response.body.results[21].id}}','{{steps.s1-create-contacts.response.body.results[22].id}}','{{steps.s1-create-contacts.response.body.results[23].id}}','{{steps.s1-create-contacts.response.body.results[24].id}}','{{steps.s1-create-contacts.response.body.results[25].id}}','{{steps.s1-create-contacts.response.body.results[26].id}}','{{steps.s1-create-contacts.response.body.results[27].id}}','{{steps.s1-create-contacts.response.body.results[28].id}}','{{steps.s1-create-contacts.response.body.results[29].id}}','{{steps.s1-create-contacts.response.body.results[30].id}}','{{steps.s1-create-contacts.response.body.results[31].id}}','{{steps.s1-create-contacts.response.body.results[32].id}}','{{steps.s1-create-contacts.response.body.results[33].id}}','{{steps.s1-create-contacts.response.body.results[34].id}}','{{steps.s1-create-contacts.response.body.results[35].id}}','{{steps.s1-create-contacts.response.body.results[36].id}}','{{steps.s1-create-contacts.response.body.results[37].id}}','{{steps.s1-create-contacts.response.body.results[38].id}}','{{steps.s1-create-contacts.response.body.results[39].id}}','{{steps.s1-create-contacts.response.body.results[40].id}}','{{steps.s1-create-contacts.response.body.results[41].id}}','{{steps.s1-create-contacts.response.body.results[42].id}}','{{steps.s1-create-contacts.response.body.results[43].id}}','{{steps.s1-create-contacts.response.body.results[44].id}}','{{steps.s1-create-contacts.response.body.results[45].id}}','{{steps.s1-create-contacts.response.body.results[46].id}}','{{steps.s1-create-contacts.response.body.results[47].id}}','{{steps.s1-create-contacts.response.body.results[48].id}}','{{steps.s1-create-contacts.response.body.results[49].id}}','{{steps.s1-create-contacts.response.body.results[50].id}}','{{steps.s1-create-contacts.response.body.results[51].id}}','{{steps.s1-create-contacts.response.body.results[52].id}}','{{steps.s1-create-contacts.response.body.results[53].id}}','{{steps.s1-create-contacts.response.body.results[54].id}}','{{steps.s1-create-contacts.response.body.results[55].id}}','{{steps.s1-create-contacts.response.body.results[56].id}}','{{steps.s1-create-contacts.response.body.results[57].id}}','{{steps.s1-create-contacts.response.body.results[58].id}}','{{steps.s1-create-contacts.response.body.results[59].id}}','{{steps.s1-create-contacts.response.body.results[60].id}}','{{steps.s1-create-contacts.response.body.results[61].id}}','{{steps.s1-create-contacts.response.body.results[62].id}}','{{steps.s1-create-contacts.response.body.results[63].id}}','{{steps.s1-create-contacts.response.body.results[64].id}}','{{steps.s1-create-contacts.response.body.results[65].id}}','{{steps.s1-create-contacts.response.body.results[66].id}}','{{steps.s1-create-contacts.response.body.results[67].id}}','{{steps.s1-create-contacts.response.body.results[68].id}}','{{steps.s1-create-contacts.response.body.results[69].id}}','{{steps.s1-create-contacts.response.body.results[70].id}}','{{steps.s1-create-contacts.response.body.results[71].id}}','{{steps.s1-create-contacts.response.body.results[72].id}}','{{steps.s1-create-contacts.response.body.results[73].id}}','{{steps.s1-create-contacts.response.body.results[74].id}}','{{steps.s1-create-contacts.response.body.results[75].id}}','{{steps.s1-create-contacts.response.body.results[76].id}}','{{steps.s1-create-contacts.response.body.results[77].id}}','{{steps.s1-create-contacts.response.body.results[78].id}}','{{steps.s1-create-contacts.response.body.results[79].id}}','{{steps.s1-create-contacts.response.body.results[80].id}}','{{steps.s1-create-contacts.response.body.results[81].id}}','{{steps.s1-create-contacts.response.body.results[82].id}}','{{steps.s1-create-contacts.response.body.results[83].id}}','{{steps.s1-create-contacts.response.body.results[84].id}}','{{steps.s1-create-contacts.response.body.results[85].id}}','{{steps.s1-create-contacts.response.body.results[86].id}}','{{steps.s1-create-contacts.response.body.results[87].id}}','{{steps.s1-create-contacts.response.body.results[88].id}}','{{steps.s1-create-contacts.response.body.results[89].id}}','{{steps.s1-create-contacts.response.body.results[90].id}}','{{steps.s1-create-contacts.response.body.results[91].id}}','{{steps.s1-create-contacts.response.body.results[92].id}}','{{steps.s1-create-contacts.response.body.results[93].id}}','{{steps.s1-create-contacts.response.body.results[94].id}}','{{steps.s1-create-contacts.response.body.results[95].id}}','{{steps.s1-create-contacts.response.body.results[96].id}}','{{steps.s1-create-contacts.response.body.results[97].id}}','{{steps.s1-create-contacts.response.body.results[98].id}}','{{steps.s1-create-contacts.response.body.results[99].id}}') 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": "set-campaign-canary-100",
      "concurrency": 4,
      "maxCaseElapsedMs": 420000,
      "assertions": [
        {
          "path": "response.body.failedCount",
          "numericEquals": 0
        },
        {
          "path": "response.body.acceptedCount",
          "numericEquals": 100
        }
      ]
    },
    {
      "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": 600000,
        "intervalMs": 30000
      },
      "onTimeout": "fail",
      "assertions": [
        {
          "path": "response.body.totalSize",
          "atLeast": 100
        }
      ]
    },
    {
      "id": "s4-exact-cohort",
      "system": "set_campaign_consistency",
      "actionStepId": "s2-set-campaign",
      "expectedCount": 100,
      "timeoutMs": 60000,
      "expectStatus": 200,
      "poll": {
        "budgetMs": 600000,
        "intervalMs": 15000
      },
      "onTimeout": "fail",
      "assertions": [
        { "path": "response.body.consistent", "equals": true },
        { "path": "response.body.expectedCount", "numericEquals": 100 },
        { "path": "response.body.providerCount", "numericEquals": 100 },
        { "path": "response.body.providerBatchCount", "numericEquals": 2 },
        { "path": "response.body.mappingSourcePropertyCount", "numericEquals": 53 },
        { "path": "response.body.expectedSourcePropertyCount", "numericEquals": 5300 },
        { "path": "response.body.verifiedSourcePropertyCount", "numericEquals": 5300 },
        { "path": "response.body.sourcePropertyMissingCount", "numericEquals": 0 },
        { "path": "response.body.skipIfSetSourcePropertyCount", "numericEquals": 17 },
        { "path": "response.body.expectedSourceHistoryFieldCount", "numericEquals": 1700 },
        { "path": "response.body.verifiedSourceHistoryFieldCount", "numericEquals": 1700 },
        { "path": "response.body.sourceHistoryMismatchCount", "numericEquals": 0 },
        { "path": "response.body.mappingFieldCount", "numericEquals": 51 },
        { "path": "response.body.mappingProjectionOnlyCount", "numericEquals": 2 },
        { "path": "response.body.expectedProjectionOnlyCellCount", "numericEquals": 200 },
        { "path": "response.body.verifiedProjectionOnlyCellCount", "numericEquals": 200 },
        { "path": "response.body.projectionOnlyMismatchCount", "numericEquals": 0 },
        { "path": "response.body.deployedMappingCount", "numericEquals": 53 },
        { "path": "response.body.mappingContractMismatchCount", "numericEquals": 0 },
        { "path": "response.body.expectedMappedCellCount", "numericEquals": 5100 },
        { "path": "response.body.mappedCellCount", "numericEquals": 5100 },
        { "path": "response.body.matchedMappedCellCount", "numericEquals": 5100 },
        { "path": "response.body.deepMismatchCount", "numericEquals": 0 },
        { "path": "response.body.fullyEquivalentRecordCount", "numericEquals": 100 },
        { "path": "response.body.leadCount", "numericEquals": 100 },
        { "path": "response.body.contactCount", "numericEquals": 0 },
        { "path": "response.body.campaignMemberCount", "numericEquals": 100 },
        { "path": "response.body.authorshipCount", "numericEquals": 100 },
        { "path": "response.body.terminalEventCount", "numericEquals": 100 },
        { "path": "response.body.mismatchCount", "numericEquals": 0 }
      ]
    },
    {
      "id": "s5-stable-exact-cohort",
      "system": "set_campaign_consistency",
      "actionStepId": "s2-set-campaign",
      "expectedCount": 100,
      "delayMs": 60000,
      "timeoutMs": 60000,
      "expectStatus": 200,
      "assertions": [
        { "path": "response.body.consistent", "equals": true },
        { "path": "response.body.expectedCount", "numericEquals": 100 },
        { "path": "response.body.providerCount", "numericEquals": 100 },
        { "path": "response.body.providerBatchCount", "numericEquals": 2 },
        { "path": "response.body.mappingSourcePropertyCount", "numericEquals": 53 },
        { "path": "response.body.expectedSourcePropertyCount", "numericEquals": 5300 },
        { "path": "response.body.verifiedSourcePropertyCount", "numericEquals": 5300 },
        { "path": "response.body.sourcePropertyMissingCount", "numericEquals": 0 },
        { "path": "response.body.skipIfSetSourcePropertyCount", "numericEquals": 17 },
        { "path": "response.body.expectedSourceHistoryFieldCount", "numericEquals": 1700 },
        { "path": "response.body.verifiedSourceHistoryFieldCount", "numericEquals": 1700 },
        { "path": "response.body.sourceHistoryMismatchCount", "numericEquals": 0 },
        { "path": "response.body.mappingFieldCount", "numericEquals": 51 },
        { "path": "response.body.mappingProjectionOnlyCount", "numericEquals": 2 },
        { "path": "response.body.expectedProjectionOnlyCellCount", "numericEquals": 200 },
        { "path": "response.body.verifiedProjectionOnlyCellCount", "numericEquals": 200 },
        { "path": "response.body.projectionOnlyMismatchCount", "numericEquals": 0 },
        { "path": "response.body.deployedMappingCount", "numericEquals": 53 },
        { "path": "response.body.mappingContractMismatchCount", "numericEquals": 0 },
        { "path": "response.body.expectedMappedCellCount", "numericEquals": 5100 },
        { "path": "response.body.mappedCellCount", "numericEquals": 5100 },
        { "path": "response.body.matchedMappedCellCount", "numericEquals": 5100 },
        { "path": "response.body.deepMismatchCount", "numericEquals": 0 },
        { "path": "response.body.fullyEquivalentRecordCount", "numericEquals": 100 },
        { "path": "response.body.leadCount", "numericEquals": 100 },
        { "path": "response.body.contactCount", "numericEquals": 0 },
        { "path": "response.body.campaignMemberCount", "numericEquals": 100 },
        { "path": "response.body.authorshipCount", "numericEquals": 100 },
        { "path": "response.body.terminalEventCount", "numericEquals": 100 },
        { "path": "response.body.mismatchCount", "numericEquals": 0 },
        { "path": "response.body.snapshotFingerprint", "equals": "{{steps.s4-exact-cohort.response.body.snapshotFingerprint}}" }
      ]
    }
  ]
}
