feat: схемы отчёта аудита, профили/пресеты и движок разрешения (BHL-019, BHL-012, BHL-013)

- spec/schemas: evidence, audit-finding, audit-report (BHL-019)
- spec/schemas: profile, preset с явным relax_to (BHL-012)
- packages/bhl: resolve.ts + bhl profile resolve — порядок не влияет,
  конфликты параметров и ослаблений, provenance и applicability (BHL-012, BHL-013)
- tests: корневые схемы 13/13, пакет 17/17
This commit is contained in:
Suslov-MD
2026-11-28 23:36:53 +03:00
parent 294bf9d68f
commit 5b514272cf
13 changed files with 1302 additions and 79 deletions
+68
View File
@@ -0,0 +1,68 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://baseline-harness.dev/spec/schemas/audit-report.schema.json",
"title": "Audit Report",
"description": "Структурированный отчёт аудита (D-005, D-019). Состояние проверяемого дерева фиксируется отпечатком, а не только commit SHA; процентный рейтинг отсутствует по замыслу.",
"type": "object",
"additionalProperties": false,
"required": ["id", "generated_at", "tool", "subject", "spec_version", "findings"],
"properties": {
"id": { "type": "string", "pattern": "^rep-[a-z0-9]+(-[a-z0-9]+)*$" },
"generated_at": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
"tool": {
"type": "object",
"additionalProperties": false,
"required": ["name", "version"],
"properties": {
"name": { "type": "string", "minLength": 1 },
"version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$" }
}
},
"agent": {
"type": "object",
"additionalProperties": false,
"required": ["name"],
"properties": {
"name": { "type": "string", "minLength": 1 },
"version": { "type": "string", "minLength": 1 }
},
"description": "Агент семантической части, если она выполнялась."
},
"subject": {
"type": "object",
"additionalProperties": false,
"required": ["kind", "fingerprint"],
"properties": {
"kind": { "enum": ["repository", "directory", "spec"] },
"fingerprint": { "type": "string", "pattern": "^sha256:[a-f0-9]{64}$" },
"revision": { "type": "string", "minLength": 1 },
"dirty": { "type": "boolean" }
}
},
"spec_version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$" },
"profiles": {
"type": "array",
"items": { "type": "string", "pattern": "^prof-[a-z0-9]+(-[a-z0-9]+)*$" }
},
"findings": {
"type": "array",
"items": { "$ref": "https://baseline-harness.dev/spec/schemas/audit-finding.schema.json" }
},
"summary": {
"type": "object",
"additionalProperties": false,
"required": ["PASS", "FAIL", "PARTIAL", "EXEMPT", "NOT_APPLICABLE", "UNKNOWN", "BLOCKED"],
"properties": {
"PASS": { "type": "integer", "minimum": 0 },
"FAIL": { "type": "integer", "minimum": 0 },
"PARTIAL": { "type": "integer", "minimum": 0 },
"EXEMPT": { "type": "integer", "minimum": 0 },
"NOT_APPLICABLE": { "type": "integer", "minimum": 0 },
"UNKNOWN": { "type": "integer", "minimum": 0 },
"BLOCKED": { "type": "integer", "minimum": 0 }
},
"description": "Сверка сумм с findings — задача bhl report validate (BHL-023)."
},
"notes": { "type": "array", "items": { "type": "string", "minLength": 3 } }
}
}