{
  "id": "provider-write-smoke",
  "title": "Acceptance runner creates, reads, archives, and re-reads one Sandbox Contact",
  "kind": "hubspot_sync",
  "optional": true,
  "targetedAcceptance": {
    "schemaVersion": "hubspot-targeted-acceptance/v1",
    "reason": "Dedicated provider-only smoke for the acceptance runner and target token; it intentionally excludes CRM, webhook, connector, and TiDB behavior."
  },
  "requiresHubSpotSandboxPreflight": true,
  "allowedTargetEnvironments": ["staging", "test3"],
  "executionMode": "serial",
  "executionModeReason": "The case owns one temporary HubSpot Contact lifecycle and archives it before completion.",
  "caseTimeoutMs": 120000,
  "linkedIssues": [],
  "provenance": {
    "businessScenario": "Prove the HubSpot acceptance test flow itself can use the selected target token to create, read, archive, and re-read one uniquely identified Contact in the exact Sandbox portal without depending on any NexusCRM HubSpot module behavior.",
    "reportedBy": "Amber",
    "capturedAt": "2026-08-26",
    "acceptanceBoundary": "PASS proves only the provider-write acceptance harness, selected target token, artifact capture, and cleanup path. It does not prove CRM inbound, outbound, webhook, connector queue, TiDB, deployment, or business synchronization."
  },
  "steps": [
    {
      "id": "create-provider-contact",
      "system": "hubspot",
      "method": "POST",
      "path": "/crm/v3/objects/contacts",
      "body": {
        "properties": {
          "email": "provider-write-smoke-{{__runId}}@example.com",
          "firstname": "ProviderWrite",
          "lastname": "Smoke{{__runId}}"
        }
      },
      "expectStatusRange": [200, 299],
      "assertions": [
        { "path": "response.body.id", "exists": true },
        { "path": "response.body.archived", "equals": false }
      ]
    },
    {
      "id": "read-provider-contact",
      "system": "hubspot",
      "method": "GET",
      "path": "/crm/v3/objects/contacts/{{steps.create-provider-contact.response.body.id}}?properties=email,firstname,lastname",
      "expectStatus": 200,
      "assertions": [
        { "path": "response.body.id", "equals": "{{steps.create-provider-contact.response.body.id}}" },
        { "path": "response.body.archived", "equals": false },
        { "path": "response.body.properties.email", "equals": "provider-write-smoke-{{__runId}}@example.com" },
        { "path": "response.body.properties.firstname", "equals": "ProviderWrite" },
        { "path": "response.body.properties.lastname", "equals": "Smoke{{__runId}}" }
      ]
    },
    {
      "id": "archive-provider-contact",
      "system": "hubspot",
      "method": "DELETE",
      "path": "/crm/v3/objects/contacts/{{steps.create-provider-contact.response.body.id}}",
      "expectStatus": 204
    },
    {
      "id": "read-archived-provider-contact",
      "system": "hubspot",
      "method": "GET",
      "path": "/crm/v3/objects/contacts/{{steps.create-provider-contact.response.body.id}}?archived=true&properties=email,firstname,lastname",
      "expectStatus": 200,
      "poll": { "budgetMs": 30000, "intervalMs": 2000 },
      "onTimeout": "fail",
      "assertions": [
        { "path": "response.body.id", "equals": "{{steps.create-provider-contact.response.body.id}}" },
        { "path": "response.body.archived", "equals": true },
        { "path": "response.body.properties.email", "equals": "provider-write-smoke-{{__runId}}@example.com" }
      ]
    }
  ]
}
