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:
@@ -0,0 +1,5 @@
|
||||
# Канонический журнал нормативных изменений BHS (D-011).
|
||||
# Каждая запись валидируется схемой spec/schemas/normative-change.schema.json.
|
||||
# Требования ссылаются на этот журнал через history_ref и не дублируют историю.
|
||||
# Публикация записей — вместе с релизом спецификации (Release Manifest, BHL-027).
|
||||
changes: []
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://baseline-harness.dev/spec/schemas/capability.schema.json",
|
||||
"title": "Capability",
|
||||
"description": "Средний уровень иерархии Domain → Capability → Atomic Requirement (D-009).",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["id", "domain", "title", "description"],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^cap-[a-z0-9]+(-[a-z0-9]+)*$",
|
||||
"description": "Постоянный идентификатор (D-031)."
|
||||
},
|
||||
"domain": {
|
||||
"type": "string",
|
||||
"pattern": "^dom-[a-z0-9]+(-[a-z0-9]+)*$",
|
||||
"description": "Ссылка на существующий домен; целостность проверяет валидатор (BHL-011)."
|
||||
},
|
||||
"title": { "type": "string", "minLength": 3 },
|
||||
"description": { "type": "string", "minLength": 10 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://baseline-harness.dev/spec/schemas/domain.schema.json",
|
||||
"title": "Domain",
|
||||
"description": "Верхний уровень иерархии спецификации BHS (D-009).",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["id", "title", "description"],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^dom-[a-z0-9]+(-[a-z0-9]+)*$",
|
||||
"description": "Постоянный идентификатор (D-031): не зависит от имени, пути и позиции."
|
||||
},
|
||||
"title": { "type": "string", "minLength": 3 },
|
||||
"description": { "type": "string", "minLength": 10 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://baseline-harness.dev/spec/schemas/normative-change.schema.json",
|
||||
"title": "Normative Change",
|
||||
"description": "Запись канонического журнала нормативных изменений BHS (D-011). История в требованиях не дублируется: требование несёт только history_ref.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["id", "release", "date", "type", "requirements", "description"],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^chg-[a-z0-9]+(-[a-z0-9]+)*$",
|
||||
"description": "Постоянный идентификатор (D-031)."
|
||||
},
|
||||
"release": {
|
||||
"type": "string",
|
||||
"pattern": "^\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$",
|
||||
"description": "Версия спецификации, в которой изменение опубликовано."
|
||||
},
|
||||
"date": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
|
||||
"type": { "enum": ["ADDED", "STRENGTHENED", "RELAXED", "CLARIFIED", "DEPRECATED", "REMOVED"] },
|
||||
"requirements": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": { "type": "string", "pattern": "^req-[a-z0-9]+(-[a-z0-9]+)*$" }
|
||||
},
|
||||
"description": { "type": "string", "minLength": 10 },
|
||||
"motivation": { "type": "string", "minLength": 3 },
|
||||
"migration": { "type": "string", "minLength": 3, "description": "Инструкция переноса для потребителей при REMOVED/STRENGTHENED." }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://baseline-harness.dev/spec/schemas/parameter.schema.json",
|
||||
"title": "Parameter",
|
||||
"description": "Типизированный параметр требования (D-018): значение переопределяется только в пределах ограничений.",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["id", "type", "description"],
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"pattern": "^param-[a-z0-9]+(-[a-z0-9]+)*$",
|
||||
"description": "Постоянный идентификатор (D-031)."
|
||||
},
|
||||
"type": { "enum": ["boolean", "integer", "number", "string", "enum"] },
|
||||
"description": { "type": "string", "minLength": 10 },
|
||||
"default": {},
|
||||
"unit": { "type": "string", "minLength": 1 },
|
||||
"constraints": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"minimum": { "type": "number" },
|
||||
"maximum": { "type": "number" },
|
||||
"values": { "type": "array", "minItems": 1, "items": { "type": ["string", "integer", "number", "boolean"] } },
|
||||
"pattern": { "type": "string" },
|
||||
"minLength": { "type": "integer", "minimum": 0 },
|
||||
"maxLength": { "type": "integer", "minimum": 1 }
|
||||
}
|
||||
},
|
||||
"overridable_by": {
|
||||
"type": "array",
|
||||
"minItems": 0,
|
||||
"uniqueItems": true,
|
||||
"items": { "enum": ["profile", "project"] },
|
||||
"default": ["profile", "project"]
|
||||
}
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"if": { "properties": { "type": { "const": "boolean" } }, "required": ["type"] },
|
||||
"then": {
|
||||
"properties": {
|
||||
"default": { "type": "boolean" },
|
||||
"constraints": { "type": "object", "additionalProperties": false, "properties": {} }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": { "properties": { "type": { "const": "integer" } }, "required": ["type"] },
|
||||
"then": {
|
||||
"properties": {
|
||||
"default": { "type": "integer" },
|
||||
"constraints": { "type": "object", "additionalProperties": false, "properties": { "minimum": { "type": "integer" }, "maximum": { "type": "integer" } } }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": { "properties": { "type": { "const": "number" } }, "required": ["type"] },
|
||||
"then": {
|
||||
"properties": {
|
||||
"default": { "type": "number" },
|
||||
"constraints": { "type": "object", "additionalProperties": false, "properties": { "minimum": { "type": "number" }, "maximum": { "type": "number" } } }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": { "properties": { "type": { "const": "string" } }, "required": ["type"] },
|
||||
"then": {
|
||||
"properties": {
|
||||
"default": { "type": "string" },
|
||||
"constraints": { "type": "object", "additionalProperties": false, "properties": { "pattern": { "type": "string" }, "minLength": { "type": "integer", "minimum": 0 }, "maxLength": { "type": "integer", "minimum": 1 } } }
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": { "properties": { "type": { "const": "enum" } }, "required": ["type"] },
|
||||
"then": {
|
||||
"required": ["constraints"],
|
||||
"properties": {
|
||||
"default": {},
|
||||
"constraints": { "type": "object", "additionalProperties": false, "required": ["values"], "properties": { "values": { "type": "array", "minItems": 1, "items": { "type": ["string", "integer", "number", "boolean"] } } } }
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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); история не дублируется."
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user