{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://harnessa.dev/schemas/harness-holdout-manifest-v1.schema.json",
  "title": "Harnessa Harness² holdout evaluation manifest",
  "description": "Frozen experiment identity and content-addressed artifact references. It contains no holdout cases, answers, rubric, or numeric grade.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version", "experiment_id", "task_id", "project_id", "attempt",
    "base_sha", "specification_hash", "specification_revision", "policy_revision",
    "harness2_revision", "mode", "k", "route_alias", "image_revision", "artifacts",
    "digest"
  ],
  "properties": {
    "schema_version": { "const": 1 },
    "experiment_id": { "type": "string", "format": "uuid" },
    "task_id": { "type": "string", "format": "uuid" },
    "project_id": { "type": "string", "format": "uuid" },
    "attempt": { "type": "integer", "minimum": 1 },
    "base_sha": { "$ref": "#/$defs/revision" },
    "specification_hash": { "$ref": "#/$defs/digest" },
    "specification_revision": { "type": "integer", "minimum": 1 },
    "policy_revision": { "type": "integer", "minimum": 1 },
    "harness2_revision": { "type": "string", "minLength": 1, "maxLength": 80 },
    "mode": { "enum": ["parallel", "sequential", "both"] },
    "k": { "type": "integer", "minimum": 1, "maximum": 3 },
    "route_alias": { "type": "string", "minLength": 1, "maxLength": 120 },
    "image_revision": { "type": "string", "minLength": 1, "maxLength": 200 },
    "artifacts": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["phase", "run_id", "harness_digest", "trace", "deliverable", "artifacts"],
        "properties": {
          "phase": { "enum": ["baseline", "candidate", "composed"] },
          "run_id": { "type": "string", "format": "uuid" },
          "harness_digest": { "$ref": "#/$defs/digest" },
          "trace": { "$ref": "#/$defs/artifactReference" },
          "deliverable": { "type": "boolean" },
          "artifacts": {
            "type": "array",
            "items": { "$ref": "#/$defs/artifactBlobReference" }
          }
        }
      }
    },
    "digest": { "$ref": "#/$defs/digest" }
  },
  "$defs": {
    "revision": { "type": "string", "pattern": "^(?:[0-9a-f]{40}|[0-9a-f]{64})$" },
    "digest": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
    "artifactReference": {
      "type": "object",
      "additionalProperties": false,
      "required": ["sha256", "size_bytes"],
      "properties": {
        "sha256": { "$ref": "#/$defs/digest" },
        "size_bytes": { "type": "integer", "minimum": 0, "maximum": 10485760 }
      }
    },
    "artifactBlobReference": {
      "type": "object",
      "additionalProperties": false,
      "required": ["sha256", "media_type", "size_bytes"],
      "properties": {
        "sha256": { "$ref": "#/$defs/digest" },
        "media_type": { "type": "string", "minLength": 1, "maxLength": 200 },
        "size_bytes": { "type": "integer", "minimum": 0, "maximum": 10485760 }
      }
    }
  }
}
