{
  "id": "in-c-019",
  "title": "Inbound salesforce_industry CASE: whitelist passes through, unmapped falls to Others",
  "kind": "hubspot_sync",
  "caseTimeoutMs": 900000,
  "linkedIssues": [3016],
  "provenance": {
    "businessScenario": "IN-C-019 — verify the salesforce_industry->Lead.Industry CASE mapping (§2.1): a whitelisted value (FSI-FinTech) lands verbatim, while a value outside the 14-class whitelist (Made-Up-Vertical) falls to 'Others'. Two rounds, one contact each.",
    "reportedBy": "HubSpot sync spec IN-C-019 (hubspot-nexuscrm-sync-CASE-EXEC-SELFCONTAINED)",
    "capturedAt": "2026-06-18",
    "calibrated": "[recalibrated 2026-08-26] HubSpot salesforce_industry is a restricted enum, so the non-whitelist round uses provider-legal 'generic' and expects Others. The final combined readback waits 60 seconds, retaining the settled Industry oracle from #3016 without restoring its duplicate case file."
  },
  "steps": [
    {
      "id": "create-contact-a",
      "system": "hubspot",
      "method": "POST",
      "path": "/crm/v3/objects/contacts",
      "body": {
        "properties": {
          "email": "inc019a-{{__runId}}@example.com",
          "lastname": "Ind{{__runId}}",
          "salesforce_industry": "FSI-FinTech"
        }
      },
      "expectStatusRange": [
        200,
        299
      ],
      "assertions": [
        {
          "path": "response.body.id",
          "exists": true
        }
      ]
    },
    {
      "id": "wait-row-a",
      "system": "nexuscrm",
      "authRole": "admin",
      "method": "GET",
      "path": "/services/data/v63.0/query?q=SELECT Id FROM Lead WHERE HubSpot_Id__c = '{{steps.create-contact-a.response.body.id}}' LIMIT 1",
      "expectStatus": 200,
      "poll": {
        "budgetMs": 180000,
        "intervalMs": 6000
      },
      "onTimeout": "blocked",
      "assertions": [
        {
          "path": "response.body.records",
          "lengthAtLeast": 1
        }
      ],
      "timeoutMs": 8000
    },
    {
      "id": "assert-industry-a",
      "system": "nexuscrm",
      "authRole": "admin",
      "method": "GET",
      "path": "/services/data/v63.0/query?q=SELECT Industry FROM Lead WHERE HubSpot_Id__c = '{{steps.create-contact-a.response.body.id}}' LIMIT 1",
      "expectStatus": 200,
      "poll": {
        "budgetMs": 180000,
        "intervalMs": 6000
      },
      "onTimeout": "fail",
      "assertions": [
        {
          "path": "response.body.records[0].Industry",
          "equals": "FSI-FinTech"
        }
      ],
      "timeoutMs": 8000
    },
    {
      "id": "create-contact-b",
      "system": "hubspot",
      "method": "POST",
      "path": "/crm/v3/objects/contacts",
      "body": {
        "properties": {
          "email": "inc019b-{{__runId}}@example.com",
          "lastname": "Ind2{{__runId}}",
          "salesforce_industry": "generic"
        }
      },
      "expectStatusRange": [
        200,
        299
      ],
      "assertions": [
        {
          "path": "response.body.id",
          "exists": true
        }
      ]
    },
    {
      "id": "wait-row-b",
      "system": "nexuscrm",
      "authRole": "admin",
      "method": "GET",
      "path": "/services/data/v63.0/query?q=SELECT Id FROM Lead WHERE HubSpot_Id__c = '{{steps.create-contact-b.response.body.id}}' LIMIT 1",
      "expectStatus": 200,
      "poll": {
        "budgetMs": 180000,
        "intervalMs": 6000
      },
      "onTimeout": "fail",
      "assertions": [
        {
          "path": "response.body.records",
          "lengthAtLeast": 1
        }
      ],
      "timeoutMs": 8000
    },
    {
      "id": "assert-industry-b",
      "system": "nexuscrm",
      "authRole": "admin",
      "method": "GET",
      "path": "/services/data/v63.0/query?q=SELECT Industry FROM Lead WHERE HubSpot_Id__c = '{{steps.create-contact-b.response.body.id}}' LIMIT 1",
      "expectStatus": 200,
      "poll": {
        "budgetMs": 180000,
        "intervalMs": 6000
      },
      "onTimeout": "fail",
      "assertions": [
        {
          "path": "response.body.records[0].Industry",
          "equals": "Others"
        }
      ],
      "timeoutMs": 8000
    },
    {
      "id": "assert-industries-settled",
      "system": "nexuscrm",
      "authRole": "admin",
      "method": "GET",
      "path": "/services/data/v63.0/query?q=SELECT HubSpot_Id__c,Industry FROM Lead WHERE HubSpot_Id__c IN ('{{steps.create-contact-a.response.body.id}}','{{steps.create-contact-b.response.body.id}}')",
      "delayMs": 60000,
      "expectStatus": 200,
      "assertions": [
        { "path": "response.body.records", "lengthAtLeast": 2 },
        { "path": "response.body.records", "countWhere": { "where": { "HubSpot_Id__c": "{{steps.create-contact-a.response.body.id}}", "Industry": "FSI-FinTech" }, "equals": 1 } },
        { "path": "response.body.records", "countWhere": { "where": { "HubSpot_Id__c": "{{steps.create-contact-b.response.body.id}}", "Industry": "Others" }, "equals": 1 } }
      ]
    }
  ]
}
