feat: схемы ядра спецификации и журнал нормативных изменений (BHL-010, BHL-016)

JSON Schema 2020-12 для Domain, Capability, Parameter, Atomic Requirement и
Normative Change; level/lifecycle/статус библиотеки раздельно; ID dom-,
cap-, req-, param-, chg- валидируются паттернами. Канонический журнал —
spec/CHANGELOG.yaml (требования ссылаются history_ref, история не
дублируется). Черновик SemVer-политики — D-039 (proposed). Тесты ajv:
7, включая отрицательные фикстуры.
This commit is contained in:
Suslov-MD
2026-11-28 19:02:34 +03:00
parent 1f5b0d9238
commit af81424fc2
12 changed files with 556 additions and 2 deletions
+129
View File
@@ -0,0 +1,129 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://baseline-harness.dev/spec/schemas/requirement.schema.json",
"title": "Atomic Requirement",
"description": "Минимальная независимо проверяемая нормативная единица (D-009, §5 задания 0.1.0). Нормативный уровень, жизненный цикл и статус библиотечного материала — разные сущности (D-029, исправление §5.7 продолжения).",
"type": "object",
"additionalProperties": false,
"required": [
"id",
"domain",
"capability",
"title",
"statement",
"level",
"rationale",
"applicability",
"acceptance_criteria",
"verification",
"expected_evidence",
"lifecycle"
],
"properties": {
"id": {
"type": "string",
"pattern": "^req-[a-z0-9]+(-[a-z0-9]+)*$",
"description": "Постоянный идентификатор (D-031): не зависит от названия, пути и позиции; освобождённые идентификаторы не переиспользуются (проверка — валидатор)."
},
"domain": { "type": "string", "pattern": "^dom-[a-z0-9]+(-[a-z0-9]+)*$" },
"capability": { "type": "string", "pattern": "^cap-[a-z0-9]+(-[a-z0-9]+)*$" },
"title": { "type": "string", "minLength": 3, "maxLength": 120 },
"statement": {
"type": "string",
"minLength": 10,
"description": "Нормативная формулировка с ключевым словом RFC 2119/8174 (D-029); сверка слова с полем level — задача валидатора (BHL-011)."
},
"level": {
"enum": ["MUST", "MUST NOT", "SHOULD", "SHOULD NOT", "MAY"],
"description": "Нормативный уровень; не смешивается с жизненным циклом и статусом библиотеки."
},
"rationale": { "type": "string", "minLength": 10 },
"applicability": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["when"],
"properties": {
"when": { "type": "string", "minLength": 3 },
"unless": { "type": "string", "minLength": 3 }
}
}
},
"parameters": {
"type": "array",
"items": { "$ref": "https://baseline-harness.dev/spec/schemas/parameter.schema.json" },
"description": "Типизированные параметры (D-018); переопределение вне ограничений отклоняет валидатор."
},
"acceptance_criteria": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["criterion"],
"properties": {
"criterion": { "type": "string", "minLength": 3 },
"measure": { "type": "string", "minLength": 3 }
}
}
},
"verification": {
"type": "object",
"additionalProperties": false,
"required": ["kind", "procedure"],
"properties": {
"kind": { "enum": ["deterministic", "semantic", "hybrid"] },
"procedure": { "type": "string", "minLength": 10 },
"automation": { "type": "string", "minLength": 1 }
}
},
"expected_evidence": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["kind", "description"],
"properties": {
"kind": {
"enum": ["file", "command-output", "test-run", "session-observation", "review-note", "hash", "other"]
},
"description": { "type": "string", "minLength": 3 }
}
}
},
"relations": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["target", "kind"],
"properties": {
"target": { "type": "string", "pattern": "^req-[a-z0-9]+(-[a-z0-9]+)*$" },
"kind": { "enum": ["depends-on", "refines", "related", "supersedes"] }
}
}
},
"antipatterns": {
"type": "array",
"items": { "type": "string", "pattern": "^ant-[a-z0-9]+(-[a-z0-9]+)*$" }
},
"lifecycle": {
"type": "object",
"additionalProperties": false,
"required": ["status"],
"properties": {
"status": { "enum": ["draft", "proposed", "accepted", "deprecated", "removed"] },
"since": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
"note": { "type": "string", "minLength": 3 }
}
},
"history_ref": {
"type": "string",
"minLength": 3,
"description": "Ссылка на канонический источник истории нормативных изменений (spec/CHANGELOG.yaml, BHL-016); история не дублируется."
}
}
}