{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cloudworldmodel-ai/json-schema/cloudworldmodel-ai-prediction-evidence-schema.json",
  "title": "PredictionEvidence",
  "description": "Versioned provenance of prediction basis, not a claim simulated outputs were\nobserved. CPU is mean serving app-host CPU (not aggregate cpuUsage); no apps\nmeans appCpu=null and an empty per-resource array. `latencyP99Basis`\nindependently identifies the P99 basis: owned in-VPC internal-ALB fit,\nscaled from that fit (not directly measured), or uncalibrated generic P99.\n`predictionEvidence.latencyP99`, when present, carries P99's evidenceLevel\nand low/central/high assumption interval; it is prediction provenance, not\nobserved simulated output, and not a statistical confidence interval.\nWhen `latencyPercentileStatus` is unavailable, public latency percentiles\nare null; a serving resource without a modeled latency distribution does not\nsupport P50/P95/P99. Fargate allocation/billing/capacity facts alone do not\nestablish workload latency. Resilience `timeoutMs` is a per-edge, per-attempt deadline\nover local service time, target base latency, injected latency, and queued wait,\nnot a deadline against aggregate chain percentiles.\nHistorical evidence may omit or null this optional quantity. `latencyBasis`\nnames the general modeled latency path; use `latencyP99Basis` for P99.\nRanges are assumption intervals, not confidence intervals. Measured lean\nuses 0.65–1.35 times the center; lean proportional AWS M5 scaling uses\nCPU 0.40–1.60 and latency 0.50–1.50 times the final reported\nP50/P95 centers (after applicable penalties). The lean scaled\nbaseline uses offered application RPS T: P50 =\nmax(1.45, 2.4833 - 0.0010466*T) ms, P95 =\nmax(P50, 3.10, 4.3697 - 0.0012973*T) ms (full-precision fit).\nOn the exact healthy lean owned ALB → 2× m5.large → MySQL db.r5.large\ngraph at 10–1,000 offered target RPS, P99 uses\nmax(final P95, 7.021919127633514 + 0.00027013891327780484*T) ms,\nfitted by ordinary least squares on the owned campaign's 10/100/500\nRPS P99 measurements. The 1,000-RPS point is a holdout, not a fit point.\nThe owned fit is a prediction, not a new observed sample or a provider\nmeasurement. Exact eligible P99 uses 0.65–1.35× assumption bounds;\nanalogous lean M5 sizes use the fit as scaling (0.50–1.50× within\nrange), not direct measurement. Beyond 1,000 RPS scaling/extrapolation\nuses 0.25–2.00×. Generic typical/heavy and ineligible paths retain the generic,\nunverified P99 formula, with 0.50–2.00× bounds in-range and 0.25–3.00×\nbeyond. Active failures disqualify a healthy measured P99 claim. The\nexact owned typical Node CRUD path instead fits P99 from 20/100/200\nRPS measurements; this is a prediction, not an observed output or a\ngeneral typical-app reference. Its 300 RPS holdout is not fitted.\nMatching one- and three-app-server topologies are explicitly labeled\nowned-scaled and derive app CPU/latency/goodput from equivalent\ntwo-server fit load (2 × total RPS ÷ app-server count); their server\ncounts were not measured. Database CPU and connection demand still use\ntotal offered traffic. One server at 300 total RPS requires a 600 RPS\nequivalent fit extrapolation beyond the holdout, with P50 held at its\n300 RPS projection. Pool-capacity comparisons are warnings only and do\nnot independently imply errors or throughput loss. The\nfinal P99 is floored at final P95; P99 is not scored in Accuracy.\nNo generic 5 ms floor applies to scaled lean latency; 0.05 ms is\nonly a physical/non-finite safety floor. Reference estimates use 0.50–2.\nBeyond 1000 offered RPS, scaled uses 0.25–2 and reference 0.25–3.\nUnknown-vCPU legacy fallback uses the widest reference range and has no\nexternal reference. `legacyGeneric` explicitly labels use of that\nunverified generic branch: true at the top level if any reported app CPU\nor latency quantity used it, and true on each affected appCpuByResource\nitem. The evidence note names each affected resource's shape and reason (missing vCPU,\nflexible shape without resource.characteristics.ocpus, or unknown/\nunrecognized shape). CPU ranges are physically capped at 100%.\nPrediction-only capacity metadata covers GCP E2 standard\ne2-standard-2/4/8/16/32, N1 standard\nn1-standard-1/2/4/8/16/32/64/96, and N2 standard\nn2-standard-2/4/8/16/32/48/64/80/96/128. Google-published vCPU and\nmemory specifications establish hardware dimensions only, not CWM\nperformance, throughput, or price.\nHistorical rows missing evidence are returned non-mutating as\nunavailable/legacy with null weight/load/quantities and empty IDs; they\nare never relabeled measured by today's model.\n",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cloudworldmodel-ai-openapi.yml#/components/schemas/PredictionEvidence",
  "type": "object",
  "required": [
    "version",
    "evidenceLevel",
    "appWeight",
    "appWeightDefaulted",
    "loadScope",
    "sourceIds",
    "formulaIds",
    "appCpu",
    "appCpuByResource",
    "latencyP50",
    "latencyP95",
    "note"
  ],
  "properties": {
    "version": {
      "type": "integer",
      "enum": [
        1
      ]
    },
    "legacyGeneric": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "True when any reported app CPU or latency quantity used the unverified generic fallback; false for newly produced non-generic evidence; null on explicitly unavailable/legacy historical evidence. Predating saved evidence can omit this field entirely; it is never reconstructed.\n"
    },
    "evidenceLevel": {
      "type": "string",
      "enum": [
        "measured",
        "scaled from measured",
        "reference estimate",
        "unavailable/legacy"
      ]
    },
    "appWeight": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "lean",
        "typical",
        "heavy",
        null
      ]
    },
    "appWeightDefaulted": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "loadScope": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "within measured load",
        "beyond measured load",
        "below measured load",
        "not calibrated",
        null
      ]
    },
    "sourceIds": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "formulaIds": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "appCpu": {
      "oneOf": [
        {
          "$ref": "#/$defs/PredictionRange"
        },
        {
          "type": "null"
        }
      ]
    },
    "appCpuByResource": {
      "type": "array",
      "items": {
        "allOf": [
          {
            "$ref": "#/$defs/PredictionQuantityEvidence"
          },
          {
            "type": "object",
            "required": [
              "resourceId"
            ],
            "properties": {
              "resourceId": {
                "type": "string"
              },
              "legacyGeneric": {
                "type": "boolean",
                "description": "True when this resource's app CPU used the unverified generic fallback. Required for newly produced evidence; absent on predating saved evidence."
              }
            }
          }
        ]
      }
    },
    "requestServingCapacity": {
      "type": "array",
      "description": "Per-Fargate-service configured task count, per-task modeled rate, aggregate capacity, and explicit evidence basis. Assumptions are not measured throughput.",
      "items": {
        "type": "object",
        "required": [
          "resourceId",
          "resourceName",
          "taskCount",
          "perTaskCapacityRps",
          "aggregateCapacityRps",
          "maxTaskCount",
          "maxAggregateCapacityRps",
          "capacityEvidence"
        ],
        "properties": {
          "resourceId": {
            "type": "string"
          },
          "resourceName": {
            "type": "string"
          },
          "taskCount": {
            "type": "integer",
            "minimum": 0,
            "description": "Effective configured desired task count."
          },
          "perTaskCapacityRps": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "aggregateCapacityRps": {
            "type": "number",
            "minimum": 0
          },
          "maxTaskCount": {
            "type": "integer",
            "minimum": 1
          },
          "maxAggregateCapacityRps": {
            "type": "number",
            "minimum": 0
          },
          "capacityEvidence": {
            "type": "object",
            "required": [
              "basis",
              "origin"
            ],
            "properties": {
              "basis": {
                "type": "string",
                "enum": [
                  "assumption",
                  "documented",
                  "measured",
                  "catalog"
                ]
              },
              "origin": {
                "type": "string",
                "enum": [
                  "caller-provided",
                  "fargate-size-heuristic",
                  "policy-default",
                  "provider-catalog"
                ]
              },
              "source": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "latencyAvailability": {
      "$ref": "#/$defs/PredictionLatencyAvailability"
    },
    "latencyP50": {
      "oneOf": [
        {
          "$ref": "#/$defs/PredictionQuantityEvidence"
        },
        {
          "type": "null"
        }
      ]
    },
    "latencyPercentileStatus": {
      "type": "string",
      "enum": [
        "modeled",
        "unavailable"
      ],
      "description": "Whether percentile evidence is available from a modeled serving-tier distribution."
    },
    "latencyP95": {
      "oneOf": [
        {
          "$ref": "#/$defs/PredictionQuantityEvidence"
        },
        {
          "type": "null"
        }
      ]
    },
    "latencyP99": {
      "oneOf": [
        {
          "$ref": "#/$defs/PredictionQuantityEvidence"
        },
        {
          "type": "null"
        }
      ],
      "description": "Optional per-percentile P99 evidence, with evidenceLevel and assumption bounds (not confidence intervals). May be null or absent on legacy rows.\n"
    },
    "note": {
      "type": "string"
    }
  },
  "$defs": {
    "PredictionLatencyAvailability": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "reason",
        "resourceIds"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "unavailable"
          ]
        },
        "reason": {
          "type": "string",
          "minLength": 1,
          "description": "Names the unresolved Fargate shape, missing workload-specific latency calibration, and applicable per-edge timeout boundary."
        },
        "resourceIds": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        }
      }
    },
    "PredictionQuantityEvidence": {
      "allOf": [
        {
          "$ref": "#/$defs/PredictionRange"
        },
        {
          "type": "object",
          "required": [
            "evidenceLevel"
          ],
          "properties": {
            "evidenceLevel": {
              "type": "string",
              "enum": [
                "measured",
                "scaled from measured",
                "reference estimate"
              ]
            }
          }
        }
      ]
    },
    "PredictionRange": {
      "type": "object",
      "required": [
        "low",
        "central",
        "high"
      ],
      "properties": {
        "low": {
          "type": "number",
          "minimum": 0
        },
        "central": {
          "type": "number",
          "minimum": 0
        },
        "high": {
          "type": "number",
          "minimum": 0
        }
      }
    }
  }
}