{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://developer.reits.tech/schemas/runner-factory-reconciliation-snapshot-coordinator.v1.schema.json",
  "title": "REITs Runner Factory five-source reconciliation snapshot coordinator dossier",
  "type": "object",
  "required": ["schemaVersion", "status", "observedAt", "scope", "truth", "implementation", "operations", "sourceReaders", "captureStates", "invariants", "verification", "failureClasses", "productionPrerequisites", "fixtureRegistry", "discovery"],
  "properties": {
    "schemaVersion": { "const": "developer.reits.tech/runner-factory-reconciliation-snapshot-coordinator/v1" },
    "status": { "const": "COORDINATOR_IMPLEMENTED_NOT_CONFIGURED" },
    "observedAt": { "type": "string", "format": "date-time" },
    "scope": {
      "type": "object",
      "required": ["mode", "sources", "consistency", "timeoutMs", "maxCaptureSkewMs", "partialReadPolicy", "mutationPolicy"],
      "properties": {
        "mode": { "const": "FIVE_SOURCE_CONCURRENT_READ_ONLY" },
        "sources": { "const": 5 },
        "consistency": { "const": "STRONGLY_CONSISTENT" },
        "timeoutMs": { "const": 2000 },
        "maxCaptureSkewMs": { "const": 2000 },
        "partialReadPolicy": { "const": "NORMALIZE_UNKNOWN_AND_CONTAIN" },
        "mutationPolicy": { "const": "NO_WRITE_CAPABILITY" }
      },
      "additionalProperties": false
    },
    "truth": {
      "type": "object",
      "required": ["configuredSourceReaders", "runtimeIdentityConfigured", "runtimeCaptures", "runtimeSourceReads", "liveSnapshots", "externalReadsExecuted", "externalWritesExecuted", "mutationsExecuted", "secretValuesRecorded", "paidResourcesCreated", "readinessGateSatisfied", "deploymentPermitted"],
      "properties": {
        "configuredSourceReaders": { "const": 0 }, "runtimeIdentityConfigured": { "const": false }, "runtimeCaptures": { "const": 0 }, "runtimeSourceReads": { "const": 0 }, "liveSnapshots": { "const": 0 },
        "externalReadsExecuted": { "const": 0 }, "externalWritesExecuted": { "const": 0 }, "mutationsExecuted": { "const": 0 }, "secretValuesRecorded": { "const": 0 },
        "paidResourcesCreated": { "const": false }, "readinessGateSatisfied": { "const": false }, "deploymentPermitted": { "const": false }
      },
      "additionalProperties": false
    },
    "implementation": {
      "type": "object",
      "required": ["coordinator", "fixtureRegistry", "verifier", "reservationReader", "capacityReader", "workerReader", "runnerReader", "journalReader"],
      "properties": {
        "coordinator": { "const": "ops/runner-factory/reconciliation-snapshot-coordinator.mjs" },
        "fixtureRegistry": { "const": "ops/runner-factory/reconciliation-snapshot-coordinator-fixtures.json" },
        "verifier": { "const": "scripts/verify-runner-factory-reconciliation-snapshot-coordinator.mjs" },
        "reservationReader": { "const": "NOT_CONFIGURED" }, "capacityReader": { "const": "NOT_CONFIGURED" }, "workerReader": { "const": "NOT_CONFIGURED" }, "runnerReader": { "const": "NOT_CONFIGURED" }, "journalReader": { "const": "NOT_CONFIGURED" }
      },
      "additionalProperties": false
    },
    "operations": {
      "type": "array", "minItems": 3, "maxItems": 3,
      "items": { "type": "object", "required": ["id", "guard", "result"], "properties": { "id": { "enum": ["plan", "capture", "verify"] }, "guard": { "type": "string", "minLength": 20 }, "result": { "type": "string", "minLength": 20 } }, "additionalProperties": false }
    },
    "sourceReaders": {
      "type": "array", "minItems": 5, "maxItems": 5,
      "items": { "type": "object", "required": ["source", "authority", "query"], "properties": { "source": { "enum": ["Reservation", "Capacity", "Worker", "Runner", "Journal"] }, "authority": { "enum": ["reservation-ledger", "capacity-ledger", "ec2-worker-read-model", "gitea-runner-read-model", "append-only-journal"] }, "query": { "type": "string", "minLength": 20 } }, "additionalProperties": false }
    },
    "captureStates": {
      "type": "array", "minItems": 6, "maxItems": 6,
      "items": { "type": "object", "required": ["id", "meaning"], "properties": { "id": { "enum": ["PLANNED", "READING", "COMPLETE", "PARTIAL_UNAVAILABLE", "ALL_UNAVAILABLE", "DENIED_INTEGRITY"] }, "meaning": { "type": "string", "minLength": 20 } }, "additionalProperties": false }
    },
    "invariants": { "type": "array", "minItems": 18, "maxItems": 18, "items": { "type": "string", "minLength": 20 } },
    "verification": {
      "type": "object",
      "required": ["status", "fixtures", "completeCaptures", "partialCaptures", "allUnavailableCaptures", "deniedInputs", "sourceReadAttempts", "unavailableSourceResults", "plannerIntegrationCases", "secretValuesRecorded", "externalCallsExecuted", "mutationsExecuted"],
      "properties": {
        "status": { "const": "PASS_FIXTURE_ONLY" }, "fixtures": { "const": 30 }, "completeCaptures": { "const": 3 }, "partialCaptures": { "const": 7 }, "allUnavailableCaptures": { "const": 1 }, "deniedInputs": { "const": 19 },
        "sourceReadAttempts": { "const": 55 }, "unavailableSourceResults": { "const": 16 }, "plannerIntegrationCases": { "const": 11 }, "secretValuesRecorded": { "const": 0 }, "externalCallsExecuted": { "const": 0 }, "mutationsExecuted": { "const": 0 }
      },
      "additionalProperties": false
    },
    "failureClasses": {
      "type": "array", "minItems": 6, "maxItems": 6,
      "items": { "type": "object", "required": ["code", "effect"], "properties": { "code": { "type": "string", "pattern": "^[A-Z0-9_|]+$" }, "effect": { "type": "string", "minLength": 20 } }, "additionalProperties": false }
    },
    "productionPrerequisites": { "type": "array", "minItems": 8, "maxItems": 8, "items": { "type": "string", "minLength": 20 } },
    "fixtureRegistry": {
      "type": "object",
      "required": ["schemaVersion", "fixedTime", "cases"],
      "properties": {
        "schemaVersion": { "const": "developer.reits.tech/runner-factory-reconciliation-snapshot-coordinator-fixtures/v1" },
        "fixedTime": { "const": "2026-07-20T20:30:00.000Z" },
        "cases": {
          "type": "array", "minItems": 30, "maxItems": 30,
          "items": {
            "oneOf": [
              { "type": "object", "required": ["id", "profile", "expected", "status", "observedSources"], "properties": { "id": { "type": "string", "pattern": "^RFSC-[0-9]{2}$" }, "profile": { "type": "string", "pattern": "^[a-z][a-z0-9-]+$" }, "expected": { "const": "CAPTURE" }, "status": { "enum": ["COMPLETE", "PARTIAL_UNAVAILABLE", "ALL_UNAVAILABLE"] }, "observedSources": { "type": "integer", "minimum": 0, "maximum": 5 }, "plannerVerdict": { "const": "SCOPE_MISMATCH" } }, "additionalProperties": false },
              { "type": "object", "required": ["id", "profile", "expected", "errorCode"], "properties": { "id": { "type": "string", "pattern": "^RFSC-[0-9]{2}$" }, "profile": { "type": "string", "pattern": "^[a-z][a-z0-9-]+$" }, "expected": { "const": "DENY" }, "errorCode": { "type": "string", "pattern": "^RF_RECON_[A-Z_]+$" } }, "additionalProperties": false }
            ]
          }
        }
      },
      "additionalProperties": false
    },
    "discovery": {
      "type": "object",
      "required": ["reconciliation", "controller", "workbench", "schema"],
      "properties": {
        "reconciliation": { "const": "/api/runner-factory/reconciliation" },
        "controller": { "const": "/api/runner-factory/controller" },
        "workbench": { "const": "/release-foundation#snapshot-coordinator" },
        "schema": { "const": "/schemas/runner-factory-reconciliation-snapshot-coordinator.v1.schema.json" }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
