{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/codai-ro/json-schema/codai-ro-resolve-attestation-schema.json",
  "title": "Attestation",
  "description": "Public execution proof. Everything needed to reproduce the verification locally.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/codai-ro-resolve-openapi.yml#/components/schemas/ResolveAttestation",
  "type": "object",
  "required": [
    "id",
    "kind",
    "repo_url",
    "base_commit",
    "patch",
    "repro_test",
    "test_command",
    "regression_command",
    "test_output_before",
    "test_output_after",
    "regression_output",
    "runner_image_digest",
    "started_at",
    "verified_at",
    "signature"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "kind": {
      "type": "string",
      "const": "codai.resolve.attestation.v0"
    },
    "repo_url": {
      "type": "string",
      "format": "uri"
    },
    "base_commit": {
      "type": "string",
      "description": "Commit SHA the patch applies to."
    },
    "patch": {
      "type": "string",
      "description": "Unified diff against `base_commit`."
    },
    "repro_test": {
      "oneOf": [
        {
          "$ref": "#/$defs/ResolveReproTest"
        },
        {
          "type": "null"
        }
      ],
      "description": "`null` when the customer supplied `test_command`."
    },
    "test_command": {
      "type": "string",
      "description": "FAIL_TO_PASS command that was executed."
    },
    "regression_command": {
      "type": [
        "string",
        "null"
      ],
      "description": "PASS_TO_PASS (repo suite) command, when one was run."
    },
    "test_output_before": {
      "type": "string",
      "description": "Tail of the test output BEFORE the patch (must fail)."
    },
    "test_output_after": {
      "type": "string",
      "description": "Tail of the test output AFTER the patch (must pass)."
    },
    "regression_output": {
      "type": [
        "string",
        "null"
      ]
    },
    "runner_image_digest": {
      "type": "string",
      "description": "Container image digest of the verification runner (`unknown` when not recorded)."
    },
    "started_at": {
      "type": "string",
      "format": "date-time"
    },
    "verified_at": {
      "type": "string",
      "format": "date-time"
    },
    "signature": {
      "oneOf": [
        {
          "$ref": "#/$defs/ResolveAttestationEnvelope"
        },
        {
          "type": "null"
        }
      ],
      "description": "DSSE envelope signing the canonical statement of this attestation (sha256 of the patch,\nrepro test, test outputs; commands, commit, runner digest, timestamps). `null` for\nattestations created before signing was enabled (2026-09-27). Verify against\n`GET /v1/resolve/keys`.\n"
    }
  },
  "$defs": {
    "ResolveAttestationEnvelope": {
      "type": "object",
      "title": "Attestation envelope",
      "description": "DSSE v1 envelope. `payload` is base64 of the RFC 8785 (JCS) canonical statement JSON\n`{kind: \"codai.resolve.attestation.v1\", attestation_id, repo_url, base_commit, patch_sha256,\nrepro_test: {path, sha256} | null, test_command, regression_command,\ntest_output_before_sha256, test_output_after_sha256, regression_output_sha256,\nrunner_image_digest, started_at, verified_at}`. Each `sig` is an ECDSA P-256/SHA-256 DER\nsignature (base64) over `PAE(payloadType, payload bytes)` =\n`\"DSSEv1 \" + len(type) + \" \" + type + \" \" + len(body) + \" \" + body`.\n",
      "required": [
        "payloadType",
        "payload",
        "signatures"
      ],
      "properties": {
        "payloadType": {
          "type": "string",
          "const": "application/vnd.codai.resolve.attestation+json;v=1"
        },
        "payload": {
          "type": "string",
          "contentEncoding": "base64",
          "description": "Base64 of the canonical statement JSON."
        },
        "signatures": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "sig"
            ],
            "properties": {
              "keyid": {
                "type": "string",
                "description": "Identifier of the signing key; matches `keyid` in `GET /v1/resolve/keys`."
              },
              "sig": {
                "type": "string",
                "contentEncoding": "base64",
                "description": "DER-encoded ECDSA signature, base64."
              }
            }
          }
        }
      }
    },
    "ResolveReproTest": {
      "type": "object",
      "title": "Repro test",
      "description": "Repro test written by the agent when you did not supply `test_command`.",
      "required": [
        "path",
        "content"
      ],
      "properties": {
        "path": {
          "type": "string",
          "description": "Path of the test file relative to the repository root."
        },
        "content": {
          "type": [
            "string",
            "null"
          ],
          "description": "Full test file content."
        }
      }
    }
  }
}