{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://jaredmodstorage.github.io/schemas/correction-propagation-contract.schema.json",
  "title": "Correction Propagation Consumer Record",
  "description": "Structural teaching schema for one consumer-level record in Jared Mastroianni's proposed correction propagation contract. Conformance does not establish truth, authority, dependency completeness, safety, deployment, or operational closure.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "correction_record_id",
    "correction_id",
    "portfolio_id",
    "facility_id",
    "subject_id",
    "fact_path",
    "superseded_assertion_id",
    "governing_assertion_id",
    "prior_value_or_hash",
    "corrected_value_or_hash",
    "reason_code",
    "authority_id",
    "authority_scope",
    "discovered_at",
    "effective_at",
    "recorded_at",
    "dependency_snapshot_id",
    "consumer_id",
    "consumer_class",
    "prior_use_state",
    "consequence_class",
    "disposition",
    "transformation_or_version",
    "idempotency_key",
    "precondition_or_checkpoint",
    "execution_state",
    "execution_receipt",
    "executed_at",
    "readback_method",
    "readback_state",
    "readback_value_or_hash",
    "rollback_or_compensation",
    "residual_state",
    "residual_owner",
    "next_review_at",
    "fictional_flag",
    "evidence_boundary"
  ],
  "properties": {
    "correction_record_id": { "type": "string", "pattern": "^CPR-FIC-[0-9]{3}$" },
    "correction_id": { "type": "string", "pattern": "^COR-FIC-[0-9]{3}$" },
    "portfolio_id": { "type": "string", "minLength": 1 },
    "facility_id": { "type": "string", "minLength": 1 },
    "subject_id": { "type": "string", "minLength": 1 },
    "fact_path": { "type": "string", "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$" },
    "superseded_assertion_id": { "type": "string", "minLength": 1 },
    "governing_assertion_id": { "type": "string", "minLength": 1 },
    "prior_value_or_hash": { "type": "string", "minLength": 1 },
    "corrected_value_or_hash": { "type": "string", "minLength": 1 },
    "reason_code": { "type": "string", "minLength": 1 },
    "authority_id": { "type": "string", "minLength": 1 },
    "authority_scope": { "type": "string", "minLength": 1 },
    "discovered_at": { "type": "string", "format": "date-time" },
    "effective_at": { "type": "string", "format": "date-time" },
    "recorded_at": { "type": "string", "format": "date-time" },
    "dependency_snapshot_id": { "type": "string", "minLength": 1 },
    "consumer_id": { "type": "string", "minLength": 1 },
    "consumer_class": {
      "enum": [
        "governing_source",
        "replica_or_read_model",
        "derived_information",
        "workflow_or_automation",
        "ai_context",
        "communication_or_public_surface",
        "executed_real_world_action"
      ]
    },
    "prior_use_state": { "type": "string", "minLength": 1 },
    "consequence_class": { "enum": ["low", "medium", "high", "critical"] },
    "disposition": {
      "enum": [
        "replace",
        "recompute",
        "retract",
        "invalidate",
        "replay",
        "annotate",
        "notify",
        "quarantine",
        "no_action",
        "cannot_reverse"
      ]
    },
    "transformation_or_version": { "type": "string", "minLength": 1 },
    "idempotency_key": { "type": "string", "minLength": 1 },
    "precondition_or_checkpoint": { "type": "string", "minLength": 1 },
    "execution_state": { "enum": ["prepared", "held", "authorized", "executing", "executed", "failed", "not_applicable"] },
    "execution_receipt": { "type": ["string", "null"] },
    "executed_at": { "type": ["string", "null"], "format": "date-time" },
    "readback_method": { "type": "string", "minLength": 1 },
    "readback_state": { "enum": ["pending", "matched", "mismatched", "unavailable", "not_applicable"] },
    "readback_value_or_hash": { "type": ["string", "null"] },
    "rollback_or_compensation": { "type": "string", "minLength": 1 },
    "residual_state": { "enum": ["none", "open", "accepted", "compensated"] },
    "residual_owner": { "type": "string", "minLength": 1 },
    "next_review_at": { "type": "string", "format": "date-time" },
    "fictional_flag": { "const": true },
    "evidence_boundary": { "type": "string", "minLength": 40 }
  }
}
