{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/mmerterden/multi-agent-pipeline/pipeline/schemas/test-gap.schema.json",
  "version": "1.0.0",
  "title": "Multi-Agent Pipeline  -  Phase 5 test gap report",
  "description": "Output of test-gap-scan.mjs. Lists symbols added/changed in the diff that have no paired test file or no matching test method. Advisory in default mode; opt-in blocking via prefs.testGap.blockingThreshold.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "stack", "totals", "gaps"],
  "properties": {
    "schemaVersion": { "type": "string", "const": "1.0.0" },
    "stack": {
      "type": "string",
      "enum": ["ios", "android", "python", "node", "unknown"]
    },
    "totals": {
      "type": "object",
      "additionalProperties": false,
      "required": ["sourcesScanned", "testsScanned", "gapCount", "gapBySeverity"],
      "properties": {
        "sourcesScanned": { "type": "integer", "minimum": 0 },
        "testsScanned": { "type": "integer", "minimum": 0 },
        "gapCount": { "type": "integer", "minimum": 0 },
        "gapBySeverity": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "blocking": { "type": "integer", "minimum": 0 },
            "important": { "type": "integer", "minimum": 0 },
            "suggestion": { "type": "integer", "minimum": 0 }
          },
          "required": ["blocking", "important", "suggestion"]
        }
      }
    },
    "gaps": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["sourcePath", "symbol", "kind", "severity", "expectedTestPaths", "hint"],
        "properties": {
          "sourcePath": { "type": "string", "minLength": 1 },
          "symbol": { "type": "string", "minLength": 1 },
          "kind": {
            "type": "string",
            "description": "Pattern id from the rules file (e.g. public_func, composable_fun, named_export)."
          },
          "severity": {
            "type": "string",
            "enum": ["blocking", "important", "suggestion"]
          },
          "expectedTestPaths": {
            "type": "array",
            "minItems": 1,
            "items": { "type": "string" },
            "description": "Likely paths the missing test should live at, in priority order."
          },
          "hint": { "type": "string" }
        }
      }
    }
  }
}
