hololake-system-architecture/product-source/hololake-native-desktop/scripts/gls-native-kernel.test.mjs

28 lines
1.8 KiB
JavaScript

import assert from 'node:assert/strict'
import { readFile } from 'node:fs/promises'
import test from 'node:test'
const contractUrl = new URL('../contracts/gls-native-runtime-kernel.json', import.meta.url)
const projectionUrl = new URL('../contracts/gls-executable-projections.json', import.meta.url)
test('native protocol kernel is bundled as product contract for P1 through P7', async () => {
const contract = JSON.parse(await readFile(contractUrl, 'utf8'))
const projections = JSON.parse(await readFile(projectionUrl, 'utf8'))
assert.equal(contract.schema, 'hololake.gls-native-runtime-kernel/v1')
assert.deepEqual(contract.stages.map((stage) => stage.id), ['P1', 'P2', 'P3', 'P4', 'P5', 'P6', 'P7'])
assert.ok(contract.stages.slice(0, 6).every((stage) => stage.state.startsWith('IMPLEMENTED')))
assert.equal(contract.stages.slice(0, 6).flatMap((stage) => stage.protocols).length, 21)
assert.equal(Object.keys(projections.projections).length, 25)
assert.equal(projections.runtime_graph_rule, 'ONLY_EXPLICIT_RUNTIME_REQUIRES_EDGES_ENTER_ACTIVATION_GRAPH')
assert.equal(contract.runtime_boundaries.every_decision_writes_receipt, true)
assert.equal(contract.runtime_boundaries.model_can_override_decision, false)
assert.equal(contract.runtime_boundaries.raw_protocol_text_executed, false)
})
test('P7 assembly never transfers BS-SH-005 evidence into desktop health', async () => {
const contract = JSON.parse(await readFile(contractUrl, 'utf8'))
assert.equal(contract.p7_node_assemblies.length, 11)
assert.ok(contract.p7_node_assemblies.every((assembly) => assembly.target === 'DESKTOP_HOLOLAKE'))
assert.ok(contract.p7_node_assemblies.every((assembly) => assembly.state !== 'ACTIVE_HEALTHY'))
assert.ok(contract.p7_node_assemblies.some((assembly) => assembly.sourceEvidenceNode === 'BS-SH-005'))
})