{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://dicworkflowkit.local/schemas/harness-run.schema.json",
  "title": "齐衡 QIHENG Harness Run",
  "type": "object",
  "required": [
    "schema",
    "runId",
    "planId",
    "candidateHash",
    "createdAt",
    "updatedAt",
    "gates"
  ],
  "properties": {
    "schema": { "const": "dic.harness-run.v1" },
    "runId": {
      "type": "string",
      "pattern": "^hrun-[a-f0-9]{16}$"
    },
    "planId": {
      "type": "string",
      "pattern": "^hplan-[a-f0-9]{16}$"
    },
    "candidateHash": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "createdAt": { "type": "string", "format": "date-time" },
    "updatedAt": { "type": "string", "format": "date-time" },
    "gates": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": ["gateId", "status", "summary", "evidence", "handoffs"],
        "properties": {
          "gateId": { "type": "string", "minLength": 1 },
          "status": {
            "enum": [
              "NOT_RUN",
              "RUNNING",
              "PASS",
              "PASS_WITH_FOLLOW_UP",
              "BLOCKED",
              "FAIL",
              "SKIPPED",
              "STALE"
            ]
          },
          "summary": { "type": "string" },
          "reusedFromCandidateHash": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "reuseMode": {
            "enum": ["SAME_CANDIDATE", "UNCHANGED_INPUTS"]
          },
          "startedAt": { "type": "string", "format": "date-time" },
          "completedAt": { "type": "string", "format": "date-time" },
          "evidence": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["path", "contentHash"],
              "properties": {
                "path": { "type": "string", "minLength": 1 },
                "contentHash": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                }
              },
              "additionalProperties": false
            }
          },
          "handoffs": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["path", "contentHash", "agent", "status"],
              "properties": {
                "path": { "type": "string", "minLength": 1 },
                "contentHash": {
                  "type": "string",
                  "pattern": "^[a-f0-9]{64}$"
                },
                "agent": { "type": "string", "minLength": 1 },
                "status": {
                  "enum": ["PASS", "PASS_WITH_FOLLOW_UP", "BLOCKED", "FAIL", "SKIPPED"]
                }
              },
              "additionalProperties": false
            }
          }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
