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:
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://baseline-harness.dev/spec/schemas/audit-finding.schema.json",
|
||||
"title": "Audit Finding",
|
||||
"description": "Проверка одного требования в отчёте аудита (D-005, D-019). Статус аудита не смешивается с уровнем и жизненным циклом требования.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["requirement", "status", "method", "evidence", "rationale"],
|
||||
"properties": {
|
||||
"requirement": { "type": "string", "pattern": "^req-[a-z0-9]+(-[a-z0-9]+)*$" },
|
||||
"status": {
|
||||
"enum": ["PASS", "FAIL", "PARTIAL", "EXEMPT", "NOT_APPLICABLE", "UNKNOWN", "BLOCKED"]
|
||||
},
|
||||
"method": { "enum": ["deterministic", "semantic", "hybrid"] },
|
||||
"evidence": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": { "$ref": "https://baseline-harness.dev/spec/schemas/evidence.schema.json" }
|
||||
},
|
||||
"issues": { "type": "array", "items": { "type": "string", "minLength": 3 } },
|
||||
"recommendations": { "type": "array", "items": { "type": "string", "minLength": 3 } },
|
||||
"corrections": { "type": "array", "items": { "type": "string", "minLength": 3 } },
|
||||
"rationale": { "type": "string", "minLength": 10 },
|
||||
"confidence": {
|
||||
"enum": ["high", "medium", "low"],
|
||||
"description": "Уверенность семантической проверки; для deterministic не требуется."
|
||||
},
|
||||
"exemption_ref": {
|
||||
"type": "string",
|
||||
"minLength": 3,
|
||||
"description": "Ссылка на утверждённое исключение при status EXEMPT."
|
||||
}
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"if": { "properties": { "status": { "const": "EXEMPT" } }, "required": ["status"] },
|
||||
"then": {
|
||||
"required": ["exemption_ref"],
|
||||
"properties": { "exemption_ref": { "type": "string", "minLength": 3 } }
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": { "properties": { "method": { "const": "semantic" } }, "required": ["method"] },
|
||||
"then": {
|
||||
"required": ["confidence"],
|
||||
"properties": { "confidence": { "enum": ["high", "medium", "low"] } }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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 } }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://baseline-harness.dev/spec/schemas/evidence.schema.json",
|
||||
"title": "Evidence",
|
||||
"description": "Доказательство для Audit Finding (D-005, D-019). Класс доказательств отличает наблюдение от интерпретации.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["kind", "locator", "description"],
|
||||
"properties": {
|
||||
"kind": {
|
||||
"enum": ["file", "command-output", "test-run", "session-observation", "review-note", "hash", "other"]
|
||||
},
|
||||
"locator": {
|
||||
"type": "string",
|
||||
"minLength": 1,
|
||||
"description": "Путь, команда или идентификатор наблюдения."
|
||||
},
|
||||
"description": { "type": "string", "minLength": 3 },
|
||||
"fingerprint": {
|
||||
"type": "string",
|
||||
"pattern": "^sha256:[a-f0-9]{64}$",
|
||||
"description": "Отпечаток состояния источника доказательства (D-019)."
|
||||
},
|
||||
"captured_at": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://baseline-harness.dev/spec/schemas/preset.schema.json",
|
||||
"title": "Preset",
|
||||
"description": "Именованная композиция профилей (D-013): разворачивается в набор профилей до разрешения.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["id", "title", "description", "profiles"],
|
||||
"properties": {
|
||||
"id": { "type": "string", "pattern": "^preset-[a-z0-9]+(-[a-z0-9]+)*$" },
|
||||
"title": { "type": "string", "minLength": 3 },
|
||||
"description": { "type": "string", "minLength": 10 },
|
||||
"profiles": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"uniqueItems": true,
|
||||
"items": { "type": "string", "pattern": "^prof-[a-z0-9]+(-[a-z0-9]+)*$" }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://baseline-harness.dev/spec/schemas/profile.schema.json",
|
||||
"title": "Profile",
|
||||
"description": "Композиционный профиль (D-013, D-002): набор требований и переопределений параметров. Ослабление только явное (relax_to).",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["id", "title", "description", "requirements"],
|
||||
"properties": {
|
||||
"id": { "type": "string", "pattern": "^prof-[a-z0-9]+(-[a-z0-9]+)*$" },
|
||||
"title": { "type": "string", "minLength": 3 },
|
||||
"description": { "type": "string", "minLength": 10 },
|
||||
"requirements": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["requirement"],
|
||||
"properties": {
|
||||
"requirement": { "type": "string", "pattern": "^req-[a-z0-9]+(-[a-z0-9]+)*$" },
|
||||
"relax_to": { "enum": ["SHOULD", "MAY"] },
|
||||
"note": { "type": "string", "minLength": 3 }
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameter_overrides": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["parameter", "value"],
|
||||
"properties": {
|
||||
"parameter": { "type": "string", "pattern": "^param-[a-z0-9]+(-[a-z0-9]+)*$" },
|
||||
"value": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user