{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cloudworldmodel-ai/json-schema/cloudworldmodel-ai-batch-chaos-job-schema.json",
  "title": "BatchChaosJob",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/cloudworldmodel-ai-chaos-engineering-api-openapi.yml#/components/schemas/BatchChaosJob",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Unique batch job identifier"
    },
    "status": {
      "type": "string",
      "enum": [
        "pending",
        "running",
        "completed",
        "failed",
        "cancelled",
        "partial_failed"
      ],
      "description": "Current batch status. 'partial_failed' indicates some child jobs failed but others succeeded.\n"
    },
    "childJobIds": {
      "type": "array",
      "description": "IDs of all child chaos jobs in this batch",
      "items": {
        "type": "string",
        "format": "uuid"
      }
    },
    "totalJobs": {
      "type": "integer",
      "description": "Total number of child jobs in this batch"
    },
    "completedJobs": {
      "type": "integer",
      "description": "Number of child jobs that completed successfully"
    },
    "failedJobs": {
      "type": "integer",
      "description": "Number of child jobs that failed"
    },
    "cancelledJobs": {
      "type": "integer",
      "description": "Number of child jobs that were cancelled"
    },
    "childJobProgress": {
      "type": "array",
      "description": "Lightweight child progress in submission order on GET /chaos/batch/{batchId}, available while pending or running and after completion. Does not include child results or unrelated child data.\n",
      "items": {
        "type": "object",
        "required": [
          "jobId",
          "status"
        ],
        "properties": {
          "jobId": {
            "type": "string",
            "description": "Child chaos job ID"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "completed",
              "failed",
              "cancelled"
            ]
          },
          "scenarioId": {
            "type": "string",
            "description": "Prebuilt scenario ID, omitted for custom injections"
          },
          "scenarioRecoveryDelays": {
            "type": "object",
            "description": "Requested overrides for a prebuilt database_crash scenario only. Missing delay fields mean simulator defaults (promotion 30 seconds, restart 1800 seconds); these are not the effective per-target delays reported in completed child results.\n",
            "properties": {
              "promotionDelaySeconds": {
                "type": "integer",
                "minimum": 0,
                "maximum": 86400
              },
              "restartDelaySeconds": {
                "type": "integer",
                "minimum": 0,
                "maximum": 86400
              }
            }
          }
        }
      }
    },
    "aggregatedResilienceScore": {
      "allOf": [
        {
          "$ref": "#/$defs/ResilienceScore"
        }
      ],
      "description": "Aggregated resilience score across all completed child jobs. Only present when status is \"completed\"."
    },
    "aggregatedVulnerabilities": {
      "type": "array",
      "description": "Aggregated vulnerabilities from all child jobs (deduplicated with occurrence counts). Only present when status is \"completed\".",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Vulnerability identifier"
          },
          "severity": {
            "type": "string",
            "enum": [
              "critical",
              "high",
              "medium",
              "low"
            ],
            "description": "Severity level"
          },
          "title": {
            "type": "string",
            "description": "Vulnerability title"
          },
          "description": {
            "type": "string",
            "description": "Detailed description"
          },
          "occurrences": {
            "type": "integer",
            "description": "Number of child jobs where this vulnerability was detected"
          }
        }
      }
    },
    "aggregatedRecommendations": {
      "type": "array",
      "description": "Aggregated recommendations from all child jobs (deduplicated). Only present when status is \"completed\".",
      "items": {
        "type": "string"
      }
    },
    "childJobResults": {
      "type": "array",
      "description": "Summary results for each child job (lightweight version for status endpoint)",
      "items": {
        "type": "object",
        "properties": {
          "jobId": {
            "type": "string",
            "format": "uuid",
            "description": "Child job ID"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "running",
              "completed",
              "failed",
              "cancelled"
            ],
            "description": "Child job status"
          },
          "resilienceScore": {
            "allOf": [
              {
                "$ref": "#/$defs/ResilienceScore"
              }
            ],
            "description": "Resilience score (only present if completed)"
          },
          "vulnerabilities": {
            "type": "array",
            "description": "Vulnerabilities detected (only present if completed)",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "description": "Error message if failed"
          }
        }
      }
    },
    "webhookUrl": {
      "type": "string",
      "format": "uri",
      "description": "Webhook URL for batch completion notification"
    },
    "webhookDeliveryStatus": {
      "type": "string",
      "enum": [
        "pending",
        "delivered",
        "failed"
      ],
      "description": "Webhook delivery status"
    },
    "webhookDeliveryAttempts": {
      "type": "integer",
      "description": "Number of webhook delivery attempts made"
    },
    "webhookDeliveryError": {
      "type": "string",
      "description": "Error message if webhook delivery failed"
    },
    "webhookDeliveredAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timestamp when webhook was successfully delivered"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the batch was created"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the batch was last updated"
    },
    "completedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the batch completed (or failed)"
    },
    "cancelledAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the batch was cancelled"
    },
    "error": {
      "type": "string",
      "description": "Error message if batch failed"
    }
  },
  "$defs": {
    "EksSpotMigrationEvent": {
      "type": "object",
      "required": [
        "type",
        "timestampSeconds",
        "resourceId",
        "resourceName",
        "deadlineSeconds",
        "workloadCount",
        "readyWorkloadCount",
        "migrationDurationSeconds",
        "remainingDeadlineSeconds"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "interruption_notice",
            "migration_deadline",
            "workload_migration_started",
            "workload_ready",
            "deadline_outcome"
          ]
        },
        "timestampSeconds": {
          "type": "number",
          "minimum": 0
        },
        "resourceId": {
          "type": "string"
        },
        "resourceName": {
          "type": "string"
        },
        "deadlineSeconds": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "workloadCount": {
          "type": "integer",
          "minimum": 0
        },
        "readyWorkloadCount": {
          "type": "integer",
          "minimum": 0
        },
        "migrationDurationSeconds": {
          "type": "number",
          "minimum": 0
        },
        "remainingDeadlineSeconds": {
          "type": "number"
        },
        "replacementNodeCount": {
          "type": "integer",
          "minimum": 0
        },
        "outcome": {
          "type": "string",
          "enum": [
            "hit",
            "miss"
          ]
        }
      }
    },
    "EksSpotMigrationState": {
      "type": "object",
      "description": "Current bounded EKS Spot interruption migration state. This evidence describes migration completion against the 120-second deadline and is separate from sustained service-health recovery.\n",
      "required": [
        "resourceId",
        "resourceName",
        "status",
        "noticeAtSeconds",
        "deadlineAtSeconds",
        "migrationStartedAtSeconds",
        "migrationDurationSeconds",
        "workloadCount",
        "readyWorkloadCount",
        "remainingDeadlineSeconds",
        "unavailableCapacity"
      ],
      "properties": {
        "resourceId": {
          "type": "string"
        },
        "resourceName": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "not_started",
            "notice",
            "migrating",
            "ready",
            "deadline_hit",
            "deadline_missed"
          ]
        },
        "noticeAtSeconds": {
          "type": "number",
          "minimum": 0
        },
        "deadlineAtSeconds": {
          "type": "number",
          "minimum": 0
        },
        "migrationStartedAtSeconds": {
          "type": "number",
          "minimum": 0
        },
        "migrationDurationSeconds": {
          "type": "number",
          "minimum": 0
        },
        "workloadCount": {
          "type": "integer",
          "minimum": 0
        },
        "readyWorkloadCount": {
          "type": "integer",
          "minimum": 0
        },
        "remainingDeadlineSeconds": {
          "type": "number"
        },
        "unavailableCapacity": {
          "type": "number",
          "minimum": 0
        },
        "replacementNodeCount": {
          "type": "integer",
          "minimum": 0
        },
        "outcome": {
          "type": "string",
          "enum": [
            "hit",
            "miss"
          ]
        }
      }
    },
    "HealthCheckLifecycle": {
      "type": "object",
      "required": [
        "resourceId",
        "resourceName",
        "platform",
        "checkType",
        "desiredReplicas",
        "unhealthyReplicas",
        "deregisteredReplicas",
        "replacementReplicas",
        "readyReplicas",
        "unhealthyAtSeconds",
        "deregisteredAtSeconds",
        "replacementStartedAtSeconds",
        "readyAtSeconds",
        "albFailOpen"
      ],
      "properties": {
        "resourceId": {
          "type": "string"
        },
        "resourceName": {
          "type": "string"
        },
        "platform": {
          "type": "string",
          "enum": [
            "ecs",
            "kubernetes"
          ]
        },
        "checkType": {
          "type": "string",
          "enum": [
            "load_balancer_readiness",
            "liveness",
            "readiness"
          ]
        },
        "desiredReplicas": {
          "type": "integer",
          "minimum": 0
        },
        "unhealthyReplicas": {
          "type": "integer",
          "minimum": 0
        },
        "deregisteredReplicas": {
          "type": "integer",
          "minimum": 0
        },
        "replacementReplicas": {
          "type": "integer",
          "minimum": 0
        },
        "readyReplicas": {
          "type": "integer",
          "minimum": 0
        },
        "unhealthyAtSeconds": {
          "type": [
            "number",
            "null"
          ]
        },
        "deregisteredAtSeconds": {
          "type": [
            "number",
            "null"
          ]
        },
        "replacementStartedAtSeconds": {
          "type": [
            "number",
            "null"
          ]
        },
        "scheduledReadyAtSeconds": {
          "type": [
            "number",
            "null"
          ],
          "description": "Estimated minimum cold-start completion; readyAtSeconds is set only when readiness is observed."
        },
        "readyAtSeconds": {
          "type": [
            "number",
            "null"
          ],
          "description": "First simulation-clock sample at which readiness is actually observed."
        },
        "albFailOpen": {
          "type": "boolean"
        }
      }
    },
    "ResilienceMetrics": {
      "type": "object",
      "description": "Resilience measurements over the same simulation-time request window. `availabilityPercent` is successful service over offered requests (goodput divided by offered load), not the percentage of samples below the 5% recovery-health threshold. When offered-load evidence is absent, the authoritative basis and explicit estimate are in `outcome`; no request totals are invented. `recoveryTimeSeconds` and `meanTimeToRecovery` are null when no sustained recovery was observed; older stored reports may contain 0 as a legacy sentinel, not proof of immediate recovery. Use recovery milestones and `sustainPeriodCompleted` in `outcome` to distinguish\n unrecovered, recovered, and recovered-then-regressed runs. A 15%\n error rate with zero goodput and no offered load is unavailable, not\n 85% availability. A healthy history with no detected incident has\n baseline evidence only and no recovery milestone. In a batch, mixing\n request-backed children with a rate-only `estimated_from_error_rate`\n child makes the offered denominator unavailable; independent goodput,\n request-window duration, and duration-weighted error-rate evidence remain\n reported. Graceful degradation is the percentage of offered requests\n successfully served in the same window; without a complete positive\n denominator its score is 0, not evidence of successful service. Batch\n recovery duration is null if any child incident did not recover.\n",
      "required": [
        "recoveryTimeSeconds",
        "availabilityPercent",
        "dataLossIncidents",
        "gracefulDegradationScore",
        "meanTimeToRecovery",
        "errorRateDuringChaos"
      ],
      "properties": {
        "healthCheckLifecycle": {
          "type": "array",
          "maxItems": 64,
          "description": "Per-resource unhealthy, deregistration, replacement/restart, readiness, and ALB fail-open evidence.",
          "items": {
            "$ref": "#/$defs/HealthCheckLifecycle"
          }
        },
        "databaseCrashAssumptions": {
          "type": "array",
          "maxItems": 32,
          "description": "Effective simulation-clock assumptions for each database_crash target, including defaults, in injection order. Absent on older reports and on runs with no database crash. Both delays are reported even though only the delay selected by recoveryMode applies to a given target. Neither value is a provider SLA. Available on single-job results and on each childJobs[].resilienceScore in batch results.\n",
          "items": {
            "type": "object",
            "required": [
              "targetResourceId",
              "recoveryMode",
              "promotionDelaySeconds",
              "restartDelaySeconds"
            ],
            "properties": {
              "targetResourceId": {
                "type": "string"
              },
              "recoveryMode": {
                "type": "string",
                "enum": [
                  "explicit_replica_promotion",
                  "sole_writer_restart"
                ]
              },
              "promotionUnavailableReason": {
                "type": "string",
                "enum": [
                  "related_replica_unavailable_at_injection"
                ],
                "description": "Present only when an explicitly related replica exists but is unavailable at injection time (including a simultaneous crash). The writer uses sole_writer_restart; promotionDelaySeconds is reported but does not apply."
              },
              "promotionDelaySeconds": {
                "type": "integer",
                "minimum": 0,
                "maximum": 86400
              },
              "restartDelaySeconds": {
                "type": "integer",
                "minimum": 0,
                "maximum": 86400
              }
            }
          }
        },
        "latencyP95Ms": {
          "type": [
            "number",
            "null"
          ],
          "description": "Maximum sampled per-interval p95 latency in milliseconds; null when no serving interval has latency evidence. Not a pooled request percentile."
        },
        "chaosIntervals": {
          "type": "array",
          "maxItems": 100,
          "description": "Bounded ten-second [startSeconds,endSeconds) simulation-clock intervals (last interval clipped at job duration). Rates integrate by interval duration into outcome request totals. Null means unavailable, not zero; targetStatus remains critical during the crash. Connected writers are hard dependencies: any required writer without its own serving replacement causes 100% errors and zero goodput, including when another independent writer is healthy or crashes concurrently. Without connection edges each writer is considered required; crashing a non-serving reader does not cause this outage. servingResourceId identifies only the first crash target (or its explicitly related promoted replica) when aggregate service is available, otherwise null; it never identifies an unrelated writer. Database crashes honor startTime on the ten-second sampling clock. No task, ACU, or connection-usage values are inferred. databaseTargets reports each distinct crashed database separately; rates and request totals remain aggregate interval values, never duplicated per target. Absent on older persisted reports.\n",
          "items": {
            "type": "object",
            "required": [
              "startSeconds",
              "endSeconds",
              "offeredRps",
              "errorRatePercent",
              "successfulThroughputRps",
              "latencyP95Ms",
              "targetResourceId",
              "servingResourceId",
              "targetStatus",
              "servingStatus",
              "servingMaxConnections"
            ],
            "properties": {
              "startSeconds": {
                "type": "number"
              },
              "endSeconds": {
                "type": "number"
              },
              "offeredRps": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "errorRatePercent": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "successfulThroughputRps": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "latencyP95Ms": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "targetResourceId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "servingResourceId": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "targetStatus": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "healthy",
                  "warning",
                  "critical"
                ]
              },
              "servingStatus": {
                "type": [
                  "string",
                  "null"
                ],
                "enum": [
                  "healthy",
                  "warning",
                  "critical"
                ]
              },
              "servingMaxConnections": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "Configured connection limit, not measured live connections."
              },
              "databaseTargets": {
                "type": "array",
                "maxItems": 32,
                "description": "One entry per distinct database crash target, in injection order. A null targetStatus means the target was removed after explicit replica promotion. Replacement is null while promotion/restart is pending; for sole-writer restart the replacement is the original target. Connection limits are configured capacity, not observed usage. No per-target request counts are implied.\n",
                "items": {
                  "type": "object",
                  "required": [
                    "targetResourceId",
                    "targetStatus",
                    "servingReplacementResourceId",
                    "servingReplacementStatus",
                    "servingReplacementMaxConnections"
                  ],
                  "properties": {
                    "targetResourceId": {
                      "type": "string"
                    },
                    "targetStatus": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "healthy",
                        "warning",
                        "critical"
                      ]
                    },
                    "servingReplacementResourceId": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "servingReplacementStatus": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "enum": [
                        "healthy",
                        "warning",
                        "critical"
                      ]
                    },
                    "servingReplacementMaxConnections": {
                      "type": [
                        "number",
                        "null"
                      ],
                      "description": "Configured connection limit, not measured live connections."
                    }
                  }
                }
              },
              "healthChecks": {
                "type": "array",
                "maxItems": 64,
                "items": {
                  "$ref": "#/$defs/HealthCheckLifecycle"
                }
              }
            }
          }
        },
        "recoveryTimeSeconds": {
          "type": [
            "number",
            "null"
          ],
          "description": "Observed sustained recovery duration in simulation seconds, null when unobserved. Older reports may contain a legacy zero sentinel; consult outcome recovery milestones for authoritative status.\n"
        },
        "availabilityPercent": {
          "type": "number",
          "description": "Successful service percentage over the measured request window, clamped to 0-100. With observed offered load this is successfulRequests / observedOfferedRequests × 100 (equivalently duration-weighted goodput / offered RPS); 15% error with valid offered load is approximately 85%, even when no sample is below the recovery threshold.\n",
          "minimum": 0,
          "maximum": 100
        },
        "dataLossIncidents": {
          "type": "number",
          "description": "Count of data-loss or corruption incidents observed during the run."
        },
        "gracefulDegradationScore": {
          "type": "number",
          "description": "Successful requests divided by offered requests over the bounded chaos window (0-100). Zero when no complete positive denominator establishes partial service; scoringReason explains the basis.\n"
        },
        "meanTimeToDetect": {
          "type": "number",
          "description": "Average time to detect failures (seconds)"
        },
        "meanTimeToRecovery": {
          "type": [
            "number",
            "null"
          ],
          "description": "Observed sustained recovery duration in simulation seconds; null if unobserved. Legacy stored zero is not proof of recovery.\n"
        },
        "errorRateDuringChaos": {
          "type": "number",
          "description": "Error rate during chaos in percentage points."
        },
        "eksSpotMigration": {
          "$ref": "#/$defs/EksSpotMigrationState"
        },
        "eksSpotMigrations": {
          "type": "array",
          "description": "Per-resource EKS Spot migration evidence for concurrent active migrations.",
          "items": {
            "$ref": "#/$defs/EksSpotMigrationState"
          }
        },
        "eksSpotMigrationEvents": {
          "type": "array",
          "description": "EKS Spot interruption lifecycle events; intentionally separate from sustained recovery evidence.",
          "items": {
            "$ref": "#/$defs/EksSpotMigrationEvent"
          }
        },
        "errorRateDuringFailure": {
          "type": "number",
          "description": "Legacy alias for the error rate during failures (percentage points)."
        },
        "outcome": {
          "type": "object",
          "description": "Optional authoritative outcome evidence. The object is omitted for legacy results that predate this contract; when present, all fields below describe one common simulation-time request window. RPS fields are rates and request fields are totals over that window. A positive modeled shedding value means offered work exceeded modeled serving\n  capacity; it is not silently counted as an application error and is\n  never fabricated from goodput or error rate. For batch results,\n  request-backed evidence mixed with a rate-only\n  `estimated_from_error_rate` child yields\n  `availabilityBasis: \"unavailable\"` rather than combining an\n  observed subset into a denominator; goodput, duration, and error-rate\n  evidence remain independent.\n",
          "required": [
            "availabilityBasis",
            "requestWindowSeconds",
            "observedOfferedRequests",
            "estimatedOfferedRequests",
            "successfulRequests",
            "modeledShedRequests",
            "observedOfferedLoadRps",
            "estimatedOfferedLoadRps",
            "successfulThroughputRps",
            "modeledSheddingRps",
            "errorRatePercent",
            "recovery"
          ],
          "properties": {
            "availabilityBasis": {
              "type": "string",
              "enum": [
                "observed_offered_load",
                "estimated_from_goodput_and_error_rate",
                "estimated_from_error_rate",
                "mixed_observed_and_estimated",
                "unavailable"
              ],
              "description": "Evidence basis for availability and offered-load values. `mixed_observed_and_estimated` combines observed offered load with goodput-and-error-rate modeled demand only. A batch that mixes request-backed evidence with a rate-only `estimated_from_error_rate` child is `unavailable`, because no relative request weight exists for that child.\n"
            },
            "requestWindowSeconds": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0,
              "description": "Exact duration of the normalized simulation-time request window, including the final sample duration. The analyzer's optional windowEndSeconds input clips the final interval to an exact exclusive boundary; this public field reports the resulting duration.\n"
            },
            "observedOfferedRequests": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0,
              "description": "Observed original-client offered request total over the window."
            },
            "estimatedOfferedRequests": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0,
              "deprecated": true,
              "description": "Deprecated compatibility alias for modeledOfferedRequests. This value is an estimate, never an observed request count.\n"
            },
            "modeledOfferedRequests": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0,
              "description": "Offered request total modeled from goodput and error rate when no aggregate original-client denominator exists. This is an estimate, not an observed request count.\n"
            },
            "successfulRequests": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0,
              "description": "Successful request total (goodput × duration) over the window."
            },
            "modeledShedRequests": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0,
              "description": "Requests explicitly shed by modeled capacity limits over the window; null when not evidenced."
            },
            "observedOfferedLoadRps": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0,
              "description": "Observed original-client offered load rate for the window."
            },
            "estimatedOfferedLoadRps": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0,
              "deprecated": true,
              "description": "Deprecated compatibility alias for modeledOfferedLoadRps. This value is an estimate, never observed offered load.\n"
            },
            "modeledOfferedLoadRps": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0,
              "description": "Offered load rate modeled from goodput and error rate when no aggregate original-client denominator exists.\n"
            },
            "successfulThroughputRps": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0,
              "description": "Duration-weighted successful throughput/goodput rate over the window."
            },
            "modeledSheddingRps": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0,
              "description": "Duration-weighted request rate explicitly shed by modeled capacity limits."
            },
            "errorRatePercent": {
              "type": [
                "number",
                "null"
              ],
              "minimum": 0,
              "maximum": 100,
              "description": "Error rate in percentage points over the same request window."
            },
            "recovery": {
              "type": "object",
              "description": "Sustained service-health recovery evidence. Health requires positive successful service and error rate below 5% for 30 simulation seconds. A healthy blip shorter than the sustain period does not complete recovery. A later regression keeps the first recovery milestone but clears the current healthy-streak milestone until another sustained recovery; finalState becomes unhealthy and regressedAfterRecovery is true. If no incident is detected, healthy samples are baseline evidence and do not create recovery milestones.\n",
              "required": [
                "healthErrorRateThresholdPercent",
                "sustainPeriodSeconds",
                "incidentStartSeconds",
                "firstHealthyStartSeconds",
                "firstRecoveryCompletedSeconds",
                "finalSustainedRecoveryCompletedSeconds",
                "sustainPeriodCompleted",
                "regressedAfterRecovery",
                "finalState"
              ],
              "properties": {
                "healthErrorRateThresholdPercent": {
                  "type": "number",
                  "enum": [
                    5
                  ],
                  "description": "Strict healthy-state error-rate threshold in percent."
                },
                "sustainPeriodSeconds": {
                  "type": "number",
                  "enum": [
                    30
                  ],
                  "description": "Simulation-time duration below the health threshold required to complete recovery."
                },
                "incidentStartSeconds": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Simulation-time start of the detected incident."
                },
                "firstHealthyStartSeconds": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "First simulation-time instant at which the run entered the healthy threshold."
                },
                "firstRecoveryCompletedSeconds": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "First sustained-recovery completion time, or null when not completed."
                },
                "finalSustainedRecoveryCompletedSeconds": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Most recent completed sustain milestone for the current healthy streak; null after a relapse until another sustain period completes.\n"
                },
                "sustainPeriodCompleted": {
                  "type": "boolean",
                  "description": "Whether the 30-second healthy sustain period completed."
                },
                "regressedAfterRecovery": {
                  "type": "boolean",
                  "description": "Whether the run became unhealthy after a sustained recovery milestone."
                },
                "finalState": {
                  "type": "string",
                  "enum": [
                    "healthy",
                    "unhealthy",
                    "unavailable"
                  ],
                  "description": "Final observed health state at the end of the common request window."
                },
                "recoveryTimeLowerBoundSeconds": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "When recovery is unobserved, at least this many simulation seconds have elapsed since the incident without sustained recovery."
                },
                "estimatedServiceRestoreSeconds": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Modeled earliest return of serving capacity (not a successful recovery or provider SLA)."
                },
                "assumption": {
                  "type": "string",
                  "description": "Explains the clock and restart/promotion assumptions, not a universal cloud-provider guarantee."
                }
              }
            }
          }
        }
      }
    },
    "ResilienceScore": {
      "type": "object",
      "description": "Composite resilience result. For canonical outcome-backed results, `overall` is reproducible from the displayed breakdown components using weights recovery 0.25, availability 0.30, dataIntegrity 0.25, and gracefulDegradation 0.20 (rounded displayed components are used). A critical no-failover/no-redundancy/single-point finding on the crashed resource sets the recovery component to zero, even if a later restart succeeds. The batch applies this rule if any child has the target-specific risk. `scoringReason` explains the policy. Legacy payloads may omit newer breakdown components and metrics. `grade` is derived from the live weighted score when canonical evidence is present, not from static vulnerability labels. It is not a deadline verdict or a statement that an unrecovered run is production-ready; inspect `metrics.outcome` for authoritative evidence and final health state when present.\n",
      "required": [
        "overall",
        "grade"
      ],
      "properties": {
        "scoringReason": {
          "type": "string",
          "description": "Explanation of a target-specific recovery score adjustment."
        },
        "overall": {
          "type": "number",
          "description": "Overall resilience score (0-100)"
        },
        "breakdown": {
          "type": "object",
          "description": "Score components on a 0-100 scale. The composite uses `recovery * 0.25 + availability * 0.30 + dataIntegrity * 0.25 + gracefulDegradation * 0.20`, rounded to the reported overall score. Canonical outcome-backed scores provide all four components. Legacy payloads may retain historical breakdown keys or omit newer components; treat those payloads as compatibility data.\n",
          "properties": {
            "recovery": {
              "type": "number",
              "description": "Recovery component (0-100)"
            },
            "availability": {
              "type": "number",
              "description": "Availability component (0-100)"
            },
            "dataIntegrity": {
              "type": "number",
              "description": "Data-integrity component (0-100)"
            },
            "gracefulDegradation": {
              "type": "number",
              "description": "Graceful-degradation component (0-100)"
            }
          }
        },
        "grade": {
          "type": "string",
          "enum": [
            "A",
            "B",
            "C",
            "D",
            "F"
          ],
          "description": "Letter grade for resilience"
        },
        "metrics": {
          "$ref": "#/$defs/ResilienceMetrics"
        }
      }
    }
  }
}