{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/repowise-dev/json-schema/repowise-dev-change-record-schema.json",
  "title": "ChangeRecord",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/repowise-dev-changes-api-openapi.yml#/components/schemas/ChangeRecord",
  "properties": {
    "schema_version": {
      "type": "integer",
      "title": "Schema Version"
    },
    "id": {
      "type": "string",
      "title": "Id"
    },
    "identity": {
      "$ref": "#/$defs/ChangeIdentity"
    },
    "shape": {
      "type": "string",
      "title": "Shape"
    },
    "forge": {
      "type": "string",
      "title": "Forge"
    },
    "forge_ref": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Forge Ref"
    },
    "title": {
      "type": "string",
      "title": "Title"
    },
    "merged_at": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Merged At"
    },
    "head_sha": {
      "type": "string",
      "title": "Head Sha"
    },
    "author": {
      "$ref": "#/$defs/ChangeAuthor"
    },
    "commit_count": {
      "type": "integer",
      "title": "Commit Count"
    },
    "files_changed": {
      "type": "integer",
      "title": "Files Changed"
    },
    "lines_added": {
      "type": "integer",
      "title": "Lines Added"
    },
    "lines_deleted": {
      "type": "integer",
      "title": "Lines Deleted"
    },
    "category": {
      "type": "string",
      "title": "Category"
    },
    "provenance": {
      "anyOf": [
        {
          "$ref": "#/$defs/ChangeProvenance"
        },
        {
          "type": "null"
        }
      ]
    },
    "health": {
      "anyOf": [
        {
          "$ref": "#/$defs/ChangeHealthResponse"
        },
        {
          "type": "null"
        }
      ]
    },
    "touches_hotspot": {
      "type": "integer",
      "title": "Touches Hotspot",
      "default": 0
    },
    "commits": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "title": "Commits"
    },
    "files": {
      "items": {
        "$ref": "#/$defs/ChangeFile"
      },
      "type": "array",
      "title": "Files"
    },
    "metadata": {
      "$ref": "#/$defs/ChangeForgeMetadata"
    },
    "evidence": {
      "anyOf": [
        {
          "$ref": "#/$defs/ChangeEvidence"
        },
        {
          "type": "null"
        }
      ]
    },
    "evidence_building": {
      "type": "boolean",
      "title": "Evidence Building",
      "default": false
    }
  },
  "type": "object",
  "required": [
    "schema_version",
    "id",
    "identity",
    "shape",
    "forge",
    "title",
    "head_sha",
    "author",
    "commit_count",
    "files_changed",
    "lines_added",
    "lines_deleted",
    "category",
    "commits",
    "files",
    "metadata"
  ],
  "$defs": {
    "ChangeAuthor": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "email": {
          "type": "string",
          "title": "Email"
        }
      },
      "type": "object",
      "required": [
        "name",
        "email"
      ],
      "title": "ChangeAuthor"
    },
    "ChangeEvidence": {
      "properties": {
        "schema_version": {
          "type": "integer",
          "title": "Schema Version"
        },
        "change_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Change Id"
        },
        "revspec": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Revspec"
        },
        "generated_at": {
          "type": "string",
          "title": "Generated At"
        },
        "index_commit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Index Commit"
        },
        "items": {
          "items": {
            "$ref": "#/$defs/EvidenceItem"
          },
          "type": "array",
          "title": "Items"
        }
      },
      "type": "object",
      "required": [
        "schema_version",
        "generated_at",
        "items"
      ],
      "title": "ChangeEvidence",
      "description": "The evidence checklist (``repowise.core.changes.evidence``), versioned."
    },
    "ChangeFile": {
      "properties": {
        "path": {
          "type": "string",
          "title": "Path"
        },
        "added": {
          "type": "integer",
          "title": "Added"
        },
        "deleted": {
          "type": "integer",
          "title": "Deleted"
        }
      },
      "type": "object",
      "required": [
        "path",
        "added",
        "deleted"
      ],
      "title": "ChangeFile"
    },
    "ChangeForgeMetadata": {
      "properties": {
        "source": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Source"
        },
        "reviewers": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reviewers"
        },
        "approvals": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Approvals"
        },
        "labels": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Labels"
        },
        "linked_issues": {
          "anyOf": [
            {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            {
              "type": "null"
            }
          ],
          "title": "Linked Issues"
        }
      },
      "type": "object",
      "title": "ChangeForgeMetadata",
      "description": "Forge facts from a metadata source; ``None`` means unknown."
    },
    "ChangeHealthFindingResponse": {
      "properties": {
        "change_kind": {
          "type": "string",
          "title": "Change Kind"
        },
        "dimension": {
          "type": "string",
          "title": "Dimension"
        },
        "biomarker_type": {
          "type": "string",
          "title": "Biomarker Type"
        },
        "severity": {
          "type": "string",
          "title": "Severity"
        },
        "severity_before": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Severity Before"
        },
        "path": {
          "type": "string",
          "title": "Path"
        },
        "symbol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Symbol"
        },
        "line_start": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Line Start"
        },
        "line_end": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Line End"
        },
        "attribution_basis": {
          "type": "string",
          "title": "Attribution Basis"
        },
        "reason": {
          "type": "string",
          "title": "Reason"
        },
        "moved_from": {
          "anyOf": [
            {
              "$ref": "#/$defs/MovedFromResponse"
            },
            {
              "type": "null"
            }
          ]
        },
        "sha": {
          "type": "string",
          "title": "Sha"
        }
      },
      "type": "object",
      "required": [
        "change_kind",
        "dimension",
        "biomarker_type",
        "severity",
        "path",
        "attribution_basis",
        "reason",
        "sha"
      ],
      "title": "ChangeHealthFindingResponse",
      "description": "A finding a change's commit introduced or worsened, with that commit."
    },
    "ChangeHealthResponse": {
      "properties": {
        "status": {
          "type": "string",
          "title": "Status"
        },
        "kind": {
          "type": "string",
          "enum": [
            "improved",
            "worsened",
            "mixed",
            "neutral"
          ],
          "title": "Kind"
        },
        "scanned_commits": {
          "type": "integer",
          "title": "Scanned Commits"
        },
        "unscanned_commits": {
          "type": "integer",
          "title": "Unscanned Commits"
        },
        "introduced": {
          "type": "integer",
          "title": "Introduced"
        },
        "worsened": {
          "type": "integer",
          "title": "Worsened"
        },
        "resolved": {
          "type": "integer",
          "title": "Resolved"
        },
        "improved": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Improved"
        },
        "moved": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Moved"
        },
        "files_improved": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Files Improved"
        },
        "files_worsened": {
          "type": "integer",
          "title": "Files Worsened"
        },
        "findings": {
          "items": {
            "$ref": "#/$defs/ChangeHealthFindingResponse"
          },
          "type": "array",
          "title": "Findings"
        }
      },
      "type": "object",
      "required": [
        "status",
        "kind",
        "scanned_commits",
        "unscanned_commits",
        "introduced",
        "worsened",
        "resolved",
        "files_worsened"
      ],
      "title": "ChangeHealthResponse",
      "description": "A change's health rollup plus its worse findings, worst first and\ncapped: file, lines, symbol and biomarker, enough for a fix prompt."
    },
    "ChangeIdentity": {
      "properties": {
        "kind": {
          "type": "string",
          "title": "Kind"
        },
        "value": {
          "type": "string",
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "kind",
        "value"
      ],
      "title": "ChangeIdentity",
      "description": "``pr`` | ``change_id`` | ``merge`` | ``commit``, first that applies."
    },
    "ChangeProvenance": {
      "properties": {
        "label": {
          "type": "string",
          "title": "Label"
        },
        "agent_commits": {
          "type": "integer",
          "title": "Agent Commits"
        },
        "human_attested_commits": {
          "type": "integer",
          "title": "Human Attested Commits"
        },
        "unknown_commits": {
          "type": "integer",
          "title": "Unknown Commits"
        },
        "coverage": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Coverage"
        }
      },
      "type": "object",
      "required": [
        "label",
        "agent_commits",
        "human_attested_commits",
        "unknown_commits"
      ],
      "title": "ChangeProvenance",
      "description": "Three-state AI provenance over the change's commits, with its coverage."
    },
    "EvidenceItem": {
      "properties": {
        "kind": {
          "type": "string",
          "title": "Kind"
        },
        "label": {
          "type": "string",
          "title": "Label"
        },
        "status": {
          "type": "string",
          "enum": [
            "ok",
            "attention",
            "unknown"
          ],
          "title": "Status"
        },
        "basis": {
          "type": "string",
          "enum": [
            "measured",
            "inferred",
            "declared",
            "unresolved"
          ],
          "title": "Basis"
        },
        "value": {
          "title": "Value"
        },
        "details": {
          "items": {
            "additionalProperties": true,
            "type": "object"
          },
          "type": "array",
          "title": "Details"
        },
        "source": {
          "type": "string",
          "title": "Source"
        },
        "line": {
          "anyOf": [
            {
              "$ref": "#/$defs/EvidenceLine"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object",
      "required": [
        "kind",
        "label",
        "status",
        "basis",
        "details",
        "source"
      ],
      "title": "EvidenceItem",
      "description": "One checklist row: what was found, whether it needs a look, how it is known."
    },
    "EvidenceLine": {
      "properties": {
        "key": {
          "type": "string",
          "title": "Key"
        },
        "params": {
          "additionalProperties": true,
          "type": "object",
          "title": "Params"
        }
      },
      "type": "object",
      "required": [
        "key",
        "params"
      ],
      "title": "EvidenceLine",
      "description": "An item's value as a message key and its parameters, for a client to word."
    },
    "MovedFromResponse": {
      "properties": {
        "path": {
          "type": "string",
          "title": "Path"
        },
        "symbol": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Symbol"
        }
      },
      "type": "object",
      "required": [
        "path"
      ],
      "title": "MovedFromResponse",
      "description": "Where a finding's code was before the commit moved it."
    }
  }
}