{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ai-akari-ai/json-schema/ai-akari-ai-signed-outcome-drift-report-schema.json",
  "title": "SignedOutcomeDriftReport",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ai-akari-ai-openapi.json#/components/schemas/SignedOutcomeDriftReport",
  "type": "object",
  "properties": {
    "artifact": {
      "type": "object",
      "properties": {
        "version": {
          "type": "string",
          "const": "decionis.outcomes.drift/1"
        },
        "report_id": {
          "type": "string",
          "format": "uuid"
        },
        "org_id": {
          "type": "string",
          "format": "uuid"
        },
        "period": {
          "type": "string",
          "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
        },
        "window": {
          "type": "object",
          "properties": {
            "from": {
              "type": "string",
              "format": "date-time",
              "maxLength": 40
            },
            "to": {
              "type": "string",
              "format": "date-time",
              "maxLength": 40
            }
          },
          "required": [
            "from",
            "to"
          ],
          "additionalProperties": false
        },
        "closed_at": {
          "type": "string",
          "format": "date-time",
          "maxLength": 40
        },
        "policy_changes": {
          "type": "object",
          "properties": {
            "releases": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "activations": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "managed": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "standard": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "changes": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "RELEASE",
                      "ACTIVATION"
                    ]
                  },
                  "policy_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "environment": {
                    "type": "string",
                    "enum": [
                      "sandbox",
                      "production"
                    ]
                  },
                  "action": {
                    "type": "string",
                    "enum": [
                      "TESTING",
                      "SHADOW",
                      "PRODUCTION",
                      "ROLLBACK",
                      "RETIREMENT"
                    ]
                  },
                  "from": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "revision_id": {
                            "type": "string",
                            "format": "uuid"
                          },
                          "number": {
                            "type": "integer",
                            "minimum": 1
                          },
                          "digest": {
                            "type": "string",
                            "pattern": "^sha256:[a-f0-9]{64}$"
                          }
                        },
                        "required": [
                          "revision_id",
                          "number",
                          "digest"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "to": {
                    "type": "object",
                    "properties": {
                      "revision_id": {
                        "type": "string",
                        "format": "uuid"
                      },
                      "number": {
                        "type": "integer",
                        "minimum": 1
                      },
                      "digest": {
                        "type": "string",
                        "pattern": "^sha256:[a-f0-9]{64}$"
                      }
                    },
                    "required": [
                      "revision_id",
                      "number",
                      "digest"
                    ],
                    "additionalProperties": false
                  },
                  "release_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "release_digest": {
                    "type": "string",
                    "pattern": "^sha256:[a-f0-9]{64}$"
                  },
                  "deployment_id": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "deployment_digest": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^sha256:[a-f0-9]{64}$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "approvals": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "user_id": {
                          "type": "string",
                          "format": "uuid"
                        },
                        "role": {
                          "type": "string",
                          "pattern": "^[A-Z][A-Z_]{0,63}$"
                        },
                        "at": {
                          "type": "string",
                          "format": "date-time",
                          "maxLength": 40
                        }
                      },
                      "required": [
                        "user_id",
                        "role",
                        "at"
                      ],
                      "additionalProperties": false
                    },
                    "maxItems": 50
                  },
                  "activated_by": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "governance_profile": {
                    "type": "string",
                    "enum": [
                      "MANAGED",
                      "STANDARD"
                    ]
                  },
                  "at": {
                    "type": "string",
                    "format": "date-time",
                    "maxLength": 40
                  }
                },
                "required": [
                  "kind",
                  "policy_id",
                  "environment",
                  "action",
                  "from",
                  "to",
                  "release_id",
                  "release_digest",
                  "deployment_id",
                  "deployment_digest",
                  "approvals",
                  "activated_by",
                  "governance_profile",
                  "at"
                ],
                "additionalProperties": false
              },
              "maxItems": 500
            },
            "truncated": {
              "type": "boolean"
            }
          },
          "required": [
            "releases",
            "activations",
            "managed",
            "standard",
            "changes",
            "truncated"
          ],
          "additionalProperties": false
        },
        "shadow": {
          "type": "object",
          "properties": {
            "basis": {
              "type": "string",
              "const": "ESTIMATE"
            },
            "observations": {
              "type": "object",
              "properties": {
                "evaluations": {
                  "type": "object",
                  "properties": {
                    "SHADOW": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "PARALLEL": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "SHADOW",
                    "PARALLEL"
                  ],
                  "additionalProperties": false
                },
                "disagreements": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "by_type": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "decision_type": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1000
                      },
                      "mode": {
                        "type": "string",
                        "enum": [
                          "SHADOW",
                          "PARALLEL"
                        ]
                      },
                      "shadow_verdict": {
                        "type": "string",
                        "enum": [
                          "ESCALATE",
                          "REJECT",
                          "REVIEW"
                        ]
                      },
                      "verdict_effect": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "OBSERVED",
                              "BINDING"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "count": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "decision_type",
                      "mode",
                      "shadow_verdict",
                      "verdict_effect",
                      "count"
                    ],
                    "additionalProperties": false
                  },
                  "maxItems": 500
                },
                "truncated": {
                  "type": "boolean"
                }
              },
              "required": [
                "evaluations",
                "disagreements",
                "by_type",
                "truncated"
              ],
              "additionalProperties": false
            },
            "replays": {
              "type": "object",
              "properties": {
                "compared": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "differing": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "by_type": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "decision_type": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 1000
                      },
                      "enforced_verdict": {
                        "type": "string",
                        "enum": [
                          "APPROVE",
                          "ESCALATE",
                          "REJECT",
                          "REVIEW"
                        ]
                      },
                      "shadow_verdict": {
                        "anyOf": [
                          {
                            "type": "string",
                            "enum": [
                              "APPROVE",
                              "ESCALATE",
                              "REJECT",
                              "REVIEW"
                            ]
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "count": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "decision_type",
                      "enforced_verdict",
                      "shadow_verdict",
                      "count"
                    ],
                    "additionalProperties": false
                  },
                  "maxItems": 500
                },
                "truncated": {
                  "type": "boolean"
                }
              },
              "required": [
                "compared",
                "differing",
                "by_type",
                "truncated"
              ],
              "additionalProperties": false
            }
          },
          "required": [
            "basis",
            "observations",
            "replays"
          ],
          "additionalProperties": false
        },
        "coverage": {
          "type": "object",
          "properties": {
            "ungoverned": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "observed": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "sources": {
              "type": "array",
              "items": {
                "anyOf": [
                  {
                    "type": "object",
                    "properties": {
                      "source": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_.:-]{0,99}$"
                      },
                      "status": {
                        "type": "string",
                        "const": "reported"
                      },
                      "description": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      },
                      "records": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "ungoverned": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "observed": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      },
                      "gaps": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "platform": {
                              "type": "string",
                              "pattern": "^[a-z0-9][a-z0-9-]{0,99}$"
                            },
                            "action_type": {
                              "type": "string",
                              "pattern": "^[A-Z][A-Z0-9_]{0,119}$"
                            },
                            "coverage": {
                              "type": "string",
                              "enum": [
                                "UNGOVERNED",
                                "OBSERVED"
                              ]
                            },
                            "count": {
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 9007199254740991
                            }
                          },
                          "required": [
                            "platform",
                            "action_type",
                            "coverage",
                            "count"
                          ],
                          "additionalProperties": false
                        },
                        "maxItems": 500
                      }
                    },
                    "required": [
                      "source",
                      "status",
                      "description",
                      "records",
                      "ungoverned",
                      "observed",
                      "gaps"
                    ],
                    "additionalProperties": false
                  },
                  {
                    "type": "object",
                    "properties": {
                      "source": {
                        "type": "string",
                        "pattern": "^[a-z][a-z0-9_.:-]{0,99}$"
                      },
                      "status": {
                        "type": "string",
                        "const": "not_reported"
                      },
                      "description": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 500
                      }
                    },
                    "required": [
                      "source",
                      "status",
                      "description"
                    ],
                    "additionalProperties": false
                  }
                ]
              },
              "maxItems": 100
            }
          },
          "required": [
            "ungoverned",
            "observed",
            "sources"
          ],
          "additionalProperties": false
        },
        "narrative": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 400
          },
          "maxItems": 12
        },
        "inputs": {
          "type": "object",
          "properties": {
            "sha256": {
              "type": "string",
              "pattern": "^[a-f0-9]{64}$"
            },
            "sources": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "source": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_.:-]{0,99}$"
                  },
                  "records": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "sha256": {
                    "type": "string",
                    "pattern": "^[a-f0-9]{64}$"
                  }
                },
                "required": [
                  "source",
                  "records",
                  "sha256"
                ],
                "additionalProperties": false
              },
              "maxItems": 100
            }
          },
          "required": [
            "sha256",
            "sources"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "version",
        "report_id",
        "org_id",
        "period",
        "window",
        "closed_at",
        "policy_changes",
        "shadow",
        "coverage",
        "narrative",
        "inputs"
      ],
      "additionalProperties": false
    },
    "artifact_sha256": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "canonicalization": {
      "type": "string",
      "const": "RFC8785/JCS"
    },
    "verification": {
      "type": "string",
      "enum": [
        "signed",
        "unsigned"
      ]
    },
    "signature": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "algorithm": {
              "type": "string",
              "const": "Ed25519"
            },
            "keyId": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_.:-]{1,128}$"
            },
            "value": {
              "type": "string",
              "pattern": "^[A-Za-z0-9_-]{86}$"
            }
          },
          "required": [
            "algorithm",
            "keyId",
            "value"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "public_jwks_path": {
      "type": "string",
      "const": "/.well-known/decision-dossier-jwks.json"
    }
  },
  "required": [
    "artifact",
    "artifact_sha256",
    "canonicalization",
    "verification",
    "signature",
    "public_jwks_path"
  ],
  "additionalProperties": false
}