{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/logbrew/json-schema/logbrew-release-page-response-schema.json",
  "title": "ReleasePageResponse",
  "description": "Opt-in page of release aggregates.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/logbrew-releases-api-openapi.yml#/components/schemas/ReleasePageResponse",
  "properties": {
    "next_cursor": {
      "anyOf": [
        {
          "$ref": "#/$defs/ReleaseCursorResponse"
        },
        {
          "type": "null"
        }
      ],
      "description": "Exclusive continuation key when another page exists."
    },
    "releases": {
      "description": "Release aggregates in newest-first order.",
      "items": {
        "$ref": "#/$defs/ReleaseResponse"
      },
      "type": "array"
    }
  },
  "required": [
    "releases",
    "next_cursor"
  ],
  "type": "object",
  "$defs": {
    "ReleaseCursorResponse": {
      "description": "Complete continuation key for a release aggregate page.",
      "properties": {
        "environment": {
          "description": "Environment of the final aggregate.",
          "type": "string"
        },
        "project_id": {
          "description": "Owning project of the final release in the page.",
          "format": "uuid",
          "type": "string"
        },
        "release": {
          "description": "Release value of the final aggregate.",
          "type": "string"
        },
        "service_name": {
          "description": "Service name of the final aggregate.",
          "type": "string"
        },
        "time": {
          "description": "Most recent observation time of the final release in the page.",
          "format": "date-time",
          "type": "string"
        }
      },
      "required": [
        "time",
        "project_id",
        "release",
        "environment",
        "service_name"
      ],
      "type": "object"
    },
    "ReleaseNextActionCode": {
      "description": "Stable release investigation action code.",
      "oneOf": [
        {
          "const": "inspect_release_issues",
          "description": "Inspect grouped issues observed in the release.",
          "type": "string"
        },
        {
          "const": "inspect_release_traces",
          "description": "Inspect traces observed in the release.",
          "type": "string"
        },
        {
          "const": "inspect_release_logs",
          "description": "Inspect logs observed in the release.",
          "type": "string"
        },
        {
          "const": "inspect_release_actions",
          "description": "Inspect product actions observed in the release.",
          "type": "string"
        },
        {
          "const": "inspect_release_metrics",
          "description": "Inspect metrics observed in the release.",
          "type": "string"
        },
        {
          "const": "review_release_telemetry",
          "description": "Review release-scoped telemetry when no signal count is positive.",
          "type": "string"
        }
      ]
    },
    "ReleaseNextActionResponse": {
      "description": "Machine-readable next investigation action for a release.",
      "properties": {
        "code": {
          "$ref": "#/$defs/ReleaseNextActionCode",
          "description": "Stable action code."
        },
        "target": {
          "$ref": "#/$defs/ReleaseNextActionTarget",
          "description": "Stable action target."
        }
      },
      "required": [
        "code",
        "target"
      ],
      "type": "object"
    },
    "ReleaseNextActionTarget": {
      "description": "Stable release investigation target.",
      "oneOf": [
        {
          "const": "telemetry_issues",
          "description": "Grouped issue list.",
          "type": "string"
        },
        {
          "const": "trace_explorer",
          "description": "Privacy-safe recent trace explorer.",
          "type": "string"
        },
        {
          "const": "telemetry_logs",
          "description": "Native telemetry logs.",
          "type": "string"
        },
        {
          "const": "telemetry_actions",
          "description": "Product action list.",
          "type": "string"
        },
        {
          "const": "telemetry_metrics",
          "description": "SDK metric list.",
          "type": "string"
        },
        {
          "const": "telemetry_reads",
          "description": "General telemetry read surfaces.",
          "type": "string"
        }
      ]
    },
    "ReleaseResponse": {
      "description": "A release summary returned to API clients.",
      "properties": {
        "action_count": {
          "description": "Number of action items assigned to this release.",
          "format": "int64",
          "type": "integer"
        },
        "environment": {
          "description": "Deployment environment.",
          "type": "string"
        },
        "first_seen_at": {
          "description": "First time this release was seen.",
          "format": "date-time",
          "type": "string"
        },
        "issue_count": {
          "description": "Number of issue items assigned to this release.",
          "format": "int64",
          "type": "integer"
        },
        "last_seen_at": {
          "description": "Most recent time this release was seen.",
          "format": "date-time",
          "type": "string"
        },
        "log_count": {
          "description": "Number of log items assigned to this release.",
          "format": "int64",
          "type": "integer"
        },
        "metric_count": {
          "description": "Number of metric items assigned to this release.",
          "format": "int64",
          "type": "integer"
        },
        "next_action": {
          "$ref": "#/$defs/ReleaseNextActionResponse",
          "description": "Machine-readable next investigation action."
        },
        "project_id": {
          "description": "Owning project identifier.",
          "format": "uuid",
          "type": "string"
        },
        "release": {
          "description": "Application release.",
          "type": "string"
        },
        "service_name": {
          "description": "Logical service name.",
          "type": "string"
        },
        "trace_health": {
          "$ref": "#/$defs/ReleaseTraceHealthResponse",
          "description": "Privacy-safe trace error health for this release and service."
        },
        "trace_span_count": {
          "description": "Number of trace span items assigned to this release.",
          "format": "int64",
          "type": "integer"
        }
      },
      "required": [
        "project_id",
        "release",
        "environment",
        "service_name",
        "issue_count",
        "log_count",
        "trace_span_count",
        "action_count",
        "metric_count",
        "first_seen_at",
        "last_seen_at",
        "trace_health",
        "next_action"
      ],
      "type": "object"
    },
    "ReleaseTraceHealthResponse": {
      "description": "Privacy-safe trace health observed for one release and service.",
      "properties": {
        "error_rate_basis_points": {
          "description": "Error-trace rate from 0 to 10,000 basis points.",
          "format": "uint16",
          "maximum": 65535,
          "minimum": 0,
          "type": "integer"
        },
        "error_trace_count": {
          "description": "Distinct traces containing at least one error span.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        },
        "status": {
          "$ref": "#/$defs/ReleaseTraceHealthStatus",
          "description": "Honest observed state without claiming that a release caused errors."
        },
        "trace_count": {
          "description": "Distinct traces observed for the release and service.",
          "format": "uint64",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "status",
        "trace_count",
        "error_trace_count",
        "error_rate_basis_points"
      ],
      "type": "object"
    },
    "ReleaseTraceHealthStatus": {
      "description": "Honest release trace-health states.",
      "oneOf": [
        {
          "const": "unknown",
          "description": "No trace data is available for this release and service.",
          "type": "string"
        },
        {
          "const": "no_errors_observed",
          "description": "Traces are present and none contain an observed error span.",
          "type": "string"
        },
        {
          "const": "errors_observed",
          "description": "At least one observed trace contains an error span.",
          "type": "string"
        }
      ]
    }
  }
}