{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://biasofia.com/benchmark/trial.schema.v1.json",
  "title": "Redacted raw vibe benchmark trial",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "run_id",
    "trial_id",
    "blind_candidate_id",
    "provider_id",
    "prompt_id",
    "repetition",
    "timestamps",
    "build",
    "boot",
    "functional_checks",
    "operator_actions",
    "human_interventions",
    "cost",
    "terminal",
    "evaluator",
    "artifacts"
  ],
  "properties": {
    "schema": {
      "const": "bia.vibe-benchmark-trial/v1"
    },
    "run_id": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9-]{7,63}$"
    },
    "trial_id": {
      "type": "string",
      "pattern": "^[0-9a-f]{24}$"
    },
    "blind_candidate_id": {
      "type": "string",
      "pattern": "^[0-9a-f]{20}$"
    },
    "provider_id": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]+$"
    },
    "prompt_id": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9-]+$"
    },
    "repetition": {
      "type": "integer",
      "minimum": 1
    },
    "timestamps": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "started_at",
        "ended_at",
        "elapsed_ms"
      ],
      "properties": {
        "started_at": {
          "type": "string",
          "format": "date-time"
        },
        "ended_at": {
          "type": "string",
          "format": "date-time"
        },
        "elapsed_ms": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "build": {
      "$ref": "#/$defs/checkOutcome"
    },
    "boot": {
      "$ref": "#/$defs/checkOutcome"
    },
    "functional_checks": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "id",
          "status",
          "evidence_sha256"
        ],
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "status": {
            "enum": [
              "pass",
              "fail",
              "not_evaluated"
            ]
          },
          "evidence_sha256": {
            "$ref": "#/$defs/digestList"
          }
        }
      }
    },
    "human_interventions": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "at"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "minLength": 1
          },
          "at": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "operator_actions": {
      "type": "array",
      "minItems": 2,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "at"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "minLength": 1
          },
          "at": {
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "cost": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "currency",
        "micros",
        "source",
        "evidence_sha256"
      ],
      "properties": {
        "status": {
          "enum": [
            "measured",
            "unavailable"
          ]
        },
        "currency": {
          "const": "USD"
        },
        "micros": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "source": {
          "type": [
            "string",
            "null"
          ]
        },
        "evidence_sha256": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^[0-9a-f]{64}$"
        }
      }
    },
    "terminal": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "failure_code"
      ],
      "properties": {
        "status": {
          "enum": [
            "completed",
            "failed",
            "timeout"
          ]
        },
        "failure_code": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "evaluator": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id_hash",
        "blinded",
        "scored_at"
      ],
      "properties": {
        "id_hash": {
          "$ref": "#/$defs/digest"
        },
        "blinded": {
          "const": true
        },
        "scored_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "artifacts": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "kind",
          "path",
          "sha256",
          "redacted"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "minLength": 1
          },
          "path": {
            "type": "string",
            "pattern": "^artifacts/"
          },
          "sha256": {
            "$ref": "#/$defs/digest"
          },
          "redacted": {
            "const": true
          }
        }
      }
    }
  },
  "$defs": {
    "digest": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    },
    "digestList": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/digest"
      }
    },
    "checkOutcome": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "evidence_sha256"
      ],
      "properties": {
        "status": {
          "enum": [
            "pass",
            "fail",
            "not_observable"
          ]
        },
        "evidence_sha256": {
          "$ref": "#/$defs/digestList"
        }
      }
    }
  }
}
