{
  "id": "fix-2480",
  "title": "Illegal picklist value is skipped, record still materializes",
  "kind": "hubspot_sync",
  "executionMode": "serial",
  "executionModeReason": "The illegal-picklist regression needs a clean materialization readback to distinguish field-level skip from whole-record drop; shared webhook queue pressure can make that readback miss the poll window, so run isolated after the parallel batch.",
  "caseTimeoutMs": 420000,
  "linkedIssues": [2480],
  "provenance": {
    "businessScenario": "FIX-2480 — re-prove #2480: an inbound contact carrying one HubSpot-legal but NexusCRM-illegal picklist value (leadsource='Amplify', not in NX LeadSource picklist) plus a valid control field (firstname=Fx2480FN, identity-synced) must still materialize the Lead; only the illegal field is skipped (not dead-lettered, not written verbatim). PASS: not whole-record dropped. FirstName proves the link fired + record materialized; LeadSource must not equal the illegal value. Control field not synced in budget = INCONCLUSIVE.",
    "reportedBy": "HubSpot sync spec FIX-2480 (hubspot-nexuscrm-sync-CASE-EXEC-SELFCONTAINED)",
    "capturedAt": "2026-06-18",
    "calibrated": "[calibrated] rating=__BOGUS_RATING__ was rejected by HubSpot itself (HS enum); switched to leadsource='Amplify' which is HS-legal but illegal in NX LeadSource picklist, so the inbound skip is actually exercised."
  },
  "steps": [
    {
      "id": "create-contact",
      "system": "hubspot",
      "method": "POST",
      "path": "/crm/v3/objects/contacts",
      "body": {
        "properties": {
          "email": "fx2480-{{__runId}}@example.com",
          "lastname": "K",
          "firstname": "Fx2480FN",
          "leadsource": "Amplify"
        }
      },
      "expectStatusRange": [200, 299],
      "assertions": [ { "path": "response.body.id", "exists": true } ]
    },
    {
      "id": "wait-materialize",
      "system": "nexuscrm",
      "authRole": "admin",
      "method": "GET",
      "path": "/services/data/v63.0/query?q=SELECT Id,FirstName,LeadSource FROM Lead WHERE HubSpot_Id__c='{{steps.create-contact.response.body.id}}' LIMIT 1",
      "expectStatus": 200,
      "poll": { "budgetMs": 300000, "intervalMs": 6000 },
      "onTimeout": "blocked",
      "assertions": [ { "path": "response.body.records[0].FirstName", "equals": "Fx2480FN" } ]
    },
    {
      "id": "assert-skip",
      "system": "nexuscrm",
      "authRole": "admin",
      "method": "GET",
      "path": "/services/data/v63.0/query?q=SELECT FirstName,LeadSource FROM Lead WHERE HubSpot_Id__c='{{steps.create-contact.response.body.id}}' LIMIT 1",
      "expectStatus": 200,
      "poll": { "budgetMs": 90000, "intervalMs": 6000 },
      "onTimeout": "fail",
      "assertions": [
        { "path": "response.body.records[0].FirstName", "equals": "Fx2480FN" },
        { "path": "response.body.records[0].LeadSource", "notEquals": "Amplify" }
      ]
    }
  ]
}
