{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://greg-clear-documents.cbgregory.chatgpt.site/trust-review-report.schema.json",
  "title": "Kinmesh Trust Boundary Review Report",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "reviewId",
    "artifactUrl",
    "reviewedAt",
    "boundaries",
    "falsificationChecks",
    "prioritizedFixes",
    "limitations"
  ],
  "properties": {
    "schema": {
      "const": "https://greg-clear-documents.cbgregory.chatgpt.site/trust-review-report.schema.json"
    },
    "reviewId": { "type": "integer", "minimum": 1 },
    "artifactUrl": { "type": "string", "format": "uri", "maxLength": 500 },
    "reviewedAt": { "type": "string", "format": "date-time" },
    "boundaries": {
      "type": "array",
      "minItems": 5,
      "maxItems": 5,
      "items": { "$ref": "#/$defs/boundary" },
      "allOf": [
        { "contains": { "properties": { "id": { "const": "identity" } }, "required": ["id"] } },
        { "contains": { "properties": { "id": { "const": "consent" } }, "required": ["id"] } },
        { "contains": { "properties": { "id": { "const": "payment" } }, "required": ["id"] } },
        { "contains": { "properties": { "id": { "const": "delivery" } }, "required": ["id"] } },
        { "contains": { "properties": { "id": { "const": "failure-recovery" } }, "required": ["id"] } }
      ]
    },
    "falsificationChecks": {
      "type": "array",
      "minItems": 10,
      "items": { "$ref": "#/$defs/check" }
    },
    "prioritizedFixes": {
      "type": "array",
      "minItems": 3,
      "items": { "$ref": "#/$defs/fix" }
    },
    "limitations": { "type": "string", "minLength": 40, "maxLength": 4000 }
  },
  "$defs": {
    "boundary": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "claim", "evidence", "failureMode", "currentControl", "residualRisk"],
      "properties": {
        "id": { "enum": ["identity", "consent", "payment", "delivery", "failure-recovery"] },
        "claim": { "type": "string", "minLength": 1, "maxLength": 2000 },
        "evidence": { "type": "string", "minLength": 1, "maxLength": 2000 },
        "failureMode": { "type": "string", "minLength": 1, "maxLength": 2000 },
        "currentControl": { "type": "string", "minLength": 1, "maxLength": 2000 },
        "residualRisk": { "type": "string", "minLength": 1, "maxLength": 2000 }
      }
    },
    "check": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "targetClaim", "test", "failureSignal", "oracleTiming", "evaluator"],
      "properties": {
        "id": { "type": "string", "minLength": 1, "maxLength": 80 },
        "targetClaim": { "type": "string", "minLength": 1, "maxLength": 1000 },
        "test": { "type": "string", "minLength": 1, "maxLength": 2000 },
        "failureSignal": { "type": "string", "minLength": 1, "maxLength": 1000 },
        "oracleTiming": { "enum": ["pre_execution", "continuous", "post_execution"] },
        "evaluator": { "type": "string", "minLength": 1, "maxLength": 1000 }
      }
    },
    "fix": {
      "type": "object",
      "additionalProperties": false,
      "required": ["priority", "title", "change", "proof"],
      "properties": {
        "priority": { "type": "integer", "minimum": 1 },
        "title": { "type": "string", "minLength": 1, "maxLength": 200 },
        "change": { "type": "string", "minLength": 1, "maxLength": 2000 },
        "proof": { "type": "string", "minLength": 1, "maxLength": 2000 }
      }
    }
  }
}
