{
  "id": "suite-durable-health",
  "title": "HubSpot suite leaves no poisoned outbound lane or unsettled D3 work",
  "kind": "hubspot_sync",
  "optional": false,
  "executionMode": "serial",
  "executionPhase": "post_run",
  "executionModeReason": "This is the suite terminal gate. It must run alone after every ordinary and serial business case has finished so provider-facing PASS results cannot hide poisoned durable work.",
  "caseTimeoutMs": 360000,
  "linkedIssues": [5488],
  "provenance": {
    "businessScenario": "A complete HubSpot acceptance run is not healthy when a provider value converged but its Integration command is uncertain, a later same-LinkKey command is blocked behind that poison, or a run-created Connector WorkItem or Runtime PlatformCommand remains dead/nonterminal. The post-run gate waits for settlement and requires all four counts to be zero.",
    "reportedBy": "HubSpot V2 Test3 launch-readiness assessment",
    "capturedAt": "2026-08-26",
    "calibrated": "The outbound lane authority is _System_IntegrationOutboundCommand. Inbound execution crosses _System_ConnectorWorkItem -> _System_ConnectorRuntimeHandoffReceipt -> _System_RuntimePlatformCommand. Integration uncertainty is checked globally for the HubSpot owner because it poisons future same-link work; WorkItem and PlatformCommand settlement are scoped to this suite start."
  },
  "steps": [
    {
      "id": "assert-hubspot-durable-health",
      "system": "tidb",
      "method": "GET",
      "sql": "SELECT (SELECT COUNT(*) FROM `_System_IntegrationOutboundCommand` C WHERE C.ConnectorOwnerKey = 'pingcap-hubspot-companion' AND C.State = 'uncertain') AS UncertainCommandCount, (SELECT COUNT(DISTINCT P.Id) FROM `_System_IntegrationOutboundCommand` P JOIN `_System_IntegrationOutboundCommand` U ON U.ScopeDigest = P.ScopeDigest AND U.CatalogRevision = P.CatalogRevision AND U.LinkKey = P.LinkKey AND U.AcceptanceSequence < P.AcceptanceSequence AND U.State = 'uncertain' WHERE P.ConnectorOwnerKey = 'pingcap-hubspot-companion' AND P.State = 'pending') AS PoisonBlockedPendingCount, (SELECT COUNT(DISTINCT W.WorkId) FROM `_System_ConnectorWorkItem` W JOIN `_System_ConnectorEvent` E ON E.Id = W.EventId WHERE E.Namespace = 'hubspot-crm-connector' AND W.CreatedDate >= DATE_SUB('{{__suiteStartedAt}}', INTERVAL 5 SECOND) AND W.State NOT IN ('processed', 'skipped')) AS NonterminalOrDeadWorkCount, (SELECT COUNT(DISTINCT P.Id) FROM `_System_RuntimePlatformCommand` P JOIN `_System_ConnectorRuntimeHandoffReceipt` H ON BINARY H.CommandId = BINARY P.CommandId JOIN `_System_ConnectorEvent` E ON E.Id = H.EventId WHERE E.Namespace = 'hubspot-crm-connector' AND P.CreatedDate >= DATE_SUB('{{__suiteStartedAt}}', INTERVAL 5 SECOND) AND P.State IN ('ACCEPTED', 'PROCESSING', 'BLOCKED', 'POISONED')) AS NonterminalOrPoisonedPlatformCommandCount",
      "expectStatus": 200,
      "poll": { "budgetMs": 300000, "intervalMs": 5000 },
      "onTimeout": "fail",
      "assertions": [
        { "path": "response.body.records[0].UncertainCommandCount", "numericEquals": 0 },
        { "path": "response.body.records[0].PoisonBlockedPendingCount", "numericEquals": 0 },
        { "path": "response.body.records[0].NonterminalOrDeadWorkCount", "numericEquals": 0 },
        { "path": "response.body.records[0].NonterminalOrPoisonedPlatformCommandCount", "numericEquals": 0 }
      ]
    }
  ]
}
