{
  "id": "k-conflict-02",
  "title": "Field-policy clearing semantics: overwrite clears FirstName, skip_if_set retains AnnualRevenue first value",
  "kind": "hubspot_sync",
  "executionMode": "serial",
  "executionModeReason": "This same-record conflict oracle requires deterministic materialization and remote edit ordering; shared queue pressure can change the observed winner window, so run isolated after the parallel batch.",
  "caseTimeoutMs": 540000,
  "linkedIssues": [2780],
  "provenance": {
    "businessScenario": "K-CONFLICT-02 — clearing semantics by field policy on a single inbound contact->Lead, with two controls. (1) overwrite (spec 2.1 identity-overwrite): firstname->FirstName; after the inbound contact materializes with FirstName=OwBase, clearing firstname on HubSpot must clear NX FirstName to ''. (2) skip_if_set / write-once (spec 2.5, MAP-02 / #2780): annualrevenue->AnnualRevenue; the first synced value must be retained even when HubSpot later changes it. The overwrite control (FirstName cleared) proves the inbound link fired before the skip_if_set retention is judged.",
    "reportedBy": "HubSpot sync spec K-CONFLICT-02 (hubspot-nexuscrm-sync-CASE-EXEC-SELFCONTAINED)",
    "capturedAt": "2026-06-18",
    "calibrated": "[calibrated] reduced from the 3-representative (jobtitle/website/country, unverified owner overwrite) version to a single PASS-able contact->Lead: overwrite control firstname->FirstName (clears to '') and skip_if_set AnnualRevenue (retains the first synced value). 2026-06-26 staging run 28222667769 showed the post-PATCH propertychange can exceed the old 90s poll window, so materialization uses the established 180s inbound budget and the mutation assertion uses 240s plus connector-event diagnostics."
  },
  "steps": [
    {
      "id": "create",
      "system": "hubspot",
      "method": "POST",
      "path": "/crm/v3/objects/contacts",
      "body": { "properties": { "email": "cl-{{__runId}}@example.com", "lastname": "Cl{{__runId}}", "firstname": "OwBase", "annual_revenue__sfdc_": "1000000" } },
      "expectStatusRange": [200, 299],
      "assertions": [ { "path": "response.body.id", "exists": true } ]
    },
    {
      "id": "materialized",
      "system": "nexuscrm",
      "authRole": "admin",
      "method": "GET",
      "path": "/services/data/v63.0/query?q=SELECT FirstName,AnnualRevenue FROM Lead WHERE HubSpot_Id__c='{{steps.create.response.body.id}}'",
      "expectStatus": 200,
      "poll": { "budgetMs": 180000, "intervalMs": 6000 },
      "onTimeout": "blocked",
      "diagnostics": {
        "connectorEvent": {
          "sourceObjectId": "{{steps.create.response.body.id}}",
          "blockOnBacklog": true,
          "blockOnForeignClaimedBy": true,
          "foreignClaimedByPattern": "(MacBook|\\.local)"
        }
      },
      "assertions": [
        { "path": "response.body.records[0].FirstName", "equals": "OwBase" },
        { "path": "response.body.records[0].AnnualRevenue", "numericEquals": 1000000 }
      ]
    },
    {
      "id": "edit",
      "system": "hubspot",
      "method": "PATCH",
      "path": "/crm/v3/objects/contacts/{{steps.create.response.body.id}}",
      "body": { "properties": { "firstname": "", "annual_revenue__sfdc_": "2000000" } },
      "expectStatusRange": [200, 299]
    },
    {
      "id": "verify",
      "system": "nexuscrm",
      "authRole": "admin",
      "method": "GET",
      "path": "/services/data/v63.0/query?q=SELECT FirstName,AnnualRevenue FROM Lead WHERE HubSpot_Id__c='{{steps.create.response.body.id}}'",
      "expectStatus": 200,
      "delayMs": 15000,
      "poll": { "budgetMs": 240000, "intervalMs": 6000 },
      "onTimeout": "fail",
      "diagnostics": {
        "connectorEvent": {
          "sourceObjectId": "{{steps.create.response.body.id}}",
          "blockOnBacklog": true,
          "blockOnForeignClaimedBy": true,
          "foreignClaimedByPattern": "(MacBook|\\.local)"
        }
      },
      "assertions": [
        { "path": "response.body.records[0].FirstName", "equals": "" },
        { "path": "response.body.records[0].AnnualRevenue", "numericEquals": 1000000 }
      ]
    }
  ]
}
