{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cloudworldmodel-ai/json-schema/cloudworldmodel-ai-pre-provision-verdict-schema.json",
  "title": "PreProvisionVerdict",
  "description": "Conservative machine-readable verdict for the highest-ranked returned strategy. Exploration alone cannot return ship. The verdict endpoint can return ship when cost, latency, error-budget and recorded caller-attested resilience checks all pass. This is a planning decision, not independent verification or a production guarantee.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cloudworldmodel-ai-multi-cloud-api-openapi.yml#/components/schemas/PreProvisionVerdict",
  "type": "object",
  "required": [
    "decision",
    "strategy",
    "candidateFingerprint",
    "reasons",
    "evidence",
    "uncertainty"
  ],
  "properties": {
    "decision": {
      "type": "string",
      "enum": [
        "ship",
        "hold",
        "ship_with_changes"
      ],
      "description": "hold means a known supplied budget or latency requirement failed, or no candidate is available. ship_with_changes means the visible checks have no known failure but evidence or explicit budgets are missing. ship requires every required check to pass."
    },
    "candidateFingerprint": {
      "type": [
        "string",
        "null"
      ],
      "description": "SHA-256 identity of the candidate ID, allocations, suggested resources and workload. Retain with test inputs; null when no candidate exists."
    },
    "strategy": {
      "oneOf": [
        {
          "$ref": "#/$defs/PreProvisionVerdictStrategy"
        },
        {
          "type": "null"
        }
      ],
      "description": "Strategy evaluated by this verdict; null when no candidate is available."
    },
    "reasons": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "code",
          "message"
        ],
        "properties": {
          "code": {
            "type": "string",
            "enum": [
              "no_candidate_strategy",
              "cost_budget_exceeded",
              "latency_slo_missed",
              "error_budget_exceeded",
              "resilience_validation_required",
              "resilience_check_failed",
              "resilience_evidence_insufficient",
              "required_checks_incomplete",
              "required_checks_passed"
            ]
          },
          "message": {
            "type": "string"
          }
        }
      }
    },
    "evidence": {
      "type": "object",
      "required": [
        "cost",
        "latency",
        "errorRate",
        "resilience"
      ],
      "properties": {
        "cost": {
          "type": "object",
          "required": [
            "estimatedPerHour",
            "budgetCheck"
          ],
          "properties": {
            "estimatedPerHour": {
              "type": [
                "number",
                "null"
              ],
              "description": "Modeled total cost per hour, including modeled egress."
            },
            "budgetCheck": {
              "type": "string",
              "enum": [
                "pass",
                "fail",
                "not_provided"
              ]
            }
          }
        },
        "latency": {
          "type": "object",
          "required": [
            "estimatedP95Ms",
            "requirementMs",
            "sloCheck",
            "headroomPct"
          ],
          "properties": {
            "estimatedP95Ms": {
              "type": [
                "number",
                "null"
              ]
            },
            "requirementMs": {
              "type": "number"
            },
            "sloCheck": {
              "type": "string",
              "enum": [
                "pass",
                "fail",
                "not_evaluated"
              ]
            },
            "headroomPct": {
              "type": [
                "number",
                "null"
              ]
            }
          }
        },
        "errorRate": {
          "type": "object",
          "required": [
            "modeledFraction",
            "budgetCheck"
          ],
          "properties": {
            "modeledFraction": {
              "type": [
                "number",
                "null"
              ],
              "description": "Allocation-count-based modeled proxy, not an observed failure rate."
            },
            "budgetCheck": {
              "type": "string",
              "enum": [
                "pass",
                "fail",
                "not_provided"
              ]
            }
          }
        },
        "resilience": {
          "type": "object",
          "required": [
            "status",
            "reason"
          ],
          "properties": {
            "status": {
              "type": "string",
              "enum": [
                "not_evaluated",
                "pass",
                "fail"
              ]
            },
            "reason": {
              "type": "string"
            },
            "provenance": {
              "type": "string",
              "enum": [
                "recorded",
                "estimated"
              ]
            },
            "verification": {
              "type": "string",
              "enum": [
                "caller_attested"
              ]
            },
            "report": {
              "$ref": "#/$defs/CompletedResilienceEvidence"
            }
          }
        }
      }
    },
    "uncertainty": {
      "type": "object",
      "required": [
        "dataSource",
        "externallyValidated",
        "providerRateTrust",
        "limitations"
      ],
      "properties": {
        "dataSource": {
          "type": "string",
          "enum": [
            "simulation-model"
          ]
        },
        "externallyValidated": {
          "type": "boolean",
          "enum": [
            false
          ]
        },
        "providerRateTrust": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "enum": [
              "on-demand",
              "spot",
              "estimated"
            ]
          }
        },
        "limitations": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    }
  },
  "$defs": {
    "CompletedResilienceEvidence": {
      "type": "object",
      "additionalProperties": false,
      "description": "Caller-attested completed test report for the exact candidateFingerprint. Keep the fingerprint with the actual test inputs; never relabel a report from another architecture or workload. Recorded means observations recorded during the test, not externally verified production evidence. Estimated reports remain unevaluated for deployment gating.",
      "required": [
        "candidateFingerprint",
        "reportRef",
        "status",
        "completedAt",
        "provenance",
        "failureInjected",
        "recoveryObserved",
        "finalHealthy",
        "resilienceCheck",
        "scope"
      ],
      "properties": {
        "candidateFingerprint": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        },
        "reportRef": {
          "type": "string",
          "minLength": 1,
          "maxLength": 500
        },
        "status": {
          "type": "string",
          "enum": [
            "completed"
          ]
        },
        "completedAt": {
          "type": "string",
          "format": "date-time",
          "description": "Actual completion timestamp, not in the future."
        },
        "provenance": {
          "type": "string",
          "enum": [
            "recorded",
            "estimated"
          ]
        },
        "failureInjected": {
          "type": "boolean"
        },
        "recoveryObserved": {
          "type": "boolean"
        },
        "finalHealthy": {
          "type": "boolean"
        },
        "resilienceCheck": {
          "type": "string",
          "enum": [
            "pass",
            "fail",
            "not_evaluated"
          ]
        },
        "scope": {
          "type": "string",
          "minLength": 1,
          "maxLength": 2000,
          "description": "Tested failures, test coverage, and pass criteria."
        }
      }
    },
    "PreProvisionVerdictStrategy": {
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        }
      }
    }
  }
}