{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://273v.github.io/kaos-compliance/api/v1/snapshot.schema.json",
  "$comment": "kaos-compliance collector version: 0.0.1",
  "title": "KAOS Compliance Snapshot",
  "description": "Source-of-truth JSON published at /api/v1/snapshot.json. See docs/DATA-MODEL.md for the prose specification and docs/METHODOLOGY.md for the collection methodology. Generated by kaos-compliance v0.0.1.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "generated_at",
    "modules"
  ],
  "properties": {
    "schema_version": {
      "type": "string",
      "const": "1.0",
      "description": "Snapshot schema version. Bumped on breaking changes only."
    },
    "generated_at": {
      "type": "string",
      "format": "date-time",
      "description": "RFC 3339 UTC timestamp; trailing Z."
    },
    "generator": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "version"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "version": {
          "type": "string"
        }
      }
    },
    "heartbeat": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "last_full_sweep_at",
        "last_light_sweep_at",
        "last_security_sweep_at",
        "stale_threshold_hours"
      ],
      "properties": {
        "last_full_sweep_at": {
          "type": "string",
          "format": "date-time"
        },
        "last_light_sweep_at": {
          "type": "string",
          "format": "date-time"
        },
        "last_security_sweep_at": {
          "type": "string",
          "format": "date-time"
        },
        "stale_threshold_hours": {
          "type": "integer",
          "minimum": 1,
          "default": 26
        }
      }
    },
    "modules": {
      "type": "array",
      "items": {
        "type": "object",
        "title": "ModuleSnapshot",
        "properties": {
          "name": {
            "type": "string"
          },
          "identity": {
            "type": "object",
            "title": "IdentitySection",
            "properties": {
              "pypi_version": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "pypi_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "main_head_sha": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "latest_tag": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "latest_tag_sha": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "tag_at_head": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "commits_past_tag": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "repo_visibility": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "last_commit_at": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "additionalProperties": false,
            "description": "What is this package today?"
          },
          "ci": {
            "type": "object",
            "title": "CISection",
            "properties": {
              "workflow_conclusion": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "workflow_run_id": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "workflow_run_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "head_sha": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "run_completed_at": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "matrix": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": {}
                }
              }
            },
            "additionalProperties": false,
            "description": "Continuous integration posture for the latest main commit."
          },
          "security": {
            "type": "object",
            "title": "SecuritySection",
            "properties": {
              "workflow_conclusion": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "workflow_run_id": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "workflow_run_url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "jobs": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": {}
                }
              },
              "run_completed_at": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "additionalProperties": false,
            "description": "Aggregate of every job inside the Security workflow."
          },
          "open_prs": {
            "type": "object",
            "title": "OpenPRsSection",
            "properties": {
              "count": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "titles": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": false,
            "description": "Open PRs against main right now."
          },
          "freshness": {
            "type": "object",
            "title": "FreshnessSection",
            "properties": {
              "days_since_last_commit": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "days_since_last_release": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "days_since_last_security_scan": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "additionalProperties": false,
            "description": "How stale is everything?"
          },
          "supply_chain": {
            "type": "object",
            "title": "SupplyChainSection",
            "description": "Output of collector.supply_chain.collect()",
            "additionalProperties": true,
            "properties": {
              "pypi_version": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "pypi_release_iso": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "wheel_platforms": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "wheel_sha256s": {
                "type": "object",
                "additionalProperties": {
                  "type": "string"
                }
              },
              "is_abi3": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "has_musllinux_wheel": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "license_expression": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "license_files_in_wheel": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "attestations": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                  "pep740_present": {
                    "type": [
                      "boolean",
                      "null"
                    ]
                  },
                  "publisher_kind": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "publisher_source_repo": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "publisher_workflow_ref": {
                    "type": [
                      "string",
                      "null"
                    ]
                  },
                  "rekor_log_index": {
                    "type": [
                      "integer",
                      "string",
                      "null"
                    ]
                  },
                  "verified_count": {
                    "type": "integer",
                    "minimum": 0
                  },
                  "total_count": {
                    "type": "integer",
                    "minimum": 0
                  }
                }
              },
              "sbom": {
                "type": "object",
                "additionalProperties": true,
                "properties": {
                  "components_count": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "license_breakdown": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "integer",
                      "minimum": 0
                    }
                  },
                  "weak_copyleft": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "strong_copyleft": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "unknown_license": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "sbom_artifact_path": {
                    "type": [
                      "string",
                      "null"
                    ]
                  }
                }
              },
              "errors": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "governance": {
            "type": "object",
            "title": "GovernanceSection",
            "description": "Output of collector.governance.collect()",
            "additionalProperties": true,
            "properties": {
              "dco_signoff_rate_90d": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0.0,
                "maximum": 1.0
              },
              "conventional_commits_rate_90d": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0.0,
                "maximum": 1.0
              },
              "verified_commit_ratio_90d": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0.0,
                "maximum": 1.0
              },
              "commits_90d": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "unique_committers_90d": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "branch_protection_enabled": {
                "type": [
                  "boolean",
                  "null"
                ]
              },
              "branch_protection_summary": {
                "type": [
                  "object",
                  "null"
                ]
              },
              "codeowners_path": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "security_md_present": {
                "type": "boolean"
              },
              "security_md_disclosure_window_days": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "notice_present": {
                "type": "boolean"
              },
              "license_files_in_sdist": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "releases_90d": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "median_pr_age_days": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "open_pr_count": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "open_issue_count": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "time_to_pypi_seconds_median": {
                "type": [
                  "integer",
                  "number",
                  "null"
                ]
              },
              "errors": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "code_metrics": {
            "type": "object",
            "title": "CodeMetricsSection",
            "description": "Output of collector.code_metrics.collect()",
            "additionalProperties": true,
            "properties": {
              "python": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "src_loc": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "tests_loc": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "src_files": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "tests_files": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "tests_count": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  }
                }
              },
              "rust": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "src_loc": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "tests_loc": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "src_files": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "tests_files": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  },
                  "tests_count": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0
                  }
                }
              },
              "errors": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "additionalProperties": false,
        "description": "One row in the dashboard's per-package grid.",
        "required": [
          "name",
          "identity",
          "ci",
          "security",
          "open_prs",
          "freshness"
        ]
      }
    }
  },
  "$defs": {
    "IdentitySection": {
      "type": "object",
      "title": "IdentitySection",
      "properties": {
        "pypi_version": {
          "type": [
            "string",
            "null"
          ]
        },
        "pypi_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "main_head_sha": {
          "type": [
            "string",
            "null"
          ]
        },
        "latest_tag": {
          "type": [
            "string",
            "null"
          ]
        },
        "latest_tag_sha": {
          "type": [
            "string",
            "null"
          ]
        },
        "tag_at_head": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "commits_past_tag": {
          "type": [
            "integer",
            "null"
          ]
        },
        "repo_visibility": {
          "type": [
            "string",
            "null"
          ]
        },
        "last_commit_at": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false,
      "description": "What is this package today?"
    },
    "CISection": {
      "type": "object",
      "title": "CISection",
      "properties": {
        "workflow_conclusion": {
          "type": [
            "string",
            "null"
          ]
        },
        "workflow_run_id": {
          "type": [
            "integer",
            "null"
          ]
        },
        "workflow_run_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "head_sha": {
          "type": [
            "string",
            "null"
          ]
        },
        "run_completed_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "matrix": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {}
          }
        }
      },
      "additionalProperties": false,
      "description": "Continuous integration posture for the latest main commit."
    },
    "SecuritySection": {
      "type": "object",
      "title": "SecuritySection",
      "properties": {
        "workflow_conclusion": {
          "type": [
            "string",
            "null"
          ]
        },
        "workflow_run_id": {
          "type": [
            "integer",
            "null"
          ]
        },
        "workflow_run_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "jobs": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": {}
          }
        },
        "run_completed_at": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "additionalProperties": false,
      "description": "Aggregate of every job inside the Security workflow."
    },
    "OpenPRsSection": {
      "type": "object",
      "title": "OpenPRsSection",
      "properties": {
        "count": {
          "type": [
            "integer",
            "null"
          ]
        },
        "titles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "additionalProperties": false,
      "description": "Open PRs against main right now."
    },
    "FreshnessSection": {
      "type": "object",
      "title": "FreshnessSection",
      "properties": {
        "days_since_last_commit": {
          "type": [
            "integer",
            "null"
          ]
        },
        "days_since_last_release": {
          "type": [
            "integer",
            "null"
          ]
        },
        "days_since_last_security_scan": {
          "type": [
            "integer",
            "null"
          ]
        }
      },
      "additionalProperties": false,
      "description": "How stale is everything?"
    }
  }
}
