{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://machinereadyknowledge.com/mrk-evidence.schema.json",
  "title": "MRK-2.0 conformance evidence",
  "description": "Output of `mrk conform`: binds a consumer's run of the section-R suite (suite_sha256) to per-article digests of one corpus, with one R5 case derived from each of that corpus's own edges (an article's digest and the digest of every edge target are recorded in corpus.articles). `sha256` is the digest of the canonical JSON of this document without that key. Evidence is reproducible and tamper-evident, not signed.",
  "type": "object",
  "required": ["mrk_evidence", "kind", "spec", "tool", "suite_sha256", "consumer", "run_at", "today", "levels", "suite_results", "self_test", "corpus", "sha256"],
  "properties": {
    "mrk_evidence": { "const": "1" },
    "kind": { "const": "retrieval-conformance" },
    "spec": { "const": "MRK-2.0" },
    "tool": {
      "type": "object",
      "required": ["name", "version"],
      "properties": { "name": { "type": "string" }, "version": { "type": "string" } }
    },
    "suite_sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
    "consumer": {
      "type": "object",
      "required": ["entry", "name"],
      "properties": {
        "entry": { "type": "string" },
        "name": { "type": "string" },
        "version": { "type": ["string", "null"] }
      }
    },
    "run_at": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?Z$" },
    "today": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" },
    "levels": {
      "type": "object",
      "required": ["C1", "C2"],
      "properties": {
        "C1": { "enum": ["pass", "fail"] },
        "C2": { "enum": ["pass", "fail", "not-claimed"] }
      }
    },
    "suite_results": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["name", "mode", "rules", "ok"],
        "properties": {
          "name": { "type": "string" },
          "mode": { "enum": ["parity", "r5_contract"] },
          "rules": { "type": "string" },
          "ok": { "type": "boolean" }
        }
      }
    },
    "self_test": { "enum": ["rejected-broken-consumer", "accepted-broken-consumer"] },
    "corpus": {
      "type": "object",
      "required": ["articles", "derived_cases"],
      "properties": {
        "articles": {
          "type": "object",
          "additionalProperties": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
        },
        "derived_cases": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["article", "edge", "section", "target", "ctx", "expect", "ok"],
            "properties": {
              "article": { "type": "string" },
              "edge": { "enum": ["depends_on", "requires"] },
              "section": { "type": "string" },
              "target": { "type": "string" },
              "ctx": { "type": "object" },
              "expect": { "type": "array", "items": { "type": "string" } },
              "ok": { "type": "boolean" },
              "missing": { "type": "array", "items": { "type": "string" } },
              "error": { "type": "string" }
            }
          }
        }
      }
    },
    "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
  }
}
