From c50092f7e493e9a204a0aa1a41bfbbdd164ca270 Mon Sep 17 00:00:00 2001 From: Suslov-MD Date: Sun, 29 Nov 2026 00:06:36 +0300 Subject: [PATCH] =?UTF-8?q?feat:=20=D1=81=D0=B8=D0=BD=D1=82=D0=B5=D1=82?= =?UTF-8?q?=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=B0=D1=8F=20=D1=81=D0=BF=D0=B5?= =?UTF-8?q?=D1=86=D0=B8=D1=84=D0=B8=D0=BA=D0=B0=D1=86=D0=B8=D1=8F=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D1=81=D0=BA=D0=B2=D0=BE=D0=B7=D0=BD=D1=8B=D1=85?= =?UTF-8?q?=20=D0=BF=D1=80=D0=BE=D0=B3=D0=BE=D0=BD=D0=BE=D0=B2=20(BHL-018)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - examples/synthetic-spec: полный набор сущностей, профилей, пресета и антипаттерна - bhl validate и profile resolve проходят пример без диагностик - тест сверяет копию схем с spec/schemas и порядок разрешения - README карты лаборатории дополнен spec/ и examples/ --- README.md | 2 + ...пецификацию-для-проверки-инфраструктуры.md | 27 +++- examples/synthetic-spec/CHANGELOG.yaml | 12 ++ examples/synthetic-spec/README.md | 23 ++++ .../antipatterns/ant-synth-late-check.yaml | 16 +++ .../capabilities/cap-synth-verify.yaml | 6 + .../domains/dom-synth-build.yaml | 5 + .../parameters/param-synth-mode.yaml | 7 + .../presets/preset-synth-all.yaml | 6 + .../profiles/prof-synth-light.yaml | 12 ++ .../profiles/prof-synth-strict.yaml | 12 ++ .../requirements/req-synth-alpha.yaml | 42 ++++++ .../requirements/req-synth-beta.yaml | 34 +++++ .../requirements/req-synth-gamma.yaml | 27 ++++ .../schemas/antipattern.schema.json | 62 +++++++++ .../schemas/audit-finding.schema.json | 50 +++++++ .../schemas/audit-report.schema.json | 68 +++++++++ .../schemas/capability.schema.json | 23 ++++ .../synthetic-spec/schemas/domain.schema.json | 18 +++ .../schemas/evidence.schema.json | 26 ++++ .../schemas/normative-change.schema.json | 31 +++++ .../schemas/parameter.schema.json | 87 ++++++++++++ .../synthetic-spec/schemas/preset.schema.json | 20 +++ .../schemas/profile.schema.json | 40 ++++++ .../schemas/project-exception.schema.json | 46 +++++++ .../schemas/project-manifest.schema.json | 41 ++++++ .../schemas/requirement.schema.json | 129 ++++++++++++++++++ tests/synthetic-spec.test.mjs | 64 +++++++++ 28 files changed, 929 insertions(+), 7 deletions(-) create mode 100644 examples/synthetic-spec/CHANGELOG.yaml create mode 100644 examples/synthetic-spec/README.md create mode 100644 examples/synthetic-spec/antipatterns/ant-synth-late-check.yaml create mode 100644 examples/synthetic-spec/capabilities/cap-synth-verify.yaml create mode 100644 examples/synthetic-spec/domains/dom-synth-build.yaml create mode 100644 examples/synthetic-spec/parameters/param-synth-mode.yaml create mode 100644 examples/synthetic-spec/presets/preset-synth-all.yaml create mode 100644 examples/synthetic-spec/profiles/prof-synth-light.yaml create mode 100644 examples/synthetic-spec/profiles/prof-synth-strict.yaml create mode 100644 examples/synthetic-spec/requirements/req-synth-alpha.yaml create mode 100644 examples/synthetic-spec/requirements/req-synth-beta.yaml create mode 100644 examples/synthetic-spec/requirements/req-synth-gamma.yaml create mode 100644 examples/synthetic-spec/schemas/antipattern.schema.json create mode 100644 examples/synthetic-spec/schemas/audit-finding.schema.json create mode 100644 examples/synthetic-spec/schemas/audit-report.schema.json create mode 100644 examples/synthetic-spec/schemas/capability.schema.json create mode 100644 examples/synthetic-spec/schemas/domain.schema.json create mode 100644 examples/synthetic-spec/schemas/evidence.schema.json create mode 100644 examples/synthetic-spec/schemas/normative-change.schema.json create mode 100644 examples/synthetic-spec/schemas/parameter.schema.json create mode 100644 examples/synthetic-spec/schemas/preset.schema.json create mode 100644 examples/synthetic-spec/schemas/profile.schema.json create mode 100644 examples/synthetic-spec/schemas/project-exception.schema.json create mode 100644 examples/synthetic-spec/schemas/project-manifest.schema.json create mode 100644 examples/synthetic-spec/schemas/requirement.schema.json create mode 100644 tests/synthetic-spec.test.mjs diff --git a/README.md b/README.md index 5ac8967..c629ea7 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,8 @@ Baseline Harness Lab (BHL) — лаборатория базового стан | `experiments/` | Самостоятельные прототипы со своими зависимостями и тестами | [Эксперименты](experiments/README.md) | | `results/` | Датированные выводы и измерения, привязанные к версии и условиям | [Результаты](results/README.md) | | `packages/` | Принятые владельцем расширения и инструменты | [Пакеты](packages/README.md) | +| `spec/` | Машиночитаемая спецификация BHS: схемы сущностей, журнал нормативных изменений | [Схемы](spec/schemas), [журнал изменений](spec/CHANGELOG.yaml) | +| `examples/` | Инфраструктурные примеры для прогонов валидации и разрешения | [Синтетическая спецификация](examples/synthetic-spec/README.md) | [Pi Supervisor](experiments/pi-supervisor/README.md) — эксперимент с параллельным локальным наблюдателем рабочей сессии. Проверки кода пройдены; полезность на рабочей Qwen ещё не измерена. Принятых пакетов пока нет. [Установить и запустить супервизор](#установка-и-запуск-супервизора). diff --git a/backlog/tasks/bhl-018 - Создать-синтетическую-спецификацию-для-проверки-инфраструктуры.md b/backlog/tasks/bhl-018 - Создать-синтетическую-спецификацию-для-проверки-инфраструктуры.md index 8519825..73b6589 100644 --- a/backlog/tasks/bhl-018 - Создать-синтетическую-спецификацию-для-проверки-инфраструктуры.md +++ b/backlog/tasks/bhl-018 - Создать-синтетическую-спецификацию-для-проверки-инфраструктуры.md @@ -1,9 +1,10 @@ --- id: BHL-018 title: Создать синтетическую спецификацию для проверки инфраструктуры -status: To Do +status: Done assignee: [] created_date: '2026-11-28T14:25:35Z' +updated_date: '2026-11-28T21:06:36Z' labels: [] milestone: m-1 dependencies: @@ -22,14 +23,26 @@ ordinal: 18000 ## Acceptance Criteria -- [ ] #1 Синтетическая спецификация проходит полный цикл валидации и разрешения -- [ ] #2 Явно отмечена как инфраструктурный пример, не BHS 0.1.0 +- [x] #1 Синтетическая спецификация проходит полный цикл валидации и разрешения +- [x] #2 Явно отмечена как инфраструктурный пример, не BHS 0.1.0 ## Definition of Done -- [ ] #1 npm run check пройден (для изменений материалов и документации) -- [ ] #2 Местный quality gate затронутого модуля пройден (для кода и конфигурации) -- [ ] #3 В записи нет секретов, персональных путей и непубликуемых идентификаторов -- [ ] #4 Состояние задачи в Backlog.md актуально: прогресс, блокеры, следующий шаг +- [x] #1 npm run check пройден (для изменений материалов и документации) +- [x] #2 Местный quality gate затронутого модуля пройден (для кода и конфигурации) +- [x] #3 В записи нет секретов, персональных путей и непубликуемых идентификаторов +- [x] #4 Состояние задачи в Backlog.md актуально: прогресс, блокеры, следующий шаг + +## Comments + + +created: 2026-11-28T21:06:36Z + +--- + +examples/synthetic-spec: 3 требования (MUST/SHOULD/MUST NOT) с параметрами, домен/возможность, 2 профиля (явное ослабление + переопределения inline и реестрового параметра), пресет, антипаттерн со связью, CHANGELOG ADDED. bhl validate: 8 файлов 0 диагностик; profile resolve --preset: ожидаемый Effective Specification, идентичный при смене порядка; копия схем сверяется с spec/schemas тестом. README явно отмечает инфраструктурный характер (не BHS 0.1.0). + +--- + diff --git a/examples/synthetic-spec/CHANGELOG.yaml b/examples/synthetic-spec/CHANGELOG.yaml new file mode 100644 index 0000000..6044796 --- /dev/null +++ b/examples/synthetic-spec/CHANGELOG.yaml @@ -0,0 +1,12 @@ +changes: + - id: chg-synth-init + release: 0.0.0 + date: 2026-11-28 + type: ADDED + requirements: [req-synth-alpha, req-synth-beta, req-synth-gamma] + description: >- + Синтетические требования введены в инфраструктурный пример для + сквозных прогонов валидации и разрешения. + motivation: >- + Инфраструктура должна проверяться на полном наборе сущностей до + согласования содержательной редакции BHS 0.1.0. diff --git a/examples/synthetic-spec/README.md b/examples/synthetic-spec/README.md new file mode 100644 index 0000000..d475b13 --- /dev/null +++ b/examples/synthetic-spec/README.md @@ -0,0 +1,23 @@ +# Синтетическая спецификация (инфраструктурный пример) + +Это инфраструктурный пример для прогонов валидации, разрешения и аудита (BHL-018, +Этап 2). Он **не является** содержательной редакцией BHS 0.1.0 (D-021): сущности +вымышленные, формулировки служебные. Содержательная спецификация согласуется с +владельцем отдельно (BHL-038). + +Содержимое: + +- `domains/`, `capabilities/`, `requirements/`, `parameters/` — минимальный набор + сущностей со связями и типизированным параметром; +- `profiles/` и `presets/` — явное ослабление и переопределение параметра; +- `antipatterns/` — антипаттерн, связанный с требованием; +- `CHANGELOG.yaml` — одна запись ADDED; +- `schemas/` — копия `spec/schemas/`; расхождение копий ловит тест + `tests/synthetic-spec.test.mjs`. + +Прогоны: + +```sh +node packages/bhl/src/cli.ts validate examples/synthetic-spec +node packages/bhl/src/cli.ts profile resolve examples/synthetic-spec --preset preset-synth-all +``` diff --git a/examples/synthetic-spec/antipatterns/ant-synth-late-check.yaml b/examples/synthetic-spec/antipatterns/ant-synth-late-check.yaml new file mode 100644 index 0000000..0a4b0ab --- /dev/null +++ b/examples/synthetic-spec/antipatterns/ant-synth-late-check.yaml @@ -0,0 +1,16 @@ +id: ant-synth-late-check +title: Проверка синтетического артефакта после отправки +description: >- + Проверка выполняется после отправки артефакта в реестр примеров, тогда + как результат уже не влияет на отправку. +level: MUST NOT +lifecycle: + status: proposed + since: '2026-11-28' + note: Инфраструктурный пример (BHL-018), не содержательная редакция BHS. +relations: + - target: req-synth-gamma + kind: contradicts +sources: + - material: examples/synthetic-spec/README.md + note: Служебное происхождение — инфраструктурный пример, не грабля проекта. diff --git a/examples/synthetic-spec/capabilities/cap-synth-verify.yaml b/examples/synthetic-spec/capabilities/cap-synth-verify.yaml new file mode 100644 index 0000000..12ebc47 --- /dev/null +++ b/examples/synthetic-spec/capabilities/cap-synth-verify.yaml @@ -0,0 +1,6 @@ +id: cap-synth-verify +domain: dom-synth-build +title: Синтетическая проверка +description: >- + Вымышленная возможность проверки для прогонов валидации и разрешения + профилей. Не является частью содержательной спецификации BHS. diff --git a/examples/synthetic-spec/domains/dom-synth-build.yaml b/examples/synthetic-spec/domains/dom-synth-build.yaml new file mode 100644 index 0000000..5a27a3a --- /dev/null +++ b/examples/synthetic-spec/domains/dom-synth-build.yaml @@ -0,0 +1,5 @@ +id: dom-synth-build +title: Синтетическая сборка +description: >- + Вымышленная область сборки для инфраструктурных прогонов валидации и + разрешения. Не является частью содержательной спецификации BHS. diff --git a/examples/synthetic-spec/parameters/param-synth-mode.yaml b/examples/synthetic-spec/parameters/param-synth-mode.yaml new file mode 100644 index 0000000..41824c7 --- /dev/null +++ b/examples/synthetic-spec/parameters/param-synth-mode.yaml @@ -0,0 +1,7 @@ +id: param-synth-mode +type: enum +description: Режим вывода синтетического прогона для проверки реестра параметров. +default: json +constraints: + values: [json, plain] +overridable_by: [profile] diff --git a/examples/synthetic-spec/presets/preset-synth-all.yaml b/examples/synthetic-spec/presets/preset-synth-all.yaml new file mode 100644 index 0000000..048dd8e --- /dev/null +++ b/examples/synthetic-spec/presets/preset-synth-all.yaml @@ -0,0 +1,6 @@ +id: preset-synth-all +title: Полный синтетический набор +description: >- + Пресет обоих синтетических профилей для сквозных прогонов разрешения + валидации, разрешения и аудита. +profiles: [prof-synth-light, prof-synth-strict] diff --git a/examples/synthetic-spec/profiles/prof-synth-light.yaml b/examples/synthetic-spec/profiles/prof-synth-light.yaml new file mode 100644 index 0000000..09d0cf6 --- /dev/null +++ b/examples/synthetic-spec/profiles/prof-synth-light.yaml @@ -0,0 +1,12 @@ +id: prof-synth-light +title: Облегчённый синтетический профиль +description: >- + Явно ослабляет проверку до отправки и переопределяет бюджет подготовки + для инфраструктурных прогонов разрешения. +requirements: + - requirement: req-synth-alpha + relax_to: SHOULD + note: ослабление только явное +parameter_overrides: + - parameter: param-synth-budget + value: 4 diff --git a/examples/synthetic-spec/profiles/prof-synth-strict.yaml b/examples/synthetic-spec/profiles/prof-synth-strict.yaml new file mode 100644 index 0000000..3723e4b --- /dev/null +++ b/examples/synthetic-spec/profiles/prof-synth-strict.yaml @@ -0,0 +1,12 @@ +id: prof-synth-strict +title: Строгий синтетический профиль +description: >- + Не ослабляет требования и переопределяет режим вывода из реестра + параметров для инфраструктурных прогонов разрешения. +requirements: + - requirement: req-synth-alpha + - requirement: req-synth-beta + - requirement: req-synth-gamma +parameter_overrides: + - parameter: param-synth-mode + value: plain diff --git a/examples/synthetic-spec/requirements/req-synth-alpha.yaml b/examples/synthetic-spec/requirements/req-synth-alpha.yaml new file mode 100644 index 0000000..9662a0c --- /dev/null +++ b/examples/synthetic-spec/requirements/req-synth-alpha.yaml @@ -0,0 +1,42 @@ +id: req-synth-alpha +domain: dom-synth-build +capability: cap-synth-verify +title: Проверка до отправки +statement: >- + Синтетический артефакт MUST проходить проверку перед отправкой в реестр + примеров. +level: MUST +rationale: >- + Служебное требование для проверки разрешения профилей и параметров; + содержательного смысла для стандарта не несёт. +applicability: + - when: отправка синтетического артефакта + unless: отправка выполняется в dry-run режиме +parameters: + - id: param-synth-budget + type: integer + description: Часов подготовки синтетического артефакта до проверки. + default: 2 + constraints: + minimum: 0 + maximum: 8 +acceptance_criteria: + - criterion: Проверка выполнена до отправки + measure: журнал прогона предшествует записи об отправке +verification: + kind: deterministic + procedure: Детерминированная проверка порядка событий в журнале примера. + automation: bhl audit +expected_evidence: + - kind: test-run + description: Журнал прогона проверки с отметкой времени +relations: + - target: req-synth-beta + kind: depends-on +lifecycle: + status: proposed + since: '2026-11-28' + note: Инфраструктурный пример (BHL-018), не содержательная редакция BHS. +history_ref: CHANGELOG.yaml +antipatterns: + - ant-synth-late-check diff --git a/examples/synthetic-spec/requirements/req-synth-beta.yaml b/examples/synthetic-spec/requirements/req-synth-beta.yaml new file mode 100644 index 0000000..0760b81 --- /dev/null +++ b/examples/synthetic-spec/requirements/req-synth-beta.yaml @@ -0,0 +1,34 @@ +id: req-synth-beta +domain: dom-synth-build +capability: cap-synth-verify +title: Документирование шагов примера +statement: >- + Синтетический пример SHOULD документировать шаги воспроизведения в README. +level: SHOULD +rationale: >- + Служебное требование для проверки разрешения параметров из реестра; + содержательного смысла для стандарта не несёт. +applicability: + - when: публикация синтетического примера +parameters: + - id: param-synth-mode + type: enum + description: Режим вывода синтетического прогона для проверки реестра параметров. + default: json + constraints: + values: [json, plain] +acceptance_criteria: + - criterion: Шаги воспроизведения описаны + measure: README примера содержит команды прогона +verification: + kind: deterministic + procedure: Проверка наличия раздела шагов воспроизведения в README примера. + automation: bhl audit +expected_evidence: + - kind: file + description: README примера с разделом шагов +lifecycle: + status: proposed + since: '2026-11-28' + note: Инфраструктурный пример (BHL-018), не содержательная редакция BHS. +history_ref: CHANGELOG.yaml diff --git a/examples/synthetic-spec/requirements/req-synth-gamma.yaml b/examples/synthetic-spec/requirements/req-synth-gamma.yaml new file mode 100644 index 0000000..acfd32a --- /dev/null +++ b/examples/synthetic-spec/requirements/req-synth-gamma.yaml @@ -0,0 +1,27 @@ +id: req-synth-gamma +domain: dom-synth-build +capability: cap-synth-verify +title: Проверка после отправки запрещена +statement: >- + Синтетический артефакт MUST NOT проверяться после отправки в реестр примеров. +level: MUST NOT +rationale: >- + Служебное требование для проверки связей антипаттернов; содержательного + смысла для стандарта не несёт. +applicability: + - when: отправка синтетического артефакта +acceptance_criteria: + - criterion: Проверка не выполняется после отправки + measure: журнал не содержит проверок позже отметки отправки +verification: + kind: deterministic + procedure: Детерминированная проверка порядка событий в журнале примера. + automation: bhl audit +expected_evidence: + - kind: test-run + description: Журнал прогона с отметками времени относительно отправки +lifecycle: + status: proposed + since: '2026-11-28' + note: Инфраструктурный пример (BHL-018), не содержательная редакция BHS. +history_ref: CHANGELOG.yaml diff --git a/examples/synthetic-spec/schemas/antipattern.schema.json b/examples/synthetic-spec/schemas/antipattern.schema.json new file mode 100644 index 0000000..346106a --- /dev/null +++ b/examples/synthetic-spec/schemas/antipattern.schema.json @@ -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 } + } +} diff --git a/examples/synthetic-spec/schemas/audit-finding.schema.json b/examples/synthetic-spec/schemas/audit-finding.schema.json new file mode 100644 index 0000000..cfb68bb --- /dev/null +++ b/examples/synthetic-spec/schemas/audit-finding.schema.json @@ -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"] } } + } + } + ] +} diff --git a/examples/synthetic-spec/schemas/audit-report.schema.json b/examples/synthetic-spec/schemas/audit-report.schema.json new file mode 100644 index 0000000..c1e56cf --- /dev/null +++ b/examples/synthetic-spec/schemas/audit-report.schema.json @@ -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 } } + } +} diff --git a/examples/synthetic-spec/schemas/capability.schema.json b/examples/synthetic-spec/schemas/capability.schema.json new file mode 100644 index 0000000..f754af3 --- /dev/null +++ b/examples/synthetic-spec/schemas/capability.schema.json @@ -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 } + } +} diff --git a/examples/synthetic-spec/schemas/domain.schema.json b/examples/synthetic-spec/schemas/domain.schema.json new file mode 100644 index 0000000..936da2d --- /dev/null +++ b/examples/synthetic-spec/schemas/domain.schema.json @@ -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 } + } +} diff --git a/examples/synthetic-spec/schemas/evidence.schema.json b/examples/synthetic-spec/schemas/evidence.schema.json new file mode 100644 index 0000000..94fc5df --- /dev/null +++ b/examples/synthetic-spec/schemas/evidence.schema.json @@ -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}$" } + } +} diff --git a/examples/synthetic-spec/schemas/normative-change.schema.json b/examples/synthetic-spec/schemas/normative-change.schema.json new file mode 100644 index 0000000..4cf48cc --- /dev/null +++ b/examples/synthetic-spec/schemas/normative-change.schema.json @@ -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." } + } +} diff --git a/examples/synthetic-spec/schemas/parameter.schema.json b/examples/synthetic-spec/schemas/parameter.schema.json new file mode 100644 index 0000000..af34d13 --- /dev/null +++ b/examples/synthetic-spec/schemas/parameter.schema.json @@ -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"] } } } } + } + } + } + ] +} diff --git a/examples/synthetic-spec/schemas/preset.schema.json b/examples/synthetic-spec/schemas/preset.schema.json new file mode 100644 index 0000000..a5109ce --- /dev/null +++ b/examples/synthetic-spec/schemas/preset.schema.json @@ -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]+)*$" } + } + } +} diff --git a/examples/synthetic-spec/schemas/profile.schema.json b/examples/synthetic-spec/schemas/profile.schema.json new file mode 100644 index 0000000..7855bef --- /dev/null +++ b/examples/synthetic-spec/schemas/profile.schema.json @@ -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": {} + } + } + } + } +} diff --git a/examples/synthetic-spec/schemas/project-exception.schema.json b/examples/synthetic-spec/schemas/project-exception.schema.json new file mode 100644 index 0000000..6fb2d38 --- /dev/null +++ b/examples/synthetic-spec/schemas/project-exception.schema.json @@ -0,0 +1,46 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://baseline-harness.dev/spec/schemas/project-exception.schema.json", + "title": "Project Exception", + "description": "Документированное обоснованное исключение, утверждаемое владельцем (D-002, D-008). Отличие от N/A: N/A — требование неприменимо, EXEMPT — применимо, но снято обоснованным решением. Не проходит: исключение без области, причины, ссылки на решение владельца или условия пересмотра.", + "type": "object", + "additionalProperties": false, + "required": ["id", "requirement", "scope", "reason", "decision_ref", "review_condition"], + "properties": { + "id": { + "type": "string", + "pattern": "^ex-[a-z0-9]+(-[a-z0-9]+)*$", + "description": "Постоянный идентификатор (D-031)." + }, + "requirement": { "type": "string", "pattern": "^req-[a-z0-9]+(-[a-z0-9]+)*$" }, + "scope": { + "type": "object", + "additionalProperties": false, + "required": ["kind", "description"], + "properties": { + "kind": { "enum": ["path", "capability", "tool", "other"] }, + "paths": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 } }, + "description": { "type": "string", "minLength": 10 } + }, + "allOf": [ + { + "if": { "properties": { "kind": { "const": "path" } }, "required": ["kind"] }, + "then": { "required": ["paths"], "properties": { "paths": true } } + } + ] + }, + "reason": { "type": "string", "minLength": 10 }, + "decision_ref": { + "type": "string", + "minLength": 3, + "description": "Ссылка на утверждённое решение владельца (например, решение Backlog D-0xx). Без неё исключение неутверждённое." + }, + "review_condition": { "type": "string", "minLength": 3 }, + "expires": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, + "status": { + "enum": ["active", "revoked", "expired"], + "default": "active", + "description": "Состояние исключения; не смешивается с жизненным циклом требования." + } + } +} diff --git a/examples/synthetic-spec/schemas/project-manifest.schema.json b/examples/synthetic-spec/schemas/project-manifest.schema.json new file mode 100644 index 0000000..5cc2724 --- /dev/null +++ b/examples/synthetic-spec/schemas/project-manifest.schema.json @@ -0,0 +1,41 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://baseline-harness.dev/spec/schemas/project-manifest.schema.json", + "title": "Project Manifest", + "description": "Источник истины о подключении проекта к спецификации (D-008): версия спецификации, выбранные профили/пресеты, проектный слой параметров и исключения. Манифест не переопределяет требования и не дублирует реестр проектов; независимо редактируемые копии конфигурации запрещены — проектные значения живут только здесь.", + "type": "object", + "additionalProperties": false, + "required": ["project", "spec_version", "profiles"], + "properties": { + "project": { "type": "string", "minLength": 1 }, + "spec_version": { "type": "string", "pattern": "^\\d+\\.\\d+\\.\\d+(-[0-9A-Za-z.-]+)?$" }, + "profiles": { + "type": "array", + "minItems": 1, + "uniqueItems": true, + "items": { "type": "string", "pattern": "^prof-[a-z0-9]+(-[a-z0-9]+)*$" } + }, + "presets": { + "type": "array", + "uniqueItems": true, + "items": { "type": "string", "pattern": "^preset-[a-z0-9]+(-[a-z0-9]+)*$" } + }, + "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": {} + } + } + }, + "exceptions": { + "type": "array", + "items": { "$ref": "https://baseline-harness.dev/spec/schemas/project-exception.schema.json" } + }, + "note": { "type": "string", "minLength": 3 } + } +} diff --git a/examples/synthetic-spec/schemas/requirement.schema.json b/examples/synthetic-spec/schemas/requirement.schema.json new file mode 100644 index 0000000..08a9ff9 --- /dev/null +++ b/examples/synthetic-spec/schemas/requirement.schema.json @@ -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); история не дублируется." + } + } +} diff --git a/tests/synthetic-spec.test.mjs b/tests/synthetic-spec.test.mjs new file mode 100644 index 0000000..9cc4795 --- /dev/null +++ b/tests/synthetic-spec.test.mjs @@ -0,0 +1,64 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { spawnSync } from 'node:child_process'; +import { readFileSync, readdirSync } from 'node:fs'; +import path from 'node:path'; + +const repoRoot = path.dirname(import.meta.dirname); +const cli = path.join(repoRoot, 'packages', 'bhl', 'src', 'cli.ts'); +const specRoot = path.join(repoRoot, 'examples', 'synthetic-spec'); + +function runCli(...args) { + const proc = spawnSync(process.execPath, [cli, ...args], { encoding: 'utf8', cwd: repoRoot }); + return { code: proc.status, stdout: proc.stdout, envelope: JSON.parse(proc.stdout) }; +} + +test('синтетическая спецификация проходит bhl validate без диагностик', () => { + const result = runCli('validate', specRoot); + assert.equal(result.code, 0); + assert.deepEqual(result.envelope.data.errors, []); + assert.equal(result.envelope.data.files, 8); +}); + +test('пресет разворачивается в Effective Specification со всеми связями', () => { + const result = runCli('profile', 'resolve', specRoot, '--preset', 'preset-synth-all'); + assert.equal(result.code, 0); + const { profiles, effective } = result.envelope.data; + assert.deepEqual(profiles, ['prof-synth-light', 'prof-synth-strict']); + assert.deepEqual( + effective.map((item) => [item.requirement, item.level, item.parameters]), + [ + ['req-synth-alpha', 'SHOULD', [{ parameter: 'param-synth-budget', value: 4, source: 'prof-synth-light' }]], + ['req-synth-beta', 'SHOULD', [{ parameter: 'param-synth-mode', value: 'plain', source: 'prof-synth-strict' }]], + ['req-synth-gamma', 'MUST NOT', []], + ], + ); + const gamma = effective.find((item) => item.requirement === 'req-synth-gamma'); + assert.deepEqual(gamma.sources, ['prof-synth-strict']); +}); + +test('разрешение пресета не зависит от порядка явных профилей', () => { + const first = runCli('profile', 'resolve', specRoot, '--profile', 'prof-synth-light', '--profile', 'prof-synth-strict'); + const second = runCli('profile', 'resolve', specRoot, '--profile', 'prof-synth-strict', '--profile', 'prof-synth-light'); + assert.equal(first.code, 0); + assert.equal(second.stdout, first.stdout); +}); + +test('копия схем в примере синхронна с spec/schemas', () => { + const canonical = new Set(readdirSync(path.join(repoRoot, 'spec', 'schemas'))); + const copy = new Set(readdirSync(path.join(specRoot, 'schemas'))); + assert.deepEqual([...copy].sort(), [...canonical].sort()); + for (const name of canonical) { + assert.equal( + readFileSync(path.join(specRoot, 'schemas', name), 'utf8'), + readFileSync(path.join(repoRoot, 'spec', 'schemas', name), 'utf8'), + `расхождение копии схемы ${name}`, + ); + } +}); + +test('пример явно отмечен как инфраструктурный, а не BHS 0.1.0', () => { + const readme = readFileSync(path.join(specRoot, 'README.md'), 'utf8'); + assert.ok(readme.includes('не является'), 'отметка о не-стандартности'); + assert.ok(readme.includes('BHS 0.1.0'), 'ссылка на содержательную редакцию'); +});