{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://matrixnetwork.me/schemas/Y_THEORY_RELATIONAL_INDUCTION_ARCHIVE_RECONCILIATION.schema.json",
  "title": "Y-Theory relational-induction archive reconciliation",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "audit_id",
    "reviewed_at",
    "review_state",
    "decision",
    "current_release",
    "authority_boundary",
    "narrative",
    "current_author_intake",
    "archives",
    "package_integrity",
    "independent_replay",
    "model_findings",
    "wisdom_dispositions",
    "guardrails",
    "next_gates"
  ],
  "properties": {
    "schema": {"const": "y-theory.relational-induction-archive-reconciliation.v1"},
    "audit_id": {"const": "RELATIONAL-INDUCTION-ARCHIVE-RECONCILIATION-2026-09-02"},
    "reviewed_at": {"type": "string", "format": "date"},
    "review_state": {"const": "completed_candidate_reconciliation"},
    "decision": {"const": "reject_wholesale_import_retain_hash_bound_candidate_evidence"},
    "current_release": {"pattern": "^YLS-[0-9]{4}\\.[0-9]{2}\\.[0-9]{2}\\.[0-9]+$"},
    "authority_boundary": {"type": "string", "minLength": 80},
    "narrative": {
      "type": "object",
      "additionalProperties": false,
      "required": ["path", "sha256"],
      "properties": {
        "path": {"const": "reports/source-reconciliation/RELATIONAL_INDUCTION_ARCHIVE_RECONCILIATION.md"},
        "sha256": {"$ref": "#/$defs/sha256"}
      }
    },
    "current_author_intake": {
      "type": "object",
      "additionalProperties": false,
      "required": ["path", "sha256", "role"],
      "properties": {
        "path": {"const": "intake/raw/YWP-20260902T004138Z-changing-oriented-relation-induces-flow.md"},
        "sha256": {"$ref": "#/$defs/sha256"},
        "role": {"type": "string", "minLength": 40}
      }
    },
    "archives": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "items": {
        "type": "object",
        "required": ["archive_id", "filename", "sha256", "size_bytes", "bytes_present_in_living_source", "disposition"],
        "properties": {
          "archive_id": {"type": "string", "minLength": 8},
          "filename": {"type": "string", "pattern": "\\.zip$"},
          "sha256": {"$ref": "#/$defs/sha256"},
          "size_bytes": {"type": "integer", "minimum": 1},
          "claimed_release": {"type": "string"},
          "bytes_present_in_living_source": {"const": false},
          "lineage_result": {"type": "string"},
          "independent_replication": {"type": "boolean"},
          "disposition": {"type": "string", "pattern": "^retain_by_hash_only"}
        },
        "additionalProperties": false
      }
    },
    "package_integrity": {
      "type": "object",
      "additionalProperties": false,
      "required": ["outer_archive_hashes_match_intake", "internal_file_manifest", "release_manifest", "approval_state", "installable_authority"],
      "properties": {
        "outer_archive_hashes_match_intake": {"const": true},
        "internal_file_manifest": {"$ref": "#/$defs/fileManifest"},
        "release_manifest": {"$ref": "#/$defs/releaseManifest"},
        "approval_state": {"$ref": "#/$defs/approvalState"},
        "installable_authority": {"const": false}
      }
    },
    "independent_replay": {
      "type": "array",
      "minItems": 2,
      "maxItems": 2,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["model", "tests_passed", "tests_total", "earned_scope", "not_earned"],
        "properties": {
          "model": {"type": "string", "minLength": 8},
          "tests_passed": {"type": "integer", "minimum": 0},
          "tests_total": {"type": "integer", "minimum": 1},
          "earned_scope": {"type": "string", "minLength": 20},
          "not_earned": {"type": "string", "minLength": 20}
        }
      }
    },
    "model_findings": {
      "type": "array",
      "minItems": 7,
      "maxItems": 7,
      "items": {"$ref": "#/$defs/finding"}
    },
    "wisdom_dispositions": {
      "type": "array",
      "minItems": 5,
      "maxItems": 5,
      "items": {"$ref": "#/$defs/disposition"}
    },
    "guardrails": {
      "type": "array",
      "minItems": 6,
      "items": {"type": "string", "minLength": 25},
      "uniqueItems": true
    },
    "next_gates": {
      "type": "array",
      "minItems": 5,
      "items": {"type": "string", "minLength": 25},
      "uniqueItems": true
    }
  },
  "$defs": {
    "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
    "fileManifest": {
      "type": "object",
      "additionalProperties": false,
      "required": ["declared_rows", "matching_rows", "mismatching_rows", "unlisted_archive_files", "result"],
      "properties": {
        "declared_rows": {"type": "integer", "minimum": 0},
        "matching_rows": {"type": "integer", "minimum": 0},
        "mismatching_rows": {"type": "integer", "minimum": 0},
        "unlisted_archive_files": {"type": "integer", "minimum": 0},
        "result": {"const": "failed"}
      }
    },
    "releaseManifest": {
      "type": "object",
      "additionalProperties": false,
      "required": ["declared_hashes", "incorrect_hashes", "result"],
      "properties": {
        "declared_hashes": {"type": "integer", "minimum": 0},
        "incorrect_hashes": {"type": "integer", "minimum": 0},
        "result": {"const": "failed"}
      }
    },
    "approvalState": {
      "type": "object",
      "additionalProperties": false,
      "required": ["approval_templates_checked", "all_blank", "signature_confirmation", "v52_in_latest_approved", "result"],
      "properties": {
        "approval_templates_checked": {"type": "integer", "minimum": 1},
        "all_blank": {"const": true},
        "signature_confirmation": {"const": false},
        "v52_in_latest_approved": {"const": false},
        "result": {"const": "not_approved"}
      }
    },
    "finding": {
      "type": "object",
      "additionalProperties": false,
      "required": ["finding_id", "severity", "statement", "required_repair"],
      "properties": {
        "finding_id": {"pattern": "^RI-F[1-7]$"},
        "severity": {"enum": ["blocking_for_claim", "material_model_defect", "material_evidence_defect", "scope_gap", "proof_boundary"]},
        "statement": {"type": "string", "minLength": 50},
        "required_repair": {"type": "string", "minLength": 30}
      }
    },
    "disposition": {
      "type": "object",
      "additionalProperties": false,
      "required": ["wisdom_id", "archive_title", "disposition", "canonical_promotion", "reason"],
      "properties": {
        "wisdom_id": {"pattern": "^V52-00[1-5]$"},
        "archive_title": {"type": "string", "minLength": 8},
        "disposition": {"enum": ["duplicate", "duplicate_as_wisdom_reject_v2_as_proof", "revise", "defer"]},
        "canonical_promotion": {"const": false},
        "reason": {"type": "string", "minLength": 50}
      }
    }
  }
}
