{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://genesiscode.dev/schemas/release-evidence-aggregate-v0.2.schema.json",
  "title": "GenesisCode release evidence aggregate v0.2",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "contentIdentitySha256",
    "dag",
    "derivedAtUtc",
    "derivation",
    "fanout",
    "github",
    "history",
    "hostHandleLifecycle",
    "kind",
    "productReleaseQualified",
    "profileOperational",
    "readinessStatus",
    "source",
    "status",
    "targetDispositions",
    "version",
    "workers"
  ],
  "properties": {
    "kind": {"const": "genesis/release-evidence-aggregate-v0.2"},
    "version": {"const": "0.2.0"},
    "status": {"const": "pass"},
    "profileOperational": {"const": true},
    "productReleaseQualified": {"const": false},
    "readinessStatus": {"const": "unsupported-product"},
    "contentIdentitySha256": {"$ref": "#/$defs/sha256"},
    "derivedAtUtc": {"type": "string", "format": "date-time"},
    "source": {"type": "object"},
    "dag": {
      "type": "object",
      "additionalProperties": false,
      "required": ["identitySha256", "path"],
      "properties": {
        "identitySha256": {"$ref": "#/$defs/sha256"},
        "path": {"const": "policies/release_evidence_dag_v0.2.json"}
      }
    },
    "github": {
      "type": "object",
      "additionalProperties": false,
      "required": ["repository", "runAttempt", "runId", "sha"],
      "properties": {
        "repository": {"type": "string", "pattern": "^[^/]+/[^/]+$"},
        "runAttempt": {"type": "string", "pattern": "^[1-9][0-9]*$"},
        "runId": {"type": "string", "pattern": "^[1-9][0-9]*$"},
        "sha": {"type": "string", "pattern": "^[0-9a-f]{40}$"}
      }
    },
    "fanout": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "artifactName",
        "bundleIdentitySha256",
        "digestSha256",
        "manifestSha256",
        "producer"
      ],
      "properties": {
        "artifactName": {"type": "string", "minLength": 1},
        "bundleIdentitySha256": {"$ref": "#/$defs/sha256"},
        "digestSha256": {"$ref": "#/$defs/sha256"},
        "manifestSha256": {"$ref": "#/$defs/sha256"},
        "producer": {
          "type": "object",
          "additionalProperties": false,
          "required": ["cacheState", "evidenceClass", "index"],
          "properties": {
            "cacheState": {"const": "cold"},
            "evidenceClass": {"const": "cache-sensitive"},
            "index": {"const": 1}
          }
        }
      }
    },
    "derivation": {
      "type": "object",
      "additionalProperties": false,
      "required": ["readOnly", "rejectedConditions", "wallMs"],
      "properties": {
        "readOnly": {"const": true},
        "rejectedConditions": {
          "type": "array",
          "minItems": 10,
          "maxItems": 10,
          "uniqueItems": true,
          "items": {"type": "string", "minLength": 1}
        },
        "wallMs": {"type": "integer", "minimum": 1, "maximum": 300000}
      }
    },
    "history": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "coldP95ArtifactBytes",
        "coldP95PeakRssBytes",
        "coldP95WallMs",
        "samplesPerCacheState",
        "warmP95ArtifactBytes",
        "warmP95PeakRssBytes",
        "warmP95WallMs"
      ],
      "properties": {
        "coldP95ArtifactBytes": {
          "type": "integer",
          "minimum": 0,
          "maximum": 21474836480
        },
        "coldP95PeakRssBytes": {"type": "integer", "minimum": 1},
        "coldP95WallMs": {"type": "integer", "minimum": 1, "maximum": 2700000},
        "samplesPerCacheState": {"const": 3},
        "warmP95ArtifactBytes": {
          "type": "integer",
          "minimum": 0,
          "maximum": 21474836480
        },
        "warmP95PeakRssBytes": {"type": "integer", "minimum": 1},
        "warmP95WallMs": {"type": "integer", "minimum": 1, "maximum": 2700000}
      }
    },
    "hostHandleLifecycle": {"$ref": "#/$defs/hostHandleLifecycle"},
    "workers": {
      "type": "array",
      "minItems": 10,
      "maxItems": 10,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "cacheState",
          "contentIdentitySha256",
          "evidenceClass",
          "index",
          "manifestSha256"
        ],
        "properties": {
          "cacheState": {"enum": ["cold", "warm", "not-measured"]},
          "contentIdentitySha256": {"$ref": "#/$defs/sha256"},
          "evidenceClass": {
            "enum": ["cache-sensitive", "invariant", "stress-performance"]
          },
          "index": {"type": "integer", "minimum": 1, "maximum": 3},
          "manifestSha256": {"$ref": "#/$defs/sha256"}
        }
      }
    },
    "targetDispositions": {
      "type": "array",
      "minItems": 4,
      "maxItems": 4,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "expectedOutcome",
          "githubRunAttempt",
          "githubRunId",
          "githubSha",
          "releaseQualified",
          "reportArtifact",
          "reportSha256",
          "runner",
          "target"
        ],
        "properties": {
          "expectedOutcome": {"const": "unsupported-product"},
          "githubRunAttempt": {"type": "string", "pattern": "^[1-9][0-9]*$"},
          "githubRunId": {"type": "string", "pattern": "^[1-9][0-9]*$"},
          "githubSha": {"type": "string", "pattern": "^[0-9a-f]{40}$"},
          "releaseQualified": {"const": false},
          "reportArtifact": {"type": "string", "minLength": 1},
          "reportSha256": {"$ref": "#/$defs/sha256"},
          "runner": {"enum": ["macos-15", "ubuntu-24.04"]},
          "target": {"enum": ["android", "edge", "ios", "service-runtime"]}
        }
      }
    }
  },
  "$defs": {
    "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
    "hostHandleLifecycle": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "coverageComplete",
        "custody",
        "independentCrossHostEvidence",
        "lifecyclePaths",
        "negativeControls",
        "nonclaims",
        "r2_2_f_closeable",
        "resourceFamilies",
        "sharedIdentities",
        "status",
        "tier1Hosts",
        "verifiedControls"
      ],
      "properties": {
        "status": {"const": "pass"},
        "coverageComplete": {"const": true},
        "independentCrossHostEvidence": {"const": true},
        "r2_2_f_closeable": {"const": true},
        "custody": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "linuxProducerArtifact",
            "linuxProducerSha256",
            "macosProducerArtifact",
            "macosProducerSha256"
          ],
          "properties": {
            "linuxProducerArtifact": {
              "const": "host-handle-lifecycle/linux/producer-worker.json"
            },
            "linuxProducerSha256": {"$ref": "#/$defs/sha256"},
            "macosProducerArtifact": {
              "const": "host-handle-lifecycle/macos/producer-target.json"
            },
            "macosProducerSha256": {"$ref": "#/$defs/sha256"}
          }
        },
        "lifecyclePaths": {
          "const": [
            "success",
            "error",
            "cancellation",
            "timeout",
            "runtime-drop",
            "restart",
            "repeated-load"
          ]
        },
        "resourceFamilies": {
          "const": [
            "filesystem",
            "network",
            "process",
            "plugin",
            "model-provider-process",
            "warm-daemon-provider-process"
          ]
        },
        "verifiedControls": {
          "const": [
            "bridge-success-error-cancellation-timeout-drop-restart",
            "browser-repeated-close-rejected",
            "editor-repeated-unsubscribe-rejected",
            "graphics-runtime-drop-dispatches-desktop-destroy",
            "gpu-device-explicit-destroy-rejected-after-close",
            "gpu-device-restart-rejects-stale-handles",
            "model-provider-session-success-error-timeout-drop-restart",
            "network-close-failures-cross-public-boundary-after-handle-removal",
            "spawn-pumps-cancel-before-fallback-reap",
            "task-worker-cancel-join-failures-cross-run-boundary",
            "warm-daemon-provider-success-error-timeout-restart-shutdown-eof",
            "warm-worker-cleanup-failures-cross-warm-and-mcp-boundaries",
            "warm-worker-pumps-cancel-before-fallback-reap",
            "xr-repeated-close-rejected"
          ]
        },
        "negativeControls": {
          "const": [
            "accept-reaped-process-group",
            "detect-live-process-group",
            "reject-duplicate-process-identity",
            "reject-malformed-process-record",
            "reject-non-persistent-transport"
          ]
        },
        "nonclaims": {
          "const": [
            "does-not-standardize-the-R5.4.e-model-api",
            "does-not-qualify-unsupported-products-or-platform-packs",
            "does-not-convert-worker-observations-into-release-authority"
          ]
        },
        "sharedIdentities": {
          "type": "object",
          "additionalProperties": false,
          "required": ["probeSourceSha256", "selfhostArtifactSha256"],
          "properties": {
            "probeSourceSha256": {"$ref": "#/$defs/sha256"},
            "selfhostArtifactSha256": {"$ref": "#/$defs/sha256"}
          }
        },
        "tier1Hosts": {
          "type": "array",
          "minItems": 2,
          "maxItems": 2,
          "prefixItems": [
            {
              "$ref": "#/$defs/linuxLifecycleHost"
            },
            {
              "$ref": "#/$defs/macosLifecycleHost"
            }
          ],
          "items": false
        }
      }
    },
    "linuxLifecycleHost": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "architecture", "artifact", "artifactSha256", "maximumCleanupMs",
        "platform", "scope"
      ],
      "properties": {
        "architecture": {"const": "x86_64"},
        "artifact": {
          "const": "host-handle-lifecycle/linux/host_bridge_fault_injection_report.json"
        },
        "artifactSha256": {"$ref": "#/$defs/sha256"},
        "maximumCleanupMs": {"type": "integer", "minimum": 0, "maximum": 8000},
        "platform": {"const": "linux"},
        "scope": {"const": "complete-host-fault-and-daemon-matrix"}
      }
    },
    "macosLifecycleHost": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "architecture", "artifact", "artifactSha256", "maximumCleanupMs",
        "platform", "scope"
      ],
      "properties": {
        "architecture": {"const": "arm64"},
        "artifact": {
          "const": "host-handle-lifecycle/macos/host_bridge_daemon_lifecycle_report.json"
        },
        "artifactSha256": {"$ref": "#/$defs/sha256"},
        "maximumCleanupMs": {"type": "integer", "minimum": 0, "maximum": 8000},
        "platform": {"const": "darwin"},
        "scope": {"const": "public-warm-daemon-lifecycle"}
      }
    }
  }
}
