feat: подключение лаборатории к BHS 0.1.0 (BHL-041)

- bhl.yaml: манифест потребителя (spec 0.1.0, профиль prof-core, без
  предварительных исключений)
- spec/profiles/prof-core.yaml: 15 требований без ослаблений; профили и
  пресеты валидируются bhl validate как факультативные каталоги
- конвейер release→sha256→fetch(lock)→verify→manifest→resolve закреплён
  интеграционным тестом; артефакты .artifacts/ вне Git
- инвентарь исключений и классификация отклонений (5.2) —
  results/dogfooding/2026-11-29-lab-connection.md
- check.mjs не сканирует .artifacts (локальное состояние сборки)
This commit is contained in:
Suslov-MD
2026-11-29 11:46:56 +03:00
parent 12c99328fe
commit 24eb332f2d
9 changed files with 153 additions and 17 deletions
+48
View File
@@ -0,0 +1,48 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { spawnSync } from 'node:child_process';
import { mkdirSync, mkdtempSync, rmSync } from 'node:fs';
import os from 'node:os';
import path from 'node:path';
const root = path.join(import.meta.dirname, '..');
const cli = path.join(root, 'packages', 'bhl', 'src', 'cli.ts');
function run(args) {
return spawnSync(process.execPath, ['--experimental-strip-types', cli, ...args], {
cwd: root,
encoding: 'utf8',
});
}
test('подключение лаборатории: release → сумма → fetch/lock → verify → манифест → Effective Specification', (t) => {
const tmp = mkdtempSync(path.join(os.tmpdir(), 'bhl-lab-'));
t.after(() => rmSync(tmp, { recursive: true, force: true }));
const release = run(['release', 'spec', '--version', '0.1.0', '--out', path.join(tmp, 'release')]);
assert.equal(release.status, 0, release.stdout);
const releaseDir = path.join(tmp, 'release');
const sum = spawnSync('sha256sum', ['-c', 'bhs-spec-0.1.0.tar.sha256'], {
cwd: releaseDir,
encoding: 'utf8',
});
assert.equal(sum.status, 0, `${sum.stdout}${sum.stderr}`);
const extracted = path.join(tmp, 'extracted');
mkdirSync(extracted, { recursive: true });
const tar = spawnSync('tar', ['-xf', path.join(releaseDir, 'bhs-spec-0.1.0.tar'), '-C', extracted], {
encoding: 'utf8',
});
assert.equal(tar.status, 0, tar.stderr);
const cache = path.join(tmp, 'cache');
const fetch = run(['fetch', path.join(extracted, 'bhs-spec-0.1.0'), '--version', '0.1.0', '--cache', cache]);
assert.equal(fetch.status, 0, fetch.stdout);
const verify = run(['verify', '--version', '0.1.0', '--cache', cache]);
assert.equal(verify.status, 0, verify.stdout);
const specRoot = path.join(cache, '0.1.0', 'spec');
const manifest = run(['manifest', 'validate', 'bhl.yaml', '--spec-root', specRoot]);
assert.equal(manifest.status, 0, manifest.stdout);
const resolve = run(['profile', 'resolve', specRoot, '--profile', 'prof-core']);
assert.equal(resolve.status, 0, resolve.stdout);
const data = JSON.parse(resolve.stdout).data;
assert.deepEqual(data.profiles, ['prof-core']);
assert.equal(data.effective.length, 15, 'Effective Specification ядра 0.1.0');
});