{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/multi-agent-ecosystem/multi-agent-pipeline/pipeline/schemas/test-gen-results.schema.json",
  "title": "Multi-Agent Pipeline  -  test-gen results",
  "description": "The outcome of the tests /multi-agent:test-gen wrote, $RUN/results.json, built by test-gen-gate.mjs results from the classify stage (multi-agent-refs/features/test-classification.md). Three states: pass, fail, not_measured; anything but pass carries its reason. `classification` keeps the measured class behind the state (an unstable test is a fail, a test with no base is not_measured), and `triage` the result-triage verdict once one is made. test-gen-gate.mjs check --stage results checks this shape without a dependency.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "source", "green", "tests", "summary"],
  "properties": {
    "schemaVersion": { "const": "1.0.0" },
    "source": { "enum": ["toolkit", "fallback"] },
    "green": { "type": "boolean" },
    "tests": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "status"],
        "properties": {
          "id": { "type": "string", "minLength": 1 },
          "file": { "type": "string", "minLength": 1 },
          "status": { "enum": ["pass", "fail", "not_measured"] },
          "classification": {
            "enum": ["passed", "regression", "preexisting", "unstable", "not_measured"]
          },
          "reason": { "type": "string", "minLength": 1 },
          "triage": { "enum": ["product-bug", "stale-test", "new-scenario", "valid", "ambiguous"] }
        },
        "if": { "properties": { "status": { "enum": ["fail", "not_measured"] } } },
        "then": { "required": ["reason"] }
      }
    },
    "summary": {
      "type": "object",
      "additionalProperties": false,
      "required": ["pass", "fail", "not_measured"],
      "properties": {
        "pass": { "type": "integer", "minimum": 0 },
        "fail": { "type": "integer", "minimum": 0 },
        "not_measured": { "type": "integer", "minimum": 0 }
      }
    }
  }
}
