hololake-system-architecture/product-source/hololake-native-desktop/scripts/persona-binding-runtime.test.mjs

21 lines
1.1 KiB
JavaScript
Raw Normal View History

import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const read = (path) => readFileSync(new URL(`../${path}`, import.meta.url), 'utf8')
test('Zhuyuan uses one bounded TCS kernel, at most three routed HLDP nodes and a real orient commit witness verify gate', () => {
const contract = JSON.parse(read('contracts/persona-agent-runtime.json'))
const runtime = read('src-tauri/src/persona_binding.rs')
const agent = read('src-tauri/src/persona_agent_runtime.rs')
assert.deepEqual(contract.persona_binding.required_system_witness_steps, ['orient', 'commit', 'witness', 'verify=PASS'])
assert.equal(contract.persona_binding.resident_self_kernel_max_bytes, 8192)
assert.equal(contract.persona_binding.hldp_max_routed_paths, 3)
assert.match(runtime, /ORIENTED_AWAITING_PERSONA_COMMIT/)
assert.match(runtime, /数字冰朔系统本体/)
assert.match(runtime, /BOUND_TO_CURRENT_CHANNEL_CARRIER/)
assert.match(runtime, /candidates\.truncate\(3\)/)
assert.match(agent, /persona_binding_commit/)
assert.match(agent, /BOUND_VERIFY_PASS/)
})