{
  "$defs": {
    "CaseOutcome": {
      "enum": [
        "passed",
        "failed",
        "skipped",
        "error"
      ],
      "title": "CaseOutcome",
      "type": "string"
    },
    "ConformanceCaseId": {
      "enum": [
        "submit",
        "adopt_after_dispatcher_crash",
        "duplicate_submit",
        "cancel_mid_run",
        "timeout",
        "stalled_not_lost",
        "confirmed_cancel_before_retry",
        "checkpoint_resume",
        "oom_classification",
        "fanout_task_count",
        "generation_verification",
        "rate_limit_backoff"
      ],
      "title": "ConformanceCaseId",
      "type": "string"
    },
    "ConformanceReport": {
      "description": "One run of the suite against one executor.",
      "examples": [
        {
          "environment": "nightly",
          "executor": "cloudrun-jobs",
          "finished_at": "2026-10-15T02:24:00Z",
          "results": [
            {
              "case_id": "submit",
              "duration_seconds": 61.0,
              "outcome": "passed"
            },
            {
              "case_id": "rate_limit_backoff",
              "duration_seconds": 33.5,
              "outcome": "passed"
            }
          ],
          "started_at": "2026-10-15T02:00:00Z",
          "suite_version": "1"
        }
      ],
      "properties": {
        "environment": {
          "default": "pr",
          "enum": [
            "pr",
            "nightly",
            "manual"
          ],
          "title": "Environment",
          "type": "string"
        },
        "executor": {
          "title": "Executor",
          "type": "string"
        },
        "finished_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Finished At"
        },
        "results": {
          "items": {
            "$ref": "#/$defs/ConformanceResult"
          },
          "title": "Results",
          "type": "array"
        },
        "started_at": {
          "format": "date-time",
          "title": "Started At",
          "type": "string"
        },
        "suite_version": {
          "default": "1",
          "title": "Suite Version",
          "type": "string"
        }
      },
      "required": [
        "executor",
        "started_at"
      ],
      "title": "ConformanceReport",
      "type": "object"
    },
    "ConformanceResult": {
      "examples": [
        {
          "case_id": "stalled_not_lost",
          "duration_seconds": 41.2,
          "outcome": "passed"
        }
      ],
      "properties": {
        "case_id": {
          "$ref": "#/$defs/ConformanceCaseId"
        },
        "duration_seconds": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Duration Seconds"
        },
        "outcome": {
          "$ref": "#/$defs/CaseOutcome"
        },
        "problems": {
          "items": {
            "type": "string"
          },
          "title": "Problems",
          "type": "array"
        }
      },
      "required": [
        "case_id",
        "outcome"
      ],
      "title": "ConformanceResult",
      "type": "object"
    },
    "ExecutorAttestation": {
      "description": "One recorded suite result, bound to the caps it was measured against.",
      "examples": [
        {
          "caps": {
            "checkpoint_storage": true,
            "classes": [
              "S",
              "M",
              "L"
            ],
            "dns_enforced": true,
            "egress_enforced": true,
            "isolation": 3,
            "max_runtime": "1h",
            "max_tasks": 10000,
            "regions": [
              "europe-west1"
            ]
          },
          "expires_at": "2026-10-18T09:30:00Z",
          "passed": true,
          "recorded_at": "2026-10-15T09:30:00Z"
        }
      ],
      "properties": {
        "caps": {
          "$ref": "#/$defs/ExecutorCaps"
        },
        "expires_at": {
          "format": "date-time",
          "title": "Expires At",
          "type": "string"
        },
        "passed": {
          "title": "Passed",
          "type": "boolean"
        },
        "recorded_at": {
          "format": "date-time",
          "title": "Recorded At",
          "type": "string"
        },
        "recorded_by": {
          "anyOf": [
            {
              "examples": [
                "run_01jaf3q2x8m9v7k5h4g3f2e1d0"
              ],
              "pattern": "^[A-Za-z0-9][A-Za-z0-9_.\\-]{0,127}$",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Recorded By"
        }
      },
      "required": [
        "caps",
        "passed",
        "recorded_at",
        "expires_at"
      ],
      "title": "ExecutorAttestation",
      "type": "object"
    },
    "ExecutorCaps": {
      "additionalProperties": false,
      "description": "What an executor can do; placement rules are enforced against these.",
      "properties": {
        "checkpoint_storage": {
          "default": false,
          "title": "Checkpoint Storage",
          "type": "boolean"
        },
        "classes": {
          "items": {
            "$ref": "#/$defs/ResourceClass"
          },
          "title": "Classes",
          "type": "array"
        },
        "dns_enforced": {
          "default": false,
          "title": "Dns Enforced",
          "type": "boolean"
        },
        "egress_enforced": {
          "default": false,
          "title": "Egress Enforced",
          "type": "boolean"
        },
        "gpus": {
          "default": [],
          "items": {
            "type": "string"
          },
          "title": "Gpus",
          "type": "array"
        },
        "isolation": {
          "$ref": "#/$defs/Isolation"
        },
        "max_runtime": {
          "description": "Duration such as '45m', '1h30m' or '90s'.",
          "examples": [
            "45m",
            "1h30m"
          ],
          "pattern": "^(?=.)(\\d+h)?(\\d+m)?(\\d+s)?$",
          "title": "Max Runtime",
          "type": "string"
        },
        "max_tasks": {
          "default": 1,
          "minimum": 1,
          "title": "Max Tasks",
          "type": "integer"
        },
        "regions": {
          "default": [],
          "items": {
            "type": "string"
          },
          "title": "Regions",
          "type": "array"
        }
      },
      "required": [
        "isolation"
      ],
      "title": "ExecutorCaps",
      "type": "object"
    },
    "Isolation": {
      "description": "How strongly a backend isolates a run (ordered: higher is stronger).",
      "enum": [
        0,
        1,
        2,
        3,
        4
      ],
      "title": "Isolation",
      "type": "integer"
    },
    "ResourceClass": {
      "description": "Executor resource class. Ordered: ``S < M < L < XL < GPU``.\n\n``GPU`` is the last (highest-rank) member on purpose: a quota whose\n``max_resource_class`` is below it refuses it, and :meth:`next_up` never offers it.",
      "enum": [
        "S",
        "M",
        "L",
        "XL",
        "GPU"
      ],
      "title": "ResourceClass",
      "type": "string"
    },
    "SecurityProbeRow": {
      "description": "One probe of a security-suite run (``mapi-security --json``).",
      "examples": [
        {
          "category": "isolation",
          "outcome": "blocked",
          "probe_id": "dns_egress"
        }
      ],
      "properties": {
        "acceptable": {
          "items": {
            "type": "string"
          },
          "title": "Acceptable",
          "type": "array"
        },
        "category": {
          "anyOf": [
            {
              "maxLength": 32,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Category"
        },
        "detail": {
          "anyOf": [
            {
              "maxLength": 2000,
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Detail"
        },
        "outcome": {
          "enum": [
            "allowed",
            "blocked",
            "error",
            "skipped"
          ],
          "title": "Outcome",
          "type": "string"
        },
        "probe_id": {
          "maxLength": 64,
          "title": "Probe Id",
          "type": "string"
        },
        "unexpected": {
          "default": false,
          "title": "Unexpected",
          "type": "boolean"
        }
      },
      "required": [
        "probe_id",
        "outcome"
      ],
      "title": "SecurityProbeRow",
      "type": "object"
    },
    "SecuritySuiteReport": {
      "description": "A security-suite run against one executor: the JSON ``mapi-security --json`` prints.",
      "examples": [
        {
          "executor": "cloudrun-jobs",
          "isolation": "microvm",
          "ok": true,
          "rows": [
            {
              "category": "isolation",
              "outcome": "blocked",
              "probe_id": "http_egress"
            },
            {
              "category": "isolation",
              "outcome": "blocked",
              "probe_id": "dns_egress"
            },
            {
              "category": "isolation",
              "outcome": "blocked",
              "probe_id": "metadata_token"
            }
          ],
          "started_at": "2026-10-15T02:30:00Z",
          "unexpected": []
        }
      ],
      "properties": {
        "executor": {
          "pattern": "^[a-z][a-z0-9-]{0,63}$",
          "title": "Executor",
          "type": "string"
        },
        "isolation": {
          "enum": [
            "none",
            "process",
            "gvisor",
            "microvm",
            "dedicated_vm"
          ],
          "title": "Isolation",
          "type": "string"
        },
        "ok": {
          "title": "Ok",
          "type": "boolean"
        },
        "rows": {
          "items": {
            "$ref": "#/$defs/SecurityProbeRow"
          },
          "maxItems": 500,
          "title": "Rows",
          "type": "array"
        },
        "started_at": {
          "anyOf": [
            {
              "format": "date-time",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Started At"
        },
        "unexpected": {
          "items": {
            "type": "string"
          },
          "title": "Unexpected",
          "type": "array"
        }
      },
      "required": [
        "executor",
        "isolation",
        "ok"
      ],
      "title": "SecuritySuiteReport",
      "type": "object"
    }
  },
  "$id": "https://schemas.mapi.dev/v1/api-ExecutorEvidence.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "The conformance and security-suite evidence recorded for one executor.",
  "examples": [
    {
      "conformance": {
        "environment": "nightly",
        "executor": "cloudrun-jobs",
        "finished_at": "2026-10-15T02:24:00Z",
        "results": [
          {
            "case_id": "submit",
            "duration_seconds": 61.0,
            "outcome": "passed"
          },
          {
            "case_id": "rate_limit_backoff",
            "duration_seconds": 33.5,
            "outcome": "passed"
          }
        ],
        "started_at": "2026-10-15T02:00:00Z",
        "suite_version": "1"
      },
      "conformance_attestation": {
        "caps": {
          "checkpoint_storage": true,
          "classes": [
            "S",
            "M",
            "L"
          ],
          "dns_enforced": true,
          "egress_enforced": true,
          "isolation": 3,
          "max_runtime": "1h",
          "max_tasks": 10000,
          "regions": [
            "europe-west1"
          ]
        },
        "expires_at": "2026-10-18T09:30:00Z",
        "passed": true,
        "recorded_at": "2026-10-15T09:30:00Z"
      },
      "executor": "cloudrun-jobs",
      "security": {
        "executor": "cloudrun-jobs",
        "isolation": "microvm",
        "ok": true,
        "rows": [
          {
            "category": "isolation",
            "outcome": "blocked",
            "probe_id": "http_egress"
          },
          {
            "category": "isolation",
            "outcome": "blocked",
            "probe_id": "dns_egress"
          },
          {
            "category": "isolation",
            "outcome": "blocked",
            "probe_id": "metadata_token"
          }
        ],
        "started_at": "2026-10-15T02:30:00Z",
        "unexpected": []
      },
      "security_attestation": {
        "caps": {
          "checkpoint_storage": true,
          "classes": [
            "S",
            "M",
            "L"
          ],
          "dns_enforced": true,
          "egress_enforced": true,
          "isolation": 3,
          "max_runtime": "1h",
          "max_tasks": 10000,
          "regions": [
            "europe-west1"
          ]
        },
        "expires_at": "2026-10-18T09:30:00Z",
        "passed": true,
        "recorded_at": "2026-10-15T09:30:00Z"
      }
    }
  ],
  "properties": {
    "conformance": {
      "anyOf": [
        {
          "$ref": "#/$defs/ConformanceReport"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "conformance_attestation": {
      "anyOf": [
        {
          "$ref": "#/$defs/ExecutorAttestation"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "executor": {
      "pattern": "^[a-z][a-z0-9-]{0,63}$",
      "title": "Executor",
      "type": "string"
    },
    "security": {
      "anyOf": [
        {
          "$ref": "#/$defs/SecuritySuiteReport"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "security_attestation": {
      "anyOf": [
        {
          "$ref": "#/$defs/ExecutorAttestation"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    }
  },
  "required": [
    "executor"
  ],
  "title": "ExecutorEvidence",
  "type": "object",
  "x-mapi-contract-version": "0.2"
}
