{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://sneakoscope.local/schemas/release/release-gate-node.schema.json",
  "type": "object",
  "required": ["schema", "gates"],
  "properties": {
    "schema": { "const": "sks.release-gates.v2" },
    "gates": {
      "type": "array",
      "items": {
        "type": "object",
        "required": ["id", "command", "deps", "resource", "side_effect", "timeout_ms", "cache", "isolation", "preset"],
        "properties": {
          "id": { "type": "string", "minLength": 1 },
          "command": { "type": "string", "minLength": 1 },
          "deps": { "type": "array", "items": { "type": "string" } },
          "resource": {
            "type": "array",
            "minItems": 1,
            "items": {
              "enum": ["cpu-light", "cpu-heavy", "io-light", "io-heavy", "git", "git-worktree", "zellij-real", "browser-real", "secret-sensitive", "local-llm-real", "remote-model-real", "python", "network", "global-config", "publish", "fs-read", "fs-write", "timing-sensitive"]
            }
          },
          "side_effect": { "enum": ["hermetic", "real-env"] },
          "timeout_ms": { "type": "integer", "minimum": 1 },
          "output_contract": { "const": "sks.gate-result.v1" },
          "contract_note": { "type": "string", "minLength": 1 },
          "cache": {
            "type": "object",
            "required": ["enabled", "inputs"],
            "properties": {
              "enabled": { "type": "boolean" },
              "inputs": { "type": "array", "items": { "type": "string" } }
            },
            "additionalProperties": false
          },
          "isolation": {
            "type": "object",
            "required": ["home", "codex_home", "report_dir"],
            "properties": {
              "home": { "enum": ["temp", "inherit"] },
              "codex_home": { "enum": ["temp", "inherit"] },
              "report_dir": { "const": "per-gate" }
            },
            "additionalProperties": false
          },
          "preset": { "type": "array", "items": { "type": "string" } }
        },
        "additionalProperties": false
      }
    }
  },
  "additionalProperties": false
}
