{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://matrixnetwork.me/source/audit/external-source-reconciliation.schema.json",
  "title": "Y Theory public external-source reconciliation",
  "description": "Release-bound schema for the redacted public projection. It is intentionally distinct from the repository-only canonical audit schema.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "release",
    "status",
    "pipeline_role",
    "report_sha256",
    "totals",
    "inventory_overlap",
    "roots",
    "authority_boundary",
    "public_boundary"
  ],
  "properties": {
    "schema": {
      "const": "y-theory.external-source-reconciliation-public.v1"
    },
    "release": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "living_source_version",
        "release_state"
      ],
      "properties": {
        "living_source_version": {
          "type": "string"
        },
        "release_state": {
          "type": "string"
        }
      }
    },
    "status": {
      "type": "string"
    },
    "pipeline_role": {
      "type": "string"
    },
    "report_sha256": {
      "type": "string"
    },
    "totals": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "roots_configured",
        "roots_available",
        "roots_unavailable",
        "observed_files",
        "observed_bytes",
        "candidate_aliases",
        "candidate_bytes",
        "excluded_files",
        "excluded_bytes",
        "unique_content_records",
        "duplicate_content_groups",
        "aliases_in_duplicate_groups",
        "redundant_aliases_after_one_copy_per_hash",
        "redundant_candidate_bytes_after_one_copy_per_hash",
        "cross_root_duplicate_groups",
        "likely_variant_families",
        "canonical_promotions",
        "semantic_equivalences_asserted"
      ],
      "properties": {
        "roots_configured": {
          "type": "integer"
        },
        "roots_available": {
          "type": "integer"
        },
        "roots_unavailable": {
          "type": "integer"
        },
        "observed_files": {
          "type": "integer"
        },
        "observed_bytes": {
          "type": "integer"
        },
        "candidate_aliases": {
          "type": "integer"
        },
        "candidate_bytes": {
          "type": "integer"
        },
        "excluded_files": {
          "type": "integer"
        },
        "excluded_bytes": {
          "type": "integer"
        },
        "unique_content_records": {
          "type": "integer"
        },
        "duplicate_content_groups": {
          "type": "integer"
        },
        "aliases_in_duplicate_groups": {
          "type": "integer"
        },
        "redundant_aliases_after_one_copy_per_hash": {
          "type": "integer"
        },
        "redundant_candidate_bytes_after_one_copy_per_hash": {
          "type": "integer"
        },
        "cross_root_duplicate_groups": {
          "type": "integer"
        },
        "likely_variant_families": {
          "type": "integer"
        },
        "canonical_promotions": {
          "type": "integer"
        },
        "semantic_equivalences_asserted": {
          "type": "integer"
        }
      }
    },
    "inventory_overlap": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "path",
        "sha256",
        "inventory_records",
        "inventory_unique_sha256",
        "external_unique_records_with_exact_overlap",
        "external_candidate_aliases_with_exact_overlap",
        "external_unique_records_without_exact_overlap"
      ],
      "properties": {
        "path": {
          "type": "string"
        },
        "sha256": {
          "type": "string"
        },
        "inventory_records": {
          "type": "integer"
        },
        "inventory_unique_sha256": {
          "type": "integer"
        },
        "external_unique_records_with_exact_overlap": {
          "type": "integer"
        },
        "external_candidate_aliases_with_exact_overlap": {
          "type": "integer"
        },
        "external_unique_records_without_exact_overlap": {
          "type": "integer"
        }
      }
    },
    "roots": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "alias",
          "declared_role",
          "available",
          "observed_files",
          "observed_bytes",
          "candidate_aliases",
          "candidate_bytes",
          "unique_candidate_hashes",
          "duplicate_content_groups",
          "excluded_files",
          "excluded_bytes"
        ],
        "properties": {
          "alias": {
            "type": "string"
          },
          "declared_role": {
            "type": "string"
          },
          "available": {
            "type": "boolean"
          },
          "observed_files": {
            "type": "integer"
          },
          "observed_bytes": {
            "type": "integer"
          },
          "candidate_aliases": {
            "type": "integer"
          },
          "candidate_bytes": {
            "type": "integer"
          },
          "unique_candidate_hashes": {
            "type": "integer"
          },
          "duplicate_content_groups": {
            "type": "integer"
          },
          "excluded_files": {
            "type": "integer"
          },
          "excluded_bytes": {
            "type": "integer"
          }
        }
      }
    },
    "authority_boundary": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "configured_root",
        "modified_time",
        "title_and_path",
        "document_instructions",
        "classification",
        "equivalence"
      ],
      "properties": {
        "configured_root": {
          "type": "string"
        },
        "modified_time": {
          "type": "string"
        },
        "title_and_path": {
          "type": "string"
        },
        "document_instructions": {
          "type": "string"
        },
        "classification": {
          "type": "string"
        },
        "equivalence": {
          "type": "string"
        }
      }
    },
    "public_boundary": {
      "type": "string"
    }
  }
}
