{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://developer.reits.tech/schemas/runner-factory-controller-target-host-driver-qualification.v1.schema.json",
  "title": "REITs target-host driver qualification contract",
  "type": "object",
  "required": ["schemaVersion", "status", "observedAt", "scope", "truth", "operations", "descriptor", "operationPorts", "pathPolicy", "systemdActionPolicy", "denialProfiles", "stateModel", "invariants", "verification", "productionPrerequisites", "fixtureRegistry", "discovery"],
  "properties": {
    "schemaVersion": { "const": "developer.reits.tech/runner-factory-target-host-driver-qualification/v1" },
    "status": { "const": "TARGET_HOST_DRIVER_QUALIFICATION_IMPLEMENTED_NOT_CONFIGURED" },
    "observedAt": { "type": "string", "format": "date-time" },
    "scope": {
      "type": "object",
      "required": ["mode", "input", "output", "packageLoaded", "driverExecuted", "networkAuthority", "deploymentAuthority", "productionEntrypointWired"],
      "properties": {
        "mode": { "const": "DOSSIER_VERIFICATION_ONLY" },
        "input": { "const": "EXACT_TRANSACTION_CONTRACT_DRIVER_DESCRIPTOR_AND_SIGNED_QUALIFICATION_EVIDENCE" },
        "output": { "const": "TEST_ONLY_TARGET_HOST_DRIVER_QUALIFICATION_RECEIPT" },
        "packageLoaded": { "const": false },
        "driverExecuted": { "const": false },
        "networkAuthority": { "const": "NONE" },
        "deploymentAuthority": { "const": "NONE" },
        "productionEntrypointWired": { "const": false }
      },
      "additionalProperties": false
    },
    "truth": {
      "type": "object",
      "required": ["productionCandidatePackages", "productionDriversConfigured", "systemdUnitsInstalled", "controllerServicesStarted", "controllerListeners", "listenerStarts", "publicRoutes", "reverseProxyRoutes", "externalReadsExecuted", "externalWritesExecuted", "mutationsExecuted", "paidResourcesCreated", "deploymentPermitted"],
      "properties": {
        "productionCandidatePackages": { "const": 0 }, "productionDriversConfigured": { "const": 0 }, "systemdUnitsInstalled": { "const": 0 }, "controllerServicesStarted": { "const": 0 }, "controllerListeners": { "const": 0 }, "listenerStarts": { "const": 0 }, "publicRoutes": { "const": 0 }, "reverseProxyRoutes": { "const": 0 }, "externalReadsExecuted": { "const": 0 }, "externalWritesExecuted": { "const": 0 }, "mutationsExecuted": { "const": 0 }, "paidResourcesCreated": { "const": false }, "deploymentPermitted": { "const": false }
      },
      "additionalProperties": false
    },
    "operations": { "type": "array", "minItems": 4, "maxItems": 4, "items": { "type": "object", "required": ["id", "guard", "result"], "properties": { "id": { "enum": ["prepare", "qualify", "verify", "dispose"] }, "guard": { "type": "string" }, "result": { "type": "string" } }, "additionalProperties": false } },
    "descriptor": {
      "type": "object",
      "required": ["packageName", "platform", "interfaceMode", "operationPorts", "permittedPaths", "systemdActions", "genericCommandPort", "shellInterpolation", "networkClient", "credentialReads", "stepReceiptSigner", "monotonicJournal"],
      "properties": {
        "packageName": { "const": "@reits/runner-factory-target-host-driver" }, "platform": { "const": "linux/amd64" }, "interfaceMode": { "const": "TYPED_EFFECT_PORTS_ONLY" }, "operationPorts": { "const": 9 }, "permittedPaths": { "const": 4 }, "systemdActions": { "const": 5 }, "genericCommandPort": { "const": false }, "shellInterpolation": { "const": false }, "networkClient": { "const": false }, "credentialReads": { "const": false }, "stepReceiptSigner": { "const": "ASYMMETRIC_REQUIRED_NOT_CONFIGURED" }, "monotonicJournal": { "const": "DURABLE_REQUIRED_NOT_CONFIGURED" }
      },
      "additionalProperties": false
    },
    "operationPorts": { "type": "array", "minItems": 9, "maxItems": 9, "items": { "type": "object", "required": ["id", "operation"], "properties": { "id": { "type": "string", "minLength": 3 }, "operation": { "type": "string", "minLength": 3 } }, "additionalProperties": false } },
    "pathPolicy": { "type": "array", "minItems": 4, "maxItems": 4, "items": { "type": "object", "required": ["id", "path", "access"], "properties": { "id": { "type": "string" }, "path": { "type": "string" }, "access": { "type": "string" } }, "additionalProperties": false } },
    "systemdActionPolicy": { "type": "array", "minItems": 5, "maxItems": 5, "items": { "type": "object", "required": ["action", "scope"], "properties": { "action": { "type": "string" }, "scope": { "type": "string" } }, "additionalProperties": false } },
    "denialProfiles": { "const": ["GENERIC_COMMAND_PORT", "SHELL_INTERPOLATION", "PATH_TRAVERSAL", "DYNAMIC_UNIT_NAME", "PUBLIC_BIND", "REVERSE_PROXY", "CREDENTIAL_READ", "UNSIGNED_STEP_RECEIPT"] },
    "stateModel": { "type": "array", "minItems": 8, "maxItems": 8 },
    "invariants": { "type": "array", "minItems": 44, "maxItems": 44, "items": { "type": "string", "minLength": 12 } },
    "verification": {
      "type": "object",
      "required": ["status", "fixtures", "acceptedOutcomes", "deniedOutcomes", "transactionReceiptsVerified", "evidenceSignaturesVerified", "qualifiedDossiers", "qualificationReceiptsVerified", "productionCandidatePackages", "productionDriversConfigured", "systemdUnitsInstalled", "controllerServicesStarted", "listenerStarts", "externalReadsExecuted", "externalWritesExecuted", "mutationsExecuted"],
      "properties": {
        "status": { "const": "PASS_FIXTURE_ONLY" }, "fixtures": { "const": 64 }, "acceptedOutcomes": { "const": 8 }, "deniedOutcomes": { "const": 56 }, "transactionReceiptsVerified": { "const": 49 }, "evidenceSignaturesVerified": { "const": 198 }, "qualifiedDossiers": { "const": 6 }, "qualificationReceiptsVerified": { "const": 2 }, "productionCandidatePackages": { "const": 0 }, "productionDriversConfigured": { "const": 0 }, "systemdUnitsInstalled": { "const": 0 }, "controllerServicesStarted": { "const": 0 }, "listenerStarts": { "const": 0 }, "externalReadsExecuted": { "const": 0 }, "externalWritesExecuted": { "const": 0 }, "mutationsExecuted": { "const": 0 }
      },
      "additionalProperties": false
    },
    "productionPrerequisites": { "type": "array", "minItems": 9, "maxItems": 9, "items": { "type": "string", "minLength": 12 } },
    "fixtureRegistry": {
      "type": "object",
      "required": ["schemaVersion", "fixedTime", "cases"],
      "properties": {
        "schemaVersion": { "const": "developer.reits.tech/runner-factory-target-host-driver-qualification-fixtures/v1" },
        "fixedTime": { "const": "2026-07-21T06:00:00.000Z" },
        "cases": { "type": "array", "minItems": 64, "maxItems": 64 }
      },
      "additionalProperties": false
    },
    "discovery": {
      "type": "object",
      "required": ["controller", "lifecycle", "upstream", "workbench", "schema"],
      "properties": {
        "controller": { "const": "/api/runner-factory/controller" },
        "lifecycle": { "const": "/api/runner-factory" },
        "upstream": { "const": "/api/runner-factory/controller/activation-transaction" },
        "workbench": { "const": "/release-foundation#target-host-driver-qualification" },
        "schema": { "const": "/schemas/runner-factory-controller-target-host-driver-qualification.v1.schema.json" }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
