feat: антипаттерны с жизненным циклом и seed из граблей библиотеки (BHL-015)

- spec/schemas/antipattern.schema.json: level и lifecycle разделены
- seed: 3 антипаттерна + 3 proposed-требования + домен/возможность
- валидатор: цели relations антипаттернов и ссылки требований
- реальный spec/ проходит bhl validate; пакет 18/18, корень зелёный
This commit is contained in:
Suslov-MD
2026-11-28 23:53:40 +03:00
parent 5b514272cf
commit 13ba43eb59
15 changed files with 424 additions and 35 deletions
+62
View File
@@ -0,0 +1,62 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://baseline-harness.dev/spec/schemas/antipattern.schema.json",
"title": "Antipattern",
"description": "Нормативный антипаттерн с историей отказов (D-004). Нормативный уровень (level) и жизненный цикл (lifecycle) — разные enum (D-029); связи с требованиями и происхождение из материалов библиотеки обязательны.",
"type": "object",
"additionalProperties": false,
"required": ["id", "title", "description", "level", "lifecycle", "relations", "sources"],
"properties": {
"id": {
"type": "string",
"pattern": "^ant-[a-z0-9]+(-[a-z0-9]+)*$",
"description": "Постоянный идентификатор (D-031)."
},
"title": { "type": "string", "minLength": 3, "maxLength": 120 },
"description": { "type": "string", "minLength": 10 },
"level": {
"enum": ["SHOULD NOT", "MUST NOT"],
"description": "Нормативная сила запрета; не смешивается с жизненным циклом."
},
"lifecycle": {
"type": "object",
"additionalProperties": false,
"required": ["status"],
"properties": {
"status": {
"enum": ["proposed", "discouraged", "forbidden", "deprecated", "removed"],
"description": "Путь антипаттерна: proposed → discouraged → forbidden; deprecated → removed. Не нормативный уровень."
},
"since": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" },
"note": { "type": "string", "minLength": 3 }
}
},
"relations": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["target", "kind"],
"properties": {
"target": { "type": "string", "pattern": "^req-[a-z0-9]+(-[a-z0-9]+)*$" },
"kind": { "enum": ["contradicts"] }
}
}
},
"sources": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["material"],
"properties": {
"material": { "type": "string", "minLength": 3 },
"note": { "type": "string", "minLength": 3 }
}
}
},
"note": { "type": "string", "minLength": 3 }
}
}